AzerothCore 3.3.5a
OpenSource WoW Emulator
Loading...
Searching...
No Matches
BattlegroundMgr Class Reference

#include "BattlegroundMgr.h"

Public Member Functions

void Update (uint32 diff)
 
void BuildPlayerJoinedBattlegroundPacket (WorldPacket *data, Player *player)
 
void BuildPlayerLeftBattlegroundPacket (WorldPacket *data, ObjectGuid guid)
 
void BuildBattlegroundListPacket (WorldPacket *data, ObjectGuid guid, Player *player, BattlegroundTypeId bgTypeId, uint8 fromWhere)
 
void BuildGroupJoinedBattlegroundPacket (WorldPacket *data, GroupJoinBattlegroundResult result)
 
void BuildBattlegroundStatusPacket (WorldPacket *data, Battleground *bg, uint8 queueSlot, uint8 statusId, uint32 time1, uint32 time2, uint8 arenaType, TeamId teamId, bool isRated=false, BattlegroundTypeId forceBgTypeId=BATTLEGROUND_TYPE_NONE)
 
void SendAreaSpiritHealerQueryOpcode (Player *player, Battleground *bg, ObjectGuid guid)
 
BattlegroundGetBattlegroundThroughClientInstance (uint32 instanceId, BattlegroundTypeId bgTypeId)
 
BattlegroundGetBattleground (uint32 instanceID, BattlegroundTypeId bgTypeId)
 
BattlegroundGetBattlegroundTemplate (BattlegroundTypeId bgTypeId)
 
BattlegroundCreateNewBattleground (BattlegroundTypeId bgTypeId, PvPDifficultyEntry const *bracketEntry, uint8 arenaType, bool isRated)
 
void AddBattleground (Battleground *bg)
 
void RemoveBattleground (BattlegroundTypeId bgTypeId, uint32 instanceId)
 
void AddToBGFreeSlotQueue (BattlegroundTypeId bgTypeId, Battleground *bg)
 
void RemoveFromBGFreeSlotQueue (BattlegroundTypeId bgTypeId, uint32 instanceId)
 
BGFreeSlotQueueContainerGetBGFreeSlotQueueStore (BattlegroundTypeId bgTypeId)
 
void LoadBattlegroundTemplates ()
 
void DeleteAllBattlegrounds ()
 
void SendToBattleground (Player *player, uint32 InstanceID, BattlegroundTypeId bgTypeId)
 
BattlegroundQueueGetBattlegroundQueue (BattlegroundQueueTypeId bgQueueTypeId)
 
void ScheduleQueueUpdate (uint32 arenaMatchmakerRating, uint8 arenaType, BattlegroundQueueTypeId bgQueueTypeId, BattlegroundTypeId bgTypeId, BattlegroundBracketId bracket_id)
 
uint32 GetPrematureFinishTime () const
 
void ToggleArenaTesting ()
 
void ToggleTesting ()
 
void SetHolidayWeekends (uint32 mask)
 
bool isArenaTesting () const
 
bool isTesting () const
 
uint32 GetMaxRatingDifference () const
 
uint32 GetRatingDiscardTimer () const
 
void InitAutomaticArenaPointDistribution ()
 
void LoadBattleMastersEntry ()
 
void CheckBattleMasters ()
 
BattlegroundTypeId GetBattleMasterBG (uint32 entry) const
 

Static Public Member Functions

static BattlegroundMgrinstance ()
 
static BattlegroundQueueTypeId BGQueueTypeId (BattlegroundTypeId bgTypeId, uint8 arenaType)
 
static BattlegroundTypeId BGTemplateId (BattlegroundQueueTypeId bgQueueTypeId)
 
static bool IsArenaType (BattlegroundTypeId bgTypeId)
 
static uint8 BGArenaType (BattlegroundQueueTypeId bgQueueTypeId)
 
static HolidayIds BGTypeToWeekendHolidayId (BattlegroundTypeId bgTypeId)
 
static BattlegroundTypeId WeekendHolidayIdToBGType (HolidayIds holiday)
 
static bool IsBGWeekend (BattlegroundTypeId bgTypeId)
 

Static Public Attributes

static std::unordered_map< int, BattlegroundQueueTypeIdbgToQueue
 
static std::unordered_map< int, BattlegroundTypeIdqueueToBg
 
static std::unordered_map< int, Battleground * > bgtypeToBattleground
 
static std::unordered_map< int, bgRefbgTypeToTemplate
 
static std::unordered_map< int, bgMapRefgetBgFromMap = {}
 
static std::unordered_map< int, bgTypeRefgetBgFromTypeID
 
static std::unordered_map< uint32, BattlegroundQueueTypeIdArenaTypeToQueue
 
static std::unordered_map< uint32, ArenaTypeQueueToArenaType
 

Private Types

typedef std::map< BattlegroundTypeId, BattlegroundDataBattlegroundDataContainer
 
typedef std::map< BattlegroundTypeId, uint8BattlegroundSelectionWeightMap
 
typedef std::map< BattlegroundTypeId, BattlegroundTemplateBattlegroundTemplateMap
 
typedef std::map< uint32, BattlegroundTemplate * > BattlegroundMapTemplateContainer
 

Private Member Functions

 BattlegroundMgr ()
 
 ~BattlegroundMgr ()
 
bool CreateBattleground (BattlegroundTemplate const *bgTemplate)
 
uint32 CreateClientVisibleInstanceId (BattlegroundTypeId bgTypeId, BattlegroundBracketId bracket_id)
 
BattlegroundTypeId GetRandomBG (BattlegroundTypeId id, uint32 minLevel)
 
BattlegroundTemplate const * GetBattlegroundTemplateByTypeId (BattlegroundTypeId id)
 
BattlegroundTemplate const * GetBattlegroundTemplateByMapId (uint32 mapId)
 

Private Attributes

BattlegroundDataContainer bgDataStore
 
BattlegroundQueue m_BattlegroundQueues [MAX_BATTLEGROUND_QUEUE_TYPES]
 
std::vector< uint64m_QueueUpdateScheduler
 
bool m_ArenaTesting
 
bool m_Testing
 
Seconds m_NextAutoDistributionTime
 
uint32 m_AutoDistributionTimeChecker
 
uint32 m_NextPeriodicQueueUpdateTime
 
BattleMastersMap mBattleMastersMap
 
BattlegroundTemplateMap _battlegroundTemplates
 
BattlegroundMapTemplateContainer _battlegroundMapTemplates
 

Detailed Description

Member Typedef Documentation

◆ BattlegroundDataContainer

◆ BattlegroundMapTemplateContainer

◆ BattlegroundSelectionWeightMap

◆ BattlegroundTemplateMap

Constructor & Destructor Documentation

◆ BattlegroundMgr()

BattlegroundMgr::BattlegroundMgr ( )
private
61 :
62 m_ArenaTesting(false),
63 m_Testing(false),
67{
68}
constexpr auto IN_MILLISECONDS
Definition: Common.h:53
bool m_ArenaTesting
Definition: BattlegroundMgr.h:155
uint32 m_AutoDistributionTimeChecker
Definition: BattlegroundMgr.h:158
Seconds m_NextAutoDistributionTime
Definition: BattlegroundMgr.h:157
uint32 m_NextPeriodicQueueUpdateTime
Definition: BattlegroundMgr.h:159
bool m_Testing
Definition: BattlegroundMgr.h:156

◆ ~BattlegroundMgr()

BattlegroundMgr::~BattlegroundMgr ( )
private
71{
73}
void DeleteAllBattlegrounds()
Definition: BattlegroundMgr.cpp:81

References DeleteAllBattlegrounds().

Member Function Documentation

◆ AddBattleground()

void BattlegroundMgr::AddBattleground ( Battleground bg)
953{
954 if (bg)
955 bgDataStore[bg->GetBgTypeID()]._Battlegrounds[bg->GetInstanceID()] = bg;
956
957 sScriptMgr->OnBattlegroundCreate(bg);
958}
#define sScriptMgr
Definition: ScriptMgr.h:708
uint32 GetInstanceID() const
Definition: Battleground.h:326
BattlegroundTypeId GetBgTypeID(bool GetRandom=false) const
Definition: Battleground.h:324
BattlegroundDataContainer bgDataStore
Definition: BattlegroundMgr.h:150

References bgDataStore, Battleground::GetBgTypeID(), Battleground::GetInstanceID(), and sScriptMgr.

Referenced by CreateBattleground().

◆ AddToBGFreeSlotQueue()

void BattlegroundMgr::AddToBGFreeSlotQueue ( BattlegroundTypeId  bgTypeId,
Battleground bg 
)
937{
938 bgDataStore[bgTypeId].BGFreeSlotQueue.push_front(bg);
939}

References bgDataStore.

◆ BGArenaType()

uint8 BattlegroundMgr::BGArenaType ( BattlegroundQueueTypeId  bgQueueTypeId)
static
707{
708 uint8 arenaType = 0;
709
711 {
712 arenaType = BattlegroundMgr::QueueToArenaType.at(bgQueueTypeId);
713 }
714
715 sScriptMgr->OnArenaQueueIdToArenaType(bgQueueTypeId, arenaType);
716
717 return arenaType;
718}
std::uint8_t uint8
Definition: Define.h:109
static std::unordered_map< uint32, ArenaType > QueueToArenaType
Definition: BattlegroundMgr.h:142

References QueueToArenaType, and sScriptMgr.

Referenced by Update().

◆ BGQueueTypeId()

BattlegroundQueueTypeId BattlegroundMgr::BGQueueTypeId ( BattlegroundTypeId  bgTypeId,
uint8  arenaType 
)
static
673{
674 uint32 queueTypeID = BATTLEGROUND_QUEUE_NONE;
675
676 if (arenaType)
677 {
679 {
680 queueTypeID = BattlegroundMgr::ArenaTypeToQueue.at(arenaType);
681 }
682
683 sScriptMgr->OnArenaTypeIDToQueueID(bgTypeId, arenaType, queueTypeID);
684
685 return static_cast<BattlegroundQueueTypeId>(queueTypeID);
686 }
687
688 if (BattlegroundMgr::bgToQueue.find(bgTypeId) != BattlegroundMgr::bgToQueue.end())
689 {
690 queueTypeID = BattlegroundMgr::bgToQueue.at(bgTypeId);
691 }
692
693 return static_cast<BattlegroundQueueTypeId>(queueTypeID);
694}
std::uint32_t uint32
Definition: Define.h:107
BattlegroundQueueTypeId
Definition: SharedDefines.h:3619
@ BATTLEGROUND_QUEUE_NONE
Definition: SharedDefines.h:3620
static std::unordered_map< int, BattlegroundQueueTypeId > bgToQueue
Definition: BattlegroundMgr.h:135
static std::unordered_map< uint32, BattlegroundQueueTypeId > ArenaTypeToQueue
Definition: BattlegroundMgr.h:141

