TrinityCore
BattlegroundEY.h
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#ifndef __BATTLEGROUNDEY_H
19#define __BATTLEGROUNDEY_H
20
21#include "Battleground.h"
22#include "BattlegroundScore.h"
23#include "Object.h"
24#include "Timer.h"
25
26static constexpr Seconds POINTS_TICK_TIME = 2s;
27static constexpr Seconds BG_EY_FLAG_ASSAULT_TIMER = 30s;
29
31{
32 BG_EY_EVENT_START_BATTLE = 13180 // Achievement: Flurry
33};
34
36{
54 PROGRESS_BAR_PERCENT_GREY = 2720, //100 = empty (only grey), 0 = blue|red (no grey)
55 PROGRESS_BAR_STATUS = 2719, //50 init!, 48 ... hordak bere .. 33 .. 0 = full 100% hordacky, 100 = full alliance
56 PROGRESS_BAR_SHOW = 2718, //1 init, 0 druhy send - bez messagu, 1 = controlled aliance
58 //set to 2 when flag is picked up, and to 1 if it is dropped
61
70};
71
73{
74 //strange ids, but sure about them
80};
81
83{
86
87 // Focused/Brutal Assault
90};
91
93{
94 BG_OBJECT_A_DOOR_EY_ENTRY = 184719, //Alliance door
95 BG_OBJECT_H_DOOR_EY_ENTRY = 184720, //Horde door
96 BG_OBJECT_FLAG2_EY_ENTRY = 208977, //Netherstorm flag (flagstand)
97 BG_OBJECT_BE_TOWER_CAP_EY_ENTRY = 184080, //BE Tower Cap Pt
98 BG_OBJECT_FR_TOWER_CAP_EY_ENTRY = 184081, //Fel Reaver Cap Pt
99 BG_OBJECT_HU_TOWER_CAP_EY_ENTRY = 184082, //Human Tower Cap Pt
100 BG_OBJECT_DR_TOWER_CAP_EY_ENTRY = 184083, //Draenei Tower Cap Pt
101};
102
104{
107
109{
114
116 EY_POINTS_MAX = 4
118
119#define BG_EY_NotEYWeekendHonorTicks 260
120#define BG_EY_EYWeekendHonorTicks 160
121
123{
127
129{
135
137{
142
144{
148
150{
155
160
165
170
176};
177
179{
180 BattlegroundEYPointIconsStruct(uint32 _WorldStateControlIndex, uint32 _WorldStateAllianceControlledIndex, uint32 _WorldStateHordeControlledIndex,
181 uint32 worldStateAllianceStatusBarIcon, uint32 worldStateHordeStatusBarIcon)
182 : WorldStateControlIndex(_WorldStateControlIndex), WorldStateAllianceControlledIndex(_WorldStateAllianceControlledIndex), WorldStateHordeControlledIndex(_WorldStateHordeControlledIndex),
183 WorldStateAllianceStatusBarIcon(worldStateAllianceStatusBarIcon), WorldStateHordeStatusBarIcon(worldStateHordeStatusBarIcon) { }
189};
190
192{
193 BattlegroundEYLosingPointStruct(uint32 _MessageIdAlliance, uint32 _MessageIdHorde)
194 : MessageIdAlliance(_MessageIdAlliance), MessageIdHorde(_MessageIdHorde)
195 { }
196
199};
200
202{
203 BattlegroundEYCapturingPointStruct(uint32 _MessageIdAlliance, uint32 _MessageIdHorde)
204 : MessageIdAlliance(_MessageIdAlliance), MessageIdHorde(_MessageIdHorde)
205 { }
206
209};
210
211class BattlegroundEY;
212
214{
215public:
217
218 void HandleProgressEventHorde(GameObject* controlZone) override;
219 void HandleProgressEventAlliance(GameObject* controlZone) override;
220 void HandleNeutralEventHorde(GameObject* controlZone) override;
221 void HandleNeutralEventAlliance(GameObject* controlZone) override;
222
223 uint32 GetPoint() const { return _point; }
224
225private:
228};
229
230const std::array<uint8, EY_POINTS_MAX> BG_EY_TickPoints = { 1, 2, 5, 10 };
231const std::array<uint32, EY_POINTS_MAX> BG_EY_FlagPoints = { 75, 85, 100, 500 };
232
233//constant arrays:
234const std::array<BattlegroundEYPointIconsStruct, EY_POINTS_MAX> m_PointsIconStruct =
235{
240};
241
242const std::array<BattlegroundEYLosingPointStruct, EY_POINTS_MAX> m_LosingPointTypes =
243{
248};
249
250const std::array<BattlegroundEYCapturingPointStruct, EY_POINTS_MAX> m_CapturingPointTypes =
251{
256};
257
259{
260 public:
261 BattlegroundEY(BattlegroundTemplate const* battlegroundTemplate);
263
264 /* inherited from BattlegroundClass */
265 void StartingEventOpenDoors() override;
266
267 void HandleKillPlayer(Player* player, Player* killer) override;
269 bool SetupBattleground() override;
270 void Reset() override;
272 void EndBattleground(Team winner) override;
273
274 Team GetPrematureWinner() override;
275
276 void ProcessEvent(WorldObject* target, uint32 eventId, WorldObject* invoker) override;
277 void PostUpdateImpl(uint32 diff) override;
278
279 void EventTeamCapturedPoint(TeamId teamId, uint32 point, GameObject* controlZone);
280 void EventTeamLostPoint(TeamId teamId, uint32 point, GameObject* controlZone);
281 void UpdatePointsCount(TeamId teamId);
282
283 void OnGameObjectCreate(GameObject* gameObject) override;
284
285 bool CanCaptureFlag([[maybe_unused]] AreaTrigger* areaTrigger, [[maybe_unused]] Player* player) override;
286 void OnCaptureFlag([[maybe_unused]] AreaTrigger* areaTrigger, [[maybe_unused]] Player* player) override;
287 void OnFlagStateChange(GameObject* flagInBase, FlagState oldValue, FlagState newValue, Player* player) override;
288
289 private:
290 /* Scorekeeping */
291 void AddPoints(Team team, uint32 Points);
292
295
296 uint8 GetControlledBaseCount(TeamId teamId) const;
297
298 std::array<uint32, PVP_TEAMS_COUNT> m_HonorScoreTics;
299
300 uint32 m_FlagCapturedBgObjectType; // type that should be despawned when flag is captured
301
304
305 std::unordered_map<uint32, std::unique_ptr<BattlegroundEYControlZoneHandler>> _controlZoneHandlers;
308
309 // Focused/Brutal Assault
313
314 void DoForFlagKeepers(std::function<void(Player*)> action) const;
315 void ResetAssaultDebuff();
318};
319#endif
BG_EY_FlagState
@ BG_EY_FLAG_STATE_ON_PLAYER
@ BG_EY_FLAG_STATE_ON_BASE
@ BG_EY_FLAG_STATE_ON_GROUND
@ BG_EY_FLAG_STATE_WAIT_RESPAWN
const std::array< BattlegroundEYPointIconsStruct, EY_POINTS_MAX > m_PointsIconStruct
const std::array< uint32, EY_POINTS_MAX > BG_EY_FlagPoints
BG_EY_Score
@ BG_EY_WARNING_NEAR_VICTORY_SCORE
@ BG_EY_MAX_TEAM_SCORE
const std::array< uint8, EY_POINTS_MAX > BG_EY_TickPoints
static constexpr Seconds BG_EY_FLAG_ASSAULT_TIMER
BG_EY_WorldStates
@ BLOOD_ELF_HORDE_CONTROL
@ DRAENEI_RUINS_HORDE_CONTROL_STATE
@ NETHERSTORM_FLAG_STATE_ALLIANCE
@ BLOOD_ELF_UNCONTROL
@ FEL_REAVER_ALLIANCE_CONTROL_STATE
@ FEL_REAVER_UNCONTROL
@ EY_HORDE_RESOURCES
@ MAGE_TOWER_ALLIANCE_CONTROL
@ MAGE_TOWER_HORDE_CONTROL_STATE
@ PROGRESS_BAR_SHOW
@ NETHERSTORM_FLAG
@ EY_ALLIANCE_BASE
@ FEL_REAVER_ALLIANCE_CONTROL
@ DRAENEI_RUINS_UNCONTROL
@ NETHERSTORM_FLAG_STATE_HORDE
@ DRAENEI_RUINS_ALLIANCE_CONTROL
@ DRAENEI_RUINS_ALLIANCE_CONTROL_STATE
@ BLOOD_ELF_ALLIANCE_CONTROL_STATE
@ EY_ALLIANCE_RESOURCES
@ BLOOD_ELF_ALLIANCE_CONTROL
@ DRAENEI_RUINS_HORDE_CONTROL
@ EY_HORDE_BASE
@ EY_MAX_RESOURCES
@ MAGE_TOWER_HORDE_CONTROL
@ PROGRESS_BAR_PERCENT_GREY
@ MAGE_TOWER_ALLIANCE_CONTROL_STATE
@ MAGE_TOWER_UNCONTROL
@ FEL_REAVER_HORDE_CONTROL_STATE
@ PROGRESS_BAR_STATUS
@ FEL_REAVER_HORDE_CONTROL
@ BLOOD_ELF_HORDE_CONTROL_STATE
EYBattlegroundPoints
@ DRAENEI_RUINS
@ BLOOD_ELF
@ MAGE_TOWER
@ EY_PLAYERS_OUT_OF_POINTS
@ EY_POINTS_MAX
@ FEL_REAVER
BG_EY_ExploitTeleportLocations
@ EY_EXPLOIT_TELEPORT_LOCATION_ALLIANCE
@ EY_EXPLOIT_TELEPORT_LOCATION_HORDE
static constexpr Seconds POINTS_TICK_TIME
BG_EY_BroadcastTexts
@ BG_EY_TEXT_HORDE_LOST_BLOOD_ELF_TOWER
@ BG_EY_TEXT_ALLIANCE_TAKEN_MAGE_TOWER
@ BG_EY_TEXT_HORDE_LOST_FEL_REAVER_RUINS
@ BG_EY_TEXT_TAKEN_FLAG
@ BG_EY_TEXT_ALLIANCE_TAKEN_FEL_REAVER_RUINS
@ BG_EY_TEXT_FLAG_RESET
@ BG_EY_TEXT_ALLIANCE_LOST_MAGE_TOWER
@ BG_EY_TEXT_HORDE_LOST_DRAENEI_RUINS
@ BG_EY_TEXT_HORDE_LOST_MAGE_TOWER
@ BG_EY_TEXT_HORDE_TAKEN_DRAENEI_RUINS
@ BG_EY_TEXT_HORDE_TAKEN_MAGE_TOWER
@ BG_EY_TEXT_ALLIANCE_TAKEN_BLOOD_ELF_TOWER
@ BG_EY_TEXT_ALLIANCE_CAPTURED_FLAG
@ BG_EY_TEXT_ALLIANCE_TAKEN_DRAENEI_RUINS
@ BG_EY_TEXT_FLAG_DROPPED
@ BG_EY_TEXT_HORDE_TAKEN_FEL_REAVER_RUINS
@ BG_EY_TEXT_HORDE_TAKEN_BLOOD_ELF_TOWER
@ BG_EY_TEXT_HORDE_CAPTURED_FLAG
@ BG_EY_TEXT_ALLIANCE_LOST_BLOOD_ELF_TOWER
@ BG_EY_TEXT_ALLIANCE_LOST_FEL_REAVER_RUINS
@ BG_EY_TEXT_ALLIANCE_LOST_DRAENEI_RUINS
const std::array< BattlegroundEYCapturingPointStruct, EY_POINTS_MAX > m_CapturingPointTypes
BG_EY_Misc
@ BG_EY_EVENT_START_BATTLE
EYBattlegroundObjectEntry
@ BG_OBJECT_HU_TOWER_CAP_EY_ENTRY
@ BG_OBJECT_BE_TOWER_CAP_EY_ENTRY
@ BG_OBJECT_FLAG2_EY_ENTRY
@ BG_OBJECT_FR_TOWER_CAP_EY_ENTRY
@ BG_OBJECT_A_DOOR_EY_ENTRY
@ BG_OBJECT_H_DOOR_EY_ENTRY
@ BG_OBJECT_DR_TOWER_CAP_EY_ENTRY
const std::array< BattlegroundEYLosingPointStruct, EY_POINTS_MAX > m_LosingPointTypes
EYBattlegroundPointsTrigger
@ AREATRIGGER_CAPTURE_FLAG
EYBattlegroundPointState
@ EY_POINT_UNDER_CONTROL
@ EY_POINT_NO_OWNER
@ EY_POINT_STATE_UNCONTROLLED
BG_EY_Sounds
@ BG_EY_SOUND_FLAG_PICKED_UP_ALLIANCE
@ BG_EY_SOUND_FLAG_CAPTURED_HORDE
@ BG_EY_SOUND_FLAG_PICKED_UP_HORDE
@ BG_EY_SOUND_FLAG_RESET
@ BG_EY_SOUND_FLAG_CAPTURED_ALLIANCE
BG_EY_Spells
@ BG_EY_BRUTAL_ASSAULT_SPELL
@ BG_EY_NETHERSTORM_FLAG_SPELL
@ BG_EY_PLAYER_DROPPED_FLAG_SPELL
@ BG_EY_FOCUSED_ASSAULT_SPELL
static constexpr uint16 BG_EY_FLAG_BRUTAL_ASSAULT_STACK_COUNT
uint8_t uint8
Definition: Define.h:144
uint16_t uint16
Definition: Define.h:143
uint32_t uint32
Definition: Define.h:142
std::chrono::seconds Seconds
Seconds shorthand typedef.
Definition: Duration.h:32
FlagState
Definition: GameObject.h:46
std::unordered_set< ObjectGuid > GuidUnorderedSet
Definition: ObjectGuid.h:396
TeamId
Team
void HandleProgressEventAlliance(GameObject *controlZone) override
void HandleProgressEventHorde(GameObject *controlZone) override
void HandleNeutralEventHorde(GameObject *controlZone) override
BattlegroundEYControlZoneHandler(BattlegroundEY *bg, uint32 point)
void HandleNeutralEventAlliance(GameObject *controlZone) override
uint32 m_FlagCapturedBgObjectType
void RemovePoint(Team team, uint32 Points=1)
void AddPoints(Team team, uint32 Points)
bool CanCaptureFlag(AreaTrigger *areaTrigger, Player *player) override
GuidUnorderedSet _doorGUIDs
void DoForFlagKeepers(std::function< void(Player *)> action) const
void EndBattleground(Team winner) override
uint8 GetControlledBaseCount(TeamId teamId) const
void HandleKillPlayer(Player *player, Player *killer) override
bool SetupBattleground() override
WorldSafeLocsEntry const * GetExploitTeleportLocation(Team team) override
std::unordered_map< uint32, std::unique_ptr< BattlegroundEYControlZoneHandler > > _controlZoneHandlers
void StartingEventOpenDoors() override
void OnGameObjectCreate(GameObject *gameObject) override
TimeTracker _pointsTimer
void RemoveAssaultDebuffFromPlayer(Player *player)
void ApplyAssaultDebuffToPlayer(Player *player)
uint16 _assaultStackCount
TimeTracker _flagAssaultTimer
void PostUpdateImpl(uint32 diff) override
Post-update hook.
void Reset() override
void EventTeamCapturedPoint(TeamId teamId, uint32 point, GameObject *controlZone)
std::array< uint32, PVP_TEAMS_COUNT > m_HonorScoreTics
void SetTeamPoint(Team team, uint32 Points=0)
void UpdatePointsCount(TeamId teamId)
void UpdateTeamScore(TeamId Team)
void ProcessEvent(WorldObject *target, uint32 eventId, WorldObject *invoker) override
Team GetPrematureWinner() override
BattlegroundEY(BattlegroundTemplate const *battlegroundTemplate)
void EventTeamLostPoint(TeamId teamId, uint32 point, GameObject *controlZone)
void OnFlagStateChange(GameObject *flagInBase, FlagState oldValue, FlagState newValue, Player *player) override
ObjectGuid _flagGUID
void OnCaptureFlag(AreaTrigger *areaTrigger, Player *player) override
int32 m_TeamScores[PVP_TEAMS_COUNT]
Definition: Battleground.h:565
static TeamId GetTeamIndexByTeamId(Team team)
Definition: Battleground.h:392
BattlegroundEYCapturingPointStruct(uint32 _MessageIdAlliance, uint32 _MessageIdHorde)
BattlegroundEYLosingPointStruct(uint32 _MessageIdAlliance, uint32 _MessageIdHorde)
BattlegroundEYPointIconsStruct(uint32 _WorldStateControlIndex, uint32 _WorldStateAllianceControlledIndex, uint32 _WorldStateHordeControlledIndex, uint32 worldStateAllianceStatusBarIcon, uint32 worldStateHordeStatusBarIcon)