TrinityCore
Loading...
Searching...
No Matches
arena_blades_edge.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 "GameObject.h"
21#include "Map.h"
22#include "ScriptMgr.h"
23#include "TaskScheduler.h"
24
26{
36
38
39 void OnUpdate(uint32 diff) override
40 {
41 _scheduler.Update(diff);
42 }
43
44 void OnInit() override
45 {
46 AddDoor(BG_BE_OBJECT_TYPE_DOOR_1, 6287.277f, 282.1877f, 3.810925f, -2.260201f, 0, 0, 0.9044551f, -0.4265689f);
47 AddDoor(BG_BE_OBJECT_TYPE_DOOR_2, 6189.546f, 241.7099f, 3.101481f, 0.8813917f, 0, 0, 0.4265689f, 0.9044551f);
48 AddDoor(BG_BE_OBJECT_TYPE_DOOR_3, 6299.116f, 296.5494f, 3.308032f, 0.8813917f, 0, 0, 0.4265689f, 0.9044551f);
49 AddDoor(BG_BE_OBJECT_TYPE_DOOR_4, 6177.708f, 227.3481f, 3.604374f, -2.260201f, 0, 0, 0.9044551f, -0.4265689f);
50 }
51
52 void OnStart() override
53 {
54 for (ObjectGuid const& guid : _doorGUIDs)
55 {
56 if (GameObject* door = battlegroundMap->GetGameObject(guid))
57 {
58 door->UseDoorOrButton();
59 door->DespawnOrUnsummon(5s);
60 }
61 }
62
63 _scheduler.Schedule(1min, [&](TaskContext const&)
64 {
65 CreateObject(BG_BE_OBJECT_TYPE_BUFF_1, 6249.042f, 275.3239f, 11.22033f, -1.448624f, 0, 0, 0.6626201f, -0.7489557f);
66 CreateObject(BG_BE_OBJECT_TYPE_BUFF_2, 6228.26f, 249.566f, 11.21812f, -0.06981307f, 0, 0, 0.03489945f, -0.9993908f);
67 });
68 }
69
70 void AddDoor(uint32 entry, float x, float y, float z, float o, float rotation0, float rotation1, float rotation2, float rotation3, GOState goState = GO_STATE_READY)
71 {
72 if (GameObject const* go = CreateObject(entry, x, y, z, o, rotation0, rotation1, rotation2, rotation3, goState))
73 _doorGUIDs.emplace_back(go->GetGUID());
74 }
75
76private:
79};
80
uint32_t uint32
Definition Define.h:154
std::vector< ObjectGuid > GuidVector
Definition ObjectGuid.h:434
#define RegisterBattlegroundMapScript(script_name, mapId)
Definition ScriptMgr.h:1447
GOState
@ GO_STATE_READY
void AddSC_arena_blades_edge()
GameObject * CreateObject(uint32 entry, float x, float y, float z, float o, float rotation0, float rotation1, float rotation2, float rotation3, GOState goState=GO_STATE_READY) const
BattlegroundMap * battlegroundMap
GameObject * GetGameObject(ObjectGuid const &guid)
Definition Map.cpp:3552
TaskScheduler & Schedule(duration_t time, task_handler_t task)
TaskScheduler & Update()
Update the scheduler to the current time.
void OnUpdate(uint32 diff) override
void OnStart() override
void AddDoor(uint32 entry, float x, float y, float z, float o, float rotation0, float rotation1, float rotation2, float rotation3, GOState goState=GO_STATE_READY)
void OnInit() override
arena_blades_edge(BattlegroundMap *map)