TrinityCore
Loading...
Searching...
No Matches
arena_nagrand_arena.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
37 explicit arena_nagrand(BattlegroundMap* map) : ArenaScript(map) { }
38
39 void OnUpdate(uint32 diff) override
40 {
41 _scheduler.Update(diff);
42 }
43
44 void OnInit() override
45 {
46 AddDoor(BG_NA_OBJECT_TYPE_DOOR_1, 4031.854f, 2966.833f, 12.6462f, -2.648788f, 0, 0, 0.9697962f, -0.2439165f);
47 AddDoor(BG_NA_OBJECT_TYPE_DOOR_2, 4081.179f, 2874.97f, 12.39171f, 0.4928045f, 0, 0, 0.2439165f, 0.9697962f);
48 AddDoor(BG_NA_OBJECT_TYPE_DOOR_3, 4023.709f, 2981.777f, 10.70117f, -2.648788f, 0, 0, 0.9697962f, -0.2439165f);
49 AddDoor(BG_NA_OBJECT_TYPE_DOOR_4, 4090.064f, 2858.438f, 10.23631f, 0.4928045f, 0, 0, 0.2439165f, 0.9697962f);
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_NA_OBJECT_TYPE_BUFF_1, 4009.189941f, 2895.250000f, 13.052700f, -1.448624f, 0, 0, 0.6626201f, -0.7489557f);
66 CreateObject(BG_NA_OBJECT_TYPE_BUFF_2, 4103.330078f, 2946.350098f, 13.051300f, -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_nagrand()
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 OnStart() override
void OnInit() override
TaskScheduler _scheduler
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 OnUpdate(uint32 diff) override
arena_nagrand(BattlegroundMap *map)