Project SkyFire Core
SkyFire 5.4.8 server core API documentation
Toggle main menu visibility
Loading...
Searching...
No Matches
stratholme.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
/* ScriptData
7
SDName: Stratholme
8
SD%Complete: 100
9
SDComment: Misc mobs for instance. go-script to apply aura and start event for quest 8945
10
SDCategory: Stratholme
11
EndScriptData */
12
13
/* ContentData
14
go_gauntlet_gate
15
npc_freed_soul
16
npc_restless_soul
17
npc_spectral_ghostly_citizen
18
EndContentData */
19
20
#include "
ScriptMgr.h
"
21
#include "
ScriptedCreature.h
"
22
#include "
stratholme.h
"
23
#include "
Group.h
"
24
#include "
Player.h
"
25
#include "
SpellInfo.h
"
26
27
/*######
28
## go_gauntlet_gate (this is the _first_ of the gauntlet gates, two exist)
29
######*/
30
31
class
go_gauntlet_gate
:
public
GameObjectScript
32
{
33
public
:
34
go_gauntlet_gate
() :
GameObjectScript
(
"go_gauntlet_gate"
) { }
35
36
bool
OnGossipHello
(
Player
* player,
GameObject
* go)
OVERRIDE
37
{
38
InstanceScript
* instance = go->GetInstanceScript();
39
40
if
(!instance)
41
return
false
;
42
43
if
(instance->
GetData
(
TYPE_BARON_RUN
) !=
NOT_STARTED
)
44
return
false
;
45
46
if
(
Group
* group = player->GetGroup())
47
{
48
for
(
GroupReference
* itr = group->GetFirstMember(); itr != NULL; itr = itr->
next
())
49
{
50
Player
* pGroupie = itr->GetSource();
51
if
(!pGroupie)
52
continue
;
53
54
if
(pGroupie->
GetQuestStatus
(
QUEST_DEAD_MAN_PLEA
) ==
QUEST_STATUS_INCOMPLETE
&&
55
!pGroupie->
HasAura
(
SPELL_BARON_ULTIMATUM
) &&
56
pGroupie->
GetMap
() == go->GetMap())
57
pGroupie->
CastSpell
(pGroupie,
SPELL_BARON_ULTIMATUM
,
true
);
58
}
59
}
else
if
(player->GetQuestStatus(
QUEST_DEAD_MAN_PLEA
) ==
QUEST_STATUS_INCOMPLETE
&&
60
!player->HasAura(
SPELL_BARON_ULTIMATUM
) &&
61
player->GetMap() == go->GetMap())
62
player->CastSpell(player,
SPELL_BARON_ULTIMATUM
,
true
);
63
64
instance->
SetData
(
TYPE_BARON_RUN
,
IN_PROGRESS
);
65
return
false
;
66
}
67
};
68
69
/*######
70
## npc_freed_soul
71
######*/
72
enum
FreedSoul
73
{
74
SAY_ZAPPED
= 0
75
};
76
77
class
npc_freed_soul
:
public
CreatureScript
78
{
79
public
:
80
npc_freed_soul
() :
CreatureScript
(
"npc_freed_soul"
) { }
81
82
struct
npc_freed_soulAI
:
public
ScriptedAI
83
{
84
npc_freed_soulAI
(
Creature
* creature) :
ScriptedAI
(creature) { }
85
86
void
Reset
()
OVERRIDE
87
{
88
Talk
(
SAY_ZAPPED
);
89
}
90
91
void
EnterCombat
(
Unit
*
/*who*/
)
OVERRIDE
{ }
92
};
93
94
CreatureAI
*
GetAI
(
Creature
* creature)
const
OVERRIDE
95
{
96
return
new
npc_freed_soulAI
(creature);
97
}
98
};
99
100
/*######
101
## npc_restless_soul
102
######*/
103
104
enum
RestlessSoul
105
{
106
// Spells
107
SPELL_EGAN_BLASTER
= 17368,
108
SPELL_SOUL_FREED
= 17370,
109
110
// Quest
111
QUEST_RESTLESS_SOUL
= 5282,
112
113
// Creatures
114
NPC_RESTLESS
= 11122,
115
NPC_FREED
= 11136
116
};
117
118
class
npc_restless_soul
:
public
CreatureScript
119
{
120
public
:
121
npc_restless_soul
() :
CreatureScript
(
"npc_restless_soul"
) { }
122
123
struct
npc_restless_soulAI
:
public
ScriptedAI
124
{
125
npc_restless_soulAI
(
Creature
* creature) :
ScriptedAI
(creature)
126
{
127
Tagger
= 0;
128
Die_Timer
= 0;
129
Tagged
=
false
;
130
}
131
132
void
Reset
()
OVERRIDE
133
{
134
Tagger
= 0;
135
Die_Timer
= 5000;
136
Tagged
=
false
;
137
}
138
139
void
EnterCombat
(
Unit
*
/*who*/
)
OVERRIDE
{ }
140
141
void
SpellHit
(
Unit
* caster,
const
SpellInfo
* spell)
OVERRIDE
142
{
143
if
(
Tagged
|| spell->Id !=
SPELL_EGAN_BLASTER
)
144
return
;
145
146
Player
* player = caster->
ToPlayer
();
147
if
(!player || player->
GetQuestStatus
(
QUEST_RESTLESS_SOUL
) !=
QUEST_STATUS_INCOMPLETE
)
148
return
;
149
150
Tagged
=
true
;
151
Tagger
= caster->GetGUID();
152
}
153
154
void
JustSummoned
(
Creature
* summoned)
OVERRIDE
155
{
156
summoned->CastSpell(summoned,
SPELL_SOUL_FREED
,
false
);
157
}
158
159
void
JustDied
(
Unit
*
/*killer*/
)
OVERRIDE
160
{
161
if
(
Tagged
)
162
me
->SummonCreature(
NPC_FREED
,
me
->GetPositionX(),
me
->GetPositionY(),
me
->GetPositionZ(),
me
->GetOrientation(),
TempSummonType::TEMPSUMMON_TIMED_DESPAWN
, 300000);
163
}
164
165
void
UpdateAI
(
uint32
diff)
OVERRIDE
166
{
167
if
(
Tagged
)
168
{
169
if
(
Die_Timer
<= diff)
170
{
171
if
(
Unit
* temp =
Unit::GetUnit
(*
me
,
Tagger
))
172
{
173
if
(
Player
* player = temp->
ToPlayer
())
174
player->KilledMonsterCredit(
NPC_RESTLESS
,
me
->GetGUID());
175
me
->Kill(
me
);
176
}
177
}
178
else
179
Die_Timer
-= diff;
180
}
181
}
182
private
:
183
uint64
Tagger
;
184
uint32
Die_Timer
;
185
bool
Tagged
;
186
};
187
188
CreatureAI
*
GetAI
(
Creature
* creature)
const
OVERRIDE
189
{
190
return
new
npc_restless_soulAI
(creature);
191
}
192
};
193
194
/*######
195
## npc_spectral_ghostly_citizen
196
######*/
197
198
enum
GhostlyCitizenSpells
199
{
200
SPELL_HAUNTING_PHANTOM
= 16336,
201
SPELL_SLAP
= 6754
202
};
203
204
class
npc_spectral_ghostly_citizen
:
public
CreatureScript
205
{
206
public
:
207
npc_spectral_ghostly_citizen
() :
CreatureScript
(
"npc_spectral_ghostly_citizen"
) { }
208
209
struct
npc_spectral_ghostly_citizenAI
:
public
ScriptedAI
210
{
211
npc_spectral_ghostly_citizenAI
(
Creature
* creature) :
ScriptedAI
(creature)
212
{
213
Die_Timer
= 0;
214
Tagged
=
false
;
215
}
216
217
void
Reset
()
OVERRIDE
218
{
219
Die_Timer
= 5000;
220
Tagged
=
false
;
221
}
222
223
void
EnterCombat
(
Unit
*
/*who*/
)
OVERRIDE
{ }
224
225
void
SpellHit
(
Unit
*
/*caster*/
,
const
SpellInfo
* spell)
OVERRIDE
226
{
227
if
(!
Tagged
&& spell->Id ==
SPELL_EGAN_BLASTER
)
228
Tagged
=
true
;
229
}
230
231
void
JustDied
(
Unit
*
/*killer*/
)
OVERRIDE
232
{
233
if
(
Tagged
)
234
{
235
for
(
uint32
i = 1; i <= 4; ++i)
236
{
237
//100%, 50%, 33%, 25% chance to spawn
238
if
((std::rand() % i + 1) == 1)
239
DoSummon
(
NPC_RESTLESS
,
me
, 20.0f, 600000);
240
}
241
}
242
}
243
244
void
UpdateAI
(
uint32
diff)
OVERRIDE
245
{
246
if
(
Tagged
)
247
{
248
if
(
Die_Timer
<= diff)
249
me
->Kill(
me
);
250
else
Die_Timer
-= diff;
251
}
252
253
if
(!
UpdateVictim
())
254
return
;
255
256
DoMeleeAttackIfReady
();
257
}
258
259
void
ReceiveEmote
(
Player
* player,
uint32
emote)
OVERRIDE
260
{
261
switch
(emote)
262
{
263
case
TEXT_EMOTE_DANCE
:
264
EnterEvadeMode
();
265
break
;
266
case
TEXT_EMOTE_RUDE
:
267
if
(
me
->IsWithinDistInMap(player, 5))
268
DoCast
(player,
SPELL_SLAP
,
false
);
269
else
270
me
->HandleEmoteCommand(
EMOTE_ONESHOT_RUDE
);
271
break
;
272
case
TEXT_EMOTE_WAVE
:
273
me
->HandleEmoteCommand(
EMOTE_ONESHOT_WAVE
);
274
break
;
275
case
TEXT_EMOTE_BOW
:
276
me
->HandleEmoteCommand(
EMOTE_ONESHOT_BOW
);
277
break
;
278
case
TEXT_EMOTE_KISS
:
279
me
->HandleEmoteCommand(
EMOTE_ONESHOT_FLEX
);
280
break
;
281
}
282
}
283
284
private
:
285
uint32
Die_Timer
;
286
bool
Tagged
;
287
};
288
289
CreatureAI
*
GetAI
(
Creature
* creature)
const
OVERRIDE
290
{
291
return
new
npc_spectral_ghostly_citizenAI
(creature);
292
}
293
};
294
295
void
AddSC_stratholme
()
296
{
297
new
go_gauntlet_gate
();
298
new
npc_freed_soul
();
299
new
npc_restless_soul
();
300
new
npc_spectral_ghostly_citizen
();
301
}
uint32
std::uint32_t uint32
Definition
Define.h:77
OVERRIDE
#define OVERRIDE
Definition
Define.h:60
uint64
std::uint64_t uint64
Definition
Define.h:76
Group.h
IN_PROGRESS
@ IN_PROGRESS
Definition
InstanceScript.h:47
NOT_STARTED
@ NOT_STARTED
Definition
InstanceScript.h:46
TempSummonType::TEMPSUMMON_TIMED_DESPAWN
@ TEMPSUMMON_TIMED_DESPAWN
Definition
Object.h:70
Player.h
QUEST_STATUS_INCOMPLETE
@ QUEST_STATUS_INCOMPLETE
Definition
QuestDef.h:89
ScriptMgr.h
ScriptedCreature.h
EMOTE_ONESHOT_FLEX
@ EMOTE_ONESHOT_FLEX
Definition
SharedDefines.h:2152
EMOTE_ONESHOT_BOW
@ EMOTE_ONESHOT_BOW
Definition
SharedDefines.h:2133
EMOTE_ONESHOT_RUDE
@ EMOTE_ONESHOT_RUDE
Definition
SharedDefines.h:2143
EMOTE_ONESHOT_WAVE
@ EMOTE_ONESHOT_WAVE
Definition
SharedDefines.h:2134
TEXT_EMOTE_BOW
@ TEXT_EMOTE_BOW
Definition
SharedDefines.h:1888
TEXT_EMOTE_DANCE
@ TEXT_EMOTE_DANCE
Definition
SharedDefines.h:1905
TEXT_EMOTE_RUDE
@ TEXT_EMOTE_RUDE
Definition
SharedDefines.h:1948
TEXT_EMOTE_KISS
@ TEXT_EMOTE_KISS
Definition
SharedDefines.h:1929
TEXT_EMOTE_WAVE
@ TEXT_EMOTE_WAVE
Definition
SharedDefines.h:1972
SpellInfo.h
CreatureAI
Definition
CreatureAI.h:54
CreatureAI::DoSummon
Creature * DoSummon(uint32 entry, Position const &pos, uint32 despawnTime=30000, TempSummonType summonType=TempSummonType::TEMPSUMMON_CORPSE_TIMED_DESPAWN)
Definition
CreatureAI.cpp:235
CreatureAI::Talk
void Talk(uint8 id, WorldObject const *whisperTarget=NULL)
Definition
CreatureAI.cpp:28
CreatureAI::UpdateVictim
bool UpdateVictim()
Definition
CreatureAI.cpp:192
CreatureAI::EnterEvadeMode
virtual void EnterEvadeMode()
Definition
CreatureAI.cpp:130
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
Group
Definition
Group.h:147
GroupReference
Definition
GroupReference.h:15
GroupReference::next
GroupReference * next()
Definition
GroupReference.h:24
InstanceScript
Definition
InstanceScript.h:123
Object::ToPlayer
Player * ToPlayer()
Definition
Object.h:204
Player
Definition
Player.h:1289
Player::GetQuestStatus
QuestStatus GetQuestStatus(uint32 quest_id) const
Definition
PlayerQuestState.cpp:1375
SpellInfo
Definition
SpellInfo.h:158
UnitAI::DoMeleeAttackIfReady
void DoMeleeAttackIfReady()
Definition
UnitAI.cpp:28
UnitAI::DoCast
void DoCast(uint32 spellId)
Definition
UnitAI.cpp:110
Unit
Definition
Unit.h:1367
Unit::CastSpell
void CastSpell(SpellCastTargets const &targets, SpellInfo const *spellInfo, CustomSpellValues const *value, TriggerCastFlags triggerFlags=TRIGGERED_NONE, Item *castItem=NULL, AuraEffect const *triggeredByAura=NULL, uint64 originalCaster=0)
Definition
UnitCombat.cpp:324
Unit::HasAura
bool HasAura(uint32 spellId, uint64 casterGUID=0, uint64 itemCasterGUID=0, uint32 reqEffMask=0) const
Definition
UnitAuraState.cpp:1182
Unit::GetUnit
static Unit * GetUnit(WorldObject &object, uint64 guid)
Definition
Unit.cpp:4895
WorldObject::GetMap
Map * GetMap() const
Definition
Object.h:740
ZoneScript::GetData
virtual uint32 GetData(uint32) const
Definition
ZoneScript.h:36
ZoneScript::SetData
virtual void SetData(uint32, uint32)
Definition
ZoneScript.h:37
go_gauntlet_gate
Definition
stratholme.cpp:32
go_gauntlet_gate::go_gauntlet_gate
go_gauntlet_gate()
Definition
stratholme.cpp:34
go_gauntlet_gate::OnGossipHello
bool OnGossipHello(Player *player, GameObject *go) OVERRIDE
Definition
stratholme.cpp:36
npc_freed_soul
Definition
stratholme.cpp:78
npc_freed_soul::npc_freed_soul
npc_freed_soul()
Definition
stratholme.cpp:80
npc_freed_soul::GetAI
CreatureAI * GetAI(Creature *creature) const OVERRIDE
Definition
stratholme.cpp:94
npc_restless_soul
Definition
stratholme.cpp:119
npc_restless_soul::GetAI
CreatureAI * GetAI(Creature *creature) const OVERRIDE
Definition
stratholme.cpp:188
npc_restless_soul::npc_restless_soul
npc_restless_soul()
Definition
stratholme.cpp:121
npc_spectral_ghostly_citizen
Definition
stratholme.cpp:205
npc_spectral_ghostly_citizen::GetAI
CreatureAI * GetAI(Creature *creature) const OVERRIDE
Definition
stratholme.cpp:289
npc_spectral_ghostly_citizen::npc_spectral_ghostly_citizen
npc_spectral_ghostly_citizen()
Definition
stratholme.cpp:207
FreedSoul
FreedSoul
Definition
stratholme.cpp:73
SAY_ZAPPED
@ SAY_ZAPPED
Definition
stratholme.cpp:74
GhostlyCitizenSpells
GhostlyCitizenSpells
Definition
stratholme.cpp:199
SPELL_SLAP
@ SPELL_SLAP
Definition
stratholme.cpp:201
SPELL_HAUNTING_PHANTOM
@ SPELL_HAUNTING_PHANTOM
Definition
stratholme.cpp:200
RestlessSoul
RestlessSoul
Definition
stratholme.cpp:105
SPELL_EGAN_BLASTER
@ SPELL_EGAN_BLASTER
Definition
stratholme.cpp:107
QUEST_RESTLESS_SOUL
@ QUEST_RESTLESS_SOUL
Definition
stratholme.cpp:111
NPC_RESTLESS
@ NPC_RESTLESS
Definition
stratholme.cpp:114
SPELL_SOUL_FREED
@ SPELL_SOUL_FREED
Definition
stratholme.cpp:108
NPC_FREED
@ NPC_FREED
Definition
stratholme.cpp:115
AddSC_stratholme
void AddSC_stratholme()
Definition
stratholme.cpp:295
stratholme.h
SPELL_BARON_ULTIMATUM
@ SPELL_BARON_ULTIMATUM
Definition
stratholme.h:66
QUEST_DEAD_MAN_PLEA
@ QUEST_DEAD_MAN_PLEA
Definition
stratholme.h:61
TYPE_BARON_RUN
@ TYPE_BARON_RUN
Definition
stratholme.h:11
ScriptedAI::me
Creature * me
Definition
ScriptedCreature.h:182
ScriptedAI::ScriptedAI
ScriptedAI(Creature *creature)
Definition
ScriptedCreature.cpp:85
npc_freed_soul::npc_freed_soulAI
Definition
stratholme.cpp:83
npc_freed_soul::npc_freed_soulAI::Reset
void Reset() OVERRIDE
Definition
stratholme.cpp:86
npc_freed_soul::npc_freed_soulAI::npc_freed_soulAI
npc_freed_soulAI(Creature *creature)
Definition
stratholme.cpp:84
npc_freed_soul::npc_freed_soulAI::EnterCombat
void EnterCombat(Unit *) OVERRIDE
Definition
stratholme.cpp:91
npc_restless_soul::npc_restless_soulAI
Definition
stratholme.cpp:124
npc_restless_soul::npc_restless_soulAI::UpdateAI
void UpdateAI(uint32 diff) OVERRIDE
== Triggered Actions Requested ==================
Definition
stratholme.cpp:165
npc_restless_soul::npc_restless_soulAI::JustSummoned
void JustSummoned(Creature *summoned) OVERRIDE
Definition
stratholme.cpp:154
npc_restless_soul::npc_restless_soulAI::npc_restless_soulAI
npc_restless_soulAI(Creature *creature)
Definition
stratholme.cpp:125
npc_restless_soul::npc_restless_soulAI::Reset
void Reset() OVERRIDE
Definition
stratholme.cpp:132
npc_restless_soul::npc_restless_soulAI::Tagged
bool Tagged
Definition
stratholme.cpp:185
npc_restless_soul::npc_restless_soulAI::Tagger
uint64 Tagger
Definition
stratholme.cpp:183
npc_restless_soul::npc_restless_soulAI::JustDied
void JustDied(Unit *) OVERRIDE
Definition
stratholme.cpp:159
npc_restless_soul::npc_restless_soulAI::Die_Timer
uint32 Die_Timer
Definition
stratholme.cpp:184
npc_restless_soul::npc_restless_soulAI::EnterCombat
void EnterCombat(Unit *) OVERRIDE
Definition
stratholme.cpp:139
npc_restless_soul::npc_restless_soulAI::SpellHit
void SpellHit(Unit *caster, const SpellInfo *spell) OVERRIDE
Definition
stratholme.cpp:141
npc_spectral_ghostly_citizen::npc_spectral_ghostly_citizenAI
Definition
stratholme.cpp:210
npc_spectral_ghostly_citizen::npc_spectral_ghostly_citizenAI::SpellHit
void SpellHit(Unit *, const SpellInfo *spell) OVERRIDE
Definition
stratholme.cpp:225
npc_spectral_ghostly_citizen::npc_spectral_ghostly_citizenAI::Reset
void Reset() OVERRIDE
Definition
stratholme.cpp:217
npc_spectral_ghostly_citizen::npc_spectral_ghostly_citizenAI::EnterCombat
void EnterCombat(Unit *) OVERRIDE
Definition
stratholme.cpp:223
npc_spectral_ghostly_citizen::npc_spectral_ghostly_citizenAI::JustDied
void JustDied(Unit *) OVERRIDE
Definition
stratholme.cpp:231
npc_spectral_ghostly_citizen::npc_spectral_ghostly_citizenAI::UpdateAI
void UpdateAI(uint32 diff) OVERRIDE
== Triggered Actions Requested ==================
Definition
stratholme.cpp:244
npc_spectral_ghostly_citizen::npc_spectral_ghostly_citizenAI::Die_Timer
uint32 Die_Timer
Definition
stratholme.cpp:285
npc_spectral_ghostly_citizen::npc_spectral_ghostly_citizenAI::ReceiveEmote
void ReceiveEmote(Player *player, uint32 emote) OVERRIDE
Definition
stratholme.cpp:259
npc_spectral_ghostly_citizen::npc_spectral_ghostly_citizenAI::npc_spectral_ghostly_citizenAI
npc_spectral_ghostly_citizenAI(Creature *creature)
Definition
stratholme.cpp:211
npc_spectral_ghostly_citizen::npc_spectral_ghostly_citizenAI::Tagged
bool Tagged
Definition
stratholme.cpp:286
src
server
scripts
EasternKingdoms
Stratholme
stratholme.cpp
Generated on
for Project SkyFire Core by
1.17.0