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
60 :
61 m_ArenaTesting(false),
62 m_Testing(false),
66{
67}
constexpr auto IN_MILLISECONDS
Definition: Common.h:62
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
70{
72}
void DeleteAllBattlegrounds()
Definition: BattlegroundMgr.cpp:80

References DeleteAllBattlegrounds().

Member Function Documentation

◆ AddBattleground()

void BattlegroundMgr::AddBattleground ( Battleground bg)
952{
953 if (bg)
954 bgDataStore[bg->GetBgTypeID()]._Battlegrounds[bg->GetInstanceID()] = bg;
955
956 sScriptMgr->OnBattlegroundCreate(bg);
957}
#define sScriptMgr
Definition: ScriptMgr.h:2702
uint32 GetInstanceID() const
Definition: Battleground.h:321
BattlegroundTypeId GetBgTypeID(bool GetRandom=false) const
Definition: Battleground.h:319
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 
)
936{
937 bgDataStore[bgTypeId].BGFreeSlotQueue.push_front(bg);
938}

References bgDataStore.

◆ BGArenaType()

uint8 BattlegroundMgr::BGArenaType ( BattlegroundQueueTypeId  bgQueueTypeId)
static
706{
707 uint8 arenaType = 0;
708
710 {
711 arenaType = BattlegroundMgr::QueueToArenaType.at(bgQueueTypeId);
712 }
713
714 sScriptMgr->OnArenaQueueIdToArenaType(bgQueueTypeId, arenaType);
715
716 return arenaType;
717}
std::uint8_t uint8
Definition: Define.h:110
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
672{
673 uint32 queueTypeID = BATTLEGROUND_QUEUE_NONE;
674
675 if (arenaType)
676 {
678 {
679 queueTypeID = BattlegroundMgr::ArenaTypeToQueue.at(arenaType);
680 }
681
682 sScriptMgr->OnArenaTypeIDToQueueID(bgTypeId, arenaType, queueTypeID);
683
684 return static_cast<BattlegroundQueueTypeId>(queueTypeID);
685 }
686
687 if (BattlegroundMgr::bgToQueue.find(bgTypeId) != BattlegroundMgr::bgToQueue.end())
688 {
689 queueTypeID = BattlegroundMgr::bgToQueue.at(bgTypeId);
690 }
691
692 return static_cast<BattlegroundQueueTypeId>(queueTypeID);
693}
std::uint32_t uint32
Definition: Define.h:108
BattlegroundQueueTypeId
Definition: SharedDefines.h:3591
@ BATTLEGROUND_QUEUE_NONE
Definition: SharedDefines.h:3592
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
696{
697 if (BattlegroundMgr::queueToBg.find(bgQueueTypeId) == BattlegroundMgr::queueToBg.end())
698 {
699 return BattlegroundTypeId(0);
700 }
701
702 return BattlegroundMgr::queueToBg[bgQueueTypeId];
703}
BattlegroundTypeId
Definition: SharedDefines.h:3451
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
854{
855 switch (bgTypeId)
856 {
857 case BATTLEGROUND_AV:
859 case BATTLEGROUND_EY:
861 case BATTLEGROUND_WS:
863 case BATTLEGROUND_SA:
865 case BATTLEGROUND_AB:
867 case BATTLEGROUND_IC:
869 default:
870 return HOLIDAY_NONE;
871 }
872}
@ BATTLEGROUND_IC
Definition: SharedDefines.h:3464
@ BATTLEGROUND_WS
Definition: SharedDefines.h:3454
@ BATTLEGROUND_EY
Definition: SharedDefines.h:3459
@ BATTLEGROUND_AV
Definition: SharedDefines.h:3453
@ BATTLEGROUND_SA
Definition: SharedDefines.h:3461
@ BATTLEGROUND_AB
Definition: SharedDefines.h:3455
@ HOLIDAY_NONE
Definition: SharedDefines.h:2714
@ HOLIDAY_CALL_TO_ARMS_AB
Definition: SharedDefines.h:2722
@ HOLIDAY_CALL_TO_ARMS_EY
Definition: SharedDefines.h:2729
@ HOLIDAY_CALL_TO_ARMS_SA
Definition: SharedDefines.h:2735
@ HOLIDAY_CALL_TO_ARMS_IC
Definition: SharedDefines.h:2739
@ HOLIDAY_CALL_TO_ARMS_AV
Definition: SharedDefines.h:2720
@ HOLIDAY_CALL_TO_ARMS_WS
Definition: SharedDefines.h:2721

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 
)
570{
571 if (!player)
572 return;
573
574 uint32 winner_kills = player->GetRandomWinner() ? sWorld->getIntConfig(CONFIG_BG_REWARD_WINNER_HONOR_LAST) : sWorld->getIntConfig(CONFIG_BG_REWARD_WINNER_HONOR_FIRST);
575 uint32 winner_arena = player->GetRandomWinner() ? sWorld->getIntConfig(CONFIG_BG_REWARD_WINNER_ARENA_LAST) : sWorld->getIntConfig(CONFIG_BG_REWARD_WINNER_ARENA_FIRST);
576 uint32 loser_kills = player->GetRandomWinner() ? sWorld->getIntConfig(CONFIG_BG_REWARD_LOSER_HONOR_LAST) : sWorld->getIntConfig(CONFIG_BG_REWARD_LOSER_HONOR_FIRST);
577
578 winner_kills = Acore::Honor::hk_honor_at_level(player->GetLevel(), float(winner_kills));
579 loser_kills = Acore::Honor::hk_honor_at_level(player->GetLevel(), float(loser_kills));
580
582 *data << guid; // battlemaster guid
583 *data << uint8(fromWhere); // from where you joined
584 *data << uint32(bgTypeId); // battleground id
585 *data << uint8(0); // unk
586 *data << uint8(0); // unk
587
588 // Rewards
589 *data << uint8(player->GetRandomWinner()); // 3.3.3 hasWin
590 *data << uint32(winner_kills); // 3.3.3 winHonor
591 *data << uint32(winner_arena); // 3.3.3 winArena
592 *data << uint32(loser_kills); // 3.3.3 lossHonor
593
594 uint8 isQueueRandom = (bgTypeId == BATTLEGROUND_RB);
595
596 *data << uint8(isQueueRandom); // 3.3.3 isRandom
597 if (isQueueRandom)
598 {
599 // Rewards (random)
600 *data << uint8(player->GetRandomWinner()); // 3.3.3 hasWin_Random
601 *data << uint32(winner_kills); // 3.3.3 winHonor_Random
602 *data << uint32(winner_arena); // 3.3.3 winArena_Random
603 *data << uint32(loser_kills); // 3.3.3 lossHonor_Random
604 }
605
606 if (bgTypeId == BATTLEGROUND_AA) // arena
607 *data << uint32(0); // unk (count?)
608 else // battleground
609 {
610 size_t count_pos = data->wpos();
611 *data << uint32(0); // number of bg instances
612
613 auto const& it = bgDataStore.find(bgTypeId);
614 if (it != bgDataStore.end())
615 {
616 // expected bracket entry
617 if (PvPDifficultyEntry const* bracketEntry = GetBattlegroundBracketByLevel(it->second._Battlegrounds.begin()->second->GetMapId(), player->GetLevel()))
618 {
619 uint32 count = 0;
620 BattlegroundBracketId bracketId = bracketEntry->GetBracketId();
621 BattlegroundClientIdsContainer& clientIds = it->second._ClientBattlegroundIds[bracketId];
622
623 for (auto const& itr : clientIds)
624 {
625 *data << uint32(itr);
626 ++count;
627 }
628
629 data->put<uint32>(count_pos, count);
630 }
631 }
632 }
633}
std::set< uint32 > BattlegroundClientIdsContainer
Definition: BattlegroundMgr.h:30
PvPDifficultyEntry const * GetBattlegroundBracketByLevel(uint32 mapid, uint32 level)
Definition: DBCStores.cpp:786
@ CONFIG_BG_REWARD_LOSER_HONOR_LAST
Definition: IWorld.h:389
@ CONFIG_BG_REWARD_WINNER_ARENA_FIRST
Definition: IWorld.h:385
@ CONFIG_BG_REWARD_WINNER_ARENA_LAST
Definition: IWorld.h:387
@ CONFIG_BG_REWARD_WINNER_HONOR_FIRST
Definition: IWorld.h:384
@ CONFIG_BG_REWARD_LOSER_HONOR_FIRST
Definition: IWorld.h:388
@ CONFIG_BG_REWARD_WINNER_HONOR_LAST
Definition: IWorld.h:386
BattlegroundBracketId
Definition: DBCEnums.h:52
@ BATTLEGROUND_AA
Definition: SharedDefines.h:3458
@ BATTLEGROUND_RB
Definition: SharedDefines.h:3465
@ SMSG_BATTLEFIELD_LIST
Definition: Opcodes.h:603
#define sWorld
Definition: World.h:451
uint32 hk_honor_at_level(uint8 level, float multiplier=1.0f)
Definition: Formulas.h:33
bool GetRandomWinner()
Definition: Player.h:2240
uint8 GetLevel() const
Definition: Unit.h:1420
void Initialize(uint16 opcode, size_t newres=200)
Definition: WorldPacket.h:69
Definition: DBCStructure.h:1414
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 
)
194{
195 // pussywizard:
196 //ASSERT(QueueSlot < PLAYER_MAX_BATTLEGROUND_QUEUES);
197
198 if (StatusID == STATUS_NONE || !bg)
199 {
201 *data << uint32(QueueSlot);
202 *data << uint64(0);
203 return;
204 }
205
206 data->Initialize(SMSG_BATTLEFIELD_STATUS, (4 + 8 + 1 + 1 + 4 + 1 + 4 + 4 + 4));
207 *data << uint32(QueueSlot);
208 // The following segment is read as uint64 in client but can be appended as their original type.
209 *data << uint8(arenatype);
210 *data << uint8(bg->isArena() ? 0xE : 0x0);
211 *data << uint32(forceBgTypeId != BATTLEGROUND_TYPE_NONE ? forceBgTypeId : bg->GetBgTypeID());
212 *data << uint16(0x1F90);
213 // End of uint64 segment, decomposed this way for simplicity
214 *data << uint8(bg->GetMinLevel());
215 *data << uint8(bg->GetMaxLevel());
216 *data << uint32(bg->GetClientInstanceID());
217
218 // following displays the minimap icon. 0 = faction icon, 1 = arenaicon
219 *data << uint8(bg->isRated() || isRated); // 1 for rated match, 0 for bg or non rated match
220
221 *data << uint32(StatusID); // status
222 switch (StatusID)
223 {
224 case STATUS_WAIT_QUEUE: // status_in_queue
225 *data << uint32(Time1); // average wait time, milliseconds
226 *data << uint32(Time2); // time in queue, updated every minute!, milliseconds
227 break;
228 case STATUS_WAIT_JOIN: // status_invite
229 *data << uint32(bg->GetMapId()); // map id
230 *data << uint64(0); // 3.3.5, unknown
231 *data << uint32(Time1); // time to remove from queue, milliseconds
232 break;
233 case STATUS_IN_PROGRESS: // status_in_progress
234 *data << uint32(bg->GetMapId()); // map id
235 *data << uint64(0); // 3.3.5, unknown
236 *data << uint32(Time1); // time to bg auto leave, 0 at bg start, 120000 after bg end, milliseconds
237 *data << uint32(Time2); // time from bg start, milliseconds
238 *data << uint8(teamId == TEAM_ALLIANCE ? 1 : 0); // arenafaction (0 for horde, 1 for alliance)
239 break;
240 default:
241 break;
242 }
243}
std::uint64_t uint64
Definition: Define.h:107
std::uint16_t uint16
Definition: Define.h:109
@ 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
@ TEAM_ALLIANCE
Definition: SharedDefines.h:732
@ BATTLEGROUND_TYPE_NONE
Definition: SharedDefines.h:3452
@ SMSG_BATTLEFIELD_STATUS
Definition: Opcodes.h:754
uint32 GetMapId() const
Definition: Battleground.h:420
uint32 GetMinLevel() const
Definition: Battleground.h:328
bool isRated() const
Definition: Battleground.h:390
uint32 GetClientInstanceID() const
Definition: Battleground.h:323
bool isArena() const
Definition: Battleground.h:388
uint32 GetMaxLevel() const
Definition: Battleground.h:329

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 
)
246{
248 *data << int32(result);
250 *data << uint64(0); // player guid
251}
std::int32_t int32
Definition: Define.h:104
@ ERR_BATTLEGROUND_JOIN_TIMED_OUT
Definition: SharedDefines.h:3620
@ ERR_BATTLEGROUND_JOIN_FAILED
Definition: SharedDefines.h:3621
@ 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 
)
260{
262 *data << player->GetGUID();
263}
@ SMSG_BATTLEGROUND_PLAYER_JOINED
Definition: Opcodes.h:778
static ObjectGuid GetGUID(Object const *o)
Definition: Object.h:106

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