References ArenaTypeToQueue, BATTLEGROUND_QUEUE_NONE, bgToQueue, and sScriptMgr.

Referenced by Group::CanJoinBattlegroundQueue(), ArenaTeam::DelMember(), BGQueueInviteEvent::Execute(), WorldSession::HandleArenaTeamDisbandOpcode(), WorldSession::HandleArenaTeamLeaveOpcode(), WorldSession::HandleArenaTeamRemoveOpcode(), WorldSession::HandleBattleFieldPortOpcode(), WorldSession::HandleBattlemasterJoinArena(), WorldSession::HandleBattlemasterJoinOpcode(), BattlegroundQueue::InviteGroupToBG(), BattlegroundQueue::RemovePlayer(), and Battleground::RemovePlayerAtLeave().

◆ BGTemplateId()

BattlegroundTypeId BattlegroundMgr::BGTemplateId ( BattlegroundQueueTypeId  bgQueueTypeId)
static
697{
698 if (BattlegroundMgr::queueToBg.find(bgQueueTypeId) == BattlegroundMgr::queueToBg.end())
699 {
700 return BattlegroundTypeId(0);
701 }
702
703 return BattlegroundMgr::queueToBg[bgQueueTypeId];
704}
BattlegroundTypeId
Definition: SharedDefines.h:3479
static std::unordered_map< int, BattlegroundTypeId > queueToBg
Definition: BattlegroundMgr.h:136

References queueToBg.

Referenced by BattlegroundQueue::BattlegroundQueueAnnouncerUpdate(), and WorldSession::HandleBattlefieldStatusOpcode().

◆ BGTypeToWeekendHolidayId()

HolidayIds BattlegroundMgr::BGTypeToWeekendHolidayId ( BattlegroundTypeId  bgTypeId)
static
855{
856 switch (bgTypeId)
857 {
858 case BATTLEGROUND_AV:
860 case BATTLEGROUND_EY:
862 case BATTLEGROUND_WS:
864 case BATTLEGROUND_SA:
866 case BATTLEGROUND_AB:
868 case BATTLEGROUND_IC:
870 default:
871 return HOLIDAY_NONE;
872 }
873}
@ BATTLEGROUND_IC
Definition: SharedDefines.h:3492
@ BATTLEGROUND_WS
Definition: SharedDefines.h:3482
@ BATTLEGROUND_EY
Definition: SharedDefines.h:3487
@ BATTLEGROUND_AV
Definition: SharedDefines.h:3481
@ BATTLEGROUND_SA
Definition: SharedDefines.h:3489
@ BATTLEGROUND_AB
Definition: SharedDefines.h:3483
@ HOLIDAY_NONE
Definition: SharedDefines.h:2742
@ HOLIDAY_CALL_TO_ARMS_AB
Definition: SharedDefines.h:2750
@ HOLIDAY_CALL_TO_ARMS_EY
Definition: SharedDefines.h:2757
@ HOLIDAY_CALL_TO_ARMS_SA
Definition: SharedDefines.h:2763
@ HOLIDAY_CALL_TO_ARMS_IC
Definition: SharedDefines.h:2767
@ HOLIDAY_CALL_TO_ARMS_AV
Definition: SharedDefines.h:2748
@ HOLIDAY_CALL_TO_ARMS_WS
Definition: SharedDefines.h:2749

References BATTLEGROUND_AB, BATTLEGROUND_AV, BATTLEGROUND_EY, BATTLEGROUND_IC, BATTLEGROUND_SA, BATTLEGROUND_WS, HOLIDAY_CALL_TO_ARMS_AB, HOLIDAY_CALL_TO_ARMS_AV, HOLIDAY_CALL_TO_ARMS_EY, HOLIDAY_CALL_TO_ARMS_IC, HOLIDAY_CALL_TO_ARMS_SA, HOLIDAY_CALL_TO_ARMS_WS, and HOLIDAY_NONE.

Referenced by IsBGWeekend().

◆ BuildBattlegroundListPacket()

void BattlegroundMgr::BuildBattlegroundListPacket ( WorldPacket data,
ObjectGuid  guid,
Player player,
BattlegroundTypeId  bgTypeId,
uint8  fromWhere 
)
571{
572 if (!player)
573 return;
574
575 uint32 winner_kills = player->GetRandomWinner() ? sWorld->getIntConfig(CONFIG_BG_REWARD_WINNER_HONOR_LAST) : sWorld->getIntConfig(CONFIG_BG_REWARD_WINNER_HONOR_FIRST);
576 uint32 winner_arena = player->GetRandomWinner() ? sWorld->getIntConfig(CONFIG_BG_REWARD_WINNER_ARENA_LAST) : sWorld->getIntConfig(CONFIG_BG_REWARD_WINNER_ARENA_FIRST);
577 uint32 loser_kills = player->GetRandomWinner() ? sWorld->getIntConfig(CONFIG_BG_REWARD_LOSER_HONOR_LAST) : sWorld->getIntConfig(CONFIG_BG_REWARD_LOSER_HONOR_FIRST);
578
579 winner_kills = Acore::Honor::hk_honor_at_level(player->GetLevel(), float(winner_kills));
580 loser_kills = Acore::Honor::hk_honor_at_level(player->GetLevel(), float(loser_kills));
581
583 *data << guid; // battlemaster guid
584 *data << uint8(fromWhere); // from where you joined
585 *data << uint32(bgTypeId); // battleground id
586 *data << uint8(0); // unk
587 *data << uint8(0); // unk
588
589 // Rewards
590 *data << uint8(player->GetRandomWinner()); // 3.3.3 hasWin
591 *data << uint32(winner_kills); // 3.3.3 winHonor
592 *data << uint32(winner_arena); // 3.3.3 winArena
593 *data << uint32(loser_kills); // 3.3.3 lossHonor
594
595 uint8 isQueueRandom = (bgTypeId == BATTLEGROUND_RB);
596
597 *data << uint8(isQueueRandom); // 3.3.3 isRandom
598 if (isQueueRandom)
599 {
600 // Rewards (random)
601 *data << uint8(player->GetRandomWinner()); // 3.3.3 hasWin_Random
602 *data << uint32(winner_kills); // 3.3.3 winHonor_Random
603 *data << uint32(winner_arena); // 3.3.3 winArena_Random
604 *data << uint32(loser_kills); // 3.3.3 lossHonor_Random
605 }
606
607 if (bgTypeId == BATTLEGROUND_AA) // arena
608 *data << uint32(0); // unk (count?)
609 else // battleground
610 {
611 std::size_t count_pos = data->wpos();
612 *data << uint32(0); // number of bg instances
613
614 auto const& it = bgDataStore.find(bgTypeId);
615 if (it != bgDataStore.end())
616 {
617 // expected bracket entry
618 if (PvPDifficultyEntry const* bracketEntry = GetBattlegroundBracketByLevel(it->second._Battlegrounds.begin()->second->GetMapId(), player->GetLevel()))
619 {
620 uint32 count = 0;
621 BattlegroundBracketId bracketId = bracketEntry->GetBracketId();
622 BattlegroundClientIdsContainer& clientIds = it->second._ClientBattlegroundIds[bracketId];
623
624 for (auto const& itr : clientIds)
625 {
626 *data << uint32(itr);
627 ++count;
628 }
629
630 data->put<uint32>(count_pos, count);
631 }
632 }
633 }
634}
std::set< uint32 > BattlegroundClientIdsContainer
Definition: BattlegroundMgr.h:30
PvPDifficultyEntry const * GetBattlegroundBracketByLevel(uint32 mapid, uint32 level)
Definition: DBCStores.cpp:793
@ CONFIG_BG_REWARD_LOSER_HONOR_LAST
Definition: IWorld.h:398
@ CONFIG_BG_REWARD_WINNER_ARENA_FIRST
Definition: IWorld.h:394
@ CONFIG_BG_REWARD_WINNER_ARENA_LAST
Definition: IWorld.h:396
@ CONFIG_BG_REWARD_WINNER_HONOR_FIRST
Definition: IWorld.h:393
@ CONFIG_BG_REWARD_LOSER_HONOR_FIRST
Definition: IWorld.h:397
@ CONFIG_BG_REWARD_WINNER_HONOR_LAST
Definition: IWorld.h:395
@ BATTLEGROUND_AA
Definition: SharedDefines.h:3486
@ BATTLEGROUND_RB
Definition: SharedDefines.h:3493
BattlegroundBracketId
Definition: DBCEnums.h:46
@ SMSG_BATTLEFIELD_LIST
Definition: Opcodes.h:603
#define sWorld
Definition: World.h:444
uint32 hk_honor_at_level(uint8 level, float multiplier=1.0f)
Definition: Formulas.h:38
bool GetRandomWinner()
Definition: Player.h:2271
uint8 GetLevel() const
Definition: Unit.h:855
void Initialize(uint16 opcode, std::size_t newres=200)
Definition: WorldPacket.h:69
Definition: DBCStructure.h:1431
std::size_t wpos() const
Definition: ByteBuffer.h:330
void put(std::size_t pos, T value)
Definition: ByteBuffer.h:137

References BATTLEGROUND_AA, BATTLEGROUND_RB, bgDataStore, CONFIG_BG_REWARD_LOSER_HONOR_FIRST, CONFIG_BG_REWARD_LOSER_HONOR_LAST, CONFIG_BG_REWARD_WINNER_ARENA_FIRST, CONFIG_BG_REWARD_WINNER_ARENA_LAST, CONFIG_BG_REWARD_WINNER_HONOR_FIRST, CONFIG_BG_REWARD_WINNER_HONOR_LAST, GetBattlegroundBracketByLevel(), Unit::GetLevel(), Player::GetRandomWinner(), Acore::Honor::hk_honor_at_level(), WorldPacket::Initialize(), ByteBuffer::put(), SMSG_BATTLEFIELD_LIST, sWorld, and ByteBuffer::wpos().

