TrinityCore
Loading...
Searching...
No Matches
arena_maldraxxus_coliseum.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 "GameObject.h"
22#include "Map.h"
23#include "MotionMaster.h"
24#include "ScriptMgr.h"
25
27{
28 namespace MapIds
29 {
30 static constexpr uint32 MaldraxxusColiseum = 2509;
31 }
32
33 namespace Creatures
34 {
35 static constexpr uint32 MaldraxxianGladiator = 185764;
36 }
37
38 namespace GameObjects
39 {
40 static constexpr uint32 Door = 375890;
41 }
42
43 namespace Destinations
44 {
45 static constexpr Position Guard1 = { 2875.89f, 2285.57f, 3260.1755f };
46 static constexpr Position Guard2 = { 2816.69f, 2300.51f, 3260.1885f };
47 static constexpr Position Guard3 = { 2873.62f, 2219.39f, 3260.7085f };
48 static constexpr Position Guard4 = { 2823.31f, 2204.30f, 3260.0960f };
49 }
50
51 namespace StringIds
52 {
53 static constexpr std::string_view Guard1 = "arena_maldraxxus_coliseum_1";
54 static constexpr std::string_view Guard2 = "arena_maldraxxus_coliseum_2";
55 static constexpr std::string_view Guard3 = "arena_maldraxxus_coliseum_3";
56 static constexpr std::string_view Guard4 = "arena_maldraxxus_coliseum_4";
57 }
58}
59
61{
63
64 void OnStart() override
65 {
66 for (ObjectGuid const& guid : _doorGUIDs)
67 {
68 if (GameObject* door = battlegroundMap->GetGameObject(guid))
69 {
70 door->UseDoorOrButton();
71 door->DespawnOrUnsummon(5s);
72 }
73 }
74
75 for (ObjectGuid const& guid : _gladiatorGUIDs)
76 {
77 if (Creature* creature = battlegroundMap->GetCreature(guid))
78 {
79 if (creature->HasStringId(MaldraxxusColiseum::StringIds::Guard1))
80 creature->GetMotionMaster()->MovePoint(1, MaldraxxusColiseum::Destinations::Guard1);
81 else if (creature->HasStringId(MaldraxxusColiseum::StringIds::Guard2))
82 creature->GetMotionMaster()->MovePoint(1, MaldraxxusColiseum::Destinations::Guard2);
83 else if (creature->HasStringId(MaldraxxusColiseum::StringIds::Guard3))
84 creature->GetMotionMaster()->MovePoint(1, MaldraxxusColiseum::Destinations::Guard3);
85 else if (creature->HasStringId(MaldraxxusColiseum::StringIds::Guard4))
86 creature->GetMotionMaster()->MovePoint(1, MaldraxxusColiseum::Destinations::Guard4);
87
88 creature->DespawnOrUnsummon(2s);
89 }
90 }
91 }
92
93 void OnCreatureCreate(Creature* creature) override
94 {
95 switch (creature->GetEntry())
96 {
98 _gladiatorGUIDs.emplace_back(creature->GetGUID());
99 break;
100 default:
101 break;
102 }
103 }
104
105 void OnGameObjectCreate(GameObject* gameobject) override
106 {
107 switch (gameobject->GetEntry())
108 {
110 _doorGUIDs.emplace_back(gameobject->GetGUID());
111 break;
112 default:
113 break;
114 }
115 }
116
117private:
120};
121
uint32_t uint32
Definition Define.h:154
std::vector< ObjectGuid > GuidVector
Definition ObjectGuid.h:434
#define RegisterBattlegroundMapScript(script_name, mapId)
Definition ScriptMgr.h:1447
Creatures
void AddSC_arena_maldraxxus_coliseum()
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
uint32 GetEntry() const
Definition Object.h:89
static constexpr uint32 MaldraxxusColiseum
static constexpr std::string_view Guard2
static constexpr std::string_view Guard3
static constexpr std::string_view Guard4
static constexpr std::string_view Guard1
void OnGameObjectCreate(GameObject *gameobject) override
arena_maldraxxus_coliseum(BattlegroundMap *map)
void OnCreatureCreate(Creature *creature) override