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 "ScenarioMgr.h"
37#include "InstanceScript.h"
38#include "Map.h"
39#include "MotionMaster.h"
40#include "ObjectAccessor.h"
41#include "Player.h"
42#include "ScriptedCreature.h"
43#include "SpellInfo.h"
44#include "SpellScript.h"
45#include "SpellAuraEffects.h"
46#include "stratholme.h"
47
48/*######
49## go_gauntlet_gate (this is the _first_ of the gauntlet gates, two exist)
50######*/
51
53{
54 public:
55 go_gauntlet_gate() : GameObjectScript("go_gauntlet_gate") { }
56
58 {
59 go_gauntlet_gateAI(GameObject* go) : GameObjectAI(go), instance(go->GetInstanceScript()) { }
60
62
63 bool OnGossipHello(Player* player) override
64 {
66 return false;
67
68 if (Group* group = player->GetGroup())
69 {
70 for (GroupReference const& itr : group->GetMembers())
71 {
72 Player* pGroupie = itr.GetSource();
73 if (!pGroupie->IsInMap(player))
74 continue;
75
77 !pGroupie->HasAura(SPELL_BARON_ULTIMATUM) &&
78 pGroupie->GetMap() == me->GetMap())
79 pGroupie->CastSpell(pGroupie, SPELL_BARON_ULTIMATUM, true);
80 }
81 }
84 player->GetMap() == me->GetMap())
85 player->CastSpell(player, SPELL_BARON_ULTIMATUM, true);
86
88 return false;
89 }
90 };
91
92 GameObjectAI* GetAI(GameObject* go) const override
93 {
94 return GetStratholmeAI<go_gauntlet_gateAI>(go);
95 }
96};
97
98/*######
99## npc_restless_soul
100######*/
101
103{
104 // Spells
107
108 // Quest
110
111 // Creatures
113 NPC_FREED = 11136
115
117{
118public:
119 npc_restless_soul() : CreatureScript("npc_restless_soul") { }
120
121 CreatureAI* GetAI(Creature* creature) const override
122 {
123 return GetStratholmeAI<npc_restless_soulAI>(creature);
124 }
125
127 {
129 {
130 Initialize();
131 }
132
134 {
135 Tagger.Clear();
136 Die_Timer = 5000;
137 Tagged = false;
138 }
139
142 bool Tagged;
143
144 void Reset() override
145 {
146 Initialize();
147 }
148
149 void JustEngagedWith(Unit* /*who*/) override { }
150
151 void SpellHit(WorldObject* caster, SpellInfo const* spellInfo) override
152 {
153 if (Tagged || spellInfo->Id != SPELL_EGAN_BLASTER)
154 return;
155
156 Player* player = caster->ToPlayer();
158 return;
159
160 Tagged = true;
161 Tagger = caster->GetGUID();
162 }
163
164 void JustSummoned(Creature* summoned) override
165 {
166 summoned->CastSpell(summoned, SPELL_SOUL_FREED, false);
167
168 if (Player* player = ObjectAccessor::GetPlayer(*me, Tagger))
169 summoned->GetMotionMaster()->MoveFollow(player, 0.0f, 0.0f);
170 }
171
172 void JustDied(Unit* /*killer*/) override
173 {
174 if (Tagged)
176 }
177
178 void UpdateAI(uint32 diff) override
179 {
180 if (Tagged)
181 {
182 if (Die_Timer <= diff)
183 {
184 if (Unit* temp = ObjectAccessor::GetUnit(*me, Tagger))
185 {
186 if (Player* player = temp->ToPlayer())
187 player->KilledMonsterCredit(NPC_RESTLESS, me->GetGUID());
188 me->KillSelf();
189 }
190 }
191 else
192 Die_Timer -= diff;
193 }
194 }
195 };
196
197};
198
199/*######
200## npc_spectral_ghostly_citizen
201######*/
202
209
211{
212public:
213 npc_spectral_ghostly_citizen() : CreatureScript("npc_spectral_ghostly_citizen") { }
214
215 CreatureAI* GetAI(Creature* creature) const override
216 {
217 return GetStratholmeAI<npc_spectral_ghostly_citizenAI>(creature);
218 }
219
221 {
223 {
224 Initialize();
225 }
226
228 {
229 Die_Timer = 5000;
230 HauntingTimer = 8000;
231 TouchTimer = 2000;
232 Tagged = false;
233 }
234
238 bool Tagged;
239
240 void Reset() override
241 {
242 Initialize();
243 }
244
245 void JustEngagedWith(Unit* /*who*/) override { }
246
247 void SpellHit(WorldObject* /*caster*/, SpellInfo const* spellInfo) override
248 {
249 if (!Tagged && spellInfo->Id == SPELL_EGAN_BLASTER)
250 Tagged = true;
251 }
252
253 void JustDied(Unit* /*killer*/) override
254 {
255 if (Tagged)
256 {
257 for (uint32 i = 1; i <= 4; ++i)
258 {
259 //100%, 50%, 33%, 25% chance to spawn
260 if (urand(1, i) == 1)
261 DoSummon(NPC_RESTLESS, me, 20.0f, 10min);
262 }
263 }
264 }
265
266 void UpdateAI(uint32 diff) override
267 {
268 if (Tagged)
269 {
270 if (Die_Timer <= diff)
271 me->KillSelf();
272 else Die_Timer -= diff;
273 }
274
275 if (!UpdateVictim())
276 return;
277
278 //HauntingTimer
279 if (HauntingTimer <= diff)
280 {
283 HauntingTimer = 11000;
284 }
285 else HauntingTimer -= diff;
286
287 //TouchTimer
288 if (TouchTimer <= diff)
289 {
292 TouchTimer = 7000;
293 }
294 else TouchTimer -= diff;
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{
328 bool Validate(SpellInfo const* /*spell*/) override
329 {
331 }
332
333 void FilterTargets(std::list<WorldObject*>& targets)
334 {
335 targets.remove_if([](WorldObject* obj)
336 {
337 return obj->GetTypeId() != TYPEID_PLAYER;
338 });
339 }
340
341 void HandleScript(SpellEffIndex /*effIndex*/)
342 {
343 if (Player* player = GetHitUnit()->ToPlayer())
344 {
345 player->AreaExploredOrEventHappens(QUEST_DEAD_MAN_PLEA);
346 player->KilledMonsterCredit(NPC_YSIDA);
347 }
348 }
349
355};
356
362
363// 16336 - Haunting Phantoms
392
395
396// 10107 - Areatrigger
398{
399public:
400 at_stratholme_service_entrance() : OnlyOnceAreaTriggerScript("at_stratholme_service_entrance") { }
401
402 bool TryHandleOnce(Player* player, AreaTriggerEntry const* /*areaTrigger*/) override
403 {
404 if (InstanceMap* map = player->GetMap()->ToInstanceMap())
405 if (map->GetLfgDungeonsId() == StratholmeLfgDungeonServiceEntrance)
406 map->SetInstanceScenario(sScenarioMgr->CreateInstanceScenario(map, StratholmeScenarioServiceEntrance));
407
408 return true;
409 }
410};
411
@ IN_MILLISECONDS
Definition Common.h:38
int32_t int32
Definition Define.h:150
uint32_t uint32
Definition Define.h:154
@ IN_PROGRESS
@ NOT_STARTED
@ TEMPSUMMON_TIMED_DESPAWN
@ TYPEID_PLAYER
Definition ObjectGuid.h:44
@ QUEST_STATUS_INCOMPLETE
Definition QuestDef.h:150
int32 irand(int32 min, int32 max)
Definition Random.cpp:35
uint32 urand(uint32 min, uint32 max)
Definition Random.cpp:42
bool roll_chance(T chance)
Definition Random.h:55
#define sScenarioMgr
#define RegisterSpellScript(spell_script)
Definition ScriptMgr.h:1383
SpellEffIndex
@ EFFECT_0
@ 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_EFFECT_SCRIPT_EFFECT
@ 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
ObjectGuid const & GetGUID() const
Definition BaseEntity.h:163
TypeID GetTypeId() const
Definition BaseEntity.h:166
virtual void EnterEvadeMode(EvadeReason why=EvadeReason::Other)
bool UpdateVictim()
Creature *const me
Definition CreatureAI.h:63
Creature * DoSummon(uint32 entry, Position const &pos, Milliseconds despawnTime=30s, TempSummonType summonType=TEMPSUMMON_CORPSE_TIMED_DESPAWN)
GameObject *const me
Definition Group.h:205
InstanceMap * ToInstanceMap()
Definition Map.h:490
void MoveFollow(Unit *target, float dist, Optional< ChaseAngle > angle={}, Optional< Milliseconds > duration={}, bool ignoreTargetWalk=false, MovementSlot slot=MOTION_SLOT_ACTIVE, Scripting::v2::ActionResultSetter< MovementStopReason > &&scriptResult={})
void Clear()
Definition ObjectGuid.h:329
Player * ToPlayer()
Definition Object.h:126
QuestStatus GetQuestStatus(uint32 quest_id) const
Definition Player.cpp:15962
Group * GetGroup(Optional< uint8 > partyIndex)
Definition Player.h:2796
uint32 const Id
Definition SpellInfo.h:328
static bool ValidateSpellInfo(std::initializer_list< uint32 > spellIds)
Unit * GetHitUnit() const
HookList< EffectHandler > OnEffectHitTarget
HookList< ObjectAreaTargetSelectHandler > OnObjectAreaTargetSelect
Unit * SelectTarget(SelectTargetMethod targetType, uint32 offset=0, float dist=0.0f, bool playerOnly=false, bool withTank=true, int32 aura=0)
Definition UnitAI.cpp:79
SpellCastResult DoCast(uint32 spellId)
Definition UnitAI.cpp:89
Definition Unit.h:635
MotionMaster * GetMotionMaster()
Definition Unit.h:1723
bool HasAura(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint32 reqEffMask=0) const
Definition Unit.cpp:4804
void HandleEmoteCommand(Emote emoteId, Player *target=nullptr, Trinity::IteratorPair< int32 const * > spellVisualKitIds={}, int32 sequenceVariation=0)
Definition Unit.cpp:1657
void KillSelf(bool durabilityLoss=true, bool skipSettingDeathState=false)
Definition Unit.h:936
Map * GetMap() const
Definition Object.h:411
SpellCastResult CastSpell(CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
Definition Object.cpp:2217
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:1398
bool IsWithinDistInMap(WorldObject const *obj, float dist2compare, bool is3D=true, bool incOwnRadius=true, bool incTargetRadius=true) const
Definition Object.cpp:501
bool IsInMap(WorldObject const *obj) const
Definition Object.cpp:469
virtual uint32 GetData(uint32) const
Definition ZoneScript.h:99
virtual void SetData(uint32, uint32)
Definition ZoneScript.h:100
bool TryHandleOnce(Player *player, AreaTriggerEntry const *) override
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)
void HandleDummyTick(AuraEffect const *)
bool Validate(SpellInfo const *) override
void HandleScript(SpellEffIndex)
void FilterTargets(std::list< WorldObject * > &targets)
void Register() override
TC_GAME_API Unit * GetUnit(WorldObject const &, ObjectGuid const &guid)
TC_GAME_API Player * GetPlayer(Map const *, ObjectGuid const &guid)
static constexpr uint32 StratholmeLfgDungeonServiceEntrance
HauntingPhantoms
@ SPELL_SUMMON_WRATH_PHANTOM
@ SPELL_SUMMON_SPITEFUL_PHANTOM
static constexpr uint32 StratholmeScenarioServiceEntrance
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:110
@ SPELL_YSIDA_SAVED
Definition stratholme.h:117
@ SPELL_BARON_ULTIMATUM
Definition stratholme.h:115
@ TYPE_BARON_RUN
Definition stratholme.h:48
constexpr float GetPositionX() const
Definition Position.h:87
constexpr float GetPositionY() const
Definition Position.h:88
constexpr float GetOrientation() const
Definition Position.h:90
constexpr float GetPositionZ() const
Definition Position.h:89
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