◆ BuildBattlegroundStatusPacket()

void BattlegroundMgr::BuildBattlegroundStatusPacket ( WorldPacket data,
Battleground bg,
uint8  queueSlot,
uint8  statusId,
uint32  time1,
uint32  time2,
uint8  arenaType,
TeamId  teamId,
bool  isRated = false,
BattlegroundTypeId  forceBgTypeId = BATTLEGROUND_TYPE_NONE 
)
195{
196 // pussywizard:
197 //ASSERT(QueueSlot < PLAYER_MAX_BATTLEGROUND_QUEUES);
198
199 if (StatusID == STATUS_NONE || !bg)
200 {
202 *data << uint32(QueueSlot);
203 *data << uint64(0);
204 return;
205 }
206
207 data->Initialize(SMSG_BATTLEFIELD_STATUS, (4 + 8 + 1 + 1 + 4 + 1 + 4 + 4 + 4));
208 *data << uint32(QueueSlot);
209 // The following segment is read as uint64 in client but can be appended as their original type.
210 *data << uint8(arenatype);
211 *data << uint8(bg->isArena() ? 0xE : 0x0);
212 *data << uint32(forceBgTypeId != BATTLEGROUND_TYPE_NONE ? forceBgTypeId : bg->GetBgTypeID());
213 *data << uint16(0x1F90);
214 // End of uint64 segment, decomposed this way for simplicity
215 *data << uint8(bg->GetMinLevel());
216 *data << uint8(bg->GetMaxLevel());
217 *data << uint32(bg->GetClientInstanceID());
218
219 // following displays the minimap icon. 0 = faction icon, 1 = arenaicon
220 *data << uint8(bg->isRated() || isRated); // 1 for rated match, 0 for bg or non rated match
221
222 *data << uint32(StatusID); // status
223 switch (StatusID)
224 {
225 case STATUS_WAIT_QUEUE: // status_in_queue
226 *data << uint32(Time1); // average wait time, milliseconds
227 *data << uint32(Time2); // time in queue, updated every minute!, milliseconds
228 break;
229 case STATUS_WAIT_JOIN: // status_invite
230 *data << uint32(bg->GetMapId()); // map id
231 *data << uint64(0); // 3.3.5, unknown
232 *data << uint32(Time1); // time to remove from queue, milliseconds
233 break;
234 case STATUS_IN_PROGRESS: // status_in_progress
235 *data << uint32(bg->GetMapId()); // map id
236 *data << uint64(0); // 3.3.5, unknown
237 *data << uint32(Time1); // time to bg auto leave, 0 at bg start, 120000 after bg end, milliseconds
238 *data << uint32(Time2); // time from bg start, milliseconds
239 *data << uint8(teamId == TEAM_ALLIANCE ? 1 : 0); // arenafaction (0 for horde, 1 for alliance)
240 break;
241 default:
242 break;
243 }
244}
std::uint64_t uint64
Definition: Define.h:106
std::uint16_t uint16
Definition: Define.h:108
@ STATUS_WAIT_QUEUE
Definition: Battleground.h:195
@ STATUS_NONE
Definition: Battleground.h:194
@ STATUS_WAIT_JOIN
Definition: Battleground.h:196
@ STATUS_IN_PROGRESS
Definition: Battleground.h:197
@ BATTLEGROUND_TYPE_NONE
Definition: SharedDefines.h:3480
@ TEAM_ALLIANCE
Definition: SharedDefines.h:760
@ SMSG_BATTLEFIELD_STATUS
Definition: Opcodes.h:754
uint32 GetMapId() const
Definition: Battleground.h:428
uint32 GetMinLevel() const
Definition: Battleground.h:333
bool isRated() const
Definition: Battleground.h:398
uint32 GetClientInstanceID() const
Definition: Battleground.h:328
bool isArena() const
Definition: Battleground.h:396
uint32 GetMaxLevel() const
Definition: Battleground.h:334

References BATTLEGROUND_TYPE_NONE, Battleground::GetBgTypeID(), Battleground::GetClientInstanceID(), Battleground::GetMapId(), Battleground::GetMaxLevel(), Battleground::GetMinLevel(), WorldPacket::Initialize(), Battleground::isArena(), Battleground::isRated(), SMSG_BATTLEFIELD_STATUS, STATUS_IN_PROGRESS, STATUS_NONE, STATUS_WAIT_JOIN, STATUS_WAIT_QUEUE, and TEAM_ALLIANCE.

◆ BuildGroupJoinedBattlegroundPacket()

void BattlegroundMgr::BuildGroupJoinedBattlegroundPacket ( WorldPacket data,
GroupJoinBattlegroundResult  result 
)
247{
249 *data << int32(result);
251 *data << uint64(0); // player guid
252}
std::int32_t int32
Definition: Define.h:103
@ ERR_BATTLEGROUND_JOIN_TIMED_OUT
Definition: SharedDefines.h:3648
@ ERR_BATTLEGROUND_JOIN_FAILED
Definition: SharedDefines.h:3649
@ SMSG_GROUP_JOINED_BATTLEGROUND
Definition: Opcodes.h:774

References ERR_BATTLEGROUND_JOIN_FAILED, ERR_BATTLEGROUND_JOIN_TIMED_OUT, WorldPacket::Initialize(), and SMSG_GROUP_JOINED_BATTLEGROUND.

◆ BuildPlayerJoinedBattlegroundPacket()

void BattlegroundMgr::BuildPlayerJoinedBattlegroundPacket ( WorldPacket data,
Player player 
)
261{
263 *data << player->GetGUID();
264}
@ SMSG_BATTLEGROUND_PLAYER_JOINED
Definition: Opcodes.h:778
static ObjectGuid GetGUID(Object const *o)
Definition: Object.h:109

References Object::GetGUID(), WorldPacket::Initialize(), and SMSG_BATTLEGROUND_PLAYER_JOINED.

◆ BuildPlayerLeftBattlegroundPacket()

void BattlegroundMgr::BuildPlayerLeftBattlegroundPacket ( WorldPacket data,
ObjectGuid  guid 
)
255{
257 *data << guid;
258}
@ SMSG_BATTLEGROUND_PLAYER_LEFT
Definition: Opcodes.h:779

References WorldPacket::Initialize(), and SMSG_BATTLEGROUND_PLAYER_LEFT.

◆ CheckBattleMasters()

void BattlegroundMgr::CheckBattleMasters ( )
842{
843 CreatureTemplateContainer const* ctc = sObjectMgr->GetCreatureTemplates();
844 for (CreatureTemplateContainer::const_iterator itr = ctc->begin(); itr != ctc->end(); ++itr)
845 {
846 if ((itr->second.npcflag & UNIT_NPC_FLAG_BATTLEMASTER) && mBattleMastersMap.find(itr->second.Entry) == mBattleMastersMap.end())
847 {
848 LOG_ERROR("sql.sql", "CreatureTemplate (Entry: {}) has UNIT_NPC_FLAG_BATTLEMASTER but no data in `battlemaster_entry` table. Removing flag!", itr->second.Entry);
849 const_cast<CreatureTemplate*>(&itr->second)->npcflag &= ~UNIT_NPC_FLAG_BATTLEMASTER;
850 }
851 }
852}
#define LOG_ERROR(filterType__,...)
Definition: Log.h:156
#define sObjectMgr
Definition: ObjectMgr.h:1623
@ UNIT_NPC_FLAG_BATTLEMASTER
Definition: UnitDefines.h:314
std::unordered_map< uint32, CreatureTemplate > CreatureTemplateContainer
Definition: CreatureData.h:295
BattleMastersMap mBattleMastersMap
Definition: BattlegroundMgr.h:160
Definition: CreatureData.h:189

References LOG_ERROR, mBattleMastersMap, sObjectMgr, and UNIT_NPC_FLAG_BATTLEMASTER.

Referenced by LoadBattleMastersEntry().

◆ CreateBattleground()

bool BattlegroundMgr::CreateBattleground ( BattlegroundTemplate const *  bgTemplate)
private
416{
417 // Create the BG
418 Battleground* bg = GetBattlegroundTemplate(bgTemplate->Id);
419
420 if (!bg)
421 {
422 bg = BattlegroundMgr::bgtypeToBattleground[bgTemplate->Id];
423
424 ASSERT(bg);
425
426 if (bgTemplate->Id == BATTLEGROUND_RB)
427 bg->SetRandom(true);
428
429 bg->SetBgTypeID(bgTemplate->Id);
430 bg->SetInstanceID(0);
431 AddBattleground(bg);
432 }
433
434 bg->SetMapId(bgTemplate->BattlemasterEntry->mapid[0]);
435 bg->SetName(bgTemplate->BattlemasterEntry->name[sWorld->GetDefaultDbcLocale()]);
436 bg->SetArenaorBGType(bgTemplate->IsArena());
437 bg->SetMinPlayersPerTeam(bgTemplate->MinPlayersPerTeam);
438 bg->SetMaxPlayersPerTeam(bgTemplate->MaxPlayersPerTeam);
439 bg->SetTeamStartPosition(TEAM_ALLIANCE, bgTemplate->StartLocation[TEAM_ALLIANCE]);
440 bg->SetTeamStartPosition(TEAM_HORDE, bgTemplate->StartLocation[TEAM_HORDE]);
441 bg->SetStartMaxDist(bgTemplate->MaxStartDistSq);
442 bg->SetLevelRange(bgTemplate->MinLevel, bgTemplate->MaxLevel);
443 bg->SetScriptId(bgTemplate->ScriptId);
444
445 return true;
446}
#define ASSERT
Definition: Errors.h:68
@ TEAM_HORDE
Definition: SharedDefines.h:761
Definition: Battleground.h:298
void SetMapId(uint32 MapID)
Definition: Battleground.h:427
void SetInstanceID(uint32 InstanceID)
Definition: Battleground.h:355
void SetRandom(bool isRandom)
Definition: Battleground.h:367
void SetScriptId(uint32 scriptId)
Definition: Battleground.h:366
void SetBgTypeID(BattlegroundTypeId TypeID)
Definition: Battleground.h:352
void SetMinPlayersPerTeam(uint32 MinPlayers)
Definition: Battleground.h:373
void SetStartMaxDist(float startMaxDist)
Definition: Battleground.h:438
void SetName(std::string_view name)
Definition: Battleground.h:351
void SetLevelRange(uint32 min, uint32 max)
Definition: Battleground.h:361
void SetArenaorBGType(bool _isArena)
Definition: Battleground.h:364
void SetTeamStartPosition(TeamId teamId, Position const &pos)
Definition: Battleground.cpp:656
void SetMaxPlayersPerTeam(uint32 MaxPlayers)
Definition: Battleground.h:372
void AddBattleground(Battleground *bg)
Definition: BattlegroundMgr.cpp:952
Battleground * GetBattlegroundTemplate(BattlegroundTypeId bgTypeId)
Definition: BattlegroundMgr.cpp:325
static std::unordered_map< int, Battleground * > bgtypeToBattleground
Definition: BattlegroundMgr.h:137

