TrinityCore
BattlegroundDS.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 "BattlegroundDS.h"
19#include "Creature.h"
20#include "Log.h"
21#include "Player.h"
22
23BattlegroundDS::BattlegroundDS(BattlegroundTemplate const* battlegroundTemplate) : Arena(battlegroundTemplate)
24{
27
30}
31
33{
35 return;
36
37 _events.Update(diff);
38
39 while (uint32 eventId = _events.ExecuteEvent())
40 {
41 switch (eventId)
42 {
44 // Add the water
47 break;
49 // Active collision and start knockback timer
53 break;
55 // Remove collision and water
60 break;
62 // Repeat knockback while the waterfall still active
64 waterSpout->CastSpell(waterSpout, BG_DS_SPELL_WATER_SPOUT, true);
66 break;
69 if (Creature* waterSpout = GetBGCreature(i))
70 waterSpout->CastSpell(waterSpout, BG_DS_SPELL_FLUSH, true);
71 break;
72 }
73 }
74
76 {
77 if (_pipeKnockBackTimer < diff)
78 {
80 if (Creature* waterSpout = GetBGCreature(i))
81 waterSpout->CastSpell(waterSpout, BG_DS_SPELL_FLUSH, true);
82
85 }
86 else
87 _pipeKnockBackTimer -= diff;
88 }
89}
90
92{
95}
96
98{
100 DoorOpen(i);
101
103 SpawnBGObject(i, 60);
104
106 //for (uint8 i = 0; i < BG_DS_PIPE_KNOCKBACK_TOTAL_COUNT; ++i)
107 // _events.ScheduleEvent(BG_DS_EVENT_PIPE_KNOCKBACK, BG_DS_PIPE_KNOCKBACK_FIRST_DELAY + i * BG_DS_PIPE_KNOCKBACK_DELAY);
108
111
113
114 DoorOpen(BG_DS_OBJECT_WATER_1); // Turn off collision
116
117 // Remove effects of Demonic Circle Summon
118 for (BattlegroundPlayerMap::const_iterator itr = GetPlayers().begin(); itr != GetPlayers().end(); ++itr)
119 if (Player* player = _GetPlayer(itr, "BattlegroundDS::StartingEventOpenDoors"))
120 player->RemoveAurasDueToSpell(SPELL_WARL_DEMONIC_CIRCLE);
121}
122
124{
125 // gates
126 if (!AddObject(BG_DS_OBJECT_DOOR_1, BG_DS_OBJECT_TYPE_DOOR_1, 1350.95f, 817.2f, 20.8096f, 3.15f, 0, 0, 0.99627f, 0.0862864f, RESPAWN_IMMEDIATELY)
127 || !AddObject(BG_DS_OBJECT_DOOR_2, BG_DS_OBJECT_TYPE_DOOR_2, 1232.65f, 764.913f, 20.0729f, 6.3f, 0, 0, 0.0310211f, -0.999519f, RESPAWN_IMMEDIATELY)
128 // water
129 || !AddObject(BG_DS_OBJECT_WATER_1, BG_DS_OBJECT_TYPE_WATER_1, 1291.56f, 790.837f, 7.1f, 3.14238f, 0, 0, 0.694215f, -0.719768f, 120)
130 || !AddObject(BG_DS_OBJECT_WATER_2, BG_DS_OBJECT_TYPE_WATER_2, 1291.56f, 790.837f, 7.1f, 3.14238f, 0, 0, 0.694215f, -0.719768f, 120)
131 // buffs
132 || !AddObject(BG_DS_OBJECT_BUFF_1, BG_DS_OBJECT_TYPE_BUFF_1, 1291.7f, 813.424f, 7.11472f, 4.64562f, 0, 0, 0.730314f, -0.683111f, 120)
133 || !AddObject(BG_DS_OBJECT_BUFF_2, BG_DS_OBJECT_TYPE_BUFF_2, 1291.7f, 768.911f, 7.11472f, 1.55194f, 0, 0, 0.700409f, 0.713742f, 120)
134 // knockback creatures
138 {
139 TC_LOG_ERROR("sql.sql", "BatteGroundDS: Failed to spawn some object!");
140 return false;
141 }
142
143 return true;
144}
145
147{
148 Arena::SetData(dataId, value);
150 _pipeKnockBackCount = value;
151}
152
154{
156 return _pipeKnockBackCount;
157
158 return Arena::GetData(dataId);
159}
constexpr Milliseconds BG_DS_WATERFALL_KNOCKBACK_TIMER
@ BG_DS_NPC_TYPE_WATER_SPOUT
@ BG_DS_EVENT_WATERFALL_ON
@ BG_DS_EVENT_WATERFALL_WARNING
@ BG_DS_EVENT_PIPE_KNOCKBACK
@ BG_DS_EVENT_WATERFALL_KNOCKBACK
@ BG_DS_EVENT_WATERFALL_OFF
@ BG_DS_SPELL_FLUSH
@ BG_DS_SPELL_WATER_SPOUT
@ SPELL_WARL_DEMONIC_CIRCLE
constexpr Seconds BG_DS_WATERFALL_TIMER_MIN
constexpr Seconds BG_DS_WATERFALL_DURATION
@ BG_DS_OBJECT_TYPE_BUFF_1
@ BG_DS_OBJECT_TYPE_DOOR_2
@ BG_DS_OBJECT_TYPE_DOOR_1
@ BG_DS_OBJECT_TYPE_WATER_2
@ BG_DS_OBJECT_TYPE_WATER_1
@ BG_DS_OBJECT_TYPE_BUFF_2
@ BG_DS_OBJECT_DOOR_2
@ BG_DS_OBJECT_WATER_2
@ BG_DS_OBJECT_MAX
@ BG_DS_OBJECT_DOOR_1
@ BG_DS_OBJECT_BUFF_1
@ BG_DS_OBJECT_BUFF_2
@ BG_DS_OBJECT_WATER_1
@ BG_DS_PIPE_KNOCKBACK_DELAY
@ BG_DS_PIPE_KNOCKBACK_FIRST_DELAY
@ BG_DS_PIPE_KNOCKBACK_TOTAL_COUNT
constexpr Seconds BG_DS_WATERFALL_TIMER_MAX
@ BG_DS_NPC_PIPE_KNOCKBACK_2
@ BG_DS_NPC_PIPE_KNOCKBACK_1
@ BG_DS_NPC_WATERFALL_KNOCKBACK
@ BG_DS_NPC_MAX
constexpr Seconds BG_DS_WATERFALL_WARNING_DURATION
constexpr uint32 BG_DS_DATA_PIPE_KNOCKBACK_COUNT
@ RESPAWN_IMMEDIATELY
Definition: Battleground.h:137
@ STATUS_IN_PROGRESS
Definition: Battleground.h:167
uint32_t uint32
Definition: Define.h:142
#define TC_LOG_ERROR(filterType__,...)
Definition: Log.h:165
@ TEAM_NEUTRAL
Definition: Arena.h:57
uint8 _pipeKnockBackCount
void PostUpdateImpl(uint32 diff) override
Post-update hook.
uint32 GetData(uint32 dataId) const override
BattlegroundDS(BattlegroundTemplate const *battlegroundTemplate)
void SetData(uint32 dataId, uint32 value) override
uint32 _pipeKnockBackTimer
void StartingEventOpenDoors() override
bool SetupBattleground() override
void StartingEventCloseDoors() override
virtual Creature * AddCreature(uint32 entry, uint32 type, float x, float y, float z, float o, TeamId teamId=TEAM_NEUTRAL, uint32 respawntime=0, Transport *transport=nullptr)
void DoorOpen(uint32 type)
void SpawnBGObject(uint32 type, uint32 respawntime)
virtual bool AddObject(uint32 type, uint32 entry, float x, float y, float z, float o, float rotation0, float rotation1, float rotation2, float rotation3, uint32 respawnTime=0, GOState goState=GO_STATE_READY)
GuidVector BgObjects
Definition: Battleground.h:443
Creature * GetBGCreature(uint32 type, bool logError=true)
Player * _GetPlayer(ObjectGuid guid, bool offlineRemove, char const *context) const
void DoorClose(uint32 type)
GuidVector BgCreatures
Definition: Battleground.h:444
BattlegroundPlayerMap const & GetPlayers() const
Definition: Battleground.h:334
BattlegroundStatus GetStatus() const
Definition: Battleground.h:284
uint32 ExecuteEvent()
Definition: EventMap.cpp:73
void Update(uint32 time)
Definition: EventMap.h:56
void ScheduleEvent(uint32 eventId, Milliseconds time, uint32 group=0, uint8 phase=0)
Definition: EventMap.cpp:36
void CancelEvent(uint32 eventId)
Definition: EventMap.cpp:131
virtual uint32 GetData(uint32) const
Definition: ZoneScript.h:91
virtual void SetData(uint32, uint32)
Definition: ZoneScript.h:92