◆ BuildPlayerLeftBattlegroundPacket()

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

References WorldPacket::Initialize(), and SMSG_BATTLEGROUND_PLAYER_LEFT.

◆ CheckBattleMasters()

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

References LOG_ERROR, mBattleMastersMap, sObjectMgr, and UNIT_NPC_FLAG_BATTLEMASTER.

Referenced by LoadBattleMastersEntry().

◆ CreateBattleground()

bool BattlegroundMgr::CreateBattleground ( BattlegroundTemplate const *  bgTemplate)
private
415{
416 // Create the BG
417 Battleground* bg = GetBattlegroundTemplate(bgTemplate->Id);
418
419 if (!bg)
420 {
421 bg = BattlegroundMgr::bgtypeToBattleground[bgTemplate->Id];
422
423 ASSERT(bg);
424
425 if (bgTemplate->Id == BATTLEGROUND_RB)
426 bg->SetRandom(true);
427
428 bg->SetBgTypeID(bgTemplate->Id);
429 bg->SetInstanceID(0);
430 AddBattleground(bg);
431 }
432
433 bg->SetMapId(bgTemplate->BattlemasterEntry->mapid[0]);
434 bg->SetName(bgTemplate->BattlemasterEntry->name[sWorld->GetDefaultDbcLocale()]);
435 bg->SetArenaorBGType(bgTemplate->IsArena());
436 bg->SetMinPlayersPerTeam(bgTemplate->MinPlayersPerTeam);
437 bg->SetMaxPlayersPerTeam(bgTemplate->MaxPlayersPerTeam);
438 bg->SetTeamStartPosition(TEAM_ALLIANCE, bgTemplate->StartLocation[TEAM_ALLIANCE]);
439 bg->SetTeamStartPosition(TEAM_HORDE, bgTemplate->StartLocation[TEAM_HORDE]);
440 bg->SetStartMaxDist(bgTemplate->MaxStartDistSq);
441 bg->SetLevelRange(bgTemplate->MinLevel, bgTemplate->MaxLevel);
442 bg->SetScriptId(bgTemplate->ScriptId);
443
444 return true;
445}
#define ASSERT
Definition: Errors.h:68
@ TEAM_HORDE
Definition: SharedDefines.h:733
Definition: Battleground.h:293
void SetMapId(uint32 MapID)
Definition: Battleground.h:419
void SetInstanceID(uint32 InstanceID)
Definition: Battleground.h:347
void SetRandom(bool isRandom)
Definition: Battleground.h:359
void SetScriptId(uint32 scriptId)
Definition: Battleground.h:358
void SetBgTypeID(BattlegroundTypeId TypeID)
Definition: Battleground.h:344
void SetMinPlayersPerTeam(uint32 MinPlayers)
Definition: Battleground.h:365
void SetStartMaxDist(float startMaxDist)
Definition: Battleground.h:430
void SetName(std::string_view name)
Definition: Battleground.h:343
void SetLevelRange(uint32 min, uint32 max)
Definition: Battleground.h:353
void SetArenaorBGType(bool _isArena)
Definition: Battleground.h:356
void SetTeamStartPosition(TeamId teamId, Position const &pos)
Definition: Battleground.cpp:648
void SetMaxPlayersPerTeam(uint32 MaxPlayers)
Definition: Battleground.h:364
void AddBattleground(Battleground *bg)
Definition: BattlegroundMgr.cpp:951
Battleground * GetBattlegroundTemplate(BattlegroundTypeId bgTypeId)
Definition: BattlegroundMgr.cpp:324
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
337{
338 if (IsArenaType(bgTypeId))
339 return 0; // arenas don't have client-instanceids
340
341 // we create here an instanceid, which is just for
342 // displaying this to the client and without any other use..
343 // the client-instanceIds are unique for each battleground-type
344 // the instance-id just needs to be as low as possible, beginning with 1
345 // the following works, because std::set is default ordered with "<"
346 // the optimalization would be to use as bitmask std::vector<uint32> - but that would only make code unreadable
347
348 BattlegroundClientIdsContainer& clientIds = bgDataStore[bgTypeId]._ClientBattlegroundIds[bracket_id];
349 uint32 lastId = 0;
350
351 for (BattlegroundClientIdsContainer::const_iterator itr = clientIds.begin(); itr != clientIds.end();)
352 {
353 if ((++lastId) != *itr) // if there is a gap between the ids, we will break..
354 break;
355
356 lastId = *itr;
357 }
358
359 clientIds.emplace(++lastId);
360 return lastId;
361}
static bool IsArenaType(BattlegroundTypeId bgTypeId)
Definition: BattlegroundMgr.cpp:661