References AddBattleground(), ASSERT, BATTLEGROUND_RB, BattlegroundTemplate::BattlemasterEntry, bgtypeToBattleground, GetBattlegroundTemplate(), BattlegroundTemplate::Id, BattlegroundTemplate::IsArena(), BattlemasterListEntry::mapid, BattlegroundTemplate::MaxLevel, BattlegroundTemplate::MaxPlayersPerTeam, BattlegroundTemplate::MaxStartDistSq, BattlegroundTemplate::MinLevel, BattlegroundTemplate::MinPlayersPerTeam, BattlemasterListEntry::name, BattlegroundTemplate::ScriptId, Battleground::SetArenaorBGType(), Battleground::SetBgTypeID(), Battleground::SetInstanceID(), Battleground::SetLevelRange(), Battleground::SetMapId(), Battleground::SetMaxPlayersPerTeam(), Battleground::SetMinPlayersPerTeam(), Battleground::SetName(), Battleground::SetRandom(), Battleground::SetScriptId(), Battleground::SetStartMaxDist(), Battleground::SetTeamStartPosition(), BattlegroundTemplate::StartLocation, sWorld, TEAM_ALLIANCE, and TEAM_HORDE.

Referenced by LoadBattlegroundTemplates().

◆ CreateClientVisibleInstanceId()

uint32 BattlegroundMgr::CreateClientVisibleInstanceId ( BattlegroundTypeId  bgTypeId,
BattlegroundBracketId  bracket_id 
)
private
338{
339 if (IsArenaType(bgTypeId))
340 return 0; // arenas don't have client-instanceids
341
342 // we create here an instanceid, which is just for
343 // displaying this to the client and without any other use..
344 // the client-instanceIds are unique for each battleground-type
345 // the instance-id just needs to be as low as possible, beginning with 1
346 // the following works, because std::set is default ordered with "<"
347 // the optimalization would be to use as bitmask std::vector<uint32> - but that would only make code unreadable
348
349 BattlegroundClientIdsContainer& clientIds = bgDataStore[bgTypeId]._ClientBattlegroundIds[bracket_id];
350 uint32 lastId = 0;
351
352 for (BattlegroundClientIdsContainer::const_iterator itr = clientIds.begin(); itr != clientIds.end();)
353 {
354 if ((++lastId) != *itr) // if there is a gap between the ids, we will break..
355 break;
356
357 lastId = *itr;
358 }
359
360 clientIds.emplace(++lastId);
361 return lastId;
362}
static bool IsArenaType(BattlegroundTypeId bgTypeId)
Definition: BattlegroundMgr.cpp:662

References bgDataStore, and IsArenaType().

Referenced by CreateNewBattleground().

◆ CreateNewBattleground()

Battleground * BattlegroundMgr::CreateNewBattleground ( BattlegroundTypeId  bgTypeId,
PvPDifficultyEntry const *  bracketEntry,
uint8  arenaType,
bool  isRated 
)
366{
367 BattlegroundTypeId bgTypeId = GetRandomBG(originalBgTypeId, bracketEntry->minLevel);
368
369 if (originalBgTypeId == BATTLEGROUND_AA)
370 originalBgTypeId = bgTypeId;
371
372 // get the template BG
373 Battleground* bg_template = GetBattlegroundTemplate(bgTypeId);
374 if (!bg_template)
375 {
376 LOG_ERROR("bg.battleground", "Battleground: CreateNewBattleground - bg template not found for {}", bgTypeId);
377 return nullptr;
378 }
379
380 Battleground* bg = nullptr;
381
382 // create a copy of the BG template
384 {
385 return nullptr;
386 }
387
388 bg = BattlegroundMgr::bgTypeToTemplate[bgTypeId](bg_template);
389
390 bool isRandom = bgTypeId != originalBgTypeId && !bg->isArena();
391
392 bg->SetBracket(bracketEntry);
393 bg->SetInstanceID(sMapMgr->GenerateInstanceId());
394 bg->SetClientInstanceID(CreateClientVisibleInstanceId(originalBgTypeId, bracketEntry->GetBracketId()));
395 bg->Init();
396 bg->SetStatus(STATUS_WAIT_JOIN); // start the joining of the bg
397 bg->SetArenaType(arenaType);
398 bg->SetBgTypeID(originalBgTypeId);
399 bg->SetRandomTypeID(bgTypeId);
400 bg->SetRated(isRated);
401 bg->SetRandom(isRandom);
402
403 // Set up correct min/max player counts for scoreboards
404 if (bg->isArena())
405 {
406 uint32 maxPlayersPerTeam = ArenaTeam::GetReqPlayersForType(arenaType) / 2;
407 sScriptMgr->OnSetArenaMaxPlayersPerTeam(arenaType, maxPlayersPerTeam);
408 bg->SetMaxPlayersPerTeam(maxPlayersPerTeam);
409 }
410
411 return bg;
412}
#define sMapMgr
Definition: MapMgr.h:221
static uint8 GetReqPlayersForType(uint32 type)
Definition: ArenaTeam.cpp:1021
void SetBracket(PvPDifficultyEntry const *bracketEntry)
Definition: Battleground.cpp:1822
void SetRated(bool state)
Definition: Battleground.h:362
virtual void Init()
Definition: Battleground.cpp:1064
void SetClientInstanceID(uint32 InstanceID)
Definition: Battleground.h:357
void SetStatus(BattlegroundStatus Status)
Definition: Battleground.h:356
void SetArenaType(uint8 type)
Definition: Battleground.h:363
void SetRandomTypeID(BattlegroundTypeId TypeID)
Definition: Battleground.h:353
static std::unordered_map< int, bgRef > bgTypeToTemplate
Definition: BattlegroundMgr.h:138
BattlegroundTypeId GetRandomBG(BattlegroundTypeId id, uint32 minLevel)
Definition: BattlegroundMgr.cpp:901
uint32 CreateClientVisibleInstanceId(BattlegroundTypeId bgTypeId, BattlegroundBracketId bracket_id)
Definition: BattlegroundMgr.cpp:337

References BATTLEGROUND_AA, bgTypeToTemplate, CreateClientVisibleInstanceId(), GetBattlegroundTemplate(), PvPDifficultyEntry::GetBracketId(), GetRandomBG(), ArenaTeam::GetReqPlayersForType(), Battleground::Init(), Battleground::isArena(), LOG_ERROR, PvPDifficultyEntry::minLevel, Battleground::SetArenaType(), Battleground::SetBgTypeID(), Battleground::SetBracket(), Battleground::SetClientInstanceID(), Battleground::SetInstanceID(), Battleground::SetMaxPlayersPerTeam(), Battleground::SetRandom(), Battleground::SetRandomTypeID(), Battleground::SetRated(), Battleground::SetStatus(), sMapMgr, sScriptMgr, and STATUS_WAIT_JOIN.

◆ DeleteAllBattlegrounds()

void BattlegroundMgr::DeleteAllBattlegrounds ( )
82{
83 for (auto& [_, data] : bgDataStore)
84 {
85 while (!data._Battlegrounds.empty())
86 delete data._Battlegrounds.begin()->second;
87
88 data._Battlegrounds.clear();
89
90 while (!data.BGFreeSlotQueue.empty())
91 delete data.BGFreeSlotQueue.front();
92 }
93
94 bgDataStore.clear();
95}

References bgDataStore.

Referenced by ~BattlegroundMgr().

◆ GetBattleground()

Battleground * BattlegroundMgr::GetBattleground ( uint32  instanceID,
BattlegroundTypeId  bgTypeId 
)
291{
292 if (!instanceId)
293 return nullptr;
294
295 auto GetBgWithInstanceID = [instanceId](BattlegroundData const* bgData) -> Battleground*
296 {
297 auto const& itr = bgData->_Battlegrounds.find(instanceId);
298 if (itr != bgData->_Battlegrounds.end())
299 return itr->second;
300
301 return nullptr;
302 };
303
304 if (bgTypeId == BATTLEGROUND_TYPE_NONE)
305 {
306 for (auto const& [bgType, bgData] : bgDataStore)
307 {
308 if (auto bg = GetBgWithInstanceID(&bgData))
309 return bg;
310 }
311 }
312 else
313 {
314 auto const& itr = bgDataStore.find(bgTypeId);
315 if (itr == bgDataStore.end())
316 return nullptr;
317
318 if (auto bg = GetBgWithInstanceID(&itr->second))
319 return bg;
320 }
321
322 return nullptr;
323}
Definition: BattlegroundMgr.h:41

References BATTLEGROUND_TYPE_NONE, and bgDataStore.

Referenced by GetBattlegroundThroughClientInstance(), and SendToBattleground().

◆ GetBattlegroundQueue()

BattlegroundQueue & BattlegroundMgr::GetBattlegroundQueue ( BattlegroundQueueTypeId  bgQueueTypeId)
inline
100{ return m_BattlegroundQueues[bgQueueTypeId]; }
BattlegroundQueue m_BattlegroundQueues[MAX_BATTLEGROUND_QUEUE_TYPES]
Definition: BattlegroundMgr.h:152

References m_BattlegroundQueues.

◆ GetBattlegroundTemplate()

