TrinityCore
Loading...
Searching...
No Matches
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 "ConversationAI.h"
22#include "InstanceScript.h"
23#include "MotionMaster.h"
24#include "ScriptMgr.h"
25#include "ScriptedCreature.h"
26#include "Unit.h"
28
36
38{
39 PATH_SARKARETH = (202416 * 10) << 3,
40 PATH_WINGLORD_DEZRAN = (202610 * 10) << 3,
41 PATH_ZSKARN = (202637 * 10) << 3
42};
43
45{
46 SPELL_ABERRUS_ENTRANCE_RP_CONVERSATION_1 = 400785, // Sabellian and Wrathion
47 SPELL_ABERRUS_ENTRANCE_RP_CONVERSATION_2 = 403340, // Sabellian and Sarkareth
48};
49
65
66Position const SabellianIntroConvoMovePosition = { 2250.6372f, 2482.3003f, 711.9592f };
67
68// Id 26 - Areatrigger
70{
72
73 void OnUnitEnter(Unit* unit) override
74 {
75 Player* player = unit->ToPlayer();
76 if (!player)
77 return;
78
80
81 if (!sabellian)
82 return;
83
85 at->Remove();
86 }
87};
88
89// Id 27 - Areatrigger
91{
93
94 void OnUnitEnter(Unit* unit) override
95 {
96 Player* player = unit->ToPlayer();
97 if (!player)
98 return;
99
101
102 if (!sabellian)
103 return;
104
106 at->Remove();
107 }
108};
109
110// 20800 - Conversation
112{
113public:
115
116 void OnStart() override
117 {
119 _events.ScheduleEvent(EVENT_SABELLIAN_MOVE, *sabellianMoveStartTime);
120
122 _events.ScheduleEvent(EVENT_SABELLIAN_MOVE_HOME_POS, *sabellianHomeMoveStartTime + Seconds(2));
123 }
124
125 void OnUpdate(uint32 diff) override
126 {
127 _events.Update(diff);
128
129 switch (_events.ExecuteEvent())
130 {
132 {
134 if (!sabellian)
135 break;
136
137 sabellian->SetWalk(true);
139 break;
140 }
142 {
144 if (!sabellian)
145 break;
146
147 sabellian->SetWalk(true);
148 sabellian->GetMotionMaster()->MovePoint(0, sabellian->ToCreature()->GetHomePosition(), false, sabellian->ToCreature()->GetHomePosition().GetOrientation());
149 break;
150 }
151 default:
152 break;
153 }
154 }
155
156private:
158};
159
160// 20985 - Conversation
162{
163public:
165
170
171 void OnUpdate(uint32 diff) override
172 {
173 _events.Update(diff);
174
175 switch (_events.ExecuteEvent())
176 {
178 {
182
183 if (!winglordDezran || !zskarn || !sarkareth)
184 return;
185
186 sarkareth->GetMotionMaster()->MovePath(PATH_SARKARETH, false);
187 sarkareth->DespawnOrUnsummon(45s);
188
189 winglordDezran->GetMotionMaster()->MovePath(PATH_WINGLORD_DEZRAN, false);
190 winglordDezran->DespawnOrUnsummon(45s);
191
192 zskarn->GetMotionMaster()->MovePath(PATH_ZSKARN, false);
193 zskarn->DespawnOrUnsummon(45s, Seconds::max()); // override respawn time to prevent instant respawn due to CREATURE_FLAG_EXTRA_DUNGEON_BOSS
194
196 {
197 instance->SetData(DATA_KAZZARA_INTRO_STATE, DONE);
198 if (Creature* kazzara = instance->GetCreature(DATA_KAZZARA_THE_HELLFORGED))
199 kazzara->AI()->DoAction(ACTION_START_KAZZARA_INTRO);
200 }
201 break;
202 }
203 default:
204 break;
205 }
206 }
207
208private:
210};
211
#define DEFAULT_LOCALE
Definition Common.h:69
uint32_t uint32
Definition Define.h:154
std::chrono::milliseconds Milliseconds
Milliseconds shorthand typedef.
Definition Duration.h:24
std::chrono::seconds Seconds
Seconds shorthand typedef.
Definition Duration.h:28
@ DONE
#define RegisterAreaTriggerAI(ai_name)
Definition ScriptMgr.h:1428
#define RegisterConversationAI(ai_name)
Definition ScriptMgr.h:1437
Position const SabellianIntroConvoMovePosition
void AddSC_aberrus_the_shadowed_crucible()
@ SPELL_ABERRUS_ENTRANCE_RP_CONVERSATION_1
@ SPELL_ABERRUS_ENTRANCE_RP_CONVERSATION_2
@ NPC_SABELLIAN_AT_ABERRUS_ENTRANCE
AreaTrigger *const at
Conversation *const conversation
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:388
void DespawnOrUnsummon(Milliseconds timeToDespawn=0s, Seconds forceRespawnTime=0s)
uint32 ExecuteEvent()
Definition EventMap.cpp:77
void Update(uint32 time)
Definition EventMap.h:61
void ScheduleEvent(uint32 eventId, Milliseconds time, uint32 group=0, uint8 phase=0)
Definition EventMap.cpp:40
void MovePoint(uint32 id, Position const &pos, bool generatePath=true, Optional< float > finalOrient={}, Optional< float > speed={}, MovementWalkRunSpeedSelectionMode speedSelectionMode=MovementWalkRunSpeedSelectionMode::Default, Optional< float > closeEnoughDistance={}, Optional< MovementFadeObject > fadeObject={}, Scripting::v2::ActionResultSetter< MovementStopReason > &&scriptResult={})
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={}, Optional< bool > exactSplinePath={}, bool generatePath=true, Optional< MovementFadeObject > fadeObject={}, Scripting::v2::ActionResultSetter< MovementStopReason > &&scriptResult={})
Player * ToPlayer()
Definition Object.h:126
Creature * ToCreature()
Definition Object.h:121
Definition Unit.h:635
MotionMaster * GetMotionMaster()
Definition Unit.h:1723
bool SetWalk(bool enable)
Definition Unit.cpp:13343
InstanceScript * GetInstanceScript() const
Definition Object.cpp:396
SpellCastResult CastSpell(CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
Definition Object.cpp:2217
Creature * FindNearestCreature(uint32 entry, float range, bool alive=true) const
Definition Object.cpp:1517
conversation_aberrus_kazzara_intro(Conversation *conversation)
conversation_aberrus_sabellian_intro(Conversation *conversation)