References bgDataStore, and IsArenaType().

Referenced by CreateNewBattleground().

◆ CreateNewBattleground()

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

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 ( )
81{
82 for (auto& [_, data] : bgDataStore)
83 {
84 while (!data._Battlegrounds.empty())
85 delete data._Battlegrounds.begin()->second;
86
87 data._Battlegrounds.clear();
88
89 while (!data.BGFreeSlotQueue.empty())
90 delete data.BGFreeSlotQueue.front();
91 }
92
93 bgDataStore.clear();
94}

References bgDataStore.

Referenced by ~BattlegroundMgr().

◆ GetBattleground()

Battleground * BattlegroundMgr::GetBattleground ( uint32  instanceID,
BattlegroundTypeId  bgTypeId 
)
290{
291 if (!instanceId)
292 return nullptr;
293
294 auto GetBgWithInstanceID = [instanceId](BattlegroundData const* bgData) -> Battleground*
295 {
296 auto const& itr = bgData->_Battlegrounds.find(instanceId);
297 if (itr != bgData->_Battlegrounds.end())
298 return itr->second;
299
300 return nullptr;
301 };
302
303 if (bgTypeId == BATTLEGROUND_TYPE_NONE)
304 {
305 for (auto const& [bgType, bgData] : bgDataStore)
306 {
307 if (auto bg = GetBgWithInstanceID(&bgData))
308 return bg;
309 }
310 }
311 else
312 {
313 auto const& itr = bgDataStore.find(bgTypeId);
314 if (itr == bgDataStore.end())
315 return nullptr;
316
317 if (auto bg = GetBgWithInstanceID(&itr->second))
318 return bg;
319 }
320
321 return nullptr;
322}
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)
325{
326 BattlegroundDataContainer::const_iterator itr = bgDataStore.find(bgTypeId);
327 if (itr == bgDataStore.end())
328 return nullptr;
329
330 BattlegroundContainer const& bgs = itr->second._Battlegrounds;
331
332 // map is sorted and we can be sure that lowest instance id has only BG template
333 return bgs.empty() ? nullptr : bgs.begin()->second;
334}
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 
)
266{
267 //cause at HandleBattlegroundJoinOpcode the clients sends the instanceid he gets from
268 //SMSG_BATTLEFIELD_LIST we need to find the battleground with this clientinstance-id
270 if (!bg)
271 return nullptr;
272
273 if (bg->isArena())
274 return GetBattleground(instanceId, bgTypeId);
275
276 auto const& it = bgDataStore.find(bgTypeId);
277 if (it == bgDataStore.end())
278 return nullptr;
279
280 for (auto const& itr : it->second._Battlegrounds)
281 {
282 if (itr.second->GetClientInstanceID() == instanceId)
283 return itr.second;
284 }
285
286 return nullptr;
287}
Battleground * GetBattleground(uint32 instanceID, BattlegroundTypeId bgTypeId)
Definition: BattlegroundMgr.cpp:289

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)
931{
932 return bgDataStore[bgTypeId].BGFreeSlotQueue;
933}