Battleground * BattlegroundMgr::GetBattlegroundTemplate ( BattlegroundTypeId  bgTypeId)
326{
327 BattlegroundDataContainer::const_iterator itr = bgDataStore.find(bgTypeId);
328 if (itr == bgDataStore.end())
329 return nullptr;
330
331 BattlegroundContainer const& bgs = itr->second._Battlegrounds;
332
333 // map is sorted and we can be sure that lowest instance id has only BG template
334 return bgs.empty() ? nullptr : bgs.begin()->second;
335}
std::map< uint32, Battleground * > BattlegroundContainer
Definition: BattlegroundMgr.h:29

References bgDataStore.

Referenced by CreateBattleground(), CreateNewBattleground(), GetBattlegroundThroughClientInstance(), and SetHolidayWeekends().

◆ GetBattlegroundTemplateByMapId()

BattlegroundTemplate const * BattlegroundMgr::GetBattlegroundTemplateByMapId ( uint32  mapId)
inlineprivate
172 {
173 auto const& itr = _battlegroundMapTemplates.find(mapId);
174 if (itr != _battlegroundMapTemplates.end())
175 return itr->second;
176
177 return nullptr;
178 }
BattlegroundMapTemplateContainer _battlegroundMapTemplates
Definition: BattlegroundMgr.h:185

References _battlegroundMapTemplates.

Referenced by GetRandomBG().

◆ GetBattlegroundTemplateByTypeId()

BattlegroundTemplate const * BattlegroundMgr::GetBattlegroundTemplateByTypeId ( BattlegroundTypeId  id)
inlineprivate
163 {
164 auto const& itr = _battlegroundTemplates.find(id);
165 if (itr != _battlegroundTemplates.end())
166 return &itr->second;
167
168 return nullptr;
169 }
BattlegroundTemplateMap _battlegroundTemplates
Definition: BattlegroundMgr.h:184

References _battlegroundTemplates.

Referenced by GetRandomBG().

◆ GetBattlegroundThroughClientInstance()

Battleground * BattlegroundMgr::GetBattlegroundThroughClientInstance ( uint32  instanceId,
BattlegroundTypeId  bgTypeId 
)
267{
268 //cause at HandleBattlegroundJoinOpcode the clients sends the instanceid he gets from
269 //SMSG_BATTLEFIELD_LIST we need to find the battleground with this clientinstance-id
271 if (!bg)
272 return nullptr;
273
274 if (bg->isArena())
275 return GetBattleground(instanceId, bgTypeId);
276
277 auto const& it = bgDataStore.find(bgTypeId);
278 if (it == bgDataStore.end())
279 return nullptr;
280
281 for (auto const& itr : it->second._Battlegrounds)
282 {
283 if (itr.second->GetClientInstanceID() == instanceId)
284 return itr.second;
285 }
286
287 return nullptr;
288}
Battleground * GetBattleground(uint32 instanceID, BattlegroundTypeId bgTypeId)
Definition: BattlegroundMgr.cpp:290

References bgDataStore, GetBattleground(), GetBattlegroundTemplate(), and Battleground::isArena().

◆ GetBattleMasterBG()

BattlegroundTypeId BattlegroundMgr::GetBattleMasterBG ( uint32  entry) const
inline
128 {
129 BattleMastersMap::const_iterator itr = mBattleMastersMap.find(entry);
130 if (itr != mBattleMastersMap.end())
131 return itr->second;
133 }

References BATTLEGROUND_TYPE_NONE, and mBattleMastersMap.

◆ GetBGFreeSlotQueueStore()

BGFreeSlotQueueContainer & BattlegroundMgr::GetBGFreeSlotQueueStore ( BattlegroundTypeId  bgTypeId)
932{
933 return bgDataStore[bgTypeId].BGFreeSlotQueue;
934}

References bgDataStore.

◆ GetMaxRatingDifference()

uint32 BattlegroundMgr::GetMaxRatingDifference ( ) const
769{
771
772 if (diff == 0)
773 {
774 diff = 5000;
775 }
776
777 return diff;
778}
@ CONFIG_ARENA_MAX_RATING_DIFFERENCE
Definition: IWorld.h:326

References CONFIG_ARENA_MAX_RATING_DIFFERENCE, and sWorld.

◆ GetPrematureFinishTime()

uint32 BattlegroundMgr::GetPrematureFinishTime ( ) const
786{
788}
@ CONFIG_BATTLEGROUND_PREMATURE_FINISH_TIMER
Definition: IWorld.h:314

References CONFIG_BATTLEGROUND_PREMATURE_FINISH_TIMER, and sWorld.

◆ GetRandomBG()

BattlegroundTypeId BattlegroundMgr::GetRandomBG ( BattlegroundTypeId  id,
uint32  minLevel 
)
private
902{
903 if (BattlegroundTemplate const* bgTemplate = GetBattlegroundTemplateByTypeId(bgTypeId))
904 {
905 std::vector<BattlegroundTypeId> ids;
906 ids.reserve(16);
907 std::vector<double> weights;
908 weights.reserve(16);
909
910 for (int32 mapId : bgTemplate->BattlemasterEntry->mapid)
911 {
912 if (mapId == -1)
913 break;
914
916 {
917 if (bg->MinLevel <= minLevel)
918 {
919 ids.push_back(bg->Id);
920 weights.push_back(bg->Weight);
921 }
922 }
923 }
924
926 }
927
929}
auto SelectRandomWeightedContainerElement(C const &container, std::vector< double > weights) -> decltype(std::begin(container))
Definition: Containers.h:165
Definition: BattlegroundMgr.h:48
BattlegroundTemplate const * GetBattlegroundTemplateByMapId(uint32 mapId)
Definition: BattlegroundMgr.h:171
BattlegroundTemplate const * GetBattlegroundTemplateByTypeId(BattlegroundTypeId id)
Definition: BattlegroundMgr.h:162

References BATTLEGROUND_TYPE_NONE, GetBattlegroundTemplateByMapId(), GetBattlegroundTemplateByTypeId(), and Acore::Containers::SelectRandomWeightedContainerElement().

Referenced by CreateNewBattleground().

◆ GetRatingDiscardTimer()

uint32 BattlegroundMgr::GetRatingDiscardTimer ( ) const
781{
782 return sWorld->getIntConfig(CONFIG_ARENA_RATING_DISCARD_TIMER);
783}
@ CONFIG_ARENA_RATING_DISCARD_TIMER
Definition: IWorld.h:327

References CONFIG_ARENA_RATING_DISCARD_TIMER, and sWorld.

◆ InitAutomaticArenaPointDistribution()

void BattlegroundMgr::InitAutomaticArenaPointDistribution ( )
548{
549 if (!sWorld->getBoolConfig(CONFIG_ARENA_AUTO_DISTRIBUTE_POINTS))
550 return;
551
552 Seconds wstime = Seconds(sWorld->getWorldState(WS_ARENA_DISTRIBUTION_TIME));
553 Seconds curtime = GameTime::GetGameTime();
554
555 LOG_INFO("server.loading", "Initializing Automatic Arena Point Distribution");
556
557 if (wstime < curtime)
558 {
559 m_NextAutoDistributionTime = curtime; // reset will be called in the next update
560 LOG_INFO("server.loading", "Next arena point distribution time in the past, reseting it now.");
561 }
562 else
563 {
565 }
566
567 LOG_INFO("server.loading", "Automatic Arena Point Distribution initialized.");
568}
#define LOG_INFO(filterType__,...)
Definition: Log.h:164
std::chrono::seconds Seconds
Seconds shorthand typedef.
Definition: Duration.h:30
@ CONFIG_ARENA_AUTO_DISTRIBUTE_POINTS
Definition: IWorld.h:123
@ WS_ARENA_DISTRIBUTION_TIME
Definition: World.h:134
Seconds GetGameTime()
Definition: GameTime.cpp:38

References CONFIG_ARENA_AUTO_DISTRIBUTE_POINTS, GameTime::GetGameTime(), LOG_INFO, m_NextAutoDistributionTime, sWorld, and WS_ARENA_DISTRIBUTION_TIME.

◆ instance()

BattlegroundMgr * BattlegroundMgr::instance ( )
static
76{
78 return &instance;
79}
Definition: BattlegroundMgr.h:64
static BattlegroundMgr * instance()
Definition: BattlegroundMgr.cpp:75

References instance().

Referenced by instance().

◆ isArenaTesting()

bool BattlegroundMgr::isArenaTesting ( ) const
inline
109{ return m_ArenaTesting; }

References m_ArenaTesting.

◆ IsArenaType()

bool BattlegroundMgr::IsArenaType ( BattlegroundTypeId  bgTypeId)
static
663{
664 return bgTypeId == BATTLEGROUND_AA
665 || bgTypeId == BATTLEGROUND_BE
666 || bgTypeId == BATTLEGROUND_NA
667 || bgTypeId == BATTLEGROUND_DS
668 || bgTypeId == BATTLEGROUND_RV
669 || bgTypeId == BATTLEGROUND_RL;
670}
@ BATTLEGROUND_BE
Definition: SharedDefines.h:3485
@ BATTLEGROUND_RV
Definition: SharedDefines.h:3491
@ BATTLEGROUND_NA
Definition: SharedDefines.h:3484
@ BATTLEGROUND_DS
Definition: SharedDefines.h:3490
@ BATTLEGROUND_RL
Definition: SharedDefines.h:3488

References BATTLEGROUND_AA, BATTLEGROUND_BE, BATTLEGROUND_DS, BATTLEGROUND_NA, BATTLEGROUND_RL, and BATTLEGROUND_RV.

Referenced by CreateClientVisibleInstanceId().

◆ IsBGWeekend()

bool BattlegroundMgr::IsBGWeekend ( BattlegroundTypeId  bgTypeId)
static
897{
899}
bool IsHolidayActive(HolidayIds id)
Definition: GameEventMgr.cpp:1910
static HolidayIds BGTypeToWeekendHolidayId(BattlegroundTypeId bgTypeId)
Definition: BattlegroundMgr.cpp:854

References BGTypeToWeekendHolidayId(), and IsHolidayActive().

Referenced by Battleground::EndBattleground(), BattlegroundAB::Init(), BattlegroundEY::Init(), and Player::SendBGWeekendWorldStates().

◆ isTesting()

bool BattlegroundMgr::isTesting ( ) const
inline
110{ return m_Testing; }

References m_Testing.

◆ LoadBattlegroundTemplates()

