TrinityCore
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 "ScriptMgr.h"
21#include "Containers.h"
22#include "Player.h"
23#include "Spell.h"
24#include "SpellScript.h"
25#include "Log.h"
26
28{
29 // Spells
30 SPELL_DRACTHYR_LOGIN = 369728, // teleports to random room, plays scene for the room, binds the home position
31 SPELL_STASIS_1 = 369735, // triggers 366620
32 SPELL_STASIS_2 = 366620, // triggers 366636
33 SPELL_STASIS_3 = 366636, // removes 365560, sends first quest (64864)
34 SPELL_STASIS_4 = 365560, // freeze the target
35 SPELL_DRACTHYR_MOVIE_ROOM_01 = 394245, // scene for room 1
36 SPELL_DRACTHYR_MOVIE_ROOM_02 = 394279, // scene for room 2
37 SPELL_DRACTHYR_MOVIE_ROOM_03 = 394281, // scene for room 3
38 SPELL_DRACTHYR_MOVIE_ROOM_04 = 394282, // scene for room 4
39 //SPELL_DRACTHYR_MOVIE_ROOM_05 = 394283, // scene for room 5 (only plays sound, unused?)
40 SPELL_MAINTAIN_DERVISHIAN = 369731, // Alliance Personal Summon
41 SPELL_MAINTAIN_KODETHI = 370112, // Horde Personal Summon
45};
46
48{
52};
53
54std::array<DracthyrLoginRoom, 4> LoginRoomData =
55{
56 {
57 {
59 { 5725.32f, -3024.26f, 251.047f, 0.01745329238474369f },
60 { 5739.97216796875f, -3023.970458984375f, 251.172332763671875f, 3.193952560424804687f }
61 },
62 {
64 { 5743.03f, -3067.28f, 251.047f, 0.798488140106201171f },
65 { 5754.3046875f, -3056.34716796875f, 251.1725006103515625f, 3.926990747451782226f }
66 },
67 {
69 { 5787.1597f, -3083.3906f, 251.04698f, 1.570796370506286621f },
70 { 5787.44970703125f, -3069.335205078125f, 251.168121337890625f, 4.729842185974121093f }
71 },
72 {
74 { 5829.32f, -3064.49f, 251.047f, 2.364955902099609375f },
75 { 5818.533203125f, -3054.5625f, 251.3630828857421875f, 5.480333805084228515f }
76 }
77 }
78};
79
80// 369728 - Dracthyr Login
81// 369744 - Awaken, Dracthyr OnquestAbandon
83{
84 bool Validate(SpellInfo const* /*spellInfo*/) override
85 {
87 }
88
89 void HandleTeleport(SpellEffIndex /*effIndex*/)
90 {
91 DracthyrLoginRoom const& room = LoginRoomData[urand(0, 3)];
92
95
97
99 }
100
101 void Register() override
102 {
104 }
105};
106
107// 3730 - Dracthyr Evoker Intro (Post Movie)
109{
110public:
111 scene_dracthyr_evoker_intro() : SceneScript("scene_dracthyr_evoker_intro") { }
112
113 void OnSceneComplete(Player* player, uint32 /*sceneInstanceID*/, SceneTemplate const* /*sceneTemplate*/) override
114 {
115 player->CastSpell(player, SPELL_STASIS_1, true);
116 }
117
118 void OnSceneCancel(Player* player, uint32 /*sceneInstanceID*/, SceneTemplate const* /*sceneTemplate*/) override
119 {
120 player->CastSpell(player, SPELL_STASIS_1, true);
121 }
122};
123
124// 369730 - Summon Dervishian
125// 370111 - Summon Kodethi
127{
129 {
130 float currentDist = 1000.0f;
131 DracthyrLoginRoom const* currentRoom = nullptr;
132
133 for (DracthyrLoginRoom const& room : LoginRoomData)
134 {
135 float dist = GetCaster()->GetDistance(room.PlayerPosition);
136 if (dist < currentDist)
137 {
138 currentDist = dist;
139 currentRoom = &room;
140 }
141 }
142 if (!currentRoom)
143 return;
144
145 dest.Relocate(currentRoom->SummonPosition);
146 }
147
148 void Register() override
149 {
151 }
152};
153
154// 64864 - Awaken, Dracthyr
156{
157public:
158 quest_awaken_dracthyr() : QuestScript("quest_awaken_dracthyr") { }
159
160 void OnQuestStatusChange(Player* player, Quest const* /*quest*/, QuestStatus /*oldStatus*/, QuestStatus newStatus) override
161 {
162 if (newStatus == QUEST_STATUS_NONE)
163 player->CastSpell(player, SPELL_AWAKEN_DRACTYHR_QUEST_ABANDON, false);
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
184{
190}
uint32_t uint32
Definition: Define.h:142
QuestStatus
Definition: QuestDef.h:141
@ QUEST_STATUS_NONE
Definition: QuestDef.h:142
uint32 urand(uint32 min, uint32 max)
Definition: Random.cpp:42
#define RegisterAreaTriggerAI(ai_name)
Definition: ScriptMgr.h:1416
#define RegisterSpellScript(spell_script)
Definition: ScriptMgr.h:1369
SpellEffIndex
Definition: SharedDefines.h:29
@ EFFECT_0
Definition: SharedDefines.h:30
@ TARGET_DEST_NEARBY_ENTRY
@ SPELL_EFFECT_TELEPORT_UNITS
#define SpellEffectFn(F, I, N)
Definition: SpellScript.h:842
#define SpellDestinationTargetSelectFn(F, I, N)
Definition: SpellScript.h:874
AreaTrigger *const at
Definition: AreaTriggerAI.h:33
Unit * GetCaster() const
bool IsPlayer() const
Definition: Object.h:212
static bool ValidateSpellInfo(std::initializer_list< uint32 > spellIds)
Definition: SpellScript.h:162
WorldLocation * GetHitDest() const
Unit * GetCaster() const
HookList< DestinationTargetSelectHandler > OnDestinationTargetSelect
Definition: SpellScript.h:873
Unit * GetHitUnit() const
HookList< EffectHandler > OnEffectHitTarget
Definition: SpellScript.h:840
void SetExplTargetDest(WorldLocation const &loc)
Definition: Unit.h:627
constexpr WorldLocation GetWorldLocation() const
Definition: Position.h:196
SpellCastResult CastSpell(CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
Definition: Object.cpp:2896
float GetDistance(WorldObject const *obj) const
Definition: Object.cpp:1078
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
constexpr void Relocate(float x, float y)
Definition: Position.h:63
void Relocate(Position const &pos)
Definition: Spell.cpp:111
at_dracthyr_stasis_feedback(AreaTrigger *areatrigger)
void OnUnitEnter(Unit *unit) override
void AddSC_zone_the_forbidden_reach()
std::array< DracthyrLoginRoom, 4 > LoginRoomData
@ SPELL_AWAKEN_DRACTYHR_QUEST_ABANDON
@ SPELL_DRACTHYR_LOGIN
@ 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
@ SPELL_MAINTAIN_KODETHI