References bgDataStore.

◆ GetMaxRatingDifference()

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

References CONFIG_ARENA_MAX_RATING_DIFFERENCE, and sWorld.

◆ GetPrematureFinishTime()

uint32 BattlegroundMgr::GetPrematureFinishTime ( ) const
785{
787}
@ CONFIG_BATTLEGROUND_PREMATURE_FINISH_TIMER
Definition: IWorld.h:308

References CONFIG_BATTLEGROUND_PREMATURE_FINISH_TIMER, and sWorld.

◆ GetRandomBG()

BattlegroundTypeId BattlegroundMgr::GetRandomBG ( BattlegroundTypeId  id,
uint32  minLevel 
)
private
901{
902 if (BattlegroundTemplate const* bgTemplate = GetBattlegroundTemplateByTypeId(bgTypeId))
903 {
904 std::vector<BattlegroundTypeId> ids;
905 ids.reserve(16);
906 std::vector<double> weights;
907 weights.reserve(16);
908
909 for (int32 mapId : bgTemplate->BattlemasterEntry->mapid)
910 {
911 if (mapId == -1)
912 break;
913
915 {
916 if (bg->MinLevel <= minLevel)
917 {
918 ids.push_back(bg->Id);
919 weights.push_back(bg->Weight);
920 }
921 }
922 }
923
925 }
926
928}
auto SelectRandomWeightedContainerElement(C const &container, std::vector< double > weights) -> decltype(std::begin(container))
Definition: Containers.h:167
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
780{
781 return sWorld->getIntConfig(CONFIG_ARENA_RATING_DISCARD_TIMER);
782}
@ CONFIG_ARENA_RATING_DISCARD_TIMER
Definition: IWorld.h:321