void BattlegroundMgr::LoadBattlegroundTemplates ( )
449{
450 uint32 oldMSTime = getMSTime();
451
454
455 // 0 1 2 3 4 5 6 7 8 9 10 11
456 QueryResult result = WorldDatabase.Query("SELECT ID, MinPlayersPerTeam, MaxPlayersPerTeam, MinLvl, MaxLvl, AllianceStartLoc, AllianceStartO, HordeStartLoc, HordeStartO, StartMaxDist, Weight, ScriptName FROM battleground_template");
457
458 if (!result)
459 {
460 LOG_ERROR("bg.battleground", ">> Loaded 0 battlegrounds. DB table `battleground_template` is empty.");
461 return;
462 }
463
464 do
465 {
466 Field* fields = result->Fetch();
467
468 BattlegroundTypeId bgTypeId = static_cast<BattlegroundTypeId>(fields[0].Get<uint32>());
469
471 continue;
472
473 // can be overwrite by values from DB
474 BattlemasterListEntry const* bl = sBattlemasterListStore.LookupEntry(bgTypeId);
475 if (!bl)
476 {
477 LOG_ERROR("bg.battleground", "Battleground ID {} not found in BattlemasterList.dbc. Battleground not created.", bgTypeId);
478 continue;
479 }
480
481 BattlegroundTemplate bgTemplate;
482 bgTemplate.Id = bgTypeId;
483 bgTemplate.MinPlayersPerTeam = fields[1].Get<uint16>();
484 bgTemplate.MaxPlayersPerTeam = fields[2].Get<uint16>();
485 bgTemplate.MinLevel = fields[3].Get<uint8>();
486 bgTemplate.MaxLevel = fields[4].Get<uint8>();
487 float dist = fields[9].Get<float>();
488 bgTemplate.MaxStartDistSq = dist * dist;
489 bgTemplate.Weight = fields[10].Get<uint8>();
490 bgTemplate.ScriptId = sObjectMgr->GetScriptId(fields[11].Get<std::string>());
491 bgTemplate.BattlemasterEntry = bl;
492
493 if (bgTemplate.MaxPlayersPerTeam == 0 || bgTemplate.MinPlayersPerTeam > bgTemplate.MaxPlayersPerTeam)
494 {
495 LOG_ERROR("sql.sql", "Table `battleground_template` for id {} contains bad values for MinPlayersPerTeam ({}) and MaxPlayersPerTeam({}).",
496 bgTemplate.Id, bgTemplate.MinPlayersPerTeam, bgTemplate.MaxPlayersPerTeam);
497
498 continue;
499 }
500
501 if (bgTemplate.MinLevel == 0 || bgTemplate.MaxLevel == 0 || bgTemplate.MinLevel > bgTemplate.MaxLevel)
502 {
503 LOG_ERROR("sql.sql", "Table `battleground_template` for id {} has bad values for LevelMin ({}) and LevelMax({})",
504 bgTemplate.Id, bgTemplate.MinLevel, bgTemplate.MaxLevel);
505 continue;
506 }
507
508 if (bgTemplate.Id != BATTLEGROUND_AA && bgTemplate.Id != BATTLEGROUND_RB)
509 {
510 uint32 startId = fields[5].Get<uint32>();
511 if (GraveyardStruct const* start = sGraveyard->GetGraveyard(startId))
512 {
513 bgTemplate.StartLocation[TEAM_ALLIANCE].Relocate(start->x, start->y, start->z, fields[6].Get<float>());
514 }
515 else
516 {
517 LOG_ERROR("sql.sql", "Table `battleground_template` for id {} contains a non-existing WorldSafeLocs.dbc id {} in field `AllianceStartLoc`. BG not created.", bgTemplate.Id, startId);
518 continue;
519 }
520
521 startId = fields[7].Get<uint32>();
522 if (GraveyardStruct const* start = sGraveyard->GetGraveyard(startId))
523 {
524 bgTemplate.StartLocation[TEAM_HORDE].Relocate(start->x, start->y, start->z, fields[8].Get<float>());
525 }
526 else
527 {
528 LOG_ERROR("sql.sql", "Table `battleground_template` for id {} contains a non-existing WorldSafeLocs.dbc id {} in field `HordeStartLoc`. BG not created.", bgTemplate.Id, startId);
529 continue;
530 }
531 }
532
533 if (!CreateBattleground(&bgTemplate))
534 continue;
535
536 _battlegroundTemplates[bgTypeId] = bgTemplate;
537
538 if (bgTemplate.BattlemasterEntry->mapid[1] == -1) // in this case we have only one mapId
540
541 } while (result->NextRow());
542
543 LOG_INFO("server.loading", ">> Loaded {} battlegrounds in {} ms", _battlegroundTemplates.size(), GetMSTimeDiffToNow(oldMSTime));
544 LOG_INFO("server.loading", " ");
545}
uint32 GetMSTimeDiffToNow(uint32 oldMSTime)
Definition: Timer.h:131
uint32 getMSTime()
Definition: Timer.h:103
@ DISABLE_TYPE_BATTLEGROUND
Definition: DisableMgr.h:32
#define sGraveyard
Definition: GameGraveyard.h:75
DBCStorage< BattlemasterListEntry > sBattlemasterListStore(BattlemasterListEntryfmt)
std::shared_ptr< ResultSet > QueryResult
Definition: DatabaseEnvFwd.h:28
DatabaseWorkerPool< WorldDatabaseConnection > WorldDatabase
Accessor to the world database.
Definition: DatabaseEnv.cpp:20
bool IsDisabledFor(DisableType type, uint32 entry, Unit const *unit, uint8 flags)
Definition: DisableMgr.cpp:306
Class used to access individual fields of database query result.
Definition: Field.h:99
std::enable_if_t< std::is_arithmetic_v< T >, T > Get() const
Definition: Field.h:113
BattlegroundTypeId Id
Definition: BattlegroundMgr.h:49
uint16 MaxPlayersPerTeam
Definition: BattlegroundMgr.h:51
uint8 MinLevel
Definition: BattlegroundMgr.h:52
BattlemasterListEntry const * BattlemasterEntry
Definition: BattlegroundMgr.h:58
float MaxStartDistSq
Definition: BattlegroundMgr.h:55
uint8 MaxLevel
Definition: BattlegroundMgr.h:53
std::array< Position, PVP_TEAMS_COUNT > StartLocation
Definition: BattlegroundMgr.h:54
uint32 ScriptId
Definition: BattlegroundMgr.h:57
uint8 Weight
Definition: BattlegroundMgr.h:56
uint16 MinPlayersPerTeam
Definition: BattlegroundMgr.h:50
bool CreateBattleground(BattlegroundTemplate const *bgTemplate)
Definition: BattlegroundMgr.cpp:415
Definition: GameGraveyard.h:28
Definition: DBCStructure.h:604
int32 mapid[8]
Definition: DBCStructure.h:606

References _battlegroundMapTemplates, _battlegroundTemplates, BATTLEGROUND_AA, BATTLEGROUND_RB, BattlegroundTemplate::BattlemasterEntry, CreateBattleground(), DISABLE_TYPE_BATTLEGROUND, Field::Get(), getMSTime(), GetMSTimeDiffToNow(), BattlegroundTemplate::Id, DisableMgr::IsDisabledFor(), LOG_ERROR, LOG_INFO, BattlemasterListEntry::mapid, BattlegroundTemplate::MaxLevel, BattlegroundTemplate::MaxPlayersPerTeam, BattlegroundTemplate::MaxStartDistSq, BattlegroundTemplate::MinLevel, BattlegroundTemplate::MinPlayersPerTeam, sBattlemasterListStore, BattlegroundTemplate::ScriptId, sGraveyard, sObjectMgr, BattlegroundTemplate::StartLocation, TEAM_ALLIANCE, TEAM_HORDE, BattlegroundTemplate::Weight, and WorldDatabase.

◆ LoadBattleMastersEntry()

void BattlegroundMgr::LoadBattleMastersEntry ( )
791{
792 uint32 oldMSTime = getMSTime();
793
794 mBattleMastersMap.clear(); // need for reload case
795
796 QueryResult result = WorldDatabase.Query("SELECT entry, bg_template FROM battlemaster_entry");
797
798 if (!result)
799 {
800 LOG_WARN("server.loading", ">> Loaded 0 battlemaster entries. DB table `battlemaster_entry` is empty!");
801 LOG_INFO("server.loading", " ");
802 return;
803 }
804
805 uint32 count = 0;
806
807 do
808 {
809 ++count;
810
811 Field* fields = result->Fetch();
812
813 uint32 entry = fields[0].Get<uint32>();
814 if (CreatureTemplate const* cInfo = sObjectMgr->GetCreatureTemplate(entry))
815 {
816 if ((cInfo->npcflag & UNIT_NPC_FLAG_BATTLEMASTER) == 0)
817 LOG_ERROR("sql.sql", "Creature (Entry: {}) listed in `battlemaster_entry` is not a battlemaster.", entry);
818 }
819 else
820 {
821 LOG_ERROR("sql.sql", "Creature (Entry: {}) listed in `battlemaster_entry` does not exist.", entry);
822 continue;
823 }
824
825 uint32 bgTypeId = fields[1].Get<uint32>();
826 if (!sBattlemasterListStore.LookupEntry(bgTypeId))
827 {
828 LOG_ERROR("sql.sql", "Table `battlemaster_entry` contain entry {} for not existed battleground type {}, ignored.", entry, bgTypeId);
829 continue;
830 }
831
832 mBattleMastersMap[entry] = BattlegroundTypeId(bgTypeId);
833 } while (result->NextRow());
834
836
837 LOG_INFO("server.loading", ">> Loaded {} battlemaster entries in {} ms", count, GetMSTimeDiffToNow(oldMSTime));
838 LOG_INFO("server.loading", " ");
839}
#define LOG_WARN(filterType__,...)
Definition: Log.h:160
void CheckBattleMasters()
Definition: BattlegroundMgr.cpp:841

References CheckBattleMasters(), Field::Get(), getMSTime(), GetMSTimeDiffToNow(), LOG_ERROR, LOG_INFO, LOG_WARN, mBattleMastersMap, sBattlemasterListStore, sObjectMgr, UNIT_NPC_FLAG_BATTLEMASTER, and WorldDatabase.

◆ RemoveBattleground()

