TrinityCore
Loading...
Searching...
No Matches
arena_mugambala.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 "Creature.h"
21#include "CreatureAI.h"
22#include "GameObject.h"
23#include "Map.h"
24#include "Player.h"
25#include "ScriptMgr.h"
26#include "SpellScript.h"
27
28namespace Mugambala
29{
30 namespace Actions
31 {
32 static constexpr uint32 ReactionTrigger = 1;
33 static constexpr uint32 ReactionDead = 2;
34 }
35
36 namespace Creatures
37 {
38 static constexpr uint32 JestryTheUntamed = 141962;
39 }
40
41 namespace GameObjects
42 {
43 static constexpr uint32 Door01 = 298780;
44 static constexpr uint32 Door02 = 298781;
45 }
46
47 namespace MapIds
48 {
49 static constexpr uint32 Mugambala = 1911;
50 }
51
52 namespace Spells
53 {
54 static constexpr uint32 ArenaLowHealthCooldownAura = 234031;
55 static constexpr uint32 ZandalarArenaVOCooldownAura = 278700;
56 static constexpr uint32 ZandalarArenaReactionTrigger = 278771;
57 }
58
59 namespace Texts
60 {
61 namespace Jestry
62 {
63 static constexpr uint8 Prepare = 0;
64 static constexpr uint8 Start = 1;
65 static constexpr uint8 ReactionNonGendered = 2;
66 static constexpr uint8 ReactionGenderF = 3;
67 static constexpr uint8 ReactionGenderM = 4;
68 static constexpr uint8 ReactionKill = 5;
69 }
70 }
71}
72
74{
76
77 void OnStart() override
78 {
79 for (ObjectGuid const& guid : _doorGUIDs)
80 {
81 if (GameObject* door = battlegroundMap->GetGameObject(guid))
82 {
83 door->UseDoorOrButton();
84 door->DespawnOrUnsummon(5s);
85 }
86 }
87
88 if (Creature const* creature = battlegroundMap->GetCreature(_jestryGUID))
89 creature->AI()->Talk(Mugambala::Texts::Jestry::Start);
90 }
91
92 void DoAction(uint32 actionId, WorldObject* source, WorldObject* target) override
93 {
94 switch (actionId)
95 {
98 break;
101 break;
102 default:
103 break;
104 }
105 }
106
107 void OnPrepareStage2() override
108 {
109 if (Creature const* creature = battlegroundMap->GetCreature(_jestryGUID))
110 creature->AI()->Talk(Mugambala::Texts::Jestry::Prepare);
111 }
112
113 void OnCreatureCreate(Creature* creature) override
114 {
115 switch (creature->GetEntry())
116 {
118 _jestryGUID = creature->GetGUID();
119 break;
120 default:
121 break;
122 }
123 }
124
125 void OnGameObjectCreate(GameObject* gameobject) override
126 {
127 switch (gameobject->GetEntry())
128 {
131 _doorGUIDs.emplace_back(gameobject->GetGUID());
132 break;
133 default:
134 break;
135 }
136 }
137
144
145 void HandleKill(Player const* victim) const
146 {
147 if (!victim)
148 return;
149
151 {
153 return;
154
155 creature->AI()->Talk(Mugambala::Texts::Jestry::ReactionKill, victim);
156
159 });
160 }
161 }
162
163 void HandleReactionLowHealth(Player const* victim) const
164 {
165 if (!victim)
166 return;
167
169 {
171 return;
172
173 if (urand(0, 1))
174 creature->AI()->Talk(Mugambala::Texts::Jestry::ReactionNonGendered, victim);
175 else if (victim->GetGender() == GENDER_FEMALE)
176 creature->AI()->Talk(Mugambala::Texts::Jestry::ReactionGenderF, victim);
177 else
178 creature->AI()->Talk(Mugambala::Texts::Jestry::ReactionGenderM, victim);
179
182 });
183 }
184 }
185
186private:
189};
190
191// 278770 - Zandalar Arena Reaction Trigger - Low Health
218
219// 278771 - Zandalar Arena Reaction Trigger
221{
222 bool Load() override
223 {
225 }
226
227 void HandleProc(ProcEventInfo const& eventInfo) const
228 {
229 if (ZoneScript* zonescript = GetTarget()->FindZoneScript())
230 zonescript->DoAction(Mugambala::Actions::ReactionDead, eventInfo.GetActor(), eventInfo.GetProcTarget());
231 }
232
237};
238
uint8_t uint8
Definition Define.h:156
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 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 AuraProcFn(F)
#define SpellEffectFn(F, I, N)
Creatures
void AddSC_arena_mugambala()
WorldObject * GetOwner() const
Unit * GetTarget() const
HookList< AuraProcHandler > OnProc
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 * GetProcTarget() const
Definition Unit.h:501
Unit * GetActor() const
Definition Unit.h:499
Unit * GetCaster() const
Unit * GetHitUnit() const
HookList< EffectHandler > OnEffectHitTarget
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
void HandleProc(ProcEventInfo const &eventInfo) const
static constexpr uint32 ReactionTrigger
static constexpr uint32 ReactionDead
static constexpr uint32 JestryTheUntamed
static constexpr uint32 Door02
static constexpr uint32 Door01
static constexpr uint32 Mugambala
static constexpr uint32 ZandalarArenaVOCooldownAura
static constexpr uint32 ZandalarArenaReactionTrigger
static constexpr uint32 ArenaLowHealthCooldownAura
static constexpr uint8 ReactionGenderF
static constexpr uint8 ReactionNonGendered
static constexpr uint8 ReactionGenderM
static constexpr uint8 Start
static constexpr uint8 Prepare
static constexpr uint8 ReactionKill
TriggerCastFlags TriggerFlags
void OnGameObjectCreate(GameObject *gameobject) override
void HandleReactionLowHealth(Player const *victim) const
void DoAction(uint32 actionId, WorldObject *source, WorldObject *target) override
arena_mugambala(BattlegroundMap *map)
void OnStart() override
void HandleKill(Player const *victim) const
void OnPlayerJoined(Player *player, bool) override
void OnPrepareStage2() override
void OnCreatureCreate(Creature *creature) override