TrinityCore
Battleground.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 __BATTLEGROUND_H
19#define __BATTLEGROUND_H
20
21#include "DBCEnums.h"
22#include "ObjectGuid.h"
23#include "Position.h"
24#include "SharedDefines.h"
25#include "UniqueTrackablePtr.h"
26#include "ZoneScript.h"
27#include <deque>
28#include <map>
29#include <vector>
30
31class BattlegroundMap;
32class Creature;
33class GameObject;
34class Group;
35class Player;
36class Transport;
37class Unit;
38class WorldObject;
39class WorldPacket;
40struct BattlegroundPlayerScoreTemplate;
45
46namespace WorldPackets
47{
48 namespace Battleground
49 {
50 struct PVPMatchStatistics;
51 struct BattlegroundPlayerPosition;
52 }
53
54}
55
57{
60
65};
66
68{
73};
74
76{
85};
86
88{
91};
92
94{
96 BG_CREATURE_ENTRY_H_SPIRITGUIDE = 13117 // horde
97};
98
100{
101 SPELL_SPIRIT_HEAL_CHANNEL_AOE = 22011, // used for AoE resurrections
102 SPELL_SPIRIT_HEAL_PLAYER_AURA = 156758, // individual player timers for resurrection
103 SPELL_SPIRIT_HEAL_CHANNEL_SELF = 305122, // channel visual for individual area spirit healers
104 SPELL_WAITING_FOR_RESURRECT = 2584, // Waiting to Resurrect
106 SPELL_SPIRIT_HEAL = 22012, // Spirit Heal
107 SPELL_RESURRECTION_VISUAL = 24171, // Resurrection Impact Visual
108 SPELL_ARENA_PREPARATION = 32727, // use this one, 32728 not correct
109 SPELL_PREPARATION = 44521, // Preparation
110 SPELL_SPIRIT_HEAL_MANA = 44535, // Spirit Heal
111 SPELL_RECENTLY_DROPPED_ALLIANCE_FLAG = 42792, // makes Alliance flag unselectable
112 SPELL_RECENTLY_DROPPED_HORDE_FLAG = 50326, // makes Horde flag unselectable
113 SPELL_RECENTLY_DROPPED_NEUTRAL_FLAG = 50327, // makes Neutral flag unselectable
114 SPELL_AURA_PLAYER_INACTIVE = 43681, // Inactive
115 SPELL_HONORABLE_DEFENDER_25Y = 68652, // +50% honor when standing at a capture point that you control, 25yards radius (added in 3.2)
116 SPELL_HONORABLE_DEFENDER_60Y = 66157, // +50% honor when standing at a capture point that you control, 60yards radius (added in 3.2), probably for 40+ player battlegrounds
124 SPELL_PET_SUMMONED = 6962 // used after resurrection
126
128{
131 //REMIND_INTERVAL = 10000, // ms
135 MAX_OFFLINE_TIME = 300, // secs
136 RESPAWN_ONE_DAY = 86400, // secs
138 BUFF_RESPAWN_TIME = 180, // secs
142};
143
145{
146 BG_START_DELAY_2M = 120000, // ms (2 minutes)
147 BG_START_DELAY_1M = 60000, // ms (1 minute)
148 BG_START_DELAY_30S = 30000, // ms (30 seconds)
149 BG_START_DELAY_15S = 15000, // ms (15 seconds) Used only in arena
150 BG_START_DELAY_NONE = 0 // ms
152
154{
159
161
163{
164 STATUS_NONE = 0, // first status, should mean bg is not instance
165 STATUS_WAIT_QUEUE = 1, // means bg is empty and waiting for queue
166 STATUS_WAIT_JOIN = 2, // this means, that BG has already started and it is waiting for more players
167 STATUS_IN_PROGRESS = 3, // means bg is running
168 STATUS_WAIT_LEAVE = 4 // means some faction has won BG and it is ending
170
172{
173 time_t OfflineRemoveTime; // for tracking and removing offline players from queue after 5 minutes
174 ::Team Team; // Player's team
177};
178
180{
182
186};
187
189{
194
196{
203
205{
211#define BG_STARTING_EVENT_COUNT 4
212
213#define BG_AWARD_ARENA_POINTS_MIN_LEVEL 71
214#define ARENA_TIMELIMIT_POINTS_LOSS -16
215
217{
221
229
231{
232 Battleground = 0,
233 Arena = 1,
234 Wargame = 2,
235 Cheat = 3,
236 ArenaSkirmish = 4
237};
238
240{
243 Neutral,
246};
247
248/*
249This class is used to:
2501. Add player to battleground
2512. Remove player from battleground
2523. some certain cases, same for all battlegrounds
2534. It has properties same for all battlegrounds
254*/
256{
257 public:
258 Battleground(BattlegroundTemplate const* battlegroundTemplate);
260 virtual ~Battleground();
261
263
264 void Update(uint32 diff);
265
266 virtual bool SetupBattleground() // must be implemented in BG subclass
267 {
268 return true;
269 }
270 virtual void Reset(); // resets all common properties for battlegrounds, must be implemented and called in BG subclass
271 virtual void StartingEventCloseDoors() { }
272 virtual void StartingEventOpenDoors() { }
273
274 virtual void DestroyGate(Player* /*player*/, GameObject* /*go*/) { }
275
276 void TriggerGameEvent(uint32 gameEventId, WorldObject* source = nullptr, WorldObject* target = nullptr) override;
277
278 /* Battleground */
279 // Get methods:
280 char const* GetName() const;
281 BattlegroundTypeId GetTypeID() const;
282 BattlegroundBracketId GetBracketId() const;
283 uint32 GetInstanceID() const { return m_InstanceID; }
284 BattlegroundStatus GetStatus() const { return m_Status; }
285 uint32 GetClientInstanceID() const { return m_ClientInstanceID; }
286 uint32 GetElapsedTime() const { return m_StartTime; }
287 uint32 GetRemainingTime() const { return m_EndTime; }
288 uint32 GetMaxPlayers() const;
289 uint32 GetMinPlayers() const;
290
291 uint32 GetMinLevel() const;
292 uint32 GetMaxLevel() const;
293
294 uint32 GetMaxPlayersPerTeam() const;
295 uint32 GetMinPlayersPerTeam() const;
296
297 int32 GetStartDelayTime() const { return m_StartDelayTime; }
298 uint8 GetArenaType() const { return m_ArenaType; }
299 PvPTeamId GetWinner() const { return _winnerTeamId; }
300 uint32 GetScriptId() const;
301 uint32 GetBonusHonorFromKill(uint32 kills) const;
302
303 // Set methods:
304 //here we can count minlevel and maxlevel for players
305 void SetBracket(PVPDifficultyEntry const* bracketEntry);
306 void SetInstanceID(uint32 InstanceID) { m_InstanceID = InstanceID; }
307 void SetStatus(BattlegroundStatus Status) { m_Status = Status; }
308 void SetClientInstanceID(uint32 InstanceID) { m_ClientInstanceID = InstanceID; }
309 void SetElapsedTime(uint32 Time) { m_StartTime = Time; }
310 void SetRemainingTime(uint32 Time) { m_EndTime = Time; }
311 void SetRated(bool state) { m_IsRated = state; }
312 void SetArenaType(uint8 type) { m_ArenaType = type; }
313 void SetWinner(PvPTeamId winnerTeamId) { _winnerTeamId = winnerTeamId; }
314 std::unordered_set<uint32> const* GetPvpStatIds() const { return _pvpStatIds; }
315
316 void ModifyStartDelayTime(int diff) { m_StartDelayTime -= diff; }
317 void SetStartDelayTime(int Time) { m_StartDelayTime = Time; }
318
319 void AddToBGFreeSlotQueue(); //this queue will be useful when more battlegrounds instances will be available
320 void RemoveFromBGFreeSlotQueue(); //this method could delete whole BG instance, if another free is available
321
322 void DecreaseInvitedCount(Team team) { (team == ALLIANCE) ? --m_InvitedAlliance : --m_InvitedHorde; }
323 void IncreaseInvitedCount(Team team) { (team == ALLIANCE) ? ++m_InvitedAlliance : ++m_InvitedHorde; }
324
325 uint32 GetInvitedCount(Team team) const { return (team == ALLIANCE) ? m_InvitedAlliance : m_InvitedHorde; }
326 bool HasFreeSlots() const;
327 uint32 GetFreeSlotsForTeam(Team team) const;
328
329 bool isArena() const;
330 bool isBattleground() const;
331 bool isRated() const { return m_IsRated; }
332
333 typedef std::map<ObjectGuid, BattlegroundPlayer> BattlegroundPlayerMap;
334 BattlegroundPlayerMap const& GetPlayers() const { return m_Players; }
335 uint32 GetPlayersSize() const { return uint32(m_Players.size()); }
336
337 typedef std::map<ObjectGuid, BattlegroundScore*> BattlegroundScoreMap;
338 uint32 GetPlayerScoresSize() const { return uint32(PlayerScores.size()); }
339
340 void StartBattleground();
341
342 GameObject* GetBGObject(uint32 type, bool logError = true);
343 Creature* GetBGCreature(uint32 type, bool logError = true);
344
345 // Location
346 uint32 GetMapId() const;
347
348 // Map pointers
349 void SetBgMap(BattlegroundMap* map);
350 BattlegroundMap* GetBgMap() const;
351 BattlegroundMap* FindBgMap() const { return m_Map; }
352
353 WorldSafeLocsEntry const* GetTeamStartPosition(TeamId teamId) const;
354
355 float GetStartMaxDist() const;
356
357 // Packet Transfer
358 // method that should fill worldpacket with actual world states (not yet implemented for all battlegrounds!)
359 void SendPacketToTeam(Team team, WorldPacket const* packet, Player* except = nullptr) const;
360 void SendPacketToAll(WorldPacket const* packet) const;
361
362 void SendChatMessage(Creature* source, uint8 textId, WorldObject* target = nullptr);
363 void SendBroadcastText(uint32 id, ChatMsg msgType, WorldObject const* target = nullptr);
364
365 template<class Do>
366 void BroadcastWorker(Do& _do);
367
368 void PlaySoundToTeam(uint32 SoundID, Team team);
369 void PlaySoundToAll(uint32 SoundID);
370 void CastSpellOnTeam(uint32 SpellID, Team team);
371 void RemoveAuraOnTeam(uint32 SpellID, Team team);
372 void RewardHonorToTeam(uint32 Honor, Team team);
373 void RewardReputationToTeam(uint32 faction_id, uint32 Reputation, Team team);
374 void UpdateWorldState(int32 worldStateId, int32 value, bool hidden = false);
375 virtual void EndBattleground(Team winner);
376 void BlockMovement(Player* player);
377
378 void SendMessageToAll(uint32 entry, ChatMsg type, Player const* source = nullptr);
379 void PSendMessageToAll(uint32 entry, ChatMsg type, Player const* source, ...);
380
381 // Raid Group
382 Group* GetBgRaid(Team team) const { return team == ALLIANCE ? m_BgRaids[TEAM_ALLIANCE] : m_BgRaids[TEAM_HORDE]; }
383 void SetBgRaid(Team team, Group* bg_raid);
384
385 virtual void BuildPvPLogDataPacket(WorldPackets::Battleground::PVPMatchStatistics& pvpLogData) const;
386
387 BattlegroundScore const* GetBattlegroundScore(Player* player) const;
388
389 virtual bool UpdatePlayerScore(Player* player, uint32 type, uint32 value, bool doAddHonor = true);
390 void UpdatePvpStat(Player* player, uint32 pvpStatId, uint32 value);
391
393 uint32 GetPlayersCountByTeam(Team team) const { return m_PlayersCount[GetTeamIndexByTeamId(team)]; }
394 uint32 GetAlivePlayersCountByTeam(Team team) const; // used in arenas to correctly handle death in spirit of redemption / last stand etc. (killer = killed) cases
395 void UpdatePlayersCountByTeam(Team team, bool remove)
396 {
397 if (remove)
398 --m_PlayersCount[GetTeamIndexByTeamId(team)];
399 else
400 ++m_PlayersCount[GetTeamIndexByTeamId(team)];
401 }
402
403 virtual void CheckWinConditions() { }
404
405 // used for rated arena battles
406 void SetArenaTeamIdForTeam(Team team, uint32 ArenaTeamId) { m_ArenaTeamIds[GetTeamIndexByTeamId(team)] = ArenaTeamId; }
407 uint32 GetArenaTeamIdForTeam(Team team) const { return m_ArenaTeamIds[GetTeamIndexByTeamId(team)]; }
408 uint32 GetArenaTeamIdByIndex(TeamId teamId) const { return m_ArenaTeamIds[teamId]; }
409 void SetArenaMatchmakerRating(Team team, uint32 MMR){ m_ArenaTeamMMR[GetTeamIndexByTeamId(team)] = MMR; }
410 uint32 GetArenaMatchmakerRating(Team team) const { return m_ArenaTeamMMR[GetTeamIndexByTeamId(team)]; }
411
412 // Triggers handle
413 // must be implemented in BG subclass
414 virtual void HandleAreaTrigger(Player* /*player*/, uint32 /*trigger*/, bool /*entered*/);
415 // must be implemented in BG subclass if need AND call base class generic code
416 virtual void HandleKillPlayer(Player* player, Player* killer);
417 virtual void HandleKillUnit(Creature* /*creature*/, Unit* /*killer*/) { }
418
419 // Battleground events
420 virtual void EventPlayerDroppedFlag(Player* /*player*/) { }
421 virtual void EventPlayerClickedOnFlag(Player* /*player*/, GameObject* /*target_obj*/) { }
422 void EventPlayerLoggedIn(Player* player);
423 void EventPlayerLoggedOut(Player* player);
424 void ProcessEvent(WorldObject* /*obj*/, uint32 /*eventId*/, WorldObject* /*invoker*/) override { }
425
426 virtual void HandlePlayerResurrect(Player* /*player*/) { }
427
428 // Death related
429 virtual WorldSafeLocsEntry const* GetClosestGraveyard(Player* player);
430
431 virtual WorldSafeLocsEntry const* GetExploitTeleportLocation(Team /*team*/) { return nullptr; }
432 // GetExploitTeleportLocation(TeamId) must be implemented in the battleground subclass.
433 void TeleportPlayerToExploitLocation(Player* player);
434
435 virtual void AddPlayer(Player* player, BattlegroundQueueTypeId queueId); // must be implemented in BG subclass
436
437 void AddOrSetPlayerToCorrectBgGroup(Player* player, Team team);
438
439 virtual void RemovePlayerAtLeave(ObjectGuid guid, bool Transport, bool SendPacket);
440 // can be extended in in BG subclass
441
445 void SpawnBGObject(uint32 type, uint32 respawntime);
446 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);
447 bool AddObject(uint32 type, uint32 entry, Position const& pos, float rotation0, float rotation1, float rotation2, float rotation3, uint32 respawnTime = 0, GOState goState = GO_STATE_READY);
448 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);
449 Creature* AddCreature(uint32 entry, uint32 type, Position const& pos, TeamId teamId = TEAM_NEUTRAL, uint32 respawntime = 0, Transport* transport = nullptr);
450 bool DelCreature(uint32 type);
451 bool DelObject(uint32 type);
452 bool RemoveObjectFromWorld(uint32 type);
453 virtual bool AddSpiritGuide(uint32 type, float x, float y, float z, float o, TeamId teamId = TEAM_NEUTRAL);
454 bool AddSpiritGuide(uint32 type, Position const& pos, TeamId teamId = TEAM_NEUTRAL);
455 int32 GetObjectType(ObjectGuid guid);
456
457 void DoorOpen(uint32 type);
458 void DoorClose(uint32 type);
459
460 virtual bool HandlePlayerUnderMap(Player* /*player*/) { return false; }
461
462 // since arenas can be AvA or Hvh, we have to get the "temporary" team of a player
463 Team GetPlayerTeam(ObjectGuid guid) const;
464 Team GetOtherTeam(Team team) const;
465 bool IsPlayerInBattleground(ObjectGuid guid) const;
466 bool IsPlayerMercenaryInBattleground(ObjectGuid guid) const;
467
468 bool ToBeDeleted() const { return m_SetDeleteThis; }
469 void SetDeleteThis() { m_SetDeleteThis = true; }
470
471 void RewardXPAtKill(Player* killer, Player* victim);
472 bool CanAwardArenaPoints() const { return GetMinLevel() >= BG_AWARD_ARENA_POINTS_MIN_LEVEL; }
473
474 virtual ObjectGuid GetFlagPickerGUID(int32 /*team*/ = -1) const { return ObjectGuid::Empty; }
475 virtual void SetDroppedFlagGUID(ObjectGuid /*guid*/, int32 /*team*/ = -1) { }
476 virtual void HandleQuestComplete(uint32 /*questid*/, Player* /*player*/) { }
477 virtual bool CanActivateGO(int32 /*entry*/, uint32 /*team*/) const { return true; }
478 virtual bool IsSpellAllowed(uint32 /*spellId*/, Player const* /*player*/) const { return true; }
479 uint32 GetTeamScore(TeamId teamId) const;
480
481 virtual Team GetPrematureWinner();
482
483 // because BattleGrounds with different types and same level range has different m_BracketId
484 uint8 GetUniqueBracketId() const;
485
486 void AddPlayerPosition(WorldPackets::Battleground::BattlegroundPlayerPosition const& position);
487 void RemovePlayerPosition(ObjectGuid guid);
488
490 {
491 auto const& itr = m_Players.find(playerGuid);
492 if (itr == m_Players.end())
493 return nullptr;
494
495 return &itr->second;
496 }
497
498 // Called when valid BattlegroundMap is assigned to the battleground
499 virtual void OnMapSet([[maybe_unused]] BattlegroundMap* map) { }
500
502 void SetWeakPtr(Trinity::unique_weak_ptr<Battleground> weakRef) { m_weakRef = std::move(weakRef); }
503
504 protected:
505 // this method is called, when BG cannot spawn its own spirit guide, or something is wrong, It correctly ends Battleground
506 void EndNow();
507 void PlayerAddedToBGCheckIfBGIsRunning(Player* player);
508
509 Player* _GetPlayer(ObjectGuid guid, bool offlineRemove, char const* context) const;
510 Player* _GetPlayer(BattlegroundPlayerMap::iterator itr, char const* context) { return _GetPlayer(itr->first, itr->second.OfflineRemoveTime != 0, context); }
511 Player* _GetPlayer(BattlegroundPlayerMap::const_iterator itr, char const* context) const { return _GetPlayer(itr->first, itr->second.OfflineRemoveTime != 0, context); }
512 Player* _GetPlayerForTeam(Team team, BattlegroundPlayerMap::const_iterator itr, char const* context) const;
513
514 /* Pre- and post-update hooks */
515
529 virtual bool PreUpdateImpl(uint32 /* diff */) { return true; }
530
542 virtual void PostUpdateImpl(uint32 /* diff */) { }
543
544 void _ProcessOfflineQueue();
545 void _ProcessProgress(uint32 diff);
546 void _ProcessLeave(uint32 diff);
547 void _ProcessJoin(uint32 diff);
548 void _CheckSafePositions(uint32 diff);
549 void _ProcessPlayerPositionBroadcast(uint32 diff);
550
551 // Scorekeeping
553 // must be implemented in BG subclass
554 virtual void RemovePlayer(Player* /*player*/, ObjectGuid /*guid*/, uint32 /*team*/) { }
555
556 // Player lists, those need to be accessible by inherited classes
558
559 // these are important variables used for starting messages
562 // this must be filled in constructors!
564
565 int32 m_TeamScores[PVP_TEAMS_COUNT];
566
567 private:
568 // Battleground
569 uint32 m_InstanceID; // Battleground Instance's GUID!
571 uint32 m_ClientInstanceID; // the instance-id which is sent to the client and without any other internal use
575 int32 m_EndTime; // it is set to 120000 when bg is ending and it decreases itself
576 uint8 m_ArenaType; // 2=2v2, 3=3v3, 5=5v5
577 bool m_InBGFreeSlotQueue; // used to make sure that BG is only once inserted into the BattlegroundMgr.BGFreeSlotQueue[bgTypeId] deque
578 bool m_SetDeleteThis; // used for safe deletion of the bg after end / all players leave
579
582 bool m_IsRated; // is this battle rated?
586
587 // Player lists
588 std::deque<ObjectGuid> m_OfflineQueue; // Player GUID
589
590 // Invited counters are useful for player invitation to BG - do not allow, if BG is started to one faction to have 2 more players than another faction
591 // Invited counters will be changed only when removing already invited player from queue, removing player from battleground and inviting player to BG
592 // Invited players counters
595
596 // Raid Group
597 Group* m_BgRaids[PVP_TEAMS_COUNT]; // 0 - alliance, 1 - horde
598
599 // Players count by team
600 uint32 m_PlayersCount[PVP_TEAMS_COUNT];
601
602 // Arena team ids by team
603 uint32 m_ArenaTeamIds[PVP_TEAMS_COUNT];
604
605 uint32 m_ArenaTeamMMR[PVP_TEAMS_COUNT];
606
607 // Start location
609 Position StartPosition[PVP_TEAMS_COUNT];
610
613 std::unordered_set<uint32> const* _pvpStatIds;
614
615 std::vector<WorldPackets::Battleground::BattlegroundPlayerPosition> _playerPositions;
616
617 // Time when the first message "the battle will begin in 2minutes" is send (or 1m for arenas)
619
621};
622#endif
BattlegroundTimeIntervals
Definition: Battleground.h:128
@ INVITE_ACCEPT_WAIT_TIME
Definition: Battleground.h:133
@ RESURRECTION_INTERVAL
Definition: Battleground.h:130
@ ARENA_COUNTDOWN_MAX
Definition: Battleground.h:140
@ PLAYER_POSITION_UPDATE_INTERVAL
Definition: Battleground.h:141
@ MAX_OFFLINE_TIME
Definition: Battleground.h:135
@ RESPAWN_IMMEDIATELY
Definition: Battleground.h:137
@ BUFF_RESPAWN_TIME
Definition: Battleground.h:138
@ TIME_AUTOCLOSE_BATTLEGROUND
Definition: Battleground.h:134
@ BATTLEGROUND_COUNTDOWN_MAX
Definition: Battleground.h:139
@ RESPAWN_ONE_DAY
Definition: Battleground.h:136
@ CHECK_PLAYER_POSITION_INVERVAL
Definition: Battleground.h:129
@ INVITATION_REMIND_TIME
Definition: Battleground.h:132
ArenaType
Definition: Battleground.h:189
@ ARENA_TYPE_5v5
Definition: Battleground.h:192
@ ARENA_TYPE_3v3
Definition: Battleground.h:191
@ ARENA_TYPE_2v2
Definition: Battleground.h:190
BattlegroundStartingEvents
Definition: Battleground.h:196
@ BG_STARTING_EVENT_NONE
Definition: Battleground.h:197
@ BG_STARTING_EVENT_3
Definition: Battleground.h:200
@ BG_STARTING_EVENT_2
Definition: Battleground.h:199
@ BG_STARTING_EVENT_1
Definition: Battleground.h:198
@ BG_STARTING_EVENT_4
Definition: Battleground.h:201
BattlegroundBuffObjects
Definition: Battleground.h:154
@ BG_OBJECTID_REGENBUFF_ENTRY
Definition: Battleground.h:156
@ BG_OBJECTID_BERSERKERBUFF_ENTRY
Definition: Battleground.h:157
@ BG_OBJECTID_SPEEDBUFF_ENTRY
Definition: Battleground.h:155
BattlegroundMarksCount
Definition: Battleground.h:88
@ ITEM_WINNER_COUNT
Definition: Battleground.h:89
@ ITEM_LOSER_COUNT
Definition: Battleground.h:90
BattlegroundCreatures
Definition: Battleground.h:94
@ BG_CREATURE_ENTRY_H_SPIRITGUIDE
Definition: Battleground.h:96
@ BG_CREATURE_ENTRY_A_SPIRITGUIDE
Definition: Battleground.h:95
uint32 const Buff_Entries[3]
Definition: Battleground.h:160
BattlegroundPlayerPositionConstants
Definition: Battleground.h:217
@ PLAYER_POSITION_ARENA_SLOT_1
Definition: Battleground.h:223
@ PLAYER_POSITION_ICON_NONE
Definition: Battleground.h:218
@ PLAYER_POSITION_ARENA_SLOT_NONE
Definition: Battleground.h:222
@ PLAYER_POSITION_ARENA_SLOT_4
Definition: Battleground.h:226
@ PLAYER_POSITION_ICON_ALLIANCE_FLAG
Definition: Battleground.h:220
@ PLAYER_POSITION_ARENA_SLOT_2
Definition: Battleground.h:224
@ PLAYER_POSITION_ICON_HORDE_FLAG
Definition: Battleground.h:219
@ PLAYER_POSITION_ARENA_SLOT_3
Definition: Battleground.h:225
@ PLAYER_POSITION_ARENA_SLOT_5
Definition: Battleground.h:227
BattlegroundBroadcastTexts
Definition: Battleground.h:57
@ BG_TEXT_START_TWO_MINUTES
Definition: Battleground.h:61
@ BG_TEXT_BATTLE_HAS_BEGUN
Definition: Battleground.h:64
@ BG_TEXT_ALLIANCE_WINS
Definition: Battleground.h:58
@ BG_TEXT_HORDE_WINS
Definition: Battleground.h:59
@ BG_TEXT_START_ONE_MINUTE
Definition: Battleground.h:62
@ BG_TEXT_START_HALF_MINUTE
Definition: Battleground.h:63
BattlegroundSpells
Definition: Battleground.h:100
@ SPELL_SPIRIT_HEAL_CHANNEL_AOE
Definition: Battleground.h:101
@ SPELL_SPIRIT_HEAL
Definition: Battleground.h:106
@ SPELL_AURA_PLAYER_INACTIVE
Definition: Battleground.h:114
@ SPELL_MERCENARY_SHAPESHIFT
Definition: Battleground.h:123
@ SPELL_RECENTLY_DROPPED_ALLIANCE_FLAG
Definition: Battleground.h:111
@ SPELL_MERCENARY_ALLIANCE_REACTIONS
Definition: Battleground.h:122
@ SPELL_PET_SUMMONED
Definition: Battleground.h:124
@ SPELL_SPIRIT_HEAL_PLAYER_AURA
Definition: Battleground.h:102
@ SPELL_MERCENARY_HORDE_REACTIONS
Definition: Battleground.h:120
@ SPELL_MERCENARY_HORDE_1
Definition: Battleground.h:119
@ SPELL_ARENA_PREPARATION
Definition: Battleground.h:108
@ SPELL_RECENTLY_DROPPED_HORDE_FLAG
Definition: Battleground.h:112
@ SPELL_MERCENARY_CONTRACT_ALLIANCE
Definition: Battleground.h:118
@ SPELL_SPIRIT_HEAL_MANA
Definition: Battleground.h:110
@ SPELL_HONORABLE_DEFENDER_25Y
Definition: Battleground.h:115
@ SPELL_MERCENARY_CONTRACT_HORDE
Definition: Battleground.h:117
@ SPELL_RECENTLY_DROPPED_NEUTRAL_FLAG
Definition: Battleground.h:113
@ SPELL_PREPARATION
Definition: Battleground.h:109
@ SPELL_SPIRIT_HEAL_CHANNEL_SELF
Definition: Battleground.h:103
@ VISUAL_SPIRIT_HEAL_CHANNEL
Definition: Battleground.h:105
@ SPELL_RESURRECTION_VISUAL
Definition: Battleground.h:107
@ SPELL_MERCENARY_ALLIANCE_1
Definition: Battleground.h:121
@ SPELL_WAITING_FOR_RESURRECT
Definition: Battleground.h:104
@ SPELL_HONORABLE_DEFENDER_60Y
Definition: Battleground.h:116
BattlegroundStartTimeIntervals
Definition: Battleground.h:145
@ BG_START_DELAY_1M
Definition: Battleground.h:147
@ BG_START_DELAY_30S
Definition: Battleground.h:148
@ BG_START_DELAY_2M
Definition: Battleground.h:146
@ BG_START_DELAY_NONE
Definition: Battleground.h:150
@ BG_START_DELAY_15S
Definition: Battleground.h:149
BattlegroundQueueIdType
Definition: Battleground.h:231
BattlegroundPointCaptureStatus
Definition: Battleground.h:240
#define BG_AWARD_ARENA_POINTS_MIN_LEVEL
Definition: Battleground.h:213
BattlegroundStatus
Definition: Battleground.h:163
@ STATUS_WAIT_QUEUE
Definition: Battleground.h:165
@ STATUS_NONE
Definition: Battleground.h:164
@ STATUS_WAIT_LEAVE
Definition: Battleground.h:168
@ STATUS_WAIT_JOIN
Definition: Battleground.h:166
@ STATUS_IN_PROGRESS
Definition: Battleground.h:167
BattlegroundSounds
Definition: Battleground.h:68
@ SOUND_BG_START
Definition: Battleground.h:71
@ SOUND_ALLIANCE_WINS
Definition: Battleground.h:70
@ SOUND_HORDE_WINS
Definition: Battleground.h:69
@ SOUND_BG_START_L70ETC
Definition: Battleground.h:72
#define BG_STARTING_EVENT_COUNT
Definition: Battleground.h:211
BattlegroundQuests
Definition: Battleground.h:76
@ SPELL_AV_QUEST_REWARD
Definition: Battleground.h:79
@ SPELL_AB_QUEST_REWARD_4_BASES
Definition: Battleground.h:83
@ SPELL_AB_QUEST_REWARD
Definition: Battleground.h:78
@ SPELL_AB_QUEST_REWARD_5_BASES
Definition: Battleground.h:84
@ SPELL_WS_QUEST_REWARD
Definition: Battleground.h:77
@ SPELL_SA_QUEST_REWARD
Definition: Battleground.h:82
@ SPELL_EY_QUEST_REWARD
Definition: Battleground.h:81
@ SPELL_AV_QUEST_KILLED_BOSS
Definition: Battleground.h:80
BattlegroundStartingEventsIds
Definition: Battleground.h:205
@ BG_STARTING_EVENT_THIRD
Definition: Battleground.h:208
@ BG_STARTING_EVENT_SECOND
Definition: Battleground.h:207
@ BG_STARTING_EVENT_FIRST
Definition: Battleground.h:206
@ BG_STARTING_EVENT_FOURTH
Definition: Battleground.h:209
BattlegroundBracketId
Definition: DBCEnums.h:59
#define TC_GAME_API
Definition: Define.h:123
uint8_t uint8
Definition: Define.h:144
int32_t int32
Definition: Define.h:138
uint32_t uint32
Definition: Define.h:142
std::vector< ObjectGuid > GuidVector
Definition: ObjectGuid.h:395
TeamId
@ TEAM_NEUTRAL
@ TEAM_ALLIANCE
@ TEAM_HORDE
uint8 constexpr PVP_TEAMS_COUNT
Team
@ ALLIANCE
BattlegroundTypeId
PvPTeamId
ChatMsg
GOState
@ GO_STATE_READY
Definition: Arena.h:57
virtual ObjectGuid GetFlagPickerGUID(int32=-1) const
Definition: Battleground.h:474
uint32 m_InvitedAlliance
Definition: Battleground.h:593
void UpdatePlayersCountByTeam(Team team, bool remove)
Definition: Battleground.h:395
void SetRemainingTime(uint32 Time)
Definition: Battleground.h:310
void SetInstanceID(uint32 InstanceID)
Definition: Battleground.h:306
bool m_SetDeleteThis
Definition: Battleground.h:578
virtual void EventPlayerClickedOnFlag(Player *, GameObject *)
Definition: Battleground.h:421
virtual bool HandlePlayerUnderMap(Player *)
Definition: Battleground.h:460
PvPTeamId _winnerTeamId
Definition: Battleground.h:580
bool ToBeDeleted() const
Definition: Battleground.h:468
PVPDifficultyEntry const * _pvpDifficultyEntry
Definition: Battleground.h:612
void SetDeleteThis()
Definition: Battleground.h:469
void IncreaseInvitedCount(Team team)
Definition: Battleground.h:323
void ModifyStartDelayTime(int diff)
Definition: Battleground.h:316
void SetElapsedTime(uint32 Time)
Definition: Battleground.h:309
virtual bool SetupBattleground()
Definition: Battleground.h:266
std::unordered_set< uint32 > const * GetPvpStatIds() const
Definition: Battleground.h:314
std::deque< ObjectGuid > m_OfflineQueue
Definition: Battleground.h:588
virtual void OnMapSet(BattlegroundMap *map)
Definition: Battleground.h:499
virtual void HandlePlayerResurrect(Player *)
Definition: Battleground.h:426
uint8 GetArenaType() const
Definition: Battleground.h:298
BattlegroundPlayerMap m_Players
Definition: Battleground.h:557
time_t _preparationStartTime
Definition: Battleground.h:618
uint32 m_ValidStartPositionTimer
Definition: Battleground.h:574
int32 m_StartDelayTime
Definition: Battleground.h:581
Group * GetBgRaid(Team team) const
Definition: Battleground.h:382
uint32 GetArenaTeamIdForTeam(Team team) const
Definition: Battleground.h:407
BattlegroundTemplate const * _battlegroundTemplate
Definition: Battleground.h:611
uint32 GetInvitedCount(Team team) const
Definition: Battleground.h:325
void SetWinner(PvPTeamId winnerTeamId)
Definition: Battleground.h:313
Battleground(Battleground const &)
uint32 m_ClientInstanceID
Definition: Battleground.h:571
GuidVector BgObjects
Definition: Battleground.h:443
uint32 GetPlayerScoresSize() const
Definition: Battleground.h:338
virtual void HandleQuestComplete(uint32, Player *)
Definition: Battleground.h:476
void DecreaseInvitedCount(Team team)
Definition: Battleground.h:322
bool CanAwardArenaPoints() const
Definition: Battleground.h:472
bool isRated() const
Definition: Battleground.h:331
virtual void PostUpdateImpl(uint32)
Post-update hook.
Definition: Battleground.h:542
PvPTeamId GetWinner() const
Definition: Battleground.h:299
void SetRated(bool state)
Definition: Battleground.h:311
virtual void RemovePlayer(Player *, ObjectGuid, uint32)
Definition: Battleground.h:554
BattlegroundMap * FindBgMap() const
Definition: Battleground.h:351
uint32 GetArenaTeamIdByIndex(TeamId teamId) const
Definition: Battleground.h:408
uint32 GetRemainingTime() const
Definition: Battleground.h:287
bool m_PrematureCountDown
Definition: Battleground.h:583
uint32 GetInstanceID() const
Definition: Battleground.h:283
Battleground & operator=(Battleground const &)=delete
uint32 m_PrematureCountDownTimer
Definition: Battleground.h:584
void SetArenaTeamIdForTeam(Team team, uint32 ArenaTeamId)
Definition: Battleground.h:406
void ProcessEvent(WorldObject *, uint32, WorldObject *) override
Definition: Battleground.h:424
virtual WorldSafeLocsEntry const * GetExploitTeleportLocation(Team)
Definition: Battleground.h:431
void SetArenaMatchmakerRating(Team team, uint32 MMR)
Definition: Battleground.h:409
GuidVector BgCreatures
Definition: Battleground.h:444
uint32 GetClientInstanceID() const
Definition: Battleground.h:285
virtual bool IsSpellAllowed(uint32, Player const *) const
Definition: Battleground.h:478
BattlegroundPlayer const * GetBattlegroundPlayerData(ObjectGuid const &playerGuid) const
Definition: Battleground.h:489
bool m_InBGFreeSlotQueue
Definition: Battleground.h:577
void SetClientInstanceID(uint32 InstanceID)
Definition: Battleground.h:308
static TeamId GetTeamIndexByTeamId(Team team)
Definition: Battleground.h:392
void SetStatus(BattlegroundStatus Status)
Definition: Battleground.h:307
virtual void StartingEventCloseDoors()
Definition: Battleground.h:271
uint32 m_LastPlayerPositionBroadcast
Definition: Battleground.h:585
void SetArenaType(uint8 type)
Definition: Battleground.h:312
uint32 m_InstanceID
Definition: Battleground.h:569
uint32 m_ResetStatTimer
Definition: Battleground.h:573
BattlegroundPlayerMap const & GetPlayers() const
Definition: Battleground.h:334
int32 GetStartDelayTime() const
Definition: Battleground.h:297
BattlegroundScoreMap PlayerScores
Definition: Battleground.h:552
virtual void StartingEventOpenDoors()
Definition: Battleground.h:272
virtual void SetDroppedFlagGUID(ObjectGuid, int32=-1)
Definition: Battleground.h:475
std::vector< WorldPackets::Battleground::BattlegroundPlayerPosition > _playerPositions
Definition: Battleground.h:615
BattlegroundStatus GetStatus() const
Definition: Battleground.h:284
virtual void HandleKillUnit(Creature *, Unit *)
Definition: Battleground.h:417
uint8 m_ArenaType
Definition: Battleground.h:576
uint32 GetPlayersCountByTeam(Team team) const
Definition: Battleground.h:393
virtual bool PreUpdateImpl(uint32)
Pre-update hook.
Definition: Battleground.h:529
Trinity::unique_weak_ptr< Battleground > m_weakRef
Definition: Battleground.h:620
virtual void CheckWinConditions()
Definition: Battleground.h:403
std::map< ObjectGuid, BattlegroundPlayer > BattlegroundPlayerMap
Definition: Battleground.h:333
std::map< ObjectGuid, BattlegroundScore * > BattlegroundScoreMap
Definition: Battleground.h:337
virtual void DestroyGate(Player *, GameObject *)
Definition: Battleground.h:274
std::unordered_set< uint32 > const * _pvpStatIds
Definition: Battleground.h:613
uint32 m_InvitedHorde
Definition: Battleground.h:594
virtual bool CanActivateGO(int32, uint32) const
Definition: Battleground.h:477
virtual void EventPlayerDroppedFlag(Player *)
Definition: Battleground.h:420
uint32 GetArenaMatchmakerRating(Team team) const
Definition: Battleground.h:410
uint32 GetElapsedTime() const
Definition: Battleground.h:286
Trinity::unique_weak_ptr< Battleground > GetWeakPtr() const
Definition: Battleground.h:501
uint32 GetPlayersSize() const
Definition: Battleground.h:335
Player * _GetPlayer(BattlegroundPlayerMap::iterator itr, char const *context)
Definition: Battleground.h:510
uint32 m_StartTime
Definition: Battleground.h:572
void SetStartDelayTime(int Time)
Definition: Battleground.h:317
BattlegroundMap * m_Map
Definition: Battleground.h:608
void SetWeakPtr(Trinity::unique_weak_ptr< Battleground > weakRef)
Definition: Battleground.h:502
Player * _GetPlayer(BattlegroundPlayerMap::const_iterator itr, char const *context) const
Definition: Battleground.h:511
BattlegroundStatus m_Status
Definition: Battleground.h:570
Definition: Group.h:197
static ObjectGuid const Empty
Definition: ObjectGuid.h:274
Definition: Unit.h:627
virtual void TriggerGameEvent(uint32 gameEventId, WorldObject *source=nullptr, WorldObject *target=nullptr)
Definition: ZoneScript.cpp:34
TC_GAME_API bool GetName(uint32 accountId, std::string &name)
void AddObject(T *object)
void Update(VignetteData &vignette, WorldObject const *owner)
Definition: Vignette.cpp:90
BattlegroundQueueTypeId queueTypeId
Definition: Battleground.h:176