void BattlegroundMgr::RemoveBattleground ( BattlegroundTypeId  bgTypeId,
uint32  instanceId 
)
961{
962 bgDataStore[bgTypeId]._Battlegrounds.erase(instanceId);
963}

References bgDataStore.

◆ RemoveFromBGFreeSlotQueue()

void BattlegroundMgr::RemoveFromBGFreeSlotQueue ( BattlegroundTypeId  bgTypeId,
uint32  instanceId 
)
942{
943 BGFreeSlotQueueContainer& queues = bgDataStore[bgTypeId].BGFreeSlotQueue;
944 for (BGFreeSlotQueueContainer::iterator itr = queues.begin(); itr != queues.end(); ++itr)
945 if ((*itr)->GetInstanceID() == instanceId)
946 {
947 queues.erase(itr);
948 return;
949 }
950}
std::list< Battleground * > BGFreeSlotQueueContainer
Definition: BattlegroundMgr.h:38

References bgDataStore.

◆ ScheduleQueueUpdate()

void BattlegroundMgr::ScheduleQueueUpdate ( uint32  arenaMatchmakerRating,
uint8  arenaType,
BattlegroundQueueTypeId  bgQueueTypeId,
BattlegroundTypeId  bgTypeId,
BattlegroundBracketId  bracket_id 
)
760{
761 //This method must be atomic, @todo add mutex
762 //we will use only 1 number created of bgTypeId and bracket_id
763 uint64 const scheduleId = ((uint64)arenaMatchmakerRating << 32) | ((uint64)arenaType << 24) | ((uint64)bgQueueTypeId << 16) | ((uint64)bgTypeId << 8) | (uint64)bracket_id;
764 if (std::find(m_QueueUpdateScheduler.begin(), m_QueueUpdateScheduler.end(), scheduleId) == m_QueueUpdateScheduler.end())
765 m_QueueUpdateScheduler.emplace_back(scheduleId);
766}
std::vector< uint64 > m_QueueUpdateScheduler
Definition: BattlegroundMgr.h:154

References m_QueueUpdateScheduler.

◆ SendAreaSpiritHealerQueryOpcode()

void BattlegroundMgr::SendAreaSpiritHealerQueryOpcode ( Player player,
Battleground bg,
ObjectGuid  guid 
)
653{
655 uint32 time_ = RESURRECTION_INTERVAL - bg->GetLastResurrectTime(); // resurrect every X seconds
656 if (time_ == uint32(-1))
657 time_ = 0;
658 data << guid << time_;
659 player->GetSession()->SendPacket(&data);
660}
#define RESURRECTION_INTERVAL
Definition: Battleground.h:167
@ SMSG_AREA_SPIRIT_HEALER_TIME
Definition: Opcodes.h:770
uint32 GetLastResurrectTime() const
Definition: Battleground.h:331
WorldSession * GetSession() const
Definition: Player.h:1978
Definition: WorldPacket.h:27
void SendPacket(WorldPacket const *packet)
Send a packet to the client.
Definition: WorldSession.cpp:214

References Battleground::GetLastResurrectTime(), Player::GetSession(), RESURRECTION_INTERVAL, WorldSession::SendPacket(), and SMSG_AREA_SPIRIT_HEALER_TIME.

◆ SendToBattleground()

void BattlegroundMgr::SendToBattleground ( Player player,
uint32  InstanceID,
BattlegroundTypeId  bgTypeId 
)
637{
638 if (Battleground* bg = GetBattleground(instanceId, bgTypeId))
639 {
640 uint32 mapid = bg->GetMapId();
641 Position const* pos = bg->GetTeamStartPosition(player->GetBgTeamId());
642
643 LOG_DEBUG("bg.battleground", "BattlegroundMgr::SendToBattleground: Sending {} to map {}, {} (bgType {})", player->GetName(), mapid, pos->ToString(), bgTypeId);
644 player->TeleportTo(mapid, pos->GetPositionX(), pos->GetPositionY(), pos->GetPositionZ(), pos->GetOrientation());
645 }
646 else
647 {
648 LOG_ERROR("bg.battleground", "BattlegroundMgr::SendToBattleground: Instance {} (bgType {}) not found while trying to teleport player {}", instanceId, bgTypeId, player->GetName());
649 }
650}
#define LOG_DEBUG(filterType__,...)
Definition: Log.h:168
std::string const & GetName() const
Definition: Object.h:458
Definition: Position.h:28
std::string ToString() const
Definition: Position.cpp:51
float GetPositionZ() const
Definition: Position.h:119
float GetOrientation() const
Definition: Position.h:120
float GetPositionX() const
Definition: Position.h:117
float GetPositionY() const
Definition: Position.h:118
bool TeleportTo(uint32 mapid, float x, float y, float z, float orientation, uint32 options=0, Unit *target=nullptr, bool newInstance=false)
Definition: Player.cpp:1330
TeamId GetBgTeamId() const
Definition: Player.h:2258

References GetBattleground(), Player::GetBgTeamId(), WorldObject::GetName(), Position::GetOrientation(), Position::GetPositionX(), Position::GetPositionY(), Position::GetPositionZ(), LOG_DEBUG, LOG_ERROR, Player::TeleportTo(), and Position::ToString().

◆ SetHolidayWeekends()

void BattlegroundMgr::SetHolidayWeekends ( uint32  mask)
749{
750 for (uint32 bgtype = 1; bgtype < MAX_BATTLEGROUND_TYPE_ID; ++bgtype)
751 {
752 if (bgtype == BATTLEGROUND_RB)
753 continue;
755 bgt->SetHoliday(mask & (1 << bgtype));
756 }
757}
#define MAX_BATTLEGROUND_TYPE_ID
Definition: SharedDefines.h:3496

References BATTLEGROUND_RB, GetBattlegroundTemplate(), and MAX_BATTLEGROUND_TYPE_ID.

◆ ToggleArenaTesting()

void BattlegroundMgr::ToggleArenaTesting ( )
735{
736 if (sWorld->getBoolConfig(CONFIG_DEBUG_ARENA))
737 {
738 m_ArenaTesting = true;
740 }
741 else
742 {
745 }
746}
@ CONFIG_DEBUG_ARENA
Definition: IWorld.h:169
@ LANG_DEBUG_ARENA_OFF
Definition: Language.h:709
@ LANG_DEBUG_ARENA_ON
Definition: Language.h:708
@ LANG_DEBUG_ARENA_CONF
Definition: Language.h:1327
Definition: Chat.h:39
void SendWorldText(std::string_view str)
Definition: Chat.cpp:133

References CONFIG_DEBUG_ARENA, LANG_DEBUG_ARENA_CONF, LANG_DEBUG_ARENA_OFF, LANG_DEBUG_ARENA_ON, m_ArenaTesting, ChatHandler::SendWorldText(), and sWorld.

◆ ToggleTesting()

void BattlegroundMgr::ToggleTesting ( )
721{
722 if (sWorld->getBoolConfig(CONFIG_DEBUG_BATTLEGROUND))
723 {
724 m_Testing = true;
726 }
727 else
728 {
731 }
732}
@ CONFIG_DEBUG_BATTLEGROUND
Definition: IWorld.h:168
@ LANG_DEBUG_BG_OFF
Definition: Language.h:711
@ LANG_DEBUG_BG_CONF
Definition: Language.h:1326
@ LANG_DEBUG_BG_ON
Definition: Language.h:710

References CONFIG_DEBUG_BATTLEGROUND, LANG_DEBUG_BG_CONF, LANG_DEBUG_BG_OFF, LANG_DEBUG_BG_ON, m_Testing, ChatHandler::SendWorldText(), and sWorld.

◆ Update()

void BattlegroundMgr::Update ( uint32  diff)
99{
100 // update all battlegrounds and delete if needed
101 for (auto& [_, bgData] : bgDataStore)
102 {
103 auto& bgList = bgData._Battlegrounds;
104 auto itrDelete = bgList.begin();
105
106 // first one is template and should not be deleted
107 for (BattlegroundContainer::iterator itr = ++itrDelete; itr != bgList.end();)
108 {
109 itrDelete = itr++;
110 Battleground* bg = itrDelete->second;
111
112 bg->Update(diff);
113 if (bg->ToBeDeleted())
114 {
115 itrDelete->second = nullptr;
116 bgList.erase(itrDelete);
117
118 BattlegroundClientIdsContainer& clients = bgData._ClientBattlegroundIds[bg->GetBracketId()];
119 if (!clients.empty())
120 clients.erase(bg->GetClientInstanceID());
121
122 delete bg;
123 }
124 }
125 }
126
127 // update events
128 for (uint8 qtype = BATTLEGROUND_QUEUE_NONE; qtype < MAX_BATTLEGROUND_QUEUE_TYPES; ++qtype)
129 m_BattlegroundQueues[qtype].UpdateEvents(diff);
130
131 // update using scheduled tasks (used only for rated arenas, initial opponent search works differently than periodic queue update)
132 if (!m_QueueUpdateScheduler.empty())
133 {
134 std::vector<uint64> scheduled;
135 std::swap(scheduled, m_QueueUpdateScheduler);
136
137 for (uint8 i = 0; i < scheduled.size(); i++)
138 {
139 uint32 arenaMMRating = scheduled[i] >> 32;
140 uint8 arenaType = scheduled[i] >> 24 & 255;
141 BattlegroundQueueTypeId bgQueueTypeId = BattlegroundQueueTypeId(scheduled[i] >> 16 & 255);
142 BattlegroundTypeId bgTypeId = BattlegroundTypeId((scheduled[i] >> 8) & 255);
143 BattlegroundBracketId bracket_id = BattlegroundBracketId(scheduled[i] & 255);
144 m_BattlegroundQueues[bgQueueTypeId].BattlegroundQueueUpdate(diff, bgTypeId, bracket_id, arenaType, arenaMMRating > 0, arenaMMRating);
145 m_BattlegroundQueues[bgQueueTypeId].BattlegroundQueueAnnouncerUpdate(diff, bgQueueTypeId, bracket_id);
146 }
147 }
148
149 // periodic queue update
151 {
153
154 LOG_TRACE("bg.arena", "BattlegroundMgr: UPDATING ARENA QUEUES");
155
156 // for rated arenas
157 for (uint32 qtype = BATTLEGROUND_QUEUE_2v2; qtype < MAX_BATTLEGROUND_QUEUE_TYPES; ++qtype)
158 {
159 for (uint32 bracket = BG_BRACKET_ID_FIRST; bracket < MAX_BATTLEGROUND_BRACKETS; ++bracket)
160 {
162 }
163 }
164
165 for (uint32 qtype = BATTLEGROUND_QUEUE_AV; qtype < MAX_BATTLEGROUND_QUEUE_TYPES; ++qtype)
166 {
167 for (uint32 bracket = BG_BRACKET_ID_FIRST; bracket < MAX_BATTLEGROUND_BRACKETS; ++bracket)
168 {
170 }
171 }
172 }
173 else
175
176 // arena points auto-distribution
178 {
180 {
182 {
183 sArenaTeamMgr->DistributeArenaPoints();
186 }
187 m_AutoDistributionTimeChecker = 600000; // 10 minutes check
188 }
189 else
191 }
192}
constexpr auto DAY
Definition: Common.h:49
#define LOG_TRACE(filterType__,...)
Definition: Log.h:172
#define sArenaTeamMgr
Definition: ArenaTeamMgr.h:67
@ CONFIG_ARENA_AUTO_DISTRIBUTE_INTERVAL_DAYS
Definition: IWorld.h:329
@ BATTLEGROUND_QUEUE_2v2
Definition: SharedDefines.h:3628
@ BATTLEGROUND_QUEUE_AV
Definition: SharedDefines.h:3621
@ MAX_BATTLEGROUND_QUEUE_TYPES
Definition: SharedDefines.h:3631
@ BG_BRACKET_ID_FIRST
Definition: DBCEnums.h:47
#define MAX_BATTLEGROUND_BRACKETS
Definition: DBCEnums.h:52
bool ToBeDeleted() const
Definition: Battleground.h:553
void Update(uint32 diff)
Definition: Battleground.cpp:242
BattlegroundBracketId GetBracketId() const
Definition: Battleground.h:325
static uint8 BGArenaType(BattlegroundQueueTypeId bgQueueTypeId)
Definition: BattlegroundMgr.cpp:706
void BattlegroundQueueUpdate(uint32 diff, BattlegroundTypeId bgTypeId, BattlegroundBracketId bracket_id, uint8 arenaType, bool isRated, uint32 arenaRating)
Definition: BattlegroundQueue.cpp:705
void BattlegroundQueueAnnouncerUpdate(uint32 diff, BattlegroundQueueTypeId bgQueueTypeId, BattlegroundBracketId bracket_id)
Definition: BattlegroundQueue.cpp:958

