TrinityCore
Loading...
Searching...
No Matches
arena_nokhudon_proving_grounds.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 "Conversation.h"
22#include "Creature.h"
23#include "CreatureAI.h"
24#include "GameObject.h"
25#include "Map.h"
26#include "Player.h"
27#include "ScriptedCreature.h"
28#include "ScriptMgr.h"
29#include "SpellScript.h"
30
32{
33 namespace Actions
34 {
35 static constexpr uint32 ReactionTrigger = 1;
36 static constexpr uint32 ReactionDead = 2;
37 }
38
39 namespace Creatures
40 {
41 static constexpr uint32 Malicia = 196670;
42 static constexpr uint32 NokhudCombatant = 196470;
43 }
44
45 namespace GameObjects
46 {
47 static constexpr uint32 Door01 = 379282;
48 }
49
50 namespace MapIds
51 {
52 static constexpr uint32 NokhudonProvingGrounds = 2563;
53 }
54
55 namespace Spells
56 {
57 static constexpr uint32 ArenaLowHealthCooldownAura = 234031;
61 }
62
63 namespace Texts
64 {
65 namespace Malicia
66 {
67 static constexpr uint8 Prepare = 0;
68 static constexpr uint8 Start = 1;
69 static constexpr uint8 ReactionNonGendered = 2;
70 }
71 }
72
73 namespace Conversations
74 {
75 static constexpr std::array<uint32, 2> ReactionKill = { 20101, 20102 };
76 }
77}
78
80{
82
83 void OnStart() override
84 {
85 for (ObjectGuid const& guid : _doorGUIDs)
86 {
87 if (GameObject* door = battlegroundMap->GetGameObject(guid))
88 {
89 door->UseDoorOrButton();
90 door->DespawnOrUnsummon(5s);
91 }
92 }
93
94 if (Creature const* creature = battlegroundMap->GetCreature(_maliciaGUID))
96 }
97
98 void DoAction(uint32 actionId, WorldObject* source, WorldObject* target) override
99 {
100 switch (actionId)
101 {
104 break;
107 break;
108 default:
109 break;
110 }
111 }
112
113 void OnPrepareStage2() override
114 {
115 if (Creature const* creature = battlegroundMap->GetCreature(_maliciaGUID))
117 }
118
119 void OnCreatureCreate(Creature* creature) override
120 {
121 switch (creature->GetEntry())
122 {
124 _maliciaGUID = creature->GetGUID();
125 break;
127 _nokhudCombatantGUIDs.emplace_back(creature->GetGUID());
128 break;
129 default:
130 break;
131 }
132 }
133
134 void OnGameObjectCreate(GameObject* gameobject) override
135 {
136 switch (gameobject->GetEntry())
137 {
139 _doorGUIDs.emplace_back(gameobject->GetGUID());
140 break;
141 default:
142 break;
143 }
144 }
145
152
171
172 void HandleReactionLowHealth(Player const* victim) const
173 {
174 if (!victim)
175 return;
176
178 {
180 return;
181
183
186 });
187 }
188
189 for (ObjectGuid const& guid : _nokhudCombatantGUIDs)
190 if (Creature* creature = battlegroundMap->GetCreature(guid))
191 creature->AI()->DoAction(NokhudonProvingGrounds::Actions::ReactionTrigger);
192 }
193
194private:
198};
199
200// 196470 - Nokhud Combatant
202{
204
205 void UpdateAI(uint32 diff) override
206 {
207 _scheduler.Update(diff);
208 }
209
210 void DoAction(int32 param) override
211 {
212 switch (param)
213 {
216 break;
217 default:
218 break;
219 }
220 }
221
223 {
225 return;
226
229
230 _scheduler.Schedule(2s, [&](TaskContext& context)
231 {
233 if (context.GetRepeatCounter() < 2)
234 context.Repeat(1s);
235 else
236 {
237 context.Schedule(1s, [&](TaskContext const&)
238 {
240 });
241 }
242 });
243 }
244
245private:
247};
248
249// 388969 - Nokhudon Proving Grounds Reaction Trigger - Low Health
276
277// 388970 - Nokhudon Proving Grounds Reaction Trigger
279{
280 bool Load() override
281 {
283 }
284
285 void HandleProc(ProcEventInfo const& eventInfo) const
286 {
287 if (ZoneScript* zonescript = GetTarget()->FindZoneScript())
288 zonescript->DoAction(NokhudonProvingGrounds::Actions::ReactionDead, eventInfo.GetActor(), eventInfo.GetProcTarget());
289 }
290
295};
296
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
#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
@ EMOTE_ONESHOT_JUMPSTART
@ EMOTE_ONESHOT_CHEER
@ 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)
@ UNIT_STAND_STATE_STAND
Definition UnitDefines.h:42
@ UNIT_STAND_STATE_SIT
Definition UnitDefines.h:43
Creatures
void AddSC_arena_nokhudon_proving_grounds()
WorldObject * GetOwner() const
Unit * GetTarget() const
HookList< AuraProcHandler > OnProc
ObjectGuid const & GetGUID() const
Definition BaseEntity.h:163
BattlegroundMap * battlegroundMap
static Conversation * CreateConversation(uint32 conversationEntry, Unit *creator, Position const &pos, ObjectGuid privateObjectOwner, SpellInfo const *spellInfo=nullptr, bool autoStart=true)
Creature *const me
Definition CreatureAI.h:63
GameObject * GetGameObject(ObjectGuid const &guid)
Definition Map.cpp:3552
Creature * GetCreature(ObjectGuid const &guid)
Definition Map.cpp:3542
static ObjectGuid const Empty
Definition ObjectGuid.h:314
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
TaskContext & Schedule(TaskScheduler::duration_t time, TaskScheduler::task_handler_t task)
TaskScheduler::repeated_t GetRepeatCounter() const
Returns the repeat counter which increases every time the task is repeated.
TaskContext & Repeat(TaskScheduler::duration_t duration)
TaskScheduler & Schedule(duration_t time, task_handler_t task)
TaskScheduler & Update()
Update the scheduler to the current time.
Definition Unit.h:635
void SetStandState(UnitStandStateType state, uint32 animKitID=0)
Definition Unit.cpp:10731
bool HasAura(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint32 reqEffMask=0) const
Definition Unit.cpp:4804
void HandleEmoteCommand(Emote emoteId, Player *target=nullptr, Trinity::IteratorPair< int32 const * > spellVisualKitIds={}, int32 sequenceVariation=0)
Definition Unit.cpp:1657
UnitStandStateType GetStandState() const
Definition Unit.h:900
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 std::array< uint32, 2 > ReactionKill
static constexpr uint32 NokhudonProvingGroundsVOCooldownAuraPlayerDeath
static constexpr uint32 NokhudonProvingGroundsReactionTrigger
static constexpr uint32 NokhudonProvingGroundsVOCooldownAura
auto SelectRandomContainerElement(C const &container) -> std::add_const_t< decltype(*std::ranges::begin(container))> &
Definition Containers.h:110
TriggerCastFlags TriggerFlags
void HandleReactionLowHealth(Player const *victim) const
void DoAction(uint32 actionId, WorldObject *source, WorldObject *target) override
void OnPlayerJoined(Player *player, bool) override
void HandleKill(Player const *victim) const
void OnGameObjectCreate(GameObject *gameobject) override
void OnCreatureCreate(Creature *creature) override