Project SkyFire Core
SkyFire 5.4.8 server core API documentation
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
7SDName: Stratholme
8SD%Complete: 100
9SDComment: Misc mobs for instance. go-script to apply aura and start event for quest 8945
10SDCategory: Stratholme
11EndScriptData */
12
13/* ContentData
14go_gauntlet_gate
15npc_freed_soul
16npc_restless_soul
17npc_spectral_ghostly_citizen
18EndContentData */
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
32{
33public:
34 go_gauntlet_gate() : GameObjectScript("go_gauntlet_gate") { }
35
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
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
65 return false;
66 }
67};
68
69/*######
70## npc_freed_soul
71######*/
73{
75};
76
78{
79public:
80 npc_freed_soul() : CreatureScript("npc_freed_soul") { }
81
83 {
84 npc_freed_soulAI(Creature* creature) : ScriptedAI(creature) { }
85
87 {
89 }
90
91 void EnterCombat(Unit* /*who*/) OVERRIDE { }
92 };
93
95 {
96 return new npc_freed_soulAI(creature);
97 }
98};
99
100/*######
101## npc_restless_soul
102######*/
103
105{
106 // Spells
109
110 // Quest
112
113 // Creatures
115 NPC_FREED = 11136
116};
117
119{
120public:
121 npc_restless_soul() : CreatureScript("npc_restless_soul") { }
122
124 {
126 {
127 Tagger = 0;
128 Die_Timer = 0;
129 Tagged = false;
130 }
131
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();
148 return;
149
150 Tagged = true;
151 Tagger = caster->GetGUID();
152 }
153
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
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:
185 bool Tagged;
186 };
187
189 {
190 return new npc_restless_soulAI(creature);
191 }
192};
193
194/*######
195## npc_spectral_ghostly_citizen
196######*/
197
203
205{
206public:
207 npc_spectral_ghostly_citizen() : CreatureScript("npc_spectral_ghostly_citizen") { }
208
210 {
212 {
213 Die_Timer = 0;
214 Tagged = false;
215 }
216
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
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
257 }
258
259 void ReceiveEmote(Player* player, uint32 emote) OVERRIDE
260 {
261 switch (emote)
262 {
263 case TEXT_EMOTE_DANCE:
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:
286 bool Tagged;
287 };
288
290 {
291 return new npc_spectral_ghostly_citizenAI(creature);
292 }
293};
294
296{
297 new go_gauntlet_gate();
298 new npc_freed_soul();
299 new npc_restless_soul();
301}
std::uint32_t uint32
Definition Define.h:77
#define OVERRIDE
Definition Define.h:60
std::uint64_t uint64
Definition Define.h:76
@ IN_PROGRESS
@ NOT_STARTED
@ TEMPSUMMON_TIMED_DESPAWN
Definition Object.h:70
@ QUEST_STATUS_INCOMPLETE
Definition QuestDef.h:89
@ EMOTE_ONESHOT_FLEX
@ EMOTE_ONESHOT_BOW
@ EMOTE_ONESHOT_RUDE
@ EMOTE_ONESHOT_WAVE
@ TEXT_EMOTE_BOW
@ TEXT_EMOTE_DANCE
@ TEXT_EMOTE_RUDE
@ TEXT_EMOTE_KISS
@ TEXT_EMOTE_WAVE
Creature * DoSummon(uint32 entry, Position const &pos, uint32 despawnTime=30000, TempSummonType summonType=TempSummonType::TEMPSUMMON_CORPSE_TIMED_DESPAWN)
void Talk(uint8 id, WorldObject const *whisperTarget=NULL)
bool UpdateVictim()
virtual void EnterEvadeMode()
CreatureScript(const char *name)
GameObjectScript(const char *name)
Definition Group.h:147
GroupReference * next()
Player * ToPlayer()
Definition Object.h:204
QuestStatus GetQuestStatus(uint32 quest_id) const
void DoMeleeAttackIfReady()
Definition UnitAI.cpp:28
void DoCast(uint32 spellId)
Definition UnitAI.cpp:110
Definition Unit.h:1367
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)
bool HasAura(uint32 spellId, uint64 casterGUID=0, uint64 itemCasterGUID=0, uint32 reqEffMask=0) const
static Unit * GetUnit(WorldObject &object, uint64 guid)
Definition Unit.cpp:4895
Map * GetMap() const
Definition Object.h:740
virtual uint32 GetData(uint32) const
Definition ZoneScript.h:36
virtual void SetData(uint32, uint32)
Definition ZoneScript.h:37
bool OnGossipHello(Player *player, GameObject *go) OVERRIDE
CreatureAI * GetAI(Creature *creature) const OVERRIDE
CreatureAI * GetAI(Creature *creature) const OVERRIDE
CreatureAI * GetAI(Creature *creature) const OVERRIDE
FreedSoul
@ SAY_ZAPPED
GhostlyCitizenSpells
@ SPELL_SLAP
@ SPELL_HAUNTING_PHANTOM
RestlessSoul
@ SPELL_EGAN_BLASTER
@ QUEST_RESTLESS_SOUL
@ NPC_RESTLESS
@ SPELL_SOUL_FREED
@ NPC_FREED
void AddSC_stratholme()
@ SPELL_BARON_ULTIMATUM
Definition stratholme.h:66
@ QUEST_DEAD_MAN_PLEA
Definition stratholme.h:61
@ TYPE_BARON_RUN
Definition stratholme.h:11
Creature * me
ScriptedAI(Creature *creature)
npc_freed_soulAI(Creature *creature)
void EnterCombat(Unit *) OVERRIDE
void UpdateAI(uint32 diff) OVERRIDE
== Triggered Actions Requested ==================
void JustSummoned(Creature *summoned) OVERRIDE
void SpellHit(Unit *caster, const SpellInfo *spell) OVERRIDE
void SpellHit(Unit *, const SpellInfo *spell) OVERRIDE
void UpdateAI(uint32 diff) OVERRIDE
== Triggered Actions Requested ==================
void ReceiveEmote(Player *player, uint32 emote) OVERRIDE