TrinityCore
ruby_sanctum.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 "ScriptMgr.h"
19#include "InstanceScript.h"
20#include "MotionMaster.h"
21#include "Player.h"
22#include "ruby_sanctum.h"
23#include "ScriptedCreature.h"
24#include "SpellScript.h"
25
27{
37};
38
40{
48};
49
51{
52 SPELL_RALLY = 75416
53};
54
55Position const xerestraszaMovePos = {3151.236f, 379.8733f, 86.31996f, 0.0f};
56
58{
59 npc_xerestrasza(Creature* creature) : ScriptedAI(creature)
60 {
61 _isIntro = true;
62 _introDone = false;
63 }
64
65 void Reset() override
66 {
67 _events.Reset();
69 }
70
71 void DoAction(int32 action) override
72 {
73 if (action == ACTION_BALTHARUS_DEATH)
74 {
75 me->setActive(true);
76 me->SetFarVisible(true);
77 _isIntro = false;
78
80 me->SetWalk(true);
82
90 }
91 else if (action == ACTION_INTRO_BALTHARUS && !_introDone)
92 {
93 _introDone = true;
95 }
96 }
97
98 void UpdateAI(uint32 diff) override
99 {
100 if (_isIntro)
101 return;
102
103 _events.Update(diff);
104
105 while (uint32 eventId = _events.ExecuteEvent())
106 {
107 switch (eventId)
108 {
111 break;
114 break;
117 break;
120 break;
123 break;
126 break;
130 me->setActive(false);
131 me->SetFarVisible(false);
132 break;
133 default:
134 break;
135 }
136 }
137 }
138
139private:
143};
144
146{
147 public:
148 at_baltharus_plateau() : OnlyOnceAreaTriggerScript("at_baltharus_plateau") { }
149
150 bool TryHandleOnce(Player* player, AreaTriggerEntry const* /*areaTrigger*/) override
151 {
152 // Only trigger once
153 if (InstanceScript* instance = player->GetInstanceScript())
154 {
155 if (Creature* xerestrasza = instance->GetCreature(DATA_XERESTRASZA))
156 xerestrasza->AI()->DoAction(ACTION_INTRO_BALTHARUS);
157
158 if (Creature* baltharus = instance->GetCreature(DATA_BALTHARUS_THE_WARBORN))
159 baltharus->AI()->DoAction(ACTION_INTRO_BALTHARUS);
160 }
161
162 return true;
163 }
164};
165
166// 75415 - Rallying Shout
168{
169 bool Validate(SpellInfo const* /*spellInfo*/) override
170 {
171 return ValidateSpellInfo({ SPELL_RALLY });
172 }
173
174 void CountTargets(std::list<WorldObject*>& targets)
175 {
176 _targetCount = targets.size();
177 }
178
179 void HandleDummy(SpellEffIndex /*effIndex*/)
180 {
182 {
186 }
187 }
188
189 void Register() override
190 {
193 }
194
196};
197
199{
203}
Texts
int32_t int32
Definition: Define.h:138
uint32_t uint32
Definition: Define.h:142
Spells
Definition: PlayerAI.cpp:32
#define RegisterSpellScript(spell_script)
Definition: ScriptMgr.h:1369
SpellEffIndex
Definition: SharedDefines.h:29
@ EFFECT_0
Definition: SharedDefines.h:30
@ TARGET_UNIT_SRC_AREA_ALLY
@ SPELL_EFFECT_DUMMY
@ TRIGGERED_FULL_MASK
Used when doing CastSpell with triggered == true.
Definition: SpellDefines.h:266
@ SPELLVALUE_AURA_STACK
Definition: SpellDefines.h:231
#define SpellEffectFn(F, I, N)
Definition: SpellScript.h:842
#define SpellObjectAreaTargetSelectFn(F, I, N)
Definition: SpellScript.h:864
@ UNIT_NPC_FLAG_QUESTGIVER
Definition: UnitDefines.h:298
void Talk(uint8 id, WorldObject const *whisperTarget=nullptr)
Definition: CreatureAI.cpp:56
Creature *const me
Definition: CreatureAI.h:61
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 Reset()
Definition: EventMap.cpp:21
void MovePoint(uint32 id, Position const &pos, bool generatePath=true, Optional< float > finalOrient={}, Optional< float > speed={}, MovementWalkRunSpeedSelectionMode speedSelectionMode=MovementWalkRunSpeedSelectionMode::Default, Optional< float > closeEnoughDistance={})
static bool ValidateSpellInfo(std::initializer_list< uint32 > spellIds)
Definition: SpellScript.h:162
Unit * GetCaster() const
HookList< EffectHandler > OnEffectHit
Definition: SpellScript.h:839
HookList< ObjectAreaTargetSelectHandler > OnObjectAreaTargetSelect
Definition: SpellScript.h:863
MotionMaster * GetMotionMaster()
Definition: Unit.h:1652
void RemoveNpcFlag(NPCFlags flags)
Definition: Unit.h:983
void SetNpcFlag(NPCFlags flags)
Definition: Unit.h:982
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
void setActive(bool isActiveObject)
Definition: Object.cpp:922
void SetFarVisible(bool on)
Definition: Object.cpp:973
bool TryHandleOnce(Player *player, AreaTriggerEntry const *) override
bool Validate(SpellInfo const *) override
void CountTargets(std::list< WorldObject * > &targets)
@ SPELL_RALLY
void AddSC_ruby_sanctum()
@ SAY_XERESTRASZA_EVENT_3
@ SAY_XERESTRASZA_EVENT_1
@ SAY_XERESTRASZA_INTRO
@ SAY_XERESTRASZA_EVENT_5
@ SAY_XERESTRASZA_EVENT_6
@ SAY_XERESTRASZA_EVENT
@ SAY_XERESTRASZA_EVENT_2
@ SAY_XERESTRASZA_EVENT_4
@ SAY_XERESTRASZA_EVENT_7
Position const xerestraszaMovePos
@ EVENT_XERESTRASZA_EVENT_7
@ EVENT_XERESTRASZA_EVENT_2
@ EVENT_XERESTRASZA_EVENT_4
@ EVENT_XERESTRASZA_EVENT_6
@ EVENT_XERESTRASZA_EVENT_5
@ EVENT_XERESTRASZA_EVENT_3
@ EVENT_XERESTRASZA_EVENT_1
#define RegisterRubySanctumCreatureAI(ai_name)
Definition: ruby_sanctum.h:138
@ DATA_XERESTRASZA
Definition: ruby_sanctum.h:38
@ DATA_BALTHARUS_THE_WARBORN
Definition: ruby_sanctum.h:31
@ ACTION_INTRO_BALTHARUS
Definition: ruby_sanctum.h:58
@ ACTION_BALTHARUS_DEATH
Definition: ruby_sanctum.h:59
CastSpellExtraArgs & AddSpellMod(SpellValueMod mod, int32 val)
Definition: SpellDefines.h:474
void Reset() override
void DoAction(int32 action) override
npc_xerestrasza(Creature *creature)
void UpdateAI(uint32 diff) override