References CONFIG_ARENA_RATING_DISCARD_TIMER, and sWorld.

◆ InitAutomaticArenaPointDistribution()

void BattlegroundMgr::InitAutomaticArenaPointDistribution ( )
547{
548 if (!sWorld->getBoolConfig(CONFIG_ARENA_AUTO_DISTRIBUTE_POINTS))
549 return;
550
551 Seconds wstime = Seconds(sWorld->getWorldState(WS_ARENA_DISTRIBUTION_TIME));
552 Seconds curtime = GameTime::GetGameTime();
553
554 LOG_INFO("server.loading", "Initializing Automatic Arena Point Distribution");
555
556 if (wstime < curtime)
557 {
558 m_NextAutoDistributionTime = curtime; // reset will be called in the next update
559 LOG_INFO("server.loading", "Next arena point distribution time in the past, reseting it now.");
560 }
561 else
562 {
564 }
565
566 LOG_INFO("server.loading", "Automatic Arena Point Distribution initialized.");
567}
#define LOG_INFO(filterType__,...)
Definition: Log.h:167
std::chrono::seconds Seconds
Seconds shorthand typedef.
Definition: Duration.h:30
@ CONFIG_ARENA_AUTO_DISTRIBUTE_POINTS
Definition: IWorld.h:122
@ 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
75{
77 return &instance;
78}
Definition: BattlegroundMgr.h:64
static BattlegroundMgr * instance()
Definition: BattlegroundMgr.cpp:74

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
662{
663 return bgTypeId == BATTLEGROUND_AA
664 || bgTypeId == BATTLEGROUND_BE
665 || bgTypeId == BATTLEGROUND_NA
666 || bgTypeId == BATTLEGROUND_DS
667 || bgTypeId == BATTLEGROUND_RV
668 || bgTypeId == BATTLEGROUND_RL;
669}
@ BATTLEGROUND_BE
Definition: SharedDefines.h:3457
@ BATTLEGROUND_RV
Definition: SharedDefines.h:3463
@ BATTLEGROUND_NA
Definition: SharedDefines.h:3456
@ BATTLEGROUND_DS
Definition: SharedDefines.h:3462
@ BATTLEGROUND_RL
Definition: SharedDefines.h:3460

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

