Project SkyFire Core
SkyFire 5.4.8 server core API documentation
Toggle main menu visibility
Loading...
Searching...
No Matches
blackfathom_deeps.cpp
Go to the documentation of this file.
1
/*
2
* This file is part of Project SkyFire https://www.projectskyfire.org.
3
* See LICENSE.md file for Copyright information
4
*/
5
6
#include "
ScriptMgr.h
"
7
#include "
ScriptedCreature.h
"
8
#include "
ScriptedGossip.h
"
9
#include "
blackfathom_deeps.h
"
10
#include "
ScriptedEscortAI.h
"
11
#include "
Player.h
"
12
13
enum
Spells
14
{
15
SPELL_BLESSING_OF_BLACKFATHOM
= 8733,
16
SPELL_RAVAGE
= 8391,
17
SPELL_FROST_NOVA
= 865,
18
SPELL_FROST_BOLT_VOLLEY
= 8398,
19
SPELL_TELEPORT_DARNASSUS
= 9268
20
};
21
22
const
Position
HomePosition
= {-815.817f, -145.299f, -25.870f, 0};
23
24
class
go_blackfathom_altar
:
public
GameObjectScript
25
{
26
public
:
27
go_blackfathom_altar
() :
GameObjectScript
(
"go_blackfathom_altar"
) { }
28
29
bool
OnGossipHello
(
Player
* player,
GameObject
*
/*go*/
)
OVERRIDE
30
{
31
if
(!player->HasAura(
SPELL_BLESSING_OF_BLACKFATHOM
))
32
player->AddAura(
SPELL_BLESSING_OF_BLACKFATHOM
, player);
33
return
true
;
34
}
35
};
36
37
class
go_blackfathom_fire
:
public
GameObjectScript
38
{
39
public
:
40
go_blackfathom_fire
() :
GameObjectScript
(
"go_blackfathom_fire"
) { }
41
42
bool
OnGossipHello
(
Player
*
/*player*/
,
GameObject
* go)
OVERRIDE
43
{
44
InstanceScript
* instance = go->GetInstanceScript();
45
46
if
(instance)
47
{
48
go->SetGoState(
GOState::GO_STATE_ACTIVE
);
49
go->SetFlag(
GAMEOBJECT_FIELD_FLAGS
,
GO_FLAG_NOT_SELECTABLE
);
50
instance->
SetData
(
DATA_FIRE
, instance->
GetData
(
DATA_FIRE
) + 1);
51
return
true
;
52
}
53
return
false
;
54
}
55
};
56
57
class
npc_blackfathom_deeps_event
:
public
CreatureScript
58
{
59
public
:
60
npc_blackfathom_deeps_event
() :
CreatureScript
(
"npc_blackfathom_deeps_event"
) { }
61
62
struct
npc_blackfathom_deeps_eventAI
:
public
ScriptedAI
63
{
64
npc_blackfathom_deeps_eventAI
(
Creature
* creature) :
ScriptedAI
(creature)
65
{
66
if
(creature->
IsSummon
())
67
{
68
creature->SetHomePosition(HomePosition);
69
AttackPlayer();
70
}
71
72
instance
= creature->
GetInstanceScript
();
73
ravageTimer
= 0;
74
frostNovaTimer
= 0;
75
frostBoltVolleyTimer
= 0;
76
Flee
=
false
;
77
}
78
79
80
void
Reset
()
OVERRIDE
81
{
82
Flee
=
false
;
83
84
ravageTimer
= std::rand() % 8000 + 5000;
85
frostNovaTimer
= std::rand() % 12000 + 9000;
86
frostBoltVolleyTimer
= std::rand() % 4000 + 2000;
87
}
88
89
void
AttackPlayer
()
90
{
91
Map::PlayerList
const
&PlList =
me
->GetMap()->GetPlayers();
92
93
if
(PlList.
isEmpty
())
94
return
;
95
96
for
(
Map::PlayerList::const_iterator
i = PlList.
begin
(); i != PlList.
end
(); ++i)
97
{
98
if
(
Player
* player = i->GetSource())
99
{
100
if
(player->IsGameMaster())
101
continue
;
102
103
if
(player->IsAlive())
104
{
105
me
->SetInCombatWith(player);
106
player->SetInCombatWith(
me
);
107
me
->AddThreat(player, 0.0f);
108
}
109
}
110
}
111
}
112
113
void
UpdateAI
(
uint32
diff)
OVERRIDE
114
{
115
if
(!
UpdateVictim
())
116
return
;
117
118
switch
(
me
->GetEntry())
119
{
120
case
NPC_AKU_MAI_SNAPJAW
:
121
{
122
if
(
ravageTimer
<= diff)
123
{
124
DoCastVictim
(
SPELL_RAVAGE
);
125
ravageTimer
= std::rand() % 14000 + 9000;
126
}
else
ravageTimer
-= diff;
127
break
;
128
}
129
case
NPC_MURKSHALLOW_SOFTSHELL
:
130
case
NPC_BARBED_CRUSTACEAN
:
131
{
132
if
(!
Flee
&&
HealthBelowPct
(15))
133
{
134
Flee
=
true
;
135
me
->DoFleeToGetAssistance();
136
}
137
break
;
138
}
139
case
NPC_AKU_MAI_SERVANT
:
140
{
141
if
(
frostBoltVolleyTimer
<= diff)
142
{
143
if
(
Unit
* target =
SelectTarget
(
SELECT_TARGET_RANDOM
, 0))
144
DoCast
(target,
SPELL_FROST_BOLT_VOLLEY
);
145
frostBoltVolleyTimer
= std::rand() % 8000 + 5000;
146
}
147
else
frostBoltVolleyTimer
-= diff;
148
149
if
(
frostNovaTimer
<= diff)
150
{
151
DoCastAOE
(
SPELL_FROST_NOVA
,
false
);
152
frostNovaTimer
= std::rand() % 30000 + 25000;
153
}
154
else
frostNovaTimer
-= diff;
155
break
;
156
}
157
}
158
159
DoMeleeAttackIfReady
();
160
}
161
162
void
JustDied
(
Unit
*
/*killer*/
)
OVERRIDE
163
{
164
if
(
me
->IsSummon())
//we are not a normal spawn.
165
if
(
instance
)
166
instance
->SetData(
DATA_EVENT
,
instance
->GetData(
DATA_EVENT
) + 1);
167
}
168
private
:
169
InstanceScript
*
instance
;
170
171
uint32
ravageTimer
;
172
uint32
frostNovaTimer
;
173
uint32
frostBoltVolleyTimer
;
174
175
bool
Flee
;
176
};
177
178
CreatureAI
*
GetAI
(
Creature
* creature)
const
OVERRIDE
179
{
180
return
new
npc_blackfathom_deeps_eventAI
(creature);
181
}
182
};
183
184
enum
Morridune
185
{
186
SAY_MORRIDUNE_1
= 0,
187
SAY_MORRIDUNE_2
= 1
188
};
189
190
class
npc_morridune
:
public
CreatureScript
191
{
192
public
:
193
npc_morridune
() :
CreatureScript
(
"npc_morridune"
) { }
194
195
struct
npc_morriduneAI
:
public
npc_escortAI
196
{
197
npc_morriduneAI
(
Creature
* creature) :
npc_escortAI
(creature)
198
{
199
Talk
(
SAY_MORRIDUNE_1
);
200
me
->RemoveFlag(
UNIT_FIELD_NPC_FLAGS
,
UNIT_NPC_FLAG_GOSSIP
);
201
Start
(
false
,
false
, 0);
202
}
203
204
void
WaypointReached
(
uint32
waypointId)
OVERRIDE
205
{
206
switch
(waypointId)
207
{
208
case
4:
209
SetEscortPaused
(
true
);
210
me
->SetFacingTo(1.775791f);
211
me
->SetFlag(
UNIT_FIELD_NPC_FLAGS
,
UNIT_NPC_FLAG_GOSSIP
);
212
Talk
(
SAY_MORRIDUNE_2
);
213
break
;
214
}
215
}
216
217
void
sGossipSelect
(
Player
* player,
uint32
/*sender*/
,
uint32
/*action*/
)
OVERRIDE
218
{
219
DoCast
(player,
SPELL_TELEPORT_DARNASSUS
);
220
}
221
};
222
223
CreatureAI
*
GetAI
(
Creature
* creature)
const
OVERRIDE
224
{
225
return
new
npc_morriduneAI
(creature);
226
}
227
};
228
229
void
AddSC_blackfathom_deeps
()
230
{
231
new
go_blackfathom_altar
();
232
new
go_blackfathom_fire
();
233
new
npc_blackfathom_deeps_event
();
234
new
npc_morridune
();
235
}
Spells
Spells
Definition
BattlegroundIC.h:645
uint32
std::uint32_t uint32
Definition
Define.h:77
OVERRIDE
#define OVERRIDE
Definition
Define.h:60
GOState::GO_STATE_ACTIVE
@ GO_STATE_ACTIVE
Definition
GameObject.h:576
Player.h
ScriptMgr.h
ScriptedCreature.h
ScriptedEscortAI.h
ScriptedGossip.h
GO_FLAG_NOT_SELECTABLE
@ GO_FLAG_NOT_SELECTABLE
Definition
SharedDefines.h:1842
UNIT_NPC_FLAG_GOSSIP
@ UNIT_NPC_FLAG_GOSSIP
Definition
Unit.h:687
SELECT_TARGET_RANDOM
@ SELECT_TARGET_RANDOM
Definition
UnitAI.h:23
UNIT_FIELD_NPC_FLAGS
@ UNIT_FIELD_NPC_FLAGS
Definition
UpdateFields.h:107
GAMEOBJECT_FIELD_FLAGS
@ GAMEOBJECT_FIELD_FLAGS
Definition
UpdateFields.h:250
Morridune
Morridune
Definition
blackfathom_deeps.cpp:185
SAY_MORRIDUNE_2
@ SAY_MORRIDUNE_2
Definition
blackfathom_deeps.cpp:187
SAY_MORRIDUNE_1
@ SAY_MORRIDUNE_1
Definition
blackfathom_deeps.cpp:186
AddSC_blackfathom_deeps
void AddSC_blackfathom_deeps()
Definition
blackfathom_deeps.cpp:229
SPELL_TELEPORT_DARNASSUS
@ SPELL_TELEPORT_DARNASSUS
Definition
blackfathom_deeps.cpp:19
SPELL_RAVAGE
@ SPELL_RAVAGE
Definition
blackfathom_deeps.cpp:16
SPELL_BLESSING_OF_BLACKFATHOM
@ SPELL_BLESSING_OF_BLACKFATHOM
Definition
blackfathom_deeps.cpp:15
SPELL_FROST_NOVA
@ SPELL_FROST_NOVA
Definition
blackfathom_deeps.cpp:17
SPELL_FROST_BOLT_VOLLEY
@ SPELL_FROST_BOLT_VOLLEY
Definition
blackfathom_deeps.cpp:18
HomePosition
const Position HomePosition
Definition
blackfathom_deeps.cpp:22
blackfathom_deeps.h
NPC_BARBED_CRUSTACEAN
@ NPC_BARBED_CRUSTACEAN
Definition
blackfathom_deeps.h:39
NPC_AKU_MAI_SERVANT
@ NPC_AKU_MAI_SERVANT
Definition
blackfathom_deeps.h:38
NPC_MURKSHALLOW_SOFTSHELL
@ NPC_MURKSHALLOW_SOFTSHELL
Definition
blackfathom_deeps.h:37
NPC_AKU_MAI_SNAPJAW
@ NPC_AKU_MAI_SNAPJAW
Definition
blackfathom_deeps.h:36
DATA_EVENT
@ DATA_EVENT
Definition
blackfathom_deeps.h:28
DATA_FIRE
@ DATA_FIRE
Definition
blackfathom_deeps.h:27
CreatureAI
Definition
CreatureAI.h:54
CreatureAI::Talk
void Talk(uint8 id, WorldObject const *whisperTarget=NULL)
Definition
CreatureAI.cpp:28
CreatureAI::UpdateVictim
bool UpdateVictim()
Definition
CreatureAI.cpp:192
Creature
Definition
Creature.h:427
CreatureScript::CreatureScript
CreatureScript(const char *name)
Definition
ScriptMgr.cpp:1436
GameObject
Definition
GameObject.h:629
GameObjectScript::GameObjectScript
GameObjectScript(const char *name)
Definition
ScriptMgr.cpp:1442
InstanceScript
Definition
InstanceScript.h:123
LinkedListHead::isEmpty
bool isEmpty() const
Definition
LinkedList.h:86
Map::PlayerList
MapRefManager PlayerList
Definition
Map.h:406
MapRefManager::end
iterator end()
Definition
MapRefManager.h:25
MapRefManager::begin
iterator begin()
Definition
MapRefManager.h:24
MapRefManager::const_iterator
LinkedListHead::Iterator< MapReference const > const_iterator
Definition
MapRefManager.h:17
Player
Definition
Player.h:1289
UnitAI::DoMeleeAttackIfReady
void DoMeleeAttackIfReady()
Definition
UnitAI.cpp:28
UnitAI::DoCast
void DoCast(uint32 spellId)
Definition
UnitAI.cpp:110
UnitAI::SelectTarget
Unit * SelectTarget(SelectAggroTarget targetType, uint32 position=0, float dist=0.0f, bool playerOnly=false, int32 aura=0)
Definition
UnitAI.cpp:66
UnitAI::DoCastVictim
void DoCastVictim(uint32 spellId, bool triggered=false)
Definition
UnitAI.cpp:168
UnitAI::DoCastAOE
void DoCastAOE(uint32 spellId, bool triggered=false)
Definition
UnitAI.cpp:176
Unit
Definition
Unit.h:1367
Unit::IsSummon
bool IsSummon() const
Definition
Unit.h:1503
WorldObject::GetInstanceScript
InstanceScript * GetInstanceScript()
Definition
Object.cpp:1612
ZoneScript::GetData
virtual uint32 GetData(uint32) const
Definition
ZoneScript.h:36
ZoneScript::SetData
virtual void SetData(uint32, uint32)
Definition
ZoneScript.h:37
go_blackfathom_altar
Definition
blackfathom_deeps.cpp:25
go_blackfathom_altar::OnGossipHello
bool OnGossipHello(Player *player, GameObject *) OVERRIDE
Definition
blackfathom_deeps.cpp:29
go_blackfathom_altar::go_blackfathom_altar
go_blackfathom_altar()
Definition
blackfathom_deeps.cpp:27
go_blackfathom_fire
Definition
blackfathom_deeps.cpp:38
go_blackfathom_fire::OnGossipHello
bool OnGossipHello(Player *, GameObject *go) OVERRIDE
Definition
blackfathom_deeps.cpp:42
go_blackfathom_fire::go_blackfathom_fire
go_blackfathom_fire()
Definition
blackfathom_deeps.cpp:40
npc_blackfathom_deeps_event
Definition
blackfathom_deeps.cpp:58
npc_blackfathom_deeps_event::GetAI
CreatureAI * GetAI(Creature *creature) const OVERRIDE
Definition
blackfathom_deeps.cpp:178
npc_blackfathom_deeps_event::npc_blackfathom_deeps_event
npc_blackfathom_deeps_event()
Definition
blackfathom_deeps.cpp:60
npc_morridune
Definition
blackfathom_deeps.cpp:191
npc_morridune::npc_morridune
npc_morridune()
Definition
blackfathom_deeps.cpp:193
npc_morridune::GetAI
CreatureAI * GetAI(Creature *creature) const OVERRIDE
Definition
blackfathom_deeps.cpp:223
Position
Definition
Object.h:274
ScriptedAI::me
Creature * me
Definition
ScriptedCreature.h:182
ScriptedAI::HealthBelowPct
bool HealthBelowPct(uint32 pct) const
Definition
ScriptedCreature.h:247
ScriptedAI::ScriptedAI
ScriptedAI(Creature *creature)
Definition
ScriptedCreature.cpp:85
npc_blackfathom_deeps_event::npc_blackfathom_deeps_eventAI
Definition
blackfathom_deeps.cpp:63
npc_blackfathom_deeps_event::npc_blackfathom_deeps_eventAI::JustDied
void JustDied(Unit *) OVERRIDE
Definition
blackfathom_deeps.cpp:162
npc_blackfathom_deeps_event::npc_blackfathom_deeps_eventAI::Flee
bool Flee
Definition
blackfathom_deeps.cpp:175
npc_blackfathom_deeps_event::npc_blackfathom_deeps_eventAI::Reset
void Reset() OVERRIDE
Definition
blackfathom_deeps.cpp:80
npc_blackfathom_deeps_event::npc_blackfathom_deeps_eventAI::npc_blackfathom_deeps_eventAI
npc_blackfathom_deeps_eventAI(Creature *creature)
Definition
blackfathom_deeps.cpp:64
npc_blackfathom_deeps_event::npc_blackfathom_deeps_eventAI::UpdateAI
void UpdateAI(uint32 diff) OVERRIDE
== Triggered Actions Requested ==================
Definition
blackfathom_deeps.cpp:113
npc_blackfathom_deeps_event::npc_blackfathom_deeps_eventAI::AttackPlayer
void AttackPlayer()
Definition
blackfathom_deeps.cpp:89
npc_blackfathom_deeps_event::npc_blackfathom_deeps_eventAI::instance
InstanceScript * instance
Definition
blackfathom_deeps.cpp:169
npc_blackfathom_deeps_event::npc_blackfathom_deeps_eventAI::frostBoltVolleyTimer
uint32 frostBoltVolleyTimer
Definition
blackfathom_deeps.cpp:173
npc_blackfathom_deeps_event::npc_blackfathom_deeps_eventAI::ravageTimer
uint32 ravageTimer
Definition
blackfathom_deeps.cpp:171
npc_blackfathom_deeps_event::npc_blackfathom_deeps_eventAI::frostNovaTimer
uint32 frostNovaTimer
Definition
blackfathom_deeps.cpp:172
npc_escortAI::npc_escortAI
npc_escortAI(Creature *creature)
Definition
ScriptedEscortAI.cpp:24
npc_escortAI::SetEscortPaused
void SetEscortPaused(bool on)
Definition
ScriptedEscortAI.cpp:489
npc_escortAI::Start
void Start(bool isActiveAttacker=true, bool run=false, uint64 playerGUID=0, Quest const *quest=NULL, bool instantRespawn=false, bool canLoopPath=false, bool resetWaypoints=true)
Definition
ScriptedEscortAI.cpp:420
npc_morridune::npc_morriduneAI
Definition
blackfathom_deeps.cpp:196
npc_morridune::npc_morriduneAI::WaypointReached
void WaypointReached(uint32 waypointId) OVERRIDE
Definition
blackfathom_deeps.cpp:204
npc_morridune::npc_morriduneAI::npc_morriduneAI
npc_morriduneAI(Creature *creature)
Definition
blackfathom_deeps.cpp:197
npc_morridune::npc_morriduneAI::sGossipSelect
void sGossipSelect(Player *player, uint32, uint32) OVERRIDE
Definition
blackfathom_deeps.cpp:217
src
server
scripts
Kalimdor
BlackfathomDeeps
blackfathom_deeps.cpp
Generated on
for Project SkyFire Core by
1.17.0