TrinityCore
Loading...
Searching...
No Matches
stratholme.cpp
Go to the documentation of this file.
1/*
2 * This file is part of the TrinityCore Project. See AUTHORS file for Copyright information
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License as published by the
6 * Free Software Foundation; either version 2 of the License, or (at your
7 * option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18/* ScriptData
19SDName: Stratholme
20SD%Complete: 100
21SDComment: Misc mobs for instance. go-script to apply aura and start event for quest 8945
22SDCategory: Stratholme
23EndScriptData */
24
25/* ContentData
26go_gauntlet_gate
27npc_freed_soul
28npc_restless_soul
29npc_spectral_ghostly_citizen
30EndContentData */
31
32#include "ScriptMgr.h"
33#include "GameObject.h"
34#include "GameObjectAI.h"
35#include "Group.h"
36#include "InstanceScript.h"
37#include "MotionMaster.h"
38#include "ObjectAccessor.h"
39#include "Player.h"
40#include "ScriptedCreature.h"
41#include "SpellInfo.h"
42#include "SpellScript.h"
43#include "SpellAuraEffects.h"
44#include "stratholme.h"
45
46/*######
47## go_gauntlet_gate (this is the _first_ of the gauntlet gates, two exist)
48######*/
49
51{
52 public:
53 go_gauntlet_gate() : GameObjectScript("go_gauntlet_gate") { }
54
56 {
57 go_gauntlet_gateAI(GameObject* go) : GameObjectAI(go), instance(go->GetInstanceScript()) { }
58
60
61 bool OnGossipHello(Player* player) override
62 {
64 return false;
65
66 if (Group* group = player->GetGroup())
67 {
68 for (GroupReference* itr = group->GetFirstMember(); itr != nullptr; itr = itr->next())
69 {
70 Player* pGroupie = itr->GetSource();
71 if (!pGroupie || !pGroupie->IsInMap(player))
72 continue;
73
75 !pGroupie->HasAura(SPELL_BARON_ULTIMATUM) &&
76 pGroupie->GetMap() == me->GetMap())
77 pGroupie->CastSpell(pGroupie, SPELL_BARON_ULTIMATUM, true);
78 }
79 }
82 player->GetMap() == me->GetMap())
83 player->CastSpell(player, SPELL_BARON_ULTIMATUM, true);
84
86 return false;
87 }
88 };
89
90 GameObjectAI* GetAI(GameObject* go) const override
91 {
92 return GetStratholmeAI<go_gauntlet_gateAI>(go);
93 }
94};
95
96/*######
97## npc_restless_soul
98######*/
99
101{
102 // Spells
105
106 // Quest
108
109 // Creatures
111 NPC_FREED = 11136
113
115{
116public:
117 npc_restless_soul() : CreatureScript("npc_restless_soul") { }
118
119 CreatureAI* GetAI(Creature* creature) const override
120 {
121 return GetStratholmeAI<npc_restless_soulAI>(creature);
122 }
123
125 {
127 {
128 Initialize();
129 }
130
132 {
133 Tagger.Clear();
134 Die_Timer = 5000;
135 Tagged = false;
136 }
137
140 bool Tagged;
141
142 void Reset() override
143 {
144 Initialize();
145 }
146
147 void JustEngagedWith(Unit* /*who*/) override { }
148
149 void SpellHit(WorldObject* caster, SpellInfo const* spellInfo) override
150 {
151 if (Tagged || spellInfo->Id != SPELL_EGAN_BLASTER)
152 return;
153
154 Player* player = caster->ToPlayer();
156 return;
157
158 Tagged = true;
159 Tagger = caster->GetGUID();
160 }
161
162 void JustSummoned(Creature* summoned) override
163 {
164 summoned->CastSpell(summoned, SPELL_SOUL_FREED, false);
165
166 if (Player* player = ObjectAccessor::GetPlayer(*me, Tagger))
167 summoned->GetMotionMaster()->MoveFollow(player, 0.0f, 0.0f);
168 }
169
170 void JustDied(Unit* /*killer*/) override
171 {
172 if (Tagged)
174 }
175
176 void UpdateAI(uint32 diff) override
177 {
178 if (Tagged)
179 {
180 if (Die_Timer <= diff)
181 {
182 if (Unit* temp = ObjectAccessor::GetUnit(*me, Tagger))
183 {
184 if (Player* player = temp->ToPlayer())
185 player->KilledMonsterCredit(NPC_RESTLESS, me->GetGUID());
186 me->KillSelf();
187 }
188 }
189 else
190 Die_Timer -= diff;
191 }
192 }
193 };
194
195};
196
197/*######
198## npc_spectral_ghostly_citizen
199######*/
200
207
209{
210public:
211 npc_spectral_ghostly_citizen() : CreatureScript("npc_spectral_ghostly_citizen") { }
212
213 CreatureAI* GetAI(Creature* creature) const override
214 {
215 return GetStratholmeAI<npc_spectral_ghostly_citizenAI>(creature);
216 }
217
219 {
221 {
222 Initialize();
223 }
224
226 {
227 Die_Timer = 5000;
228 HauntingTimer = 8000;
229 TouchTimer = 2000;
230 Tagged = false;
231 }
232
236 bool Tagged;
237
238 void Reset() override
239 {
240 Initialize();
241 }
242
243 void JustEngagedWith(Unit* /*who*/) override { }
244
245 void SpellHit(WorldObject* /*caster*/, SpellInfo const* spellInfo) override
246 {
247 if (!Tagged && spellInfo->Id == SPELL_EGAN_BLASTER)
248 Tagged = true;
249 }
250
251 void JustDied(Unit* /*killer*/) override
252 {
253 if (Tagged)
254 {
255 for (uint32 i = 1; i <= 4; ++i)
256 {
257 //100%, 50%, 33%, 25% chance to spawn
258 if (urand(1, i) == 1)
259 DoSummon(NPC_RESTLESS, me, 20.0f, 10min);
260 }
261 }
262 }
263
264 void UpdateAI(uint32 diff) override
265 {
266 if (Tagged)
267 {
268 if (Die_Timer <= diff)
269 me->KillSelf();
270 else Die_Timer -= diff;
271 }
272
273 if (!UpdateVictim())
274 return;
275
276 //HauntingTimer
277 if (HauntingTimer <= diff)
278 {
281 HauntingTimer = 11000;
282 }
283 else HauntingTimer -= diff;
284
285 //TouchTimer
286 if (TouchTimer <= diff)
287 {
290 TouchTimer = 7000;
291 }
292 else TouchTimer -= diff;
293
295 }
296
297 void ReceiveEmote(Player* player, uint32 emote) override
298 {
299 switch (emote)
300 {
301 case TEXT_EMOTE_DANCE:
303 break;
304 case TEXT_EMOTE_RUDE:
305 if (me->IsWithinDistInMap(player, 5))
306 DoCast(player, SPELL_SLAP, false);
307 else
309 break;
310 case TEXT_EMOTE_WAVE:
312 break;
313 case TEXT_EMOTE_BOW:
315 break;
316 case TEXT_EMOTE_KISS:
318 break;
319 }
320 }
321 };
322
323};
324
325// 31912 - Ysida Saved Credit Trigger
327{
329
330 bool Validate(SpellInfo const* /*spell*/) override
331 {
333 }
334
335 void FilterTargets(std::list<WorldObject*>& targets)
336 {
337 targets.remove_if([](WorldObject* obj)
338 {
339 return obj->GetTypeId() != TYPEID_PLAYER;
340 });
341 }
342
343 void HandleScript(SpellEffIndex /*effIndex*/)
344 {
345 if (Player* player = GetHitUnit()->ToPlayer())
346 {
347 player->AreaExploredOrEventHappens(QUEST_DEAD_MAN_PLEA);
348 player->KilledMonsterCredit(NPC_YSIDA);
349 }
350 }
351
357};
358
364
365// 16336 - Haunting Phantoms
396
@ IN_MILLISECONDS
Definition Common.h:35
int32_t int32
Definition Define.h:129
uint32_t uint32
Definition Define.h:133
@ IN_PROGRESS
@ NOT_STARTED
@ TEMPSUMMON_TIMED_DESPAWN
@ TYPEID_PLAYER
Definition ObjectGuid.h:39
@ QUEST_STATUS_INCOMPLETE
Definition QuestDef.h:107
int32 irand(int32 min, int32 max)
Definition Random.cpp:35
uint32 urand(uint32 min, uint32 max)
Definition Random.cpp:42
bool roll_chance_i(int chance)
Definition Random.h:59
#define RegisterSpellScript(spell_script)
Definition ScriptMgr.h:1128
SpellEffIndex
@ EFFECT_0
@ SPELL_EFFECT_SCRIPT_EFFECT
@ TARGET_UNIT_SRC_AREA_ENTRY
@ 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
@ SPELL_AURA_DUMMY
#define SpellEffectFn(F, I, N)
#define SpellObjectAreaTargetSelectFn(F, I, N)
#define AuraEffectPeriodicFn(F, I, N)
#define AuraEffectUpdatePeriodicFn(F, I, N)
#define AuraEffectCalcPeriodicFn(F, I, N)
void CalculatePeriodic(Unit *caster, bool resetPeriodicTimer=true, bool load=false)
HookList< EffectCalcPeriodicHandler > DoEffectCalcPeriodic
HookList< EffectPeriodicHandler > OnEffectPeriodic
Unit * GetCaster() const
HookList< EffectUpdatePeriodicHandler > OnEffectUpdatePeriodic
Unit * GetTarget() const
bool UpdateVictim()
Creature *const me
Definition CreatureAI.h:82
Creature * DoSummon(uint32 entry, Position const &pos, Milliseconds despawnTime=30s, TempSummonType summonType=TEMPSUMMON_CORPSE_TIMED_DESPAWN)
virtual void EnterEvadeMode(EvadeReason why=EVADE_REASON_OTHER)
GameObject *const me
Definition Group.h:165
void MoveFollow(Unit *target, float dist, ChaseAngle angle, MovementSlot slot=MOTION_SLOT_ACTIVE)
void Clear()
Definition ObjectGuid.h:150
TypeID GetTypeId() const
Definition Object.h:93
static ObjectGuid GetGUID(Object const *o)
Definition Object.h:78
static Player * ToPlayer(Object *o)
Definition Object.h:180
Group * GetGroup()
Definition Player.h:2171
QuestStatus GetQuestStatus(uint32 quest_id) const
Definition Player.cpp:15642
uint32 Id
Definition SpellInfo.h:289
Unit * GetHitUnit() const
HookList< EffectHandler > OnEffectHitTarget
HookList< ObjectAreaTargetSelectHandler > OnObjectAreaTargetSelect
void DoMeleeAttackIfReady()
Definition UnitAI.cpp:54
Unit * SelectTarget(SelectTargetMethod targetType, uint32 offset=0, float dist=0.0f, bool playerOnly=false, bool withTank=true, int32 aura=0)
Definition UnitAI.cpp:96
SpellCastResult DoCast(uint32 spellId)
Definition UnitAI.cpp:106
Definition Unit.h:769
void KillSelf(bool durabilityLoss=true)
Definition Unit.h:1023
MotionMaster * GetMotionMaster()
Definition Unit.h:1667
bool HasAura(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint8 reqEffMask=0) const
Definition Unit.cpp:4535
void HandleEmoteCommand(Emote emoteId)
Definition Unit.cpp:1568
Map * GetMap() const
Definition Object.h:449
SpellCastResult CastSpell(CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
Definition Object.cpp:2832
TempSummon * SummonCreature(uint32 entry, Position const &pos, TempSummonType despawnType=TEMPSUMMON_MANUAL_DESPAWN, Milliseconds despawnTime=0s, uint32 vehId=0, uint32 spellId=0, ObjectGuid privateObjectOwner=ObjectGuid::Empty)
Definition Object.cpp:1992
bool IsWithinDistInMap(WorldObject const *obj, float dist2compare, bool is3D=true, bool incOwnRadius=true, bool incTargetRadius=true) const
Definition Object.cpp:1192
bool IsInMap(WorldObject const *obj) const
Definition Object.cpp:1160
virtual uint32 GetData(uint32) const
Definition ZoneScript.h:55
virtual void SetData(uint32, uint32)
Definition ZoneScript.h:56
static bool ValidateSpellInfo(std::initializer_list< uint32 > spellIds)
GameObjectAI * GetAI(GameObject *go) const override
CreatureAI * GetAI(Creature *creature) const override
CreatureAI * GetAI(Creature *creature) const override
void CalcPeriodic(AuraEffect const *, bool &isPeriodic, int32 &amplitude)
void HandleUpdatePeriodic(AuraEffect *aurEff)
PrepareAuraScript(spell_stratholme_haunting_phantoms)
void HandleDummyTick(AuraEffect const *)
bool Validate(SpellInfo const *) override
void HandleScript(SpellEffIndex)
void FilterTargets(std::list< WorldObject * > &targets)
PrepareSpellScript(spell_ysida_saved_credit)
void Register() override
TC_GAME_API Unit * GetUnit(WorldObject const &, ObjectGuid const &guid)
TC_GAME_API Player * GetPlayer(Map const *, ObjectGuid const &guid)
HauntingPhantoms
@ SPELL_SUMMON_WRATH_PHANTOM
@ SPELL_SUMMON_SPITEFUL_PHANTOM
GhostlyCitizenSpells
@ SPELL_DEBILITATING_TOUCH
@ SPELL_SLAP
@ SPELL_HAUNTING_PHANTOM
RestlessSoul
@ SPELL_EGAN_BLASTER
@ QUEST_RESTLESS_SOUL
@ NPC_RESTLESS
@ SPELL_SOUL_FREED
@ NPC_FREED
void AddSC_stratholme()
@ NPC_YSIDA
Definition stratholme.h:81
@ QUEST_DEAD_MAN_PLEA
Definition stratholme.h:117
@ SPELL_YSIDA_SAVED
Definition stratholme.h:124
@ SPELL_BARON_ULTIMATUM
Definition stratholme.h:122
@ TYPE_BARON_RUN
Definition stratholme.h:48
float GetPositionZ() const
Definition Position.h:81
float GetOrientation() const
Definition Position.h:82
float GetPositionX() const
Definition Position.h:79
float GetPositionY() const
Definition Position.h:80
bool OnGossipHello(Player *player) override
void SpellHit(WorldObject *caster, SpellInfo const *spellInfo) override
void UpdateAI(uint32 diff) override
void JustSummoned(Creature *summoned) override
void SpellHit(WorldObject *, SpellInfo const *spellInfo) override
void ReceiveEmote(Player *player, uint32 emote) override