Referenced by CreateClientVisibleInstanceId().

◆ IsBGWeekend()

bool BattlegroundMgr::IsBGWeekend ( BattlegroundTypeId  bgTypeId)
static
896{
898}
bool IsHolidayActive(HolidayIds id)
Definition: GameEventMgr.cpp:1910
static HolidayIds BGTypeToWeekendHolidayId(BattlegroundTypeId bgTypeId)
Definition: BattlegroundMgr.cpp:853

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 ( )
448{
449 uint32 oldMSTime = getMSTime();
450
453
454 // 0 1 2 3 4 5 6 7 8 9 10 11
455 QueryResult result = WorldDatabase.Query("SELECT ID, MinPlayersPerTeam, MaxPlayersPerTeam, MinLvl, MaxLvl, AllianceStartLoc, AllianceStartO, HordeStartLoc, HordeStartO, StartMaxDist, Weight, ScriptName FROM battleground_template");
456
457 if (!result)
458 {
459 LOG_ERROR("bg.battleground", ">> Loaded 0 battlegrounds. DB table `battleground_template` is empty.");
460 return;
461 }
462
463 do
464 {
465 Field* fields = result->Fetch();
466
467 BattlegroundTypeId bgTypeId = static_cast<BattlegroundTypeId>(fields[0].Get<uint32>());
468
470 continue;
471
472 // can be overwrite by values from DB
473 BattlemasterListEntry const* bl = sBattlemasterListStore.LookupEntry(bgTypeId);
474 if (!bl)
475 {
476 LOG_ERROR("bg.battleground", "Battleground ID {} not found in BattlemasterList.dbc. Battleground not created.", bgTypeId);
477 continue;
478 }
479
480 BattlegroundTemplate bgTemplate;
481 bgTemplate.Id = bgTypeId;
482 bgTemplate.MinPlayersPerTeam = fields[1].Get<uint16>();
483 bgTemplate.MaxPlayersPerTeam = fields[2].Get<uint16>();
484 bgTemplate.MinLevel = fields[3].Get<uint8>();
485 bgTemplate.MaxLevel = fields[4].Get<uint8>();
486 float dist = fields[9].Get<float>();
487 bgTemplate.MaxStartDistSq = dist * dist;
488 bgTemplate.Weight = fields[10].Get<uint8>();
489 bgTemplate.ScriptId = sObjectMgr->GetScriptId(fields[11].Get<std::string>());
490 bgTemplate.BattlemasterEntry = bl;
491
492 if (bgTemplate.MaxPlayersPerTeam == 0 || bgTemplate.MinPlayersPerTeam > bgTemplate.MaxPlayersPerTeam)
493 {
494 LOG_ERROR("sql.sql", "Table `battleground_template` for id {} contains bad values for MinPlayersPerTeam ({}) and MaxPlayersPerTeam({}).",
495 bgTemplate.Id, bgTemplate.MinPlayersPerTeam, bgTemplate.MaxPlayersPerTeam);
496
497 continue;
498 }
499
500 if (bgTemplate.MinLevel == 0 || bgTemplate.MaxLevel == 0 || bgTemplate.MinLevel > bgTemplate.MaxLevel)
501 {
502 LOG_ERROR("sql.sql", "Table `battleground_template` for id {} has bad values for LevelMin ({}) and LevelMax({})",
503 bgTemplate.Id, bgTemplate.MinLevel, bgTemplate.MaxLevel);
504 continue;
505 }
506
507 if (bgTemplate.Id != BATTLEGROUND_AA && bgTemplate.Id != BATTLEGROUND_RB)
508 {
509 uint32 startId = fields[5].Get<uint32>();
510 if (GraveyardStruct const* start = sGraveyard->GetGraveyard(startId))
511 {
512 bgTemplate.StartLocation[TEAM_ALLIANCE].Relocate(start->x, start->y, start->z, fields[6].Get<float>());
513 }
514 else
515 {
516 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);
517 continue;
518 }
519
520 startId = fields[7].Get<uint32>();
521 if (GraveyardStruct const* start = sGraveyard->GetGraveyard(startId))
522 {
523 bgTemplate.StartLocation[TEAM_HORDE].Relocate(start->x, start->y, start->z, fields[8].Get<float>());
524 }
525 else
526 {
527 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);
528 continue;
529 }
530 }
531
532 if (!CreateBattleground(&bgTemplate))
533 continue;
534
535 _battlegroundTemplates[bgTypeId] = bgTemplate;
536
537 if (bgTemplate.BattlemasterEntry->mapid[1] == -1) // in this case we have only one mapId
539
540 } while (result->NextRow());
541
542 LOG_INFO("server.loading", ">> Loaded {} battlegrounds in {} ms", _battlegroundTemplates.size(), GetMSTimeDiffToNow(oldMSTime));
543 LOG_INFO("server.loading", " ");
544}
uint32 GetMSTimeDiffToNow(uint32 oldMSTime)
Definition: Timer.h:131
uint32 getMSTime()
Definition: Timer.h:103
DatabaseWorkerPool< WorldDatabaseConnection > WorldDatabase
Accessor to the world database.
Definition: DatabaseEnv.cpp:20
std::shared_ptr< ResultSet > QueryResult
Definition: DatabaseEnvFwd.h:28
@ DISABLE_TYPE_BATTLEGROUND
Definition: DisableMgr.h:32
DBCStorage< BattlemasterListEntry > sBattlemasterListStore(BattlemasterListEntryfmt)
#define sGraveyard
Definition: GameGraveyard.h:75
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:414
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 ( )
790{
791 uint32 oldMSTime = getMSTime();
792
793 mBattleMastersMap.clear(); // need for reload case
794
795 QueryResult result = WorldDatabase.Query("SELECT entry, bg_template FROM battlemaster_entry");
796
797 if (!result)
798 {
799 LOG_WARN("server.loading", ">> Loaded 0 battlemaster entries. DB table `battlemaster_entry` is empty!");
800 LOG_INFO("server.loading", " ");
801 return;
802 }
803
804 uint32 count = 0;
805
806 do
807 {
808 ++count;
809
810 Field* fields = result->Fetch();
811
812 uint32 entry = fields[0].Get<uint32>();
813 if (CreatureTemplate const* cInfo = sObjectMgr->GetCreatureTemplate(entry))
814 {
815 if ((cInfo->npcflag & UNIT_NPC_FLAG_BATTLEMASTER) == 0)
816 LOG_ERROR("sql.sql", "Creature (Entry: {}) listed in `battlemaster_entry` is not a battlemaster.", entry);
817 }
818 else
819 {
820 LOG_ERROR("sql.sql", "Creature (Entry: {}) listed in `battlemaster_entry` does not exist.", entry);
821 continue;
822 }
823
824 uint32 bgTypeId = fields[1].Get<uint32>();
825 if (!sBattlemasterListStore.LookupEntry(bgTypeId))
826 {
827 LOG_ERROR("sql.sql", "Table `battlemaster_entry` contain entry {} for not existed battleground type {}, ignored.", entry, bgTypeId);
828 continue;
829 }
830
831 mBattleMastersMap[entry] = BattlegroundTypeId(bgTypeId);
832 } while (result->NextRow());
833
835
836 LOG_INFO("server.loading", ">> Loaded {} battlemaster entries in {} ms", count, GetMSTimeDiffToNow(oldMSTime));
837 LOG_INFO("server.loading", " ");
838}
#define LOG_WARN(filterType__,...)
Definition: Log.h:163
void CheckBattleMasters()
Definition: BattlegroundMgr.cpp:840

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 
)
960{
961 bgDataStore[bgTypeId]._Battlegrounds.erase(instanceId);
962}

