19 #ifndef __BATTLEGROUND_H
20 #define __BATTLEGROUND_H
202 #define BG_STARTING_EVENT_COUNT 4
211 #define BG_AWARD_ARENA_POINTS_MIN_LEVEL 71
212 #define ARENA_TIMELIMIT_POINTS_LOSS -16
247 virtual void Reset();
261 std::string
const&
GetName()
const {
return m_Name; }
289 void SetName(std::string
const& name) { m_Name = name; }
315 void AddToBGFreeSlotQueue();
316 void RemoveFromBGFreeSlotQueue();
321 void SetRandom(
bool isRandom) { m_IsRandom = isRandom; }
323 bool HasFreeSlots()
const;
331 BattlegroundPlayerMap
const&
GetPlayers()
const {
return m_Players; }
340 void RemovePlayerFromResurrectQueue(
ObjectGuid player_guid);
343 void RelocateDeadPlayers(
ObjectGuid guideGuid);
345 void StartBattleground();
369 void SendPacketToAll(
WorldPacket const* packet)
const;
374 void BroadcastWorker(Do& _do);
377 void PlaySoundToAll(
uint32 SoundID);
383 virtual void EndBattleground(
uint32 winner);
384 void BlockMovement(
Player* player);
405 --m_PlayersCount[GetTeamIndexByTeamId(Team)];
407 ++m_PlayersCount[GetTeamIndexByTeamId(Team)];
421 virtual void HandleAreaTrigger(
Player* ,
uint32 ,
bool );
423 virtual void HandleKillPlayer(
Player* player,
Player* killer);
429 void EventPlayerLoggedIn(
Player* player);
430 void EventPlayerLoggedOut(
Player* player);
441 virtual void AddPlayer(
Player* player);
443 void AddOrSetPlayerToCorrectBgGroup(
Player* player,
uint32 team);
449 void SetHoliday(
bool is_holiday);
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);
459 bool DelCreature(
uint32 type);
460 bool DelObject(
uint32 type);
465 void DoorOpen(
uint32 type);
466 void DoorClose(
uint32 type);
473 bool IsPlayerInBattleground(
ObjectGuid guid)
const;
488 virtual uint32 GetPrematureWinner();
491 uint8 GetUniqueBracketId()
const;
496 void PlayerAddedToBGCheckIfBGIsRunning(
Player* player);
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;
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);
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
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: 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
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: 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