References BATTLEGROUND_AA, BATTLEGROUND_QUEUE_2v2, BATTLEGROUND_QUEUE_AV, BATTLEGROUND_QUEUE_NONE, BattlegroundQueue::BattlegroundQueueAnnouncerUpdate(), BattlegroundQueue::BattlegroundQueueUpdate(), BG_BRACKET_ID_FIRST, BGArenaType(), bgDataStore, CONFIG_ARENA_AUTO_DISTRIBUTE_INTERVAL_DAYS, CONFIG_ARENA_AUTO_DISTRIBUTE_POINTS, DAY, Battleground::GetBracketId(), Battleground::GetClientInstanceID(), GameTime::GetGameTime(), IN_MILLISECONDS, LOG_TRACE, m_AutoDistributionTimeChecker, m_BattlegroundQueues, m_NextAutoDistributionTime, m_NextPeriodicQueueUpdateTime, m_QueueUpdateScheduler, MAX_BATTLEGROUND_BRACKETS, MAX_BATTLEGROUND_QUEUE_TYPES, sArenaTeamMgr, sWorld, Battleground::ToBeDeleted(), Battleground::Update(), and WS_ARENA_DISTRIBUTION_TIME.

◆ WeekendHolidayIdToBGType()

Member Data Documentation

◆ _battlegroundMapTemplates

BattlegroundMapTemplateContainer BattlegroundMgr::_battlegroundMapTemplates
private

◆ _battlegroundTemplates

BattlegroundTemplateMap BattlegroundMgr::_battlegroundTemplates
private

◆ ArenaTypeToQueue

std::unordered_map< uint32, BattlegroundQueueTypeId > BattlegroundMgr::ArenaTypeToQueue
static
Initial value:
=
{
}
@ ARENA_TYPE_5v5
Definition: Battleground.h:214
@ ARENA_TYPE_3v3
Definition: Battleground.h:213
@ ARENA_TYPE_2v2
Definition: Battleground.h:212
@ BATTLEGROUND_QUEUE_5v5
Definition: SharedDefines.h:3630
@ BATTLEGROUND_QUEUE_3v3
Definition: SharedDefines.h:3629

Referenced by BGQueueTypeId().

◆ bgDataStore

◆ bgToQueue

std::unordered_map< int, BattlegroundQueueTypeId > BattlegroundMgr::bgToQueue
static
Initial value:
=
{
}
@ BATTLEGROUND_QUEUE_RB
Definition: SharedDefines.h:3627
@ BATTLEGROUND_QUEUE_SA
Definition: SharedDefines.h:3625
@ BATTLEGROUND_QUEUE_AB
Definition: SharedDefines.h:3623
@ BATTLEGROUND_QUEUE_WS
Definition: SharedDefines.h:3622
@ BATTLEGROUND_QUEUE_EY
Definition: SharedDefines.h:3624
@ BATTLEGROUND_QUEUE_IC
Definition: SharedDefines.h:3626

Referenced by BGQueueTypeId().

◆ bgtypeToBattleground

std::unordered_map< int, Battleground * > BattlegroundMgr::bgtypeToBattleground
static
Initial value:
=
{
}
Definition: BattlegroundAB.h:291
Definition: BattlegroundAV.h:1783
Definition: BattlegroundBE.h:47
Definition: BattlegroundDS.h:94
Definition: BattlegroundEY.h:380
Definition: BattlegroundIC.h:952
Definition: BattlegroundNA.h:47
Definition: BattlegroundRL.h:43
Definition: BattlegroundRV.h:86
Class for manage Strand of Ancient battleground.
Definition: BattlegroundSA.h:456
Definition: BattlegroundWS.h:220

Referenced by CreateBattleground().

◆ bgTypeToTemplate

std::unordered_map< int, bgRef > BattlegroundMgr::bgTypeToTemplate
static
Initial value:
=
{
{ BATTLEGROUND_AV, [](Battleground * bg_t) -> Battleground* { return new BattlegroundAV(*(BattlegroundAV*)bg_t); } },
{ BATTLEGROUND_WS, [](Battleground * bg_t) -> Battleground* { return new BattlegroundWS(*(BattlegroundWS*)bg_t); } },
{ BATTLEGROUND_AB, [](Battleground * bg_t) -> Battleground* { return new BattlegroundAB(*(BattlegroundAB*)bg_t); } },
{ BATTLEGROUND_NA, [](Battleground * bg_t) -> Battleground* { return new BattlegroundNA(*(BattlegroundNA*)bg_t); } },
{ BATTLEGROUND_BE, [](Battleground * bg_t) -> Battleground* { return new BattlegroundBE(*(BattlegroundBE*)bg_t); } },
{ BATTLEGROUND_EY, [](Battleground * bg_t) -> Battleground* { return new BattlegroundEY(*(BattlegroundEY*)bg_t); } },
{ BATTLEGROUND_RL, [](Battleground * bg_t) -> Battleground* { return new BattlegroundRL(*(BattlegroundRL*)bg_t); } },
{ BATTLEGROUND_SA, [](Battleground * bg_t) -> Battleground* { return new BattlegroundSA(*(BattlegroundSA*)bg_t); } },
{ BATTLEGROUND_DS, [](Battleground * bg_t) -> Battleground* { return new BattlegroundDS(*(BattlegroundDS*)bg_t); } },
{ BATTLEGROUND_RV, [](Battleground * bg_t) -> Battleground* { return new BattlegroundRV(*(BattlegroundRV*)bg_t); } },
{ BATTLEGROUND_IC, [](Battleground * bg_t) -> Battleground* { return new BattlegroundIC(*(BattlegroundIC*)bg_t); } },
{ BATTLEGROUND_RB, [](Battleground * bg_t) -> Battleground* { return new Battleground(*bg_t); }, },
{ BATTLEGROUND_AA, [](Battleground * bg_t) -> Battleground* { return new Battleground(*bg_t); }, },
}

Referenced by CreateNewBattleground().

◆ getBgFromMap

std::unordered_map< int, bgMapRef > BattlegroundMgr::getBgFromMap = {}
static

◆ getBgFromTypeID

std::unordered_map< int, bgTypeRef > BattlegroundMgr::getBgFromTypeID
static
Initial value:
=
{
{
[](WorldPacket * data, Battleground::BattlegroundScoreMap::const_iterator itr2, Battleground * bg)
{
{
*data << uint32(0);
}
else
{
BattlegroundMgr::getBgFromMap[bg->GetMapId()](data, itr2);
}
}
}
}
static std::unordered_map< int, bgMapRef > getBgFromMap
Definition: BattlegroundMgr.h:139

◆ m_ArenaTesting

bool BattlegroundMgr::m_ArenaTesting
private

◆ m_AutoDistributionTimeChecker

uint32 BattlegroundMgr::m_AutoDistributionTimeChecker
private

Referenced by Update().

◆ m_BattlegroundQueues

BattlegroundQueue BattlegroundMgr::m_BattlegroundQueues[MAX_BATTLEGROUND_QUEUE_TYPES]
private

Referenced by GetBattlegroundQueue(), and Update().

◆ m_NextAutoDistributionTime

Seconds BattlegroundMgr::m_NextAutoDistributionTime
private

◆ m_NextPeriodicQueueUpdateTime

uint32 BattlegroundMgr::m_NextPeriodicQueueUpdateTime
private

Referenced by Update().

◆ m_QueueUpdateScheduler

std::vector<uint64> BattlegroundMgr::m_QueueUpdateScheduler
private

Referenced by ScheduleQueueUpdate(), and Update().

◆ m_Testing

bool BattlegroundMgr::m_Testing
private

Referenced by isTesting(), and ToggleTesting().

◆ mBattleMastersMap

BattleMastersMap BattlegroundMgr::mBattleMastersMap
private

◆ QueueToArenaType

std::unordered_map< uint32, ArenaType > BattlegroundMgr::QueueToArenaType
static

◆ queueToBg