References bgDataStore.

◆ RemoveFromBGFreeSlotQueue()

void BattlegroundMgr::RemoveFromBGFreeSlotQueue ( BattlegroundTypeId  bgTypeId,
uint32  instanceId 
)
941{
942 BGFreeSlotQueueContainer& queues = bgDataStore[bgTypeId].BGFreeSlotQueue;
943 for (BGFreeSlotQueueContainer::iterator itr = queues.begin(); itr != queues.end(); ++itr)
944 if ((*itr)->GetInstanceID() == instanceId)
945 {
946 queues.erase(itr);
947 return;
948 }
949}
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 
)
759{
760 //This method must be atomic, @todo add mutex
761 //we will use only 1 number created of bgTypeId and bracket_id
762 uint64 const scheduleId = ((uint64)arenaMatchmakerRating << 32) | ((uint64)arenaType << 24) | ((uint64)bgQueueTypeId << 16) | ((uint64)bgTypeId << 8) | (uint64)bracket_id;
763 if (std::find(m_QueueUpdateScheduler.begin(), m_QueueUpdateScheduler.end(), scheduleId) == m_QueueUpdateScheduler.end())
764 m_QueueUpdateScheduler.emplace_back(scheduleId);
765}
std::vector< uint64 > m_QueueUpdateScheduler
Definition: BattlegroundMgr.h:154

