TrinityCore
Loading...
Searching...
No Matches
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#include "Random.h"
23#include "WorldPacket.h"
24#include "WorldStatePackets.h"
25
34
36{
38 return;
39
40 _events.Update(diff);
41
42 while (uint32 eventId = _events.ExecuteEvent())
43 {
44 switch (eventId)
45 {
47 // Add the water
50 break;
52 // Active collision and start knockback timer
56 break;
58 // Remove collision and water
63 break;
65 // Repeat knockback while the waterfall still active
67 waterSpout->CastSpell(waterSpout, BG_DS_SPELL_WATER_SPOUT, true);
69 break;
72 if (Creature* waterSpout = GetBGCreature(i))
73 waterSpout->CastSpell(waterSpout, BG_DS_SPELL_FLUSH, true);
74 break;
75 }
76 }
77
79 {
80 if (_pipeKnockBackTimer < diff)
81 {
83 if (Creature* waterSpout = GetBGCreature(i))
84 waterSpout->CastSpell(waterSpout, BG_DS_SPELL_FLUSH, true);
85
88 }
89 else
90 _pipeKnockBackTimer -= diff;
91 }
92}
93
99
101{
103 DoorOpen(i);
104
106 SpawnBGObject(i, 60);
107
109 //for (uint8 i = 0; i < BG_DS_PIPE_KNOCKBACK_TOTAL_COUNT; ++i)
110 // _events.ScheduleEvent(BG_DS_EVENT_PIPE_KNOCKBACK, BG_DS_PIPE_KNOCKBACK_FIRST_DELAY + i * BG_DS_PIPE_KNOCKBACK_DELAY);
111
114
116
117 DoorOpen(BG_DS_OBJECT_WATER_1); // Turn off collision
119
120 // Remove effects of Demonic Circle Summon
121 for (BattlegroundPlayerMap::const_iterator itr = GetPlayers().begin(); itr != GetPlayers().end(); ++itr)
122 if (Player* player = _GetPlayer(itr, "BattlegroundDS::StartingEventOpenDoors"))
123 player->RemoveAurasDueToSpell(SPELL_WARL_DEMONIC_CIRCLE);
124}
125
127{
129 return;
130
131 switch (trigger)
132 {
133 case 5347:
134 case 5348:
135 // Remove effects of Demonic Circle Summon
137
138 // Someone has get back into the pipes and the knockback has already been performed,
139 // so we reset the knockback count for kicking the player again into the arena.
142 break;
143 default:
144 Battleground::HandleAreaTrigger(player, trigger);
145 break;
146 }
147}
148
150{
151 packet.Worldstates.emplace_back(3610, 1); // ARENA_WORLD_STATE_ALIVE_PLAYERS_SHOW
152
154}
155
157{
158 // gates
159 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)
160 || !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)
161 // water
162 || !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)
163 || !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)
164 // buffs
165 || !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)
166 || !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)
167 // knockback creatures
171 {
172 TC_LOG_ERROR("sql.sql", "BatteGroundDS: Failed to spawn some object!");
173 return false;
174 }
175
176 return true;
177}
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
@ RESPAWN_IMMEDIATELY
@ STATUS_IN_PROGRESS
uint32_t uint32
Definition Define.h:133
#define TC_LOG_ERROR(filterType__,...)
Definition Log.h:165
@ TEAM_NEUTRAL
void FillInitialWorldStates(WorldPackets::WorldState::InitWorldStates &packet) override
Definition Arena.cpp:92
void HandleAreaTrigger(Player *Source, uint32 Trigger) override
void FillInitialWorldStates(WorldPackets::WorldState::InitWorldStates &packet) override
void PostUpdateImpl(uint32 diff) override
Post-update hook.
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
Creature * GetBGCreature(uint32 type, bool logError=true)
Player * _GetPlayer(ObjectGuid guid, bool offlineRemove, char const *context) const
void DoorClose(uint32 type)
GuidVector BgCreatures
BattlegroundPlayerMap const & GetPlayers() const
BattlegroundStatus GetStatus() const
virtual void HandleAreaTrigger(Player *, uint32)
void Update(uint32 time)
Definition EventMap.h:67
EventId ExecuteEvent()
Definition EventMap.cpp:73
void CancelEvent(EventId eventId)
Definition EventMap.cpp:151
void ScheduleEvent(EventId eventId, Milliseconds time, GroupIndex group=0u, PhaseIndex phase=0u)
Definition EventMap.cpp:36
void RemoveAurasDueToSpell(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, uint8 reqEffMask=0, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition Unit.cpp:3784
std::vector< WorldStateInfo > Worldstates