TrinityCore
Loading...
Searching...
No Matches
zone_the_forbidden_reach.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 "Containers.h"
21#include "Player.h"
22#include "ScriptMgr.h"
23#include "SpellInfo.h"
24#include "SpellScript.h"
25
27{
28 // Spells
29 SPELL_DRACTHYR_LOGIN = 369728, // teleports to random room, plays scene for the room, binds the home position
30 SPELL_STASIS_1 = 369735, // triggers 366620
31 SPELL_STASIS_2 = 366620, // triggers 366636
32 SPELL_STASIS_3 = 366636, // removes 365560, sends first quest (64864)
33 SPELL_STASIS_4 = 365560, // freeze the target
34 SPELL_DRACTHYR_MOVIE_ROOM_01 = 394245, // scene for room 1
35 SPELL_DRACTHYR_MOVIE_ROOM_02 = 394279, // scene for room 2
36 SPELL_DRACTHYR_MOVIE_ROOM_03 = 394281, // scene for room 3
37 SPELL_DRACTHYR_MOVIE_ROOM_04 = 394282, // scene for room 4
38 //SPELL_DRACTHYR_MOVIE_ROOM_05 = 394283, // scene for room 5 (only plays sound, unused?)
39 SPELL_MAINTAIN_DERVISHIAN = 369731, // Alliance Personal Summon
40 SPELL_MAINTAIN_KODETHI = 370112, // Horde Personal Summon
44};
45
52
53static constexpr std::array<DracthyrLoginRoom, 4> LoginRoomData =
54{{
55 {
57 { 5725.32f, -3024.26f, 251.047f, 0.01745329238474369f },
58 { 5739.97216796875f, -3023.970458984375f, 251.172332763671875f, 3.193952560424804687f }
59 },
60 {
62 { 5743.03f, -3067.28f, 251.047f, 0.798488140106201171f },
63 { 5754.3046875f, -3056.34716796875f, 251.1725006103515625f, 3.926990747451782226f }
64 },
65 {
67 { 5787.1597f, -3083.3906f, 251.04698f, 1.570796370506286621f },
68 { 5787.44970703125f, -3069.335205078125f, 251.168121337890625f, 4.729842185974121093f }
69 },
70 {
72 { 5829.32f, -3064.49f, 251.047f, 2.364955902099609375f },
73 { 5818.533203125f, -3054.5625f, 251.3630828857421875f, 5.480333805084228515f }
74 }
75}};
76
77// 369728 - Dracthyr Login
78// 369744 - Awaken, Dracthyr OnquestAbandon
80{
85
86 void HandleTeleport(SpellEffIndex /*effIndex*/)
87 {
88 DracthyrLoginRoom const& room = LoginRoomData[urand(0, 3)];
89
92
94
96
97 // relocate questgiver to new random room
99 if (Player* player = GetCaster()->ToPlayer())
100 player->UpdateAreaDependentAuras(player->GetAreaId());
101 }
102
107};
108
109// 3730 - Dracthyr Evoker Intro (Post Movie)
111{
112public:
113 scene_dracthyr_evoker_intro() : SceneScript("scene_dracthyr_evoker_intro") { }
114
115 void OnSceneComplete(Player* player, uint32 /*sceneInstanceID*/, SceneTemplate const* /*sceneTemplate*/) override
116 {
117 player->CastSpell(player, SPELL_STASIS_1, true);
118 }
119
120 void OnSceneCancel(Player* player, uint32 /*sceneInstanceID*/, SceneTemplate const* /*sceneTemplate*/) override
121 {
122 player->CastSpell(player, SPELL_STASIS_1, true);
123 }
124};
125
126// 369730 - Summon Dervishian
127// 370111 - Summon Kodethi
129{
130 void SetDest(SpellDestination& dest) const
131 {
132 auto currentRoom = std::ranges::min_element(LoginRoomData, [caster = GetCaster()](DracthyrLoginRoom const& left, DracthyrLoginRoom const& right)
133 {
134 return caster->GetDistance(left.PlayerPosition) < caster->GetDistance(right.PlayerPosition);
135 });
136
137 if (currentRoom == LoginRoomData.end())
138 return;
139
140 dest.Relocate(currentRoom->SummonPosition);
141 }
142
147};
148
149// 64864 - Awaken, Dracthyr
151{
152public:
153 quest_awaken_dracthyr() : QuestScript("quest_awaken_dracthyr") { }
154
155 void OnQuestStatusChange(Player* player, Quest const* /*quest*/, QuestStatus /*oldStatus*/, QuestStatus newStatus) override
156 {
157 if (newStatus == QUEST_STATUS_NONE)
158 {
159 player->CastSpell(player, SPELL_AWAKEN_DRACTYHR_QUEST_ABANDON, false);
160 // remove summon aura to relocate questgiver to new random room
163 }
164 }
165};
166
167// 30308 - Stasis Feedback
169{
171
172 void OnUnitEnter(Unit* unit) override
173 {
174 if (!unit->IsPlayer())
175 return;
176
177 unit->CastSpell(nullptr, SPELL_STASIS_FEEDBACK_KNOCKBACK, false);
178 if (Unit* caster = at->GetCaster())
179 caster->CastSpell(caster->GetPosition(), SPELL_STASIS_FEEDBACK_VISUAL, true);
180 }
181};
182
uint32_t uint32
Definition Define.h:154
QuestStatus
Definition QuestDef.h:146
@ QUEST_STATUS_NONE
Definition QuestDef.h:147
uint32 urand(uint32 min, uint32 max)
Definition Random.cpp:42
#define RegisterAreaTriggerAI(ai_name)
Definition ScriptMgr.h:1428
#define RegisterSpellScript(spell_script)
Definition ScriptMgr.h:1383
SpellEffIndex
@ EFFECT_0
@ TARGET_DEST_NEARBY_ENTRY
@ SPELL_EFFECT_TELEPORT_UNITS
#define SpellEffectFn(F, I, N)
#define SpellDestinationTargetSelectFn(F, I, N)
AreaTrigger *const at
Unit * GetCaster() const
bool IsPlayer() const
Definition BaseEntity.h:173
static bool ValidateSpellInfo(std::initializer_list< uint32 > spellIds)
WorldLocation * GetHitDest() const
Unit * GetCaster() const
HookList< DestinationTargetSelectHandler > OnDestinationTargetSelect
Unit * GetHitUnit() const
HookList< EffectHandler > OnEffectHitTarget
void SetExplTargetDest(WorldLocation const &loc)
SpellInfo const * GetSpellInfo() const
Definition Unit.h:635
void RemoveAura(AuraApplicationMap::iterator &i, AuraRemoveMode mode=AURA_REMOVE_BY_DEFAULT)
Definition Unit.cpp:3828
constexpr WorldLocation GetWorldLocation() const
Definition Position.h:211
SpellCastResult CastSpell(CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
Definition Object.cpp:2217
void OnQuestStatusChange(Player *player, Quest const *, QuestStatus, QuestStatus newStatus) override
void OnSceneComplete(Player *player, uint32, SceneTemplate const *) override
void OnSceneCancel(Player *player, uint32, SceneTemplate const *) override
void HandleTeleport(SpellEffIndex)
bool Validate(SpellInfo const *) override
void SetDest(SpellDestination &dest) const
constexpr void Relocate(float x, float y)
Definition Position.h:74
void Relocate(Position const &pos)
Definition Spell.cpp:82
at_dracthyr_stasis_feedback(AreaTrigger *areatrigger)
void OnUnitEnter(Unit *unit) override
void AddSC_zone_the_forbidden_reach()
static constexpr std::array< DracthyrLoginRoom, 4 > LoginRoomData
@ SPELL_AWAKEN_DRACTYHR_QUEST_ABANDON
@ SPELL_MAINTAIN_DERVISHIAN
@ SPELL_DRACTHYR_MOVIE_ROOM_03
@ SPELL_DRACTHYR_MOVIE_ROOM_04
@ SPELL_STASIS_FEEDBACK_VISUAL
@ SPELL_DRACTHYR_MOVIE_ROOM_01
@ SPELL_DRACTHYR_MOVIE_ROOM_02
@ SPELL_STASIS_FEEDBACK_KNOCKBACK