References m_QueueUpdateScheduler.

◆ SendAreaSpiritHealerQueryOpcode()

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

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 
)
636{
637 if (Battleground* bg = GetBattleground(instanceId, bgTypeId))
638 {
639 uint32 mapid = bg->GetMapId();
640 Position const* pos = bg->GetTeamStartPosition(player->GetBgTeamId());
641
642 LOG_DEBUG("bg.battleground", "BattlegroundMgr::SendToBattleground: Sending {} to map {}, {} (bgType {})", player->GetName(), mapid, pos->ToString(), bgTypeId);
643 player->TeleportTo(mapid, pos->GetPositionX(), pos->GetPositionY(), pos->GetPositionZ(), pos->GetOrientation());
644 }
645 else
646 {
647 LOG_ERROR("bg.battleground", "BattlegroundMgr::SendToBattleground: Instance {} (bgType {}) not found while trying to teleport player {}", instanceId, bgTypeId, player->GetName());
648 }
649}
#define LOG_DEBUG(filterType__,...)
Definition: Log.h:171
std::string const & GetName() const
Definition: Object.h:446
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:1311
TeamId GetBgTeamId() const
Definition: Player.h:2227

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)
748{
749 for (uint32 bgtype = 1; bgtype < MAX_BATTLEGROUND_TYPE_ID; ++bgtype)
750 {
751 if (bgtype == BATTLEGROUND_RB)
752 continue;
754 bgt->SetHoliday(mask & (1 << bgtype));
755 }
756}
#define MAX_BATTLEGROUND_TYPE_ID
Definition: SharedDefines.h:3468

References BATTLEGROUND_RB, GetBattlegroundTemplate(), and MAX_BATTLEGROUND_TYPE_ID.

◆ ToggleArenaTesting()

void BattlegroundMgr::ToggleArenaTesting ( )
734{
735 if (sWorld->getBoolConfig(CONFIG_DEBUG_ARENA))
736 {
737 m_ArenaTesting = true;
738 sWorld->SendWorldText(LANG_DEBUG_ARENA_CONF);
739 }
740 else
741 {
744 }
745}
@ LANG_DEBUG_ARENA_OFF
Definition: Language.h:689
@ LANG_DEBUG_ARENA_ON
Definition: Language.h:688
@ LANG_DEBUG_ARENA_CONF
Definition: Language.h:1331
@ CONFIG_DEBUG_ARENA
Definition: IWorld.h:166

References CONFIG_DEBUG_ARENA, LANG_DEBUG_ARENA_CONF, LANG_DEBUG_ARENA_OFF, LANG_DEBUG_ARENA_ON, m_ArenaTesting, and sWorld.

◆ ToggleTesting()

void BattlegroundMgr::ToggleTesting ( )
720{
721 if (sWorld->getBoolConfig(CONFIG_DEBUG_BATTLEGROUND))
722 {
723 m_Testing = true;
724 sWorld->SendWorldText(LANG_DEBUG_BG_CONF);
725 }
726 else
727 {
730 }
731}
@ LANG_DEBUG_BG_OFF
Definition: Language.h:691
@ LANG_DEBUG_BG_CONF
Definition: Language.h:1330
@ LANG_DEBUG_BG_ON
Definition: Language.h:690
@ CONFIG_DEBUG_BATTLEGROUND
Definition: IWorld.h:165

References CONFIG_DEBUG_BATTLEGROUND, LANG_DEBUG_BG_CONF, LANG_DEBUG_BG_OFF, LANG_DEBUG_BG_ON, m_Testing, and sWorld.

◆ Update()

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

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, 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:3602
@ BATTLEGROUND_QUEUE_3v3
Definition: SharedDefines.h:3601

Referenced by BGQueueTypeId().

◆ bgDataStore

◆ bgToQueue

std::unordered_map< int, BattlegroundQueueTypeId > BattlegroundMgr::bgToQueue
static
Initial value:
=
{
}
@ BATTLEGROUND_QUEUE_RB
Definition: SharedDefines.h:3599
@ BATTLEGROUND_QUEUE_SA
Definition: SharedDefines.h:3597
@ BATTLEGROUND_QUEUE_AB
Definition: SharedDefines.h:3595
@ BATTLEGROUND_QUEUE_WS
Definition: SharedDefines.h:3594
@ BATTLEGROUND_QUEUE_EY
Definition: SharedDefines.h:3596
@ BATTLEGROUND_QUEUE_IC
Definition: SharedDefines.h:3598

Referenced by BGQueueTypeId().

◆ bgtypeToBattleground

std::unordered_map< int, Battleground * > BattlegroundMgr::bgtypeToBattleground
static
Initial value:
=
{
}
Definition: BattlegroundAB.h:291
Definition: BattlegroundAV.h:1618
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