TrinityCore
Loading...
Searching...
No Matches
arena_blades_edge_legion.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 "Battleground.h"
19#include "BattlegroundScript.h"
20#include "Containers.h"
21#include "GameObject.h"
22#include "Map.h"
23#include "Player.h"
24#include "ScriptedCreature.h"
25#include "ScriptMgr.h"
26#include "SpellScript.h"
27#include "TaskScheduler.h"
28
29namespace BladesEdge
30{
31 namespace Actions
32 {
33 static constexpr uint32 ArenaStart = 1;
34 static constexpr uint32 ReactionTrigger = 2;
35 static constexpr uint32 MaulgarReactionGenderedM = 3;
36 static constexpr uint32 MaulgarReactionGenderedF = 4;
37 static constexpr uint32 MaulgarReactionNonGendered = 5;
38 static constexpr uint32 MaulgarReactionBored = 6;
39 }
40
41 namespace Creatures
42 {
43 static constexpr uint32 HighKingMaulgar = 115494;
44 }
45
46 namespace GameObjects
47 {
48 static constexpr uint32 Door01 = 265571;
49 static constexpr uint32 Door02 = 265569;
50 }
51
52 namespace MapIds
53 {
54 static constexpr uint32 BladesEdge = 1672;
55 }
56
57 namespace Spells
58 {
59 static constexpr uint32 KingVoiceOverCooldownAura = 236744;
60 static constexpr uint32 ArenaLowHealthCooldownAura = 234031;
61 static constexpr uint32 ArenaReactionTrigger = 234032;
62 }
63
64 namespace Texts
65 {
67 {
68 static constexpr uint8 Bored = 0;
69 static constexpr uint8 ReactionTriggerGenderedM = 1;
70 static constexpr uint8 ReactionTriggerGenderedF = 2;
71 static constexpr uint8 ReactionTriggerNonGendered = 3;
72 static constexpr uint8 ArenaStart = 4;
73 }
74 }
75}
76
78{
80
81 void OnUpdate(uint32 diff) override
82 {
83 _scheduler.Update(diff);
84 }
85
86 void DoAction(uint32 actionId, WorldObject* source, WorldObject* /*target*/) override
87 {
88 switch (actionId)
89 {
92 break;
93 default:
94 break;
95 }
96 }
97
98 void OnStart() override
99 {
100 for (ObjectGuid const& guid : _doorGUIDs)
101 {
102 if (GameObject* door = battlegroundMap->GetGameObject(guid))
103 {
104 door->UseDoorOrButton();
105 door->DespawnOrUnsummon(5s);
106 }
107 }
108
109 if (Creature const* maulgar = battlegroundMap->GetCreature(_maulgarGUID))
110 maulgar->AI()->DoAction(BladesEdge::Actions::ArenaStart);
111
112 _scheduler.Schedule(5s, [&](TaskContext& context)
113 {
114 if (_scheduleBored)
115 context.Repeat(1min, 2min);
116 });
117 }
118
119 void OnCreatureCreate(Creature* creature) override
120 {
121 switch (creature->GetEntry())
122 {
124 _maulgarGUID = creature->GetGUID();
125 break;
126 default:
127 break;
128 }
129 }
130
131 void OnGameObjectCreate(GameObject* gameobject) override
132 {
133 switch (gameobject->GetEntry())
134 {
137 _doorGUIDs.push_back(gameobject->GetGUID());
138 break;
139 default:
140 break;
141 }
142 }
143
150
152 {
153 if (Creature const* maulgar = battlegroundMap->GetCreature(_maulgarGUID))
154 {
155 if (urand(0, 1))
157 else if (source)
158 {
159 if (source->GetGender() == GENDER_FEMALE)
160 maulgar->AI()->DoAction(BladesEdge::Actions::MaulgarReactionGenderedF);
161 else
162 maulgar->AI()->DoAction(BladesEdge::Actions::MaulgarReactionGenderedM);
163 }
164 }
165
166 _scheduleBored = false;
167 }
168
169private:
174};
175
176// 115494 - High King Maulgar
212
213// 234033 - Blade's Edge Arena Game Event
240
uint8_t uint8
Definition Define.h:156
int32_t int32
Definition Define.h:150
uint32_t uint32
Definition Define.h:154
std::vector< ObjectGuid > GuidVector
Definition ObjectGuid.h:434
Spells
Definition PlayerAI.cpp:32
uint32 urand(uint32 min, uint32 max)
Definition Random.cpp:42
#define RegisterBattlegroundMapScript(script_name, mapId)
Definition ScriptMgr.h:1447
#define RegisterCreatureAI(ai_name)
Definition ScriptMgr.h:1392
#define RegisterSpellScript(spell_script)
Definition ScriptMgr.h:1383
SpellEffIndex
@ EFFECT_0
@ GENDER_FEMALE
@ SPELL_EFFECT_SCRIPT_EFFECT
@ TRIGGERED_IGNORE_CAST_IN_PROGRESS
Will not check if a current cast is in progress.
@ TRIGGERED_DONT_REPORT_CAST_ERROR
Will return SPELL_FAILED_DONT_REPORT in CheckCast functions.
#define SpellEffectFn(F, I, N)
Creatures
void AddSC_arena_blades_edge_legion()
ObjectGuid const & GetGUID() const
Definition BaseEntity.h:163
BattlegroundMap * battlegroundMap
GameObject * GetGameObject(ObjectGuid const &guid)
Definition Map.cpp:3552
Creature * GetCreature(ObjectGuid const &guid)
Definition Map.cpp:3542
Player * ToPlayer()
Definition Object.h:126
uint32 GetEntry() const
Definition Object.h:89
Unit * GetCaster() const
Unit * GetHitUnit() const
HookList< EffectHandler > OnEffectHitTarget
TaskContext & Repeat(TaskScheduler::duration_t duration)
TaskScheduler & Schedule(duration_t time, task_handler_t task)
TaskScheduler & Update()
Update the scheduler to the current time.
SpellCastResult DoCastAOE(uint32 spellId, CastSpellExtraArgs const &args={})
Definition UnitAI.h:162
Definition Unit.h:635
Gender GetGender() const
Definition Unit.h:767
bool HasAura(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint32 reqEffMask=0) const
Definition Unit.cpp:4804
constexpr uint32 GetMapId() const
Definition Position.h:216
ZoneScript * FindZoneScript() const
Definition Object.cpp:1365
SpellCastResult CastSpell(CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
Definition Object.cpp:2217
static constexpr uint32 MaulgarReactionGenderedF
static constexpr uint32 MaulgarReactionBored
static constexpr uint32 ArenaStart
static constexpr uint32 MaulgarReactionNonGendered
static constexpr uint32 ReactionTrigger
static constexpr uint32 MaulgarReactionGenderedM
static constexpr uint32 HighKingMaulgar
static constexpr uint32 BladesEdge
static constexpr uint32 ArenaReactionTrigger
static constexpr uint32 ArenaLowHealthCooldownAura
static constexpr uint32 KingVoiceOverCooldownAura
TriggerCastFlags TriggerFlags
void OnUpdate(uint32 diff) override
arena_blades_edge_legion(BattlegroundMap *map)
void DoAction(uint32 actionId, WorldObject *source, WorldObject *) override
void OnCreatureCreate(Creature *creature) override
void OnPlayerJoined(Player *player, bool) override
void HandleReactionTriggerLowHealth(Player const *source)
void OnGameObjectCreate(GameObject *gameobject) override