TrinityCore
zone_assault_on_the_dark_portal.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#include "AreaTrigger.h"
19#include "AreaTriggerAI.h"
20#include "PhasingHandler.h"
21#include "Player.h"
22#include "QuestDef.h"
23#include "ScriptMgr.h"
24#include "ScriptedCreature.h"
25#include "ScriptedFollowerAI.h"
26#include "SpellScript.h"
27#include "TemporarySummon.h"
28
30{
31 SPELL_ALTAR_ALTERCATION_CANCEL_AURAS = 167547, // Serverside Spell
40 SPELL_HUT_CREDIT = 164613, // Serverside Spell
45};
46
48{
51};
52
54{
57};
58
60{
64};
65
67{
68 // Ariok
76
77 // Kilrogg
80};
81
83{
86};
87
89{
94};
95
96// 621 - Dark Portal: Run away
98{
99public:
100 scene_dark_portal_run_away() : SceneScript("scene_dark_portal_run_away") { }
101
102 void OnSceneComplete(Player* player, uint32 /*sceneInstanceID*/, SceneTemplate const* /*sceneTemplate*/) override
103 {
106 }
107};
108
109// 34420 - The Cost of War
111{
112public:
113 quest_the_cost_of_war() : QuestScript("quest_the_cost_of_war") { }
114
115 void OnQuestStatusChange(Player* player, Quest const* /*quest*/, QuestStatus /*oldStatus*/, QuestStatus newStatus) override
116 {
117 if (newStatus == QUEST_STATUS_NONE)
118 {
121 }
122 else if (newStatus == QUEST_STATUS_INCOMPLETE)
123 {
126 }
127 }
128};
129
130// 34422 - Blaze of Glory
132{
133public:
134 quest_blaze_of_glory() : QuestScript("quest_blaze_of_glory") { }
135
136 void OnQuestStatusChange(Player* player, Quest const* /*quest*/, QuestStatus /*oldStatus*/, QuestStatus newStatus) override
137 {
138 if (newStatus == QUEST_STATUS_NONE)
139 {
145 }
146 else if (newStatus == QUEST_STATUS_INCOMPLETE)
148 else if (newStatus == QUEST_STATUS_COMPLETE)
150 }
151};
152
153// 770 - Bleeding Hollow: Holdout
155{
156public:
157 scene_bleeding_hollow_holdout() : SceneScript("scene_bleeding_hollow_holdout") { }
158
159 void OnSceneComplete(Player* player, uint32 /*sceneInstanceID*/, SceneTemplate const* /*sceneTemplate*/) override
160 {
163 }
164
165 void OnSceneTriggerEvent(Player* player, uint32 /*sceneInstanceID*/, SceneTemplate const* /*sceneTemplate*/, std::string const& triggerName) override
166 {
167 if (triggerName == "Push")
168 player->CastSpell(player, SPELL_PUSH_ARMY, false);
169 }
170};
171
172// 771 - Bleeding Hollow: Trail of Flame
174{
175 public:
176 scene_bleeding_hollow_trail_of_flame() : SceneScript("scene_bleeding_hollow_trail_of_flame") { }
177
178 void OnSceneTriggerEvent(Player* player, uint32 /*sceneInstanceID*/, SceneTemplate const* /*sceneTemplate*/, std::string const& triggerName) override
179 {
180 if (triggerName == "Visual")
181 player->CastSpell(player, SPELL_TRAIL_OF_FLAME_LARGE, true);
182 else if (triggerName == "Clear")
183 player->CastSpell(player, SPELL_CANCEL_TRAIL_OF_FLAME_VISUAL, true);
184 else if (triggerName == "Credit")
185 player->CastSpell(player, SPELL_HUT_CREDIT, true);
186 }
187};
188
189// 34423 - Altar Altercation
191{
192public:
193 quest_altar_altercation() : QuestScript("quest_altar_altercation") { }
194
195 void OnQuestStatusChange(Player* player, Quest const* /*quest*/, QuestStatus /*oldStatus*/, QuestStatus newStatus) override
196 {
197 if (newStatus == QUEST_STATUS_NONE)
199 }
200};
201
202// 161618 - Summon Ariok
204{
205 bool Validate(SpellInfo const* /*spellInfo*/) override
206 {
208 }
209
211 {
213 }
214
215 void Register() override
216 {
218 }
219};
220
221// 694 - Bleeding Hollow: Kilrogg Reveal
223{
224public:
225 scene_bleeding_hollow_kilrogg_reveal() : SceneScript("scene_bleeding_hollow_kilrogg_reveal") { }
226
227 void OnSceneCancel(Player* player, uint32 /*sceneInstanceID*/, SceneTemplate const* /*sceneTemplate*/) override
228 {
229 player->CastSpell(player, SPELL_CANCEL_PHASE_AURA, false);
230 }
231
232 void OnSceneTriggerEvent(Player* player, uint32 /*sceneInstanceID*/, SceneTemplate const* /*sceneTemplate*/, std::string const& triggerName) override
233 {
234 if (triggerName == "FreeCamera")
235 player->CastSpell(player, SPELL_CANCEL_PHASE_AURA, false);
236 }
237};
238
239// 167955 - Destroying
241{
242 void HandleOnHit(SpellEffIndex /*effIndex*/)
243 {
244 Creature* creature = GetHitUnit()->ToCreature();
245 if (!creature)
246 return;
247
248 creature->DespawnOrUnsummon(); // @TODO: Spawntracking should cause despawn for casting player only and respawn on abandon quest
249 }
250
251 void Register() override
252 {
254 }
255};
256
257// 80087 - Ariok
259{
261
262 void JustAppeared() override
263 {
265
266 if (TempSummon const* tempSummon = me->ToTempSummon())
267 {
268 if (Player* summoner = tempSummon->GetSummoner()->ToPlayer())
269 {
270 if (!summoner)
271 return;
272
273 StartFollow(summoner);
274 }
275 }
276 }
277
278 void DoAction(int32 action) override
279 {
280 switch (action)
281 {
282 case ACTION_INTRO:
283 {
285 break;
286 }
287 case ACTION_ON_ALTAR:
288 {
291 events.ScheduleEvent(EVENT_ALTAR, 5s + 400ms);
292 break;
293 }
294 default:
295 break;
296 }
297 }
298
299 void UpdateAI(uint32 diff) override
300 {
301 events.Update(diff);
302
303 while (uint32 eventId = events.ExecuteEvent())
304 {
305 switch (eventId)
306 {
307 case EVENT_TALK_1:
309 events.ScheduleEvent(EVENT_TALK_2, 5s + 700ms);
310 break;
311 case EVENT_TALK_2:
313 events.ScheduleEvent(EVENT_TALK_3, 7s + 400ms);
314 break;
315 case EVENT_TALK_3:
317 break;
318 case EVENT_ALTAR:
321 break;
322 default:
323 break;
324 }
325 }
326 }
327private:
329};
330
331// 164979 - (Serverside/Non-DB2) Trigger Ariok
333{
334 void HandleOnHit(SpellEffIndex /*effIndex*/)
335 {
336 Creature* creature = GetHitUnit()->ToCreature();
337
338 if (!creature)
339 return;
340
342 {
344 creature->DespawnOrUnsummon();
345 }
346 else if (GetCaster()->HasAura(SPELL_ON_ALTAR))
347 creature->AI()->DoAction(ACTION_ON_ALTAR);
348 }
349
350 void Register() override
351 {
353 }
354};
355
356// 83670 - Blood Ritual Orb
358{
360
361 void JustAppeared() override
362 {
364 me->CastSpell(bloodChosen, SPELL_BLOOD_RITUAL_ORB_BEAM, true);
365 }
366
367 void OnSpellClick(Unit* clicker, bool /*spellClickHandled*/) override
368 {
369 if (me->HasStringId("west_orb"))
370 {
371 Creature* kilrogg = clicker->FindNearestCreatureWithOptions(50.0f, { .CreatureId = NPC_ALTAR_ALTERCATION_KILROGG, .IgnorePhases = true });
372 if (!kilrogg)
373 return;
374
375 kilrogg->AI()->Talk(SAY_KILROGG_WEST_ORB_INTERACT, clicker);
376 }
377 else if (me->HasStringId("middle_orb"))
378 {
379 Creature* ariok = clicker->FindNearestCreatureWithOptions(50.0f, { .CreatureId = NPC_ALTAR_ALTERCATION_ARIOK, .IsSummon = true, .IgnorePhases = true, .OwnerGuid = clicker->GetGUID() });
380 if (!ariok)
381 return;
382
383 clicker->CastSpell(clicker, SPELL_BLEEDING_HOLLOW_SNEAKY_ARMY, true);
385 }
386 }
387
388 void UpdateAI(uint32 /*diff*/) override
389 {
390 UpdateVictim();
391 }
392};
393
394// Id - 52
396{
398
399 void OnUnitEnter(Unit* unit) override
400 {
401 Player* player = unit->ToPlayer();
402 if (!player)
403 return;
404
406 if (!kilrogg)
407 return;
408
409 kilrogg->AI()->Talk(SAY_KILROGG_ENTER_ALTAR_AT, player);
410 }
411};
412
413// Id - 50
415{
417
418 void OnUnitEnter(Unit* unit) override
419 {
420 Player* player = unit->ToPlayer();
421 if (!player)
422 return;
423
425 return;
426
428 return;
429
430 player->CastSpell(nullptr, SPELL_ON_ALTAR);
431 }
432
433 void OnUnitExit(Unit* unit) override
434 {
436 }
437};
438
440{
446
456};
int32_t int32
Definition: Define.h:138
uint32_t uint32
Definition: Define.h:142
QuestStatus
Definition: QuestDef.h:141
@ QUEST_STATUS_INCOMPLETE
Definition: QuestDef.h:145
@ QUEST_STATUS_NONE
Definition: QuestDef.h:142
@ QUEST_STATUS_COMPLETE
Definition: QuestDef.h:143
#define RegisterCreatureAI(ai_name)
Definition: ScriptMgr.h:1380
#define RegisterAreaTriggerAI(ai_name)
Definition: ScriptMgr.h:1416
#define RegisterSpellScript(spell_script)
Definition: ScriptMgr.h:1369
SpellEffIndex
Definition: SharedDefines.h:29
@ EFFECT_1
Definition: SharedDefines.h:31
@ EFFECT_0
Definition: SharedDefines.h:30
@ SPELL_EFFECT_DUMMY
@ TRIGGERED_FULL_MASK
Used when doing CastSpell with triggered == true.
Definition: SpellDefines.h:266
#define SpellEffectFn(F, I, N)
Definition: SpellScript.h:842
#define SpellCastFn(F)
Definition: SpellScript.h:825
@ UNIT_STATE_ROOT
Definition: Unit.h:265
void Talk(uint8 id, WorldObject const *whisperTarget=nullptr)
Definition: CreatureAI.cpp:56
bool UpdateVictim()
Definition: CreatureAI.cpp:245
Creature *const me
Definition: CreatureAI.h:61
void DespawnOrUnsummon(Milliseconds timeToDespawn=0s, Seconds forceRespawnTime=0s)
Definition: Creature.cpp:2415
bool HasStringId(std::string_view id) const
Definition: Creature.cpp:3165
CreatureAI * AI() const
Definition: Creature.h:214
uint32 ExecuteEvent()
Definition: EventMap.cpp:73
void Update(uint32 time)
Definition: EventMap.h:56
void ScheduleEvent(uint32 eventId, Milliseconds time, uint32 group=0, uint8 phase=0)
Definition: EventMap.cpp:36
void StartFollow(Player *player, uint32 factionForFollower=0, uint32 quest=0)
static Creature * ToCreature(Object *o)
Definition: Object.h:219
static ObjectGuid GetGUID(Object const *o)
Definition: Object.h:159
static Player * ToPlayer(Object *o)
Definition: Object.h:213
static bool OnConditionChange(WorldObject *object, bool updateVisibility=true)
bool IsQuestObjectiveComplete(uint16 slot, Quest const *quest, QuestObjective const &objective) const
Definition: Player.cpp:17090
void RemoveRewardedQuest(uint32 questId, bool update=true)
Definition: Player.cpp:16113
static bool ValidateSpellInfo(std::initializer_list< uint32 > spellIds)
Definition: SpellScript.h:162
Unit * GetCaster() const
Unit * GetHitUnit() const
HookList< EffectHandler > OnEffectHitTarget
Definition: SpellScript.h:840
HookList< CastHandler > BeforeCast
Definition: SpellScript.h:820
virtual void DoAction(int32)
Definition: UnitAI.h:72
Definition: Unit.h:627
void ClearUnitState(uint32 f)
Definition: Unit.h:733
TempSummon * ToTempSummon()
Definition: Unit.h:1756
void AddUnitState(uint32 f)
Definition: Unit.h:731
void RemoveAurasDueToSpell(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, uint32 reqEffMask=0, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition: Unit.cpp:3831
Creature * FindNearestCreatureWithOptions(float range, FindCreatureOptions const &options) const
Definition: Object.cpp:2157
SpellCastResult CastSpell(CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
Definition: Object.cpp:2896
Creature * FindNearestCreature(uint32 entry, float range, bool alive=true) const
Definition: Object.cpp:2148
void OnQuestStatusChange(Player *player, Quest const *, QuestStatus, QuestStatus newStatus) override
void OnQuestStatusChange(Player *player, Quest const *, QuestStatus, QuestStatus newStatus) override
void OnQuestStatusChange(Player *player, Quest const *, QuestStatus, QuestStatus newStatus) override
void OnSceneTriggerEvent(Player *player, uint32, SceneTemplate const *, std::string const &triggerName) override
void OnSceneComplete(Player *player, uint32, SceneTemplate const *) override
void OnSceneCancel(Player *player, uint32, SceneTemplate const *) override
void OnSceneTriggerEvent(Player *player, uint32, SceneTemplate const *, std::string const &triggerName) override
void OnSceneTriggerEvent(Player *player, uint32, SceneTemplate const *, std::string const &triggerName) override
void OnSceneComplete(Player *player, uint32, SceneTemplate const *) override
at_altar_altercation_reach_altar(AreaTrigger *areatrigger)
@ SPELL_BLEEDING_HOLLOW_TRAIL_OF_FLAME
@ SPELL_BLEEDING_HOLLOW_KILROGG_REVEAL
@ SPELL_CANCEL_TRAIL_OF_FLAME_VISUAL
@ SPELL_ALTAR_ALTERCATION_CANCEL_AURAS
@ OBJECTIVE_ALTAR_ALTERCATION_ESCORT_ARIOK
@ OBJECTIVE_ALTAR_ALTERCATION_SPEAK_WITH_ARIOK
void AddSC_assault_on_the_dark_portal()