TrinityCore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Battleground.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2008-2016 TrinityCore <http://www.trinitycore.org/>
3  * Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
4  *
5  * This program is free software; you can redistribute it and/or modify it
6  * under the terms of the GNU General Public License as published by the
7  * Free Software Foundation; either version 2 of the License, or (at your
8  * option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful, but WITHOUT
11  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
13  * more details.
14  *
15  * You should have received a copy of the GNU General Public License along
16  * with this program. If not, see <http://www.gnu.org/licenses/>.
17  */
18 
19 #ifndef __BATTLEGROUND_H
20 #define __BATTLEGROUND_H
21 
22 #include "ArenaScore.h"
23 #include "Common.h"
24 #include "SharedDefines.h"
25 #include "DBCEnums.h"
26 #include "WorldPacket.h"
27 #include "Object.h"
28 #include "GameObject.h"
31 #include "EventMap.h"
32 
33 class Creature;
34 class GameObject;
35 class Group;
36 class Player;
37 class Unit;
38 class WorldObject;
39 class WorldPacket;
40 class BattlegroundMap;
41 
42 struct PvPDifficultyEntry;
43 struct WorldSafeLocsEntry;
44 
46 {
53 };
54 
56 {
61 };
62 
64 {
73 };
74 
76 {
90 };
91 
93 {
96 };
97 
99 {
100  BG_CREATURE_ENTRY_A_SPIRITGUIDE = 13116, // alliance
102 };
103 
105 {
106  SPELL_WAITING_FOR_RESURRECT = 2584, // Waiting to Resurrect
107  SPELL_SPIRIT_HEAL_CHANNEL = 22011, // Spirit Heal Channel
108  SPELL_SPIRIT_HEAL = 22012, // Spirit Heal
109  SPELL_RESURRECTION_VISUAL = 24171, // Resurrection Impact Visual
110  SPELL_ARENA_PREPARATION = 32727, // use this one, 32728 not correct
111  SPELL_PREPARATION = 44521, // Preparation
112  SPELL_SPIRIT_HEAL_MANA = 44535, // Spirit Heal
113  SPELL_RECENTLY_DROPPED_FLAG = 42792, // Recently Dropped Flag
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
117 };
118 
120 {
122  RESURRECTION_INTERVAL = 30000, // ms
123  //REMIND_INTERVAL = 10000, // ms
124  INVITATION_REMIND_TIME = 20000, // ms
125  INVITE_ACCEPT_WAIT_TIME = 90000, // ms
127  MAX_OFFLINE_TIME = 300, // secs
128  RESPAWN_ONE_DAY = 86400, // secs
129  RESPAWN_IMMEDIATELY = 0, // secs
130  BUFF_RESPAWN_TIME = 180, // secs
132  ARENA_COUNTDOWN_MAX = 60, // secs
134 };
135 
137 {
138  BG_START_DELAY_2M = 120000, // ms (2 minutes)
139  BG_START_DELAY_1M = 60000, // ms (1 minute)
140  BG_START_DELAY_30S = 30000, // ms (30 seconds)
141  BG_START_DELAY_15S = 15000, // ms (15 seconds) Used only in arena
143 };
144 
146 {
150 };
151 
153 
155 {
156  STATUS_NONE = 0, // first status, should mean bg is not instance
157  STATUS_WAIT_QUEUE = 1, // means bg is empty and waiting for queue
158  STATUS_WAIT_JOIN = 2, // this means, that BG has already started and it is waiting for more players
159  STATUS_IN_PROGRESS = 3, // means bg is running
160  STATUS_WAIT_LEAVE = 4 // means some faction has won BG and it is ending
161 };
162 
164 {
165  time_t OfflineRemoveTime; // for tracking and removing offline players from queue after 5 minutes
166  uint32 Team; // Player's team
167  int32 ActiveSpec; // Player's active spec
168 };
169 
171 {
173 
177 };
178 
180 {
184 };
185 
187 {
193 };
194 
196 {
201 };
202 #define BG_STARTING_EVENT_COUNT 4
203 
205 {
209 };
210 
211 #define BG_AWARD_ARENA_POINTS_MIN_LEVEL 71
212 #define ARENA_TIMELIMIT_POINTS_LOSS -16
213 
215 {
219 
226 };
227 
228 /*
229 This class is used to:
230 1. Add player to battleground
231 2. Remove player from battleground
232 3. some certain cases, same for all battlegrounds
233 4. It has properties same for all battlegrounds
234 */
236 {
237  public:
238  Battleground();
239  virtual ~Battleground();
240 
241  void Update(uint32 diff);
242 
243  virtual bool SetupBattleground() // must be implemented in BG subclass
244  {
245  return true;
246  }
247  virtual void Reset(); // resets all common properties for battlegrounds, must be implemented and called in BG subclass
248  virtual void StartingEventCloseDoors() { }
249  virtual void StartingEventOpenDoors() { }
250  virtual void ResetBGSubclass() { } // must be implemented in BG subclass
251 
252  virtual void DestroyGate(Player* /*player*/, GameObject* /*go*/) { }
253 
254  /* achievement req. */
255  virtual bool IsAllNodesControlledByTeam(uint32 /*team*/) const { return false; }
256  void StartTimedAchievement(AchievementCriteriaTimedTypes type, uint32 entry);
257  virtual bool CheckAchievementCriteriaMeet(uint32 /*criteriaId*/, Player const* /*player*/, Unit const* /*target*/ = NULL, uint32 /*miscvalue1*/ = 0);
258 
259  /* Battleground */
260  // Get methods:
261  std::string const& GetName() const { return m_Name; }
262  uint64 GetQueueId() const { return m_queueId; }
263  BattlegroundTypeId GetTypeID(bool GetRandom = false) const { return GetRandom ? m_RandomTypeID : m_TypeID; }
264  BattlegroundBracketId GetBracketId() const { return m_BracketId; }
265  uint32 GetInstanceID() const { return m_InstanceID; }
266  BattlegroundStatus GetStatus() const { return m_Status; }
267  uint32 GetClientInstanceID() const { return m_ClientInstanceID; }
268  uint32 GetElapsedTime() const { return m_StartTime; }
269  uint32 GetRemainingTime() const { return m_EndTime; }
270  uint32 GetLastResurrectTime() const { return m_LastResurrectTime; }
271  uint32 GetMaxPlayers() const { return m_MaxPlayers; }
272  uint32 GetMinPlayers() const { return m_MinPlayers; }
273 
274  uint32 GetMinLevel() const { return m_LevelMin; }
275  uint32 GetMaxLevel() const { return m_LevelMax; }
276 
277  uint32 GetMaxPlayersPerTeam() const { return m_MaxPlayersPerTeam; }
278  uint32 GetMinPlayersPerTeam() const { return m_MinPlayersPerTeam; }
279 
280  int32 GetStartDelayTime() const { return m_StartDelayTime; }
281  uint8 GetArenaType() const { return m_ArenaType; }
282  BattlegroundTeamId GetWinner() const { return _winnerTeamId; }
283  uint32 GetScriptId() const { return ScriptId; }
284  uint32 GetBonusHonorFromKill(uint32 kills) const;
285  bool IsRandom() const { return m_IsRandom; }
286 
287  // Set methods:
288  void SetQueueId(uint64 queueId) { m_queueId = queueId; }
289  void SetName(std::string const& name) { m_Name = name; }
291  void SetRandomTypeID(BattlegroundTypeId TypeID) { m_RandomTypeID = TypeID; }
292  //here we can count minlevel and maxlevel for players
293  void SetBracket(PvPDifficultyEntry const* bracketEntry);
294  void SetInstanceID(uint32 InstanceID) { m_InstanceID = InstanceID; }
295  void SetStatus(BattlegroundStatus Status) { m_Status = Status; }
296  void SetClientInstanceID(uint32 InstanceID) { m_ClientInstanceID = InstanceID; }
297  void SetElapsedTime(uint32 Time) { m_StartTime = Time; }
298  void SetRemainingTime(uint32 Time) { m_EndTime = Time; }
299  void SetLastResurrectTime(uint32 Time) { m_LastResurrectTime = Time; }
300  void SetMaxPlayers(uint32 MaxPlayers) { m_MaxPlayers = MaxPlayers; }
301  void SetMinPlayers(uint32 MinPlayers) { m_MinPlayers = MinPlayers; }
302  void SetLevelRange(uint32 min, uint32 max) { m_LevelMin = min; m_LevelMax = max; }
303  void SetRated(bool state) { m_IsRated = state; }
304  void SetArenaType(uint8 type) { m_ArenaType = type; }
305  void SetArenaorBGType(bool _isArena) { m_IsArena = _isArena; }
306  void SetWinner(BattlegroundTeamId winnerTeamId) { _winnerTeamId = winnerTeamId; }
307  void SetScriptId(uint32 scriptId) { ScriptId = scriptId; }
308 
309  void ModifyStartDelayTime(int diff) { m_StartDelayTime -= diff; }
310  void SetStartDelayTime(int Time) { m_StartDelayTime = Time; }
311 
312  void SetMaxPlayersPerTeam(uint32 MaxPlayers) { m_MaxPlayersPerTeam = MaxPlayers; }
313  void SetMinPlayersPerTeam(uint32 MinPlayers) { m_MinPlayersPerTeam = MinPlayers; }
314 
315  void AddToBGFreeSlotQueue(); //this queue will be useful when more battlegrounds instances will be available
316  void RemoveFromBGFreeSlotQueue(); //this method could delete whole BG instance, if another free is available
317 
318  void DecreaseInvitedCount(uint32 team) { (team == ALLIANCE) ? --m_InvitedAlliance : --m_InvitedHorde; }
319  void IncreaseInvitedCount(uint32 team) { (team == ALLIANCE) ? ++m_InvitedAlliance : ++m_InvitedHorde; }
320 
321  void SetRandom(bool isRandom) { m_IsRandom = isRandom; }
322  uint32 GetInvitedCount(uint32 team) const { return (team == ALLIANCE) ? m_InvitedAlliance : m_InvitedHorde; }
323  bool HasFreeSlots() const;
324  uint32 GetFreeSlotsForTeam(uint32 Team) const;
325 
326  bool isArena() const { return m_IsArena; }
327  bool isBattleground() const { return !m_IsArena; }
328  bool isRated() const { return m_IsRated; }
329 
330  typedef std::map<ObjectGuid, BattlegroundPlayer> BattlegroundPlayerMap;
331  BattlegroundPlayerMap const& GetPlayers() const { return m_Players; }
332  uint32 GetPlayersSize() const { return uint32(m_Players.size()); }
333 
334  typedef std::map<ObjectGuid, BattlegroundScore*> BattlegroundScoreMap;
335  uint32 GetPlayerScoresSize() const { return uint32(PlayerScores.size()); }
336 
337  uint32 GetReviveQueueSize() const { return uint32(m_ReviveQueue.size()); }
338 
339  void AddPlayerToResurrectQueue(ObjectGuid npc_guid, ObjectGuid player_guid);
340  void RemovePlayerFromResurrectQueue(ObjectGuid player_guid);
341 
343  void RelocateDeadPlayers(ObjectGuid guideGuid);
344 
345  void StartBattleground();
346 
347  GameObject* GetBGObject(uint32 type, bool logError = true);
348  Creature* GetBGCreature(uint32 type, bool logError = true);
349 
350  // Location
351  void SetMapId(uint32 MapID) { m_MapId = MapID; }
352  uint32 GetMapId() const { return m_MapId; }
353 
354  // Map pointers
355  void SetBgMap(BattlegroundMap* map) { m_Map = map; }
356  BattlegroundMap* GetBgMap() const { ASSERT(m_Map); return m_Map; }
357  BattlegroundMap* FindBgMap() const { return m_Map; }
358 
359  void SetTeamStartPosition(TeamId teamId, Position const& pos);
360  Position const* GetTeamStartPosition(TeamId teamId) const;
361 
362  void SetStartMaxDist(float startMaxDist) { m_StartMaxDist = startMaxDist; }
363  float GetStartMaxDist() const { return m_StartMaxDist; }
364 
365  // Packet Transfer
366  // method that should fill worldpacket with actual world states (not yet implemented for all battlegrounds!)
368  void SendPacketToTeam(uint32 TeamID, WorldPacket const* packet, Player* sender = NULL, bool self = true) const;
369  void SendPacketToAll(WorldPacket const* packet) const;
370 
371  void SendChatMessage(Creature* source, uint8 textId, WorldObject* target = NULL);
372 
373  template<class Do>
374  void BroadcastWorker(Do& _do);
375 
376  void PlaySoundToTeam(uint32 SoundID, uint32 TeamID);
377  void PlaySoundToAll(uint32 SoundID);
378  void CastSpellOnTeam(uint32 SpellID, uint32 TeamID);
379  void RemoveAuraOnTeam(uint32 SpellID, uint32 TeamID);
380  void RewardHonorToTeam(uint32 Honor, uint32 TeamID);
381  void RewardReputationToTeam(uint32 faction_id, uint32 Reputation, uint32 TeamID);
382  void UpdateWorldState(uint32 variable, uint32 value, bool hidden = false);
383  virtual void EndBattleground(uint32 winner);
384  void BlockMovement(Player* player);
385 
386  void SendMessageToAll(uint32 entry, ChatMsg type, Player const* source = NULL);
387  void PSendMessageToAll(uint32 entry, ChatMsg type, Player const* source, ...);
388 
389  // specialized version with 2 string id args
390  void SendMessage2ToAll(uint32 entry, ChatMsg type, Player const* source, uint32 strId1 = 0, uint32 strId2 = 0);
391 
392  // Raid Group
393  Group* GetBgRaid(uint32 TeamID) const { return TeamID == ALLIANCE ? m_BgRaids[TEAM_ALLIANCE] : m_BgRaids[TEAM_HORDE]; }
394  void SetBgRaid(uint32 TeamID, Group* bg_raid);
395 
396  void BuildPvPLogDataPacket(WorldPackets::Battleground::PVPLogData& pvpLogData);
397  virtual bool UpdatePlayerScore(Player* player, uint32 type, uint32 value, bool doAddHonor = true);
398 
400  uint32 GetPlayersCountByTeam(uint32 Team) const { return m_PlayersCount[GetTeamIndexByTeamId(Team)]; }
401  uint32 GetAlivePlayersCountByTeam(uint32 Team) const; // used in arenas to correctly handle death in spirit of redemption / last stand etc. (killer = killed) cases
403  {
404  if (remove)
405  --m_PlayersCount[GetTeamIndexByTeamId(Team)];
406  else
407  ++m_PlayersCount[GetTeamIndexByTeamId(Team)];
408  }
409 
410  virtual void CheckWinConditions() { }
411 
412  // used for rated arena battles
413  void SetArenaTeamIdForTeam(uint32 Team, uint32 ArenaTeamId) { m_ArenaTeamIds[GetTeamIndexByTeamId(Team)] = ArenaTeamId; }
414  uint32 GetArenaTeamIdForTeam(uint32 Team) const { return m_ArenaTeamIds[GetTeamIndexByTeamId(Team)]; }
415  uint32 GetArenaTeamIdByIndex(uint32 index) const { return m_ArenaTeamIds[index]; }
416  void SetArenaMatchmakerRating(uint32 Team, uint32 MMR){ m_ArenaTeamMMR[GetTeamIndexByTeamId(Team)] = MMR; }
417  uint32 GetArenaMatchmakerRating(uint32 Team) const { return m_ArenaTeamMMR[GetTeamIndexByTeamId(Team)]; }
418 
419  // Triggers handle
420  // must be implemented in BG subclass
421  virtual void HandleAreaTrigger(Player* /*player*/, uint32 /*trigger*/, bool /*entered*/);
422  // must be implemented in BG subclass if need AND call base class generic code
423  virtual void HandleKillPlayer(Player* player, Player* killer);
424  virtual void HandleKillUnit(Creature* /*creature*/, Player* /*killer*/) { }
425 
426  // Battleground events
427  virtual void EventPlayerDroppedFlag(Player* /*player*/) { }
428  virtual void EventPlayerClickedOnFlag(Player* /*player*/, GameObject* /*target_obj*/) { }
429  void EventPlayerLoggedIn(Player* player);
430  void EventPlayerLoggedOut(Player* player);
431  virtual void ProcessEvent(WorldObject* /*obj*/, uint32 /*eventId*/, WorldObject* /*invoker*/ = NULL) { }
432 
433  // this function can be used by spell to interact with the BG map
434  virtual void DoAction(uint32 /*action*/, ObjectGuid /*var*/) { }
435 
436  virtual void HandlePlayerResurrect(Player* /*player*/) { }
437 
438  // Death related
439  virtual WorldSafeLocsEntry const* GetClosestGraveYard(Player* player);
440 
441  virtual void AddPlayer(Player* player); // must be implemented in BG subclass
442 
443  void AddOrSetPlayerToCorrectBgGroup(Player* player, uint32 team);
444 
445  virtual void RemovePlayerAtLeave(ObjectGuid guid, bool Transport, bool SendPacket);
446  // can be extended in in BG subclass
447 
448  void HandleTriggerBuff(ObjectGuid go_guid);
449  void SetHoliday(bool is_holiday);
450 
454  void SpawnBGObject(uint32 type, uint32 respawntime);
455  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);
456  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);
457  virtual Creature* AddCreature(uint32 entry, uint32 type, float x, float y, float z, float o, TeamId teamId = TEAM_NEUTRAL, uint32 respawntime = 0, Transport* transport = NULL);
458  Creature* AddCreature(uint32 entry, uint32 type, Position const& pos, TeamId teamId = TEAM_NEUTRAL, uint32 respawntime = 0, Transport* transport = NULL);
459  bool DelCreature(uint32 type);
460  bool DelObject(uint32 type);
461  virtual bool AddSpiritGuide(uint32 type, float x, float y, float z, float o, TeamId teamId = TEAM_NEUTRAL);
462  bool AddSpiritGuide(uint32 type, Position const& pos, TeamId teamId = TEAM_NEUTRAL);
463  int32 GetObjectType(ObjectGuid guid);
464 
465  void DoorOpen(uint32 type);
466  void DoorClose(uint32 type);
467 
468  virtual bool HandlePlayerUnderMap(Player* /*player*/) { return false; }
469 
470  // since arenas can be AvA or Hvh, we have to get the "temporary" team of a player
471  uint32 GetPlayerTeam(ObjectGuid guid) const;
472  uint32 GetOtherTeam(uint32 teamId) const;
473  bool IsPlayerInBattleground(ObjectGuid guid) const;
474 
475  bool ToBeDeleted() const { return m_SetDeleteThis; }
476  void SetDeleteThis() { m_SetDeleteThis = true; }
477 
478  void RewardXPAtKill(Player* killer, Player* victim);
479  bool CanAwardArenaPoints() const { return m_LevelMin >= BG_AWARD_ARENA_POINTS_MIN_LEVEL; }
480 
481  virtual ObjectGuid GetFlagPickerGUID(int32 /*team*/ = -1) const { return ObjectGuid::Empty; }
482  virtual void SetDroppedFlagGUID(ObjectGuid /*guid*/, int32 /*team*/ = -1) { }
483  virtual void HandleQuestComplete(uint32 /*questid*/, Player* /*player*/) { }
484  virtual bool CanActivateGO(int32 /*entry*/, uint32 /*team*/) const { return true; }
485  virtual bool IsSpellAllowed(uint32 /*spellId*/, Player const* /*player*/) const { return true; }
486  uint32 GetTeamScore(uint32 TeamID) const;
487 
488  virtual uint32 GetPrematureWinner();
489 
490  // because BattleGrounds with different types and same level range has different m_BracketId
491  uint8 GetUniqueBracketId() const;
492 
493  protected:
494  // this method is called, when BG cannot spawn its own spirit guide, or something is wrong, It correctly ends Battleground
495  void EndNow();
496  void PlayerAddedToBGCheckIfBGIsRunning(Player* player);
497 
498  Player* _GetPlayer(ObjectGuid guid, bool offlineRemove, const char* context) const;
499  Player* _GetPlayer(BattlegroundPlayerMap::iterator itr, const char* context) { return _GetPlayer(itr->first, itr->second.OfflineRemoveTime != 0, context); }
500  Player* _GetPlayer(BattlegroundPlayerMap::const_iterator itr, const char* context) const { return _GetPlayer(itr->first, itr->second.OfflineRemoveTime != 0, context); }
501  Player* _GetPlayerForTeam(uint32 teamId, BattlegroundPlayerMap::const_iterator itr, const char* context) const;
502 
503  /* Pre- and post-update hooks */
504 
518  virtual bool PreUpdateImpl(uint32 /* diff */) { return true; }
519 
531  virtual void PostUpdateImpl(uint32 /* diff */) { }
532 
533  void _ProcessOfflineQueue();
534  void _ProcessResurrect(uint32 diff);
535  void _ProcessProgress(uint32 diff);
536  void _ProcessLeave(uint32 diff);
537  void _ProcessJoin(uint32 diff);
538  void _CheckSafePositions(uint32 diff);
539  void _ProcessPlayerPositionBroadcast(uint32 diff);
540  virtual void GetPlayerPositionData(std::vector<WorldPackets::Battleground::BattlegroundPlayerPosition>* /*positions*/) const { }
541 
542  // Scorekeeping
543  BattlegroundScoreMap PlayerScores; // Player scores
544  // must be implemented in BG subclass
545  virtual void RemovePlayer(Player* /*player*/, ObjectGuid /*guid*/, uint32 /*team*/) { }
546 
547  // Player lists, those need to be accessible by inherited classes
548  BattlegroundPlayerMap m_Players;
549  // Spirit Guide guid + Player list GUIDS
550  std::map<ObjectGuid, GuidVector> m_ReviveQueue;
551 
552  // these are important variables used for starting messages
555  // this must be filled in constructors!
556  uint32 StartMessageIds[BG_STARTING_EVENT_COUNT];
557 
560 
562  int32 m_TeamScores[BG_TEAMS_COUNT];
563 
564  ArenaTeamScore _arenaTeamScores[BG_TEAMS_COUNT];
565 
566  private:
567  // Battleground
570  uint32 m_InstanceID; // Battleground Instance's GUID!
572  uint32 m_ClientInstanceID; // the instance-id which is sent to the client and without any other internal use
577  int32 m_EndTime; // it is set to 120000 when bg is ending and it decreases itself
580  uint8 m_ArenaType; // 2=2v2, 3=3v3, 5=5v5
581  bool m_InBGFreeSlotQueue; // used to make sure that BG is only once inserted into the BattlegroundMgr.BGFreeSlotQueue[bgTypeId] deque
582  bool m_SetDeleteThis; // used for safe deletion of the bg after end / all players leave
583  bool m_IsArena;
586  bool m_IsRated; // is this battle rated?
589  std::string m_Name;
592 
593  // Player lists
594  GuidVector m_ResurrectQueue; // Player GUID
595  GuidDeque m_OfflineQueue; // Player GUID
596 
597  // 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
598  // Invited counters will be changed only when removing already invited player from queue, removing player from battleground and inviting player to BG
599  // Invited players counters
602 
603  // Raid Group
604  Group* m_BgRaids[BG_TEAMS_COUNT]; // 0 - alliance, 1 - horde
605 
606  // Players count by team
607  uint32 m_PlayersCount[BG_TEAMS_COUNT];
608 
609  // Arena team ids by team
610  uint32 m_ArenaTeamIds[BG_TEAMS_COUNT];
611 
612  uint32 m_ArenaTeamMMR[BG_TEAMS_COUNT];
613 
614  // Limits
621 
622  // Start location
625  Position StartPosition[BG_TEAMS_COUNT];
628 };
629 #endif
uint32 m_MinPlayersPerTeam
Definition: Battleground.h:619
Definition: Battleground.h:80
Definition: Battleground.h:49
Definition: Battleground.h:82
virtual bool PreUpdateImpl(uint32)
Pre-update hook.
Definition: Battleground.h:518
Definition: Battleground.h:159
Definition: Battleground.h:121
Definition: Battleground.h:129
uint32 GetMinPlayersPerTeam() const
Definition: Battleground.h:278
int32 m_StartDelayTime
Definition: Battleground.h:585
Definition: Battleground.h:223
Definition: Battleground.h:183
ArenaType
Definition: Battleground.h:179
uint32 GetPlayersSize() const
Definition: Battleground.h:332
virtual void HandleKillUnit(Creature *, Player *)
Definition: Battleground.h:424
Definition: Battleground.h:224
Definition: Battleground.h:199
Definition: Battleground.h:127
bool m_BuffChange
Definition: Battleground.h:558
BattlegroundTypeId
Definition: SharedDefines.h:4558
virtual void ResetBGSubclass()
Definition: Battleground.h:250
void SetMinPlayersPerTeam(uint32 MinPlayers)
Definition: Battleground.h:313
uint32 m_ResetStatTimer
Definition: Battleground.h:575
static ObjectGuid const Empty
Definition: ObjectGuid.h:196
BattlegroundMap * FindBgMap() const
Definition: Battleground.h:357
Definition: Battleground.h:125
Definition: Battleground.h:112
BattlegroundTypeId m_RandomTypeID
Definition: Battleground.h:569
uint32 ScriptId
Definition: Battleground.h:627
bool ToBeDeleted() const
Definition: Battleground.h:475
virtual void ProcessEvent(WorldObject *, uint32, WorldObject *=NULL)
Definition: Battleground.h:431
Definition: Battleground.h:122
void SetMaxPlayersPerTeam(uint32 MaxPlayers)
Definition: Battleground.h:312
void DecreaseInvitedCount(uint32 team)
Definition: Battleground.h:318
virtual void RemovePlayer(Player *, ObjectGuid, uint32)
Definition: Battleground.h:545
void SetStartDelayTime(int Time)
Definition: Battleground.h:310
Definition: Battleground.h:142
Definition: Battleground.h:109
BattlegroundQuests
Definition: Battleground.h:63
Definition: Battleground.h:58
Definition: Battleground.h:200
Definition: Battleground.h:51
uint32 m_ValidStartPositionTimer
Definition: Battleground.h:576
uint32 m_CountdownTimer
Definition: Battleground.h:574
Definition: Battleground.h:182
void SetRemainingTime(uint32 Time)
Definition: Battleground.h:298
Definition: Battleground.h:86
BattlegroundBracketId
Definition: DBCEnums.h:57
BattlegroundStatus GetStatus() const
Definition: Battleground.h:266
void SetDeleteThis()
Definition: Battleground.h:476
BattlegroundStatus m_Status
Definition: Battleground.h:571
BattlegroundStartingEventsIds
Definition: Battleground.h:195
uint32 m_PrematureCountDownTimer
Definition: Battleground.h:588
virtual bool IsSpellAllowed(uint32, Player const *) const
Definition: Battleground.h:485
Definition: Battleground.h:101
void SetArenaType(uint8 type)
Definition: Battleground.h:304
Definition: Battleground.h:148
uint32 GetMinPlayers() const
Definition: Battleground.h:272
Definition: Battleground.h:218
std::string m_Name
Definition: Battleground.h:589
Player * _GetPlayer(BattlegroundPlayerMap::const_iterator itr, const char *context) const
Definition: Battleground.h:500
Definition: DBCStructure.h:1434
ChatMsg
Definition: SharedDefines.h:4228
float GetStartMaxDist() const
Definition: Battleground.h:363
void SetArenaMatchmakerRating(uint32 Team, uint32 MMR)
Definition: Battleground.h:416
BattlegroundPlayerMap m_Players
Definition: Battleground.h:548
arena_t NULL
Definition: jemalloc_internal.h:624
BattlegroundMap * GetBgMap() const
Definition: Battleground.h:356
void SetRandomTypeID(BattlegroundTypeId TypeID)
Definition: Battleground.h:291
Definition: Transport.h:28
bool m_PrematureCountDown
Definition: Battleground.h:587
void SetElapsedTime(uint32 Time)
Definition: Battleground.h:297
std::map< ObjectGuid, GuidVector > m_ReviveQueue
Definition: Battleground.h:550
void SetQueueId(uint64 queueId)
Definition: Battleground.h:288
Definition: Object.h:423
int32 ActiveSpec
Definition: Battleground.h:167
Definition: Battleground.h:66
BattlegroundTimeIntervals
Definition: Battleground.h:119
Definition: Creature.h:467
std::deque< ObjectGuid > GuidDeque
Definition: ObjectGuid.h:334
uint32 GetPlayerScoresSize() const
Definition: Battleground.h:335
BattlegroundPlayerMap const & GetPlayers() const
Definition: Battleground.h:331
BGHonorMode
Definition: Battleground.h:204
std::vector< ObjectGuid > GuidVector
Definition: ObjectGuid.h:335
uint32 m_LevelMin
Definition: Battleground.h:615
Definition: ArenaScore.h:46
uint32 m_InvitedHorde
Definition: Battleground.h:601
Definition: Battleground.h:157
BattlegroundBuffObjects
Definition: Battleground.h:145
Definition: Battleground.h:107
uint32 m_MaxPlayersPerTeam
Definition: Battleground.h:617
uint32 GetReviveQueueSize() const
Definition: Battleground.h:337
BattlegroundSpells
Definition: Battleground.h:104
Definition: Battleground.h:78
BattlegroundTeamId _winnerTeamId
Definition: Battleground.h:584
uint32 m_StartTime
Definition: Battleground.h:573
int32 m_EndTime
Definition: Battleground.h:577
BattlegroundStatus
Definition: Battleground.h:154
Definition: Battleground.h:198
void SetInstanceID(uint32 InstanceID)
Definition: Battleground.h:294
Definition: Battleground.h:149
Definition: Battleground.h:208
void SetLastResurrectTime(uint32 Time)
Definition: Battleground.h:299
BattlegroundMarksCount
Definition: Battleground.h:92
uint32 m_MapId
Definition: Battleground.h:623
uint64 GetQueueId() const
Definition: Battleground.h:262
T max(const T &x, const T &y)
Definition: g3dmath.h:320
static TeamId GetTeamIndexByTeamId(uint32 Team)
Definition: Battleground.h:399
Definition: Battleground.h:69
Definition: SharedDefines.h:994
#define BG_TEAMS_COUNT
Definition: SharedDefines.h:4555
Definition: Battleground.h:181
void SetStartMaxDist(float startMaxDist)
Definition: Battleground.h:362
Definition: Battleground.h:70
Definition: BattlegroundPackets.h:89
Definition: SharedDefines.h:1000
Definition: Battleground.h:88
bool isRated() const
Definition: Battleground.h:328
bool m_IsRated
Definition: Battleground.h:586
uint32 GetInvitedCount(uint32 team) const
Definition: Battleground.h:322
Definition: Battleground.h:216
bool isArena() const
Definition: Battleground.h:326
virtual void StartingEventOpenDoors()
Definition: Battleground.h:249
virtual bool SetupBattleground()
Definition: Battleground.h:243
bool IsRandom() const
Definition: Battleground.h:285
virtual void DestroyGate(Player *, GameObject *)
Definition: Battleground.h:252
Definition: Battleground.h:126
Definition: Battleground.h:222
Definition: Battleground.h:72
Definition: Battleground.h:158
Team
Definition: SharedDefines.h:997
T min(const T &x, const T &y)
Definition: g3dmath.h:305
Definition: Battleground.h:67
virtual void CheckWinConditions()
Definition: Battleground.h:410
uint32 m_InstanceID
Definition: Battleground.h:570
Definition: Battleground.h:52
uint8 GetArenaType() const
Definition: Battleground.h:281
uint32 Team
Definition: Battleground.h:166
void SetTypeID(BattlegroundTypeId TypeID)
Definition: Battleground.h:290
GuidVector BgObjects
Definition: Battleground.h:452
void SetLevelRange(uint32 min, uint32 max)
Definition: Battleground.h:302
Definition: Battleground.h:108
void SetClientInstanceID(uint32 InstanceID)
Definition: Battleground.h:296
uint32 m_MinPlayers
Definition: Battleground.h:620
uint32 m_MaxPlayers
Definition: Battleground.h:618
GuidVector BgCreatures
Definition: Battleground.h:453
Definition: Map.h:790
Definition: Battleground.h:147
uint32 m_LastResurrectTime
Definition: Battleground.h:578
Definition: Battleground.h:189
BattlegroundStartingEvents
Definition: Battleground.h:186
virtual void FillInitialWorldStates(WorldPackets::WorldState::InitWorldStates &)
Definition: Battleground.h:367
Definition: Battleground.h:59
Definition: Battleground.h:68
uint8 m_ArenaType
Definition: Battleground.h:580
uint32 spellid
Definition: Battleground.h:176
virtual void StartingEventCloseDoors()
Definition: Battleground.h:248
AchievementCriteriaTimedTypes
Definition: DBCEnums.h:181
G3D::int16 z
Definition: Vector3int16.h:46
std::string const & GetName() const
Definition: Battleground.h:261
Definition: Battleground.h:83
BattlegroundCriteriaId
Definition: Battleground.h:45
uint64 m_queueId
Definition: Battleground.h:590
uint32 GetArenaTeamIdForTeam(uint32 Team) const
Definition: Battleground.h:414
uint32 m_LastPlayerPositionBroadcast
Definition: Battleground.h:591
void AddObject(T *object)
Definition: ObjectAccessor.h:98
void SetBgMap(BattlegroundMap *map)
Definition: Battleground.h:355
Definition: Battleground.h:94
void SetArenaorBGType(bool _isArena)
Definition: Battleground.h:305
virtual void SetDroppedFlagGUID(ObjectGuid, int32=-1)
Definition: Battleground.h:482
int32_t int32
Definition: Define.h:146
Definition: Battleground.h:113
void SetMapId(uint32 MapID)
Definition: Battleground.h:351
virtual void EventPlayerClickedOnFlag(Player *, GameObject *)
Definition: Battleground.h:428
uint32_t uint32
Definition: Define.h:150
uint32 m_ClientInstanceID
Definition: Battleground.h:572
Definition: Battleground.h:81
uint64_t uint64
Definition: Define.h:149
uint32 GetArenaTeamIdByIndex(uint32 index) const
Definition: Battleground.h:415
G3D::int16 y
Definition: Vector2int16.h:38
Definition: WorldStatePackets.h:27
Definition: Battleground.h:106
uint32 GetScriptId() const
Definition: Battleground.h:283
Definition: SharedDefines.h:992
Definition: GameObject.h:880
bool m_IsRandom
Definition: Battleground.h:559
Definition: Battleground.h:128
Definition: Battleground.h:79
bool CanAwardArenaPoints() const
Definition: Battleground.h:479
virtual bool CanActivateGO(int32, uint32) const
Definition: Battleground.h:484
BattlegroundCreatures
Definition: Battleground.h:98
virtual bool IsAllNodesControlledByTeam(uint32) const
Definition: Battleground.h:255
Definition: Battleground.h:85
bool isBattleground() const
Definition: Battleground.h:327
Definition: Battleground.h:77
bool m_IsArena
Definition: Battleground.h:583
uint8 m_Events
Definition: Battleground.h:553
void SetRated(bool state)
Definition: Battleground.h:303
uint32 m_InvitedAlliance
Definition: Battleground.h:600
Definition: Battleground.h:217
uint32 GetMaxLevel() const
Definition: Battleground.h:275
Definition: Battleground.h:84
Definition: Battleground.h:220
#define BG_AWARD_ARENA_POINTS_MIN_LEVEL
Definition: Battleground.h:211
TeamId
Definition: SharedDefines.h:990
Definition: Battleground.h:130
Definition: Battleground.h:115
uint32 GetInstanceID() const
Definition: Battleground.h:265
std::map< ObjectGuid, BattlegroundScore * > BattlegroundScoreMap
Definition: Battleground.h:334
Definition: Battleground.h:48
Definition: Battleground.h:192
TypeID
Definition: ObjectGuid.h:27
virtual void HandleQuestComplete(uint32, Player *)
Definition: Battleground.h:483
BattlegroundBracketId GetBracketId() const
Definition: Battleground.h:264
Definition: Battleground.h:139
Definition: GameObject.h:823
Definition: Battleground.h:188
BattlegroundMap * m_Map
Definition: Battleground.h:624
GOState
Definition: GameObject.h:820
BattlegroundBracketId m_BracketId
Definition: Battleground.h:579
void SetWinner(BattlegroundTeamId winnerTeamId)
Definition: Battleground.h:306
Definition: Battleground.h:133
Definition: Battleground.h:206
void SetRandom(bool isRandom)
Definition: Battleground.h:321
GameObject * object
Definition: Battleground.h:174
Definition: Battleground.h:116
bool m_SetDeleteThis
Definition: Battleground.h:582
void IncreaseInvitedCount(uint32 team)
Definition: Battleground.h:319
int32 GetStartDelayTime() const
Definition: Battleground.h:280
Definition: Battleground.h:221
uint32 GetClientInstanceID() const
Definition: Battleground.h:267
virtual void HandlePlayerResurrect(Player *)
Definition: Battleground.h:436
Definition: Battleground.h:170
uint32 GetRemainingTime() const
Definition: Battleground.h:269
BattlegroundObjectInfo()
Definition: Battleground.h:172
Definition: Battleground.h:191
Definition: Battleground.h:60
BattlegroundStartTimeIntervals
Definition: Battleground.h:136
BattlegroundTypeId m_TypeID
Definition: Battleground.h:568
virtual void EventPlayerDroppedFlag(Player *)
Definition: Battleground.h:427
Definition: DBCStructure.h:926
Definition: Battleground.h:124
uint32 GetMaxPlayersPerTeam() const
Definition: Battleground.h:277
Definition: Battleground.h:140
#define TC_GAME_API
Definition: Define.h:134
time_t OfflineRemoveTime
Definition: Battleground.h:165
BattlegroundTeamId GetWinner() const
Definition: Battleground.h:282
GuidDeque m_OfflineQueue
Definition: Battleground.h:595
Definition: Battleground.h:160
BattlegroundSounds
Definition: Battleground.h:55
virtual ObjectGuid GetFlagPickerGUID(int32=-1) const
Definition: Battleground.h:481
Definition: Battleground.h:141
bool m_InBGFreeSlotQueue
Definition: Battleground.h:581
GuidVector m_ResurrectQueue
Definition: Battleground.h:594
Definition: Battleground.h:65
Definition: Battleground.h:114
uint8_t uint8
Definition: Define.h:152
Definition: Position.h:27
uint32 GetArenaMatchmakerRating(uint32 Team) const
Definition: Battleground.h:417
Definition: Battleground.h:100
Definition: Battleground.h:132
void SetArenaTeamIdForTeam(uint32 Team, uint32 ArenaTeamId)
Definition: Battleground.h:413
#define ASSERT
Definition: Errors.h:55
uint32 const Buff_Entries[3]
Definition: Battleground.h:152
BattlegroundPlayerPositionConstants
Definition: Battleground.h:214
uint32 m_LevelMax
Definition: Battleground.h:616
BattlegroundTypeId GetTypeID(bool GetRandom=false) const
Definition: Battleground.h:263
Definition: Battleground.h:156
BattlegroundMarks
Definition: Battleground.h:75
uint32 GetMapId() const
Definition: Battleground.h:352
Definition: Battleground.h:131
Definition: Battleground.h:235
#define BG_STARTING_EVENT_COUNT
Definition: Battleground.h:202
const FieldDescriptor value
Definition: descriptor.h:1522
uint32 GetLastResurrectTime() const
Definition: Battleground.h:270
void SetName(std::string const &name)
Definition: Battleground.h:289
Definition: Battleground.h:47
std::map< ObjectGuid, BattlegroundPlayer > BattlegroundPlayerMap
Definition: Battleground.h:330
Definition: ObjectGuid.h:189
uint32_t uint32
Definition: g3dmath.h:168
Definition: Battleground.h:87
Definition: Battleground.h:57
G3D::int16 x
Definition: Vector2int16.h:37
BattlegroundTeamId
Definition: SharedDefines.h:4548
virtual void DoAction(uint32, ObjectGuid)
Definition: Battleground.h:434
uint32 GetMaxPlayers() const
Definition: Battleground.h:271
uint32 GetMinLevel() const
Definition: Battleground.h:274
Definition: Battleground.h:111
void UpdateWorldState(Map *map, uint32 id, uint32 state)
Definition: chapter5.cpp:220
Definition: Battleground.h:207
Definition: SharedDefines.h:993
Definition: Battleground.h:163
Definition: Unit.h:1305
uint32 GetPlayersCountByTeam(uint32 Team) const
Definition: Battleground.h:400
void SetScriptId(uint32 scriptId)
Definition: Battleground.h:307
void ModifyStartDelayTime(int diff)
Definition: Battleground.h:309
void SetMaxPlayers(uint32 MaxPlayers)
Definition: Battleground.h:300
Definition: Battleground.h:190
Definition: Battleground.h:110
Definition: Battleground.h:138
uint32 GetElapsedTime() const
Definition: Battleground.h:268
Definition: WorldPacket.h:26
void UpdatePlayersCountByTeam(uint32 Team, bool remove)
Definition: Battleground.h:402
Definition: Battleground.h:89
void SetStatus(BattlegroundStatus Status)
Definition: Battleground.h:295
virtual void PostUpdateImpl(uint32)
Post-update hook.
Definition: Battleground.h:531
void Update(uint32 diff)
Definition: WeatherMgr.cpp:150
Group * GetBgRaid(uint32 TeamID) const
Definition: Battleground.h:393
virtual void GetPlayerPositionData(std::vector< WorldPackets::Battleground::BattlegroundPlayerPosition > *) const
Definition: Battleground.h:540
Player * _GetPlayer(BattlegroundPlayerMap::iterator itr, const char *context)
Definition: Battleground.h:499
Definition: Group.h:191
Definition: Battleground.h:197
void SetMinPlayers(uint32 MinPlayers)
Definition: Battleground.h:301
float m_StartMaxDist
Definition: Battleground.h:626
virtual bool HandlePlayerUnderMap(Player *)
Definition: Battleground.h:468
Definition: Battleground.h:225
BGHonorMode m_HonorMode
Definition: Battleground.h:561
Definition: Battleground.h:95
Definition: Battleground.h:50
int32 timer
Definition: Battleground.h:175
BattlegroundScoreMap PlayerScores
Definition: Battleground.h:543
Definition: Battleground.h:71