TrinityCore
aberrus_the_shadowed_crucible.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 "Conversation.h"
21#include "InstanceScript.h"
22#include "MotionMaster.h"
23#include "ScriptMgr.h"
24#include "ScriptedCreature.h"
25#include "Unit.h"
27
29{
34};
35
37{
38 PATH_SARKARETH = (202416 * 10) << 3,
39 PATH_WINGLORD_DEZRAN = (202610 * 10) << 3,
40 PATH_ZSKARN = (202637 * 10) << 3
41};
42
44{
45 SPELL_ABERRUS_ENTRANCE_RP_CONVERSATION_1 = 400785, // Sabellian and Wrathion
46 SPELL_ABERRUS_ENTRANCE_RP_CONVERSATION_2 = 403340, // Sabellian and Sarkareth
47};
48
50{
51 // Sabellian intro
53
56
57 // Kazzara intro
61
63};
64
65Position const SabellianIntroConvoMovePosition = { 2250.6372f, 2482.3003f, 711.9592f };
66
67// Id 26 - Areatrigger
69{
71
72 void OnUnitEnter(Unit* unit) override
73 {
74 Player* player = unit->ToPlayer();
75 if (!player)
76 return;
77
79
80 if (!sabellian)
81 return;
82
84 at->Remove();
85 }
86};
87
88// Id 27 - Areatrigger
90{
92
93 void OnUnitEnter(Unit* unit) override
94 {
95 Player* player = unit->ToPlayer();
96 if (!player)
97 return;
98
100
101 if (!sabellian)
102 return;
103
105 at->Remove();
106 }
107};
108
109// 20800 - Conversation
111{
112public:
113 conversation_aberrus_sabellian_intro() : ConversationScript("conversation_aberrus_sabellian_intro") { }
114
115 void OnConversationStart(Conversation* conversation) override
116 {
117 if (Milliseconds const* sabellianMoveStartTime = conversation->GetLineStartTime(DEFAULT_LOCALE, CONVO_SABELLIAN_INTRO_LINE_01))
118 _events.ScheduleEvent(EVENT_SABELLIAN_MOVE, *sabellianMoveStartTime);
119
120 if (Milliseconds const* sabellianHomeMoveStartTime = conversation->GetLineStartTime(DEFAULT_LOCALE, CONVO_SABELLIAN_INTRO_LINE_02))
121 _events.ScheduleEvent(EVENT_SABELLIAN_MOVE_HOME_POS, *sabellianHomeMoveStartTime + Seconds(2));
122 }
123
124 void OnConversationUpdate(Conversation* conversation, uint32 diff) override
125 {
126 _events.Update(diff);
127
128 switch (_events.ExecuteEvent())
129 {
131 {
132 Creature* sabellian = conversation->GetActorCreature(CONVO_ACTOR_IDX_SABELLIAN);
133 if (!sabellian)
134 break;
135
136 sabellian->SetWalk(true);
138 break;
139 }
141 {
142 Creature* sabellian = conversation->GetActorCreature(CONVO_ACTOR_IDX_SABELLIAN);
143 if (!sabellian)
144 break;
145
146 sabellian->SetWalk(true);
147 sabellian->GetMotionMaster()->MovePoint(0, sabellian->ToCreature()->GetHomePosition(), false, sabellian->ToCreature()->GetHomePosition().GetOrientation());
148 break;
149 }
150 default:
151 break;
152 }
153 }
154
155private:
157};
158
159// 20985 - Conversation
161{
162public:
163 conversation_aberrus_kazzara_intro() : ConversationScript("conversation_aberrus_kazzara_intro") { }
164
165 void OnConversationStart(Conversation* conversation) override
166 {
168 }
169
170 void OnConversationUpdate(Conversation* conversation, uint32 diff) override
171 {
172 _events.Update(diff);
173
174 switch (_events.ExecuteEvent())
175 {
177 {
178 Creature* winglordDezran = conversation->GetActorCreature(CONVO_ACTOR_IDX_WINGLORD_DEZRAN);
179 Creature* zskarn = conversation->GetActorCreature(CONVO_ACTOR_IDX_ZSKARN);
180 Creature* sarkareth = conversation->GetActorCreature(CONVO_ACTOR_IDX_SARKARETH);
181
182 if (!winglordDezran || !zskarn || !sarkareth)
183 return;
184
185 sarkareth->GetMotionMaster()->MovePath(PATH_SARKARETH, false);
186 sarkareth->DespawnOrUnsummon(45s);
187
188 winglordDezran->GetMotionMaster()->MovePath(PATH_WINGLORD_DEZRAN, false);
189 winglordDezran->DespawnOrUnsummon(45s);
190
191 zskarn->GetMotionMaster()->MovePath(PATH_ZSKARN, false);
192 zskarn->DespawnOrUnsummon(45s, Seconds::max()); // override respawn time to prevent instant respawn due to CREATURE_FLAG_EXTRA_DUNGEON_BOSS
193
194 if (InstanceScript* instance = conversation->GetInstanceScript())
195 {
196 instance->SetData(DATA_KAZZARA_INTRO_STATE, DONE);
197 if (Creature* kazzara = instance->GetCreature(DATA_KAZZARA_THE_HELLFORGED))
198 kazzara->AI()->DoAction(ACTION_START_KAZZARA_INTRO);
199 }
200 break;
201 }
202 default:
203 break;
204 }
205 }
206
207private:
209};
210
212{
215
218}
#define DEFAULT_LOCALE
Definition: Common.h:66
uint32_t uint32
Definition: Define.h:142
std::chrono::seconds Seconds
Seconds shorthand typedef.
Definition: Duration.h:32
std::chrono::milliseconds Milliseconds
Milliseconds shorthand typedef.
Definition: Duration.h:29
@ DONE
#define RegisterAreaTriggerAI(ai_name)
Definition: ScriptMgr.h:1416
Position const SabellianIntroConvoMovePosition
void AddSC_aberrus_the_shadowed_crucible()
@ SPELL_ABERRUS_ENTRANCE_RP_CONVERSATION_1
@ SPELL_ABERRUS_ENTRANCE_RP_CONVERSATION_2
@ CONVO_ACTOR_IDX_WINGLORD_DEZRAN
@ ACTION_START_KAZZARA_INTRO
@ DATA_KAZZARA_THE_HELLFORGED
@ NPC_SABELLIAN_AT_ABERRUS_ENTRANCE
AreaTrigger *const at
Definition: AreaTriggerAI.h:33
Milliseconds GetLineEndTime(LocaleConstant locale, int32 lineId) const
Milliseconds const * GetLineStartTime(LocaleConstant locale, int32 lineId) const
Creature * GetActorCreature(uint32 actorIdx) const
void GetHomePosition(float &x, float &y, float &z, float &ori) const
Definition: Creature.h:373
void DespawnOrUnsummon(Milliseconds timeToDespawn=0s, Seconds forceRespawnTime=0s)
Definition: Creature.cpp:2415
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 MovePath(uint32 pathId, bool repeatable, Optional< Milliseconds > duration={}, Optional< float > speed={}, MovementWalkRunSpeedSelectionMode speedSelectionMode=MovementWalkRunSpeedSelectionMode::Default, Optional< std::pair< Milliseconds, Milliseconds > > waitTimeRangeAtPathEnd={}, Optional< float > wanderDistanceAtPathEnds={}, Optional< bool > followPathBackwardsFromEndToStart={}, bool generatePath=true)
void MovePoint(uint32 id, Position const &pos, bool generatePath=true, Optional< float > finalOrient={}, Optional< float > speed={}, MovementWalkRunSpeedSelectionMode speedSelectionMode=MovementWalkRunSpeedSelectionMode::Default, Optional< float > closeEnoughDistance={})
static Creature * ToCreature(Object *o)
Definition: Object.h:219
static Player * ToPlayer(Object *o)
Definition: Object.h:213
Definition: Unit.h:627
MotionMaster * GetMotionMaster()
Definition: Unit.h:1652
bool SetWalk(bool enable)
Definition: Unit.cpp:12707
InstanceScript * GetInstanceScript() const
Definition: Object.cpp:1042
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 OnConversationUpdate(Conversation *conversation, uint32 diff) override
void OnConversationStart(Conversation *conversation) override
void OnConversationUpdate(Conversation *conversation, uint32 diff) override
void OnConversationStart(Conversation *conversation) override