TrinityCore
Loading...
Searching...
No Matches
BattlegroundMgr Class Reference

#include <BattlegroundMgr.h>

Classes

struct  ScheduledQueueUpdate
 

Public Member Functions

 BattlegroundMgr (BattlegroundMgr const &right)=delete
 
 BattlegroundMgr (BattlegroundMgr &&right)=delete
 
BattlegroundMgr & operator= (BattlegroundMgr const &right)=delete
 
BattlegroundMgr & operator= (BattlegroundMgr &&right)=delete
 
void Update (uint32 diff)
 
void SendBattlegroundList (Player *player, ObjectGuid const &guid, BattlegroundTypeId bgTypeId)
 
void SendAreaSpiritHealerQueryOpcode (Player *player, Battleground *bg, ObjectGuid guid)
 
Battleground * GetBattlegroundThroughClientInstance (uint32 instanceId, BattlegroundTypeId bgTypeId)
 
Battleground * GetBattleground (uint32 InstanceID, BattlegroundTypeId bgTypeId)
 
Battleground * GetBattlegroundTemplate (BattlegroundTypeId bgTypeId)
 
Battleground * CreateNewBattleground (BattlegroundTypeId bgTypeId, PvPDifficultyEntry const *bracketEntry, uint8 arenaType, bool isRated)
 
void AddBattleground (Battleground *bg)
 
void AddToBGFreeSlotQueue (BattlegroundTypeId bgTypeId, Battleground *bg)
 
void RemoveFromBGFreeSlotQueue (BattlegroundTypeId bgTypeId, uint32 instanceId)
 
BGFreeSlotQueueContainer & GetBGFreeSlotQueueStore (BattlegroundTypeId bgTypeId)
 
void LoadBattlegroundTemplates ()
 
void DeleteAllBattlegrounds ()
 
void SendToBattleground (Player *player, uint32 InstanceID, BattlegroundTypeId bgTypeId)
 
bool IsValidQueueId (BattlegroundQueueTypeId bgQueueTypeId)
 
BattlegroundQueue & GetBattlegroundQueue (BattlegroundQueueTypeId bgQueueTypeId)
 
void ScheduleQueueUpdate (uint32 arenaMatchmakerRating, BattlegroundQueueTypeId bgQueueTypeId)
 
uint32 GetPrematureFinishTime () const
 
void ToggleArenaTesting ()
 
void ToggleTesting ()
 
void ResetHolidays ()
 
void SetHolidayActive (uint32 battlegroundId)
 
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 BattlegroundMgr * instance ()
 
static void BuildBattlegroundStatusHeader (WorldPackets::Battleground::BattlefieldStatusHeader *header, Battleground const *bg, uint32 queueSlot, BattlegroundQueueTypeId queueId)
 
static void BuildBattlegroundStatusNone (WorldPackets::Battleground::BattlefieldStatusNone *battlefieldStatus, uint32 queueSlot)
 
static void BuildBattlegroundStatusNeedConfirmation (WorldPackets::Battleground::BattlefieldStatusNeedConfirmation *battlefieldStatus, Battleground const *bg, uint32 queueSlot, uint32 timeout, BattlegroundQueueTypeId queueId)
 
static void BuildBattlegroundStatusActive (WorldPackets::Battleground::BattlefieldStatusActive *battlefieldStatus, Battleground const *bg, Player const *player, uint32 queueSlot, BattlegroundQueueTypeId queueId)
 
static void BuildBattlegroundStatusQueued (WorldPackets::Battleground::BattlefieldStatusQueued *battlefieldStatus, Battleground const *bg, uint32 queueSlot, uint32 joinTime, BattlegroundQueueTypeId queueId, uint32 avgWaitTime)
 
static void BuildBattlegroundStatusFailed (WorldPackets::Battleground::BattlefieldStatusFailed *battlefieldStatus, GroupJoinBattlegroundResult result, ObjectGuid const *errorGuid=nullptr)
 
static void BuildGroupJoinedBattlegroundPacket (WorldPackets::Battleground::GroupJoinedBattleground *groupJoinedBattleground, BattlegroundTypeId bgTypeId)
 
static bool IsRandomBattleground (uint32 battlemasterListId)
 
static BattlegroundQueueTypeId BGQueueTypeId (BattlegroundTypeId bgTypeId, uint8 bracketId, uint8 arenaType)
 
static HolidayIds BGTypeToWeekendHolidayId (BattlegroundTypeId bgTypeId)
 
static BattlegroundTypeId WeekendHolidayIdToBGType (HolidayIds holiday)
 
static bool IsBGWeekend (BattlegroundTypeId bgTypeId)
 

Private Types

typedef std::map< BattlegroundTypeId, BattlegroundData > BattlegroundDataContainer
 
typedef std::map< BattlegroundTypeId, uint8 > BattlegroundSelectionWeightMap
 
typedef std::map< BattlegroundTypeId, BattlegroundTemplate > BattlegroundTemplateMap
 
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)
 
BattlegroundTemplate const * GetBattlegroundTemplateByTypeId (BattlegroundTypeId id)
 
BattlegroundTemplate const * GetBattlegroundTemplateByMapId (uint32 mapId)
 

Static Private Member Functions

static bool IsArenaType (BattlegroundTypeId bgTypeId)
 

Private Attributes

BattlegroundDataContainer bgDataStore
 
std::map< BattlegroundQueueTypeId, BattlegroundQueue > m_BattlegroundQueues
 
std::vector< ScheduledQueueUpdate > m_QueueUpdateScheduler
 
uint32 m_NextRatedArenaUpdate
 
time_t m_NextAutoDistributionTime
 
uint32 m_AutoDistributionTimeChecker
 
uint32 m_UpdateTimer
 
bool m_ArenaTesting
 
bool m_Testing
 
BattleMastersMap mBattleMastersMap
 
BattlegroundTemplateMap _battlegroundTemplates
 
BattlegroundMapTemplateContainer _battlegroundMapTemplates
 

Detailed Description

Definition at line 80 of file BattlegroundMgr.h.

Member Typedef Documentation

◆ BattlegroundDataContainer

◆ BattlegroundMapTemplateContainer

◆ BattlegroundSelectionWeightMap

Definition at line 203 of file BattlegroundMgr.h.

◆ BattlegroundTemplateMap

Constructor & Destructor Documentation

◆ BattlegroundMgr() [1/3]

BattlegroundMgr::BattlegroundMgr ( )
private

Definition at line 60 of file BattlegroundMgr.cpp.

◆ ~BattlegroundMgr()

BattlegroundMgr::~BattlegroundMgr ( )
private

Definition at line 66 of file BattlegroundMgr.cpp.

References DeleteAllBattlegrounds().

◆ BattlegroundMgr() [2/3]

BattlegroundMgr::BattlegroundMgr ( BattlegroundMgr const &  right)
delete

◆ BattlegroundMgr() [3/3]

BattlegroundMgr::BattlegroundMgr ( BattlegroundMgr &&  right)
delete

Member Function Documentation

◆ AddBattleground()

◆ AddToBGFreeSlotQueue()

void BattlegroundMgr::AddToBGFreeSlotQueue ( BattlegroundTypeId  bgTypeId,
Battleground *  bg 
)

Definition at line 904 of file BattlegroundMgr.cpp.

References bgDataStore.

◆ BGQueueTypeId()

◆ BGTypeToWeekendHolidayId()

◆ BuildBattlegroundStatusActive()

◆ BuildBattlegroundStatusFailed()

◆ BuildBattlegroundStatusHeader()

◆ BuildBattlegroundStatusNeedConfirmation()

◆ BuildBattlegroundStatusNone()

◆ BuildBattlegroundStatusQueued()

◆ BuildGroupJoinedBattlegroundPacket()

void BattlegroundMgr::BuildGroupJoinedBattlegroundPacket ( WorldPackets::Battleground::GroupJoinedBattleground *  groupJoinedBattleground,
BattlegroundTypeId  bgTypeId 
)
static

◆ CheckBattleMasters()

void BattlegroundMgr::CheckBattleMasters ( )

◆ CreateBattleground()

◆ CreateClientVisibleInstanceId()

uint32 BattlegroundMgr::CreateClientVisibleInstanceId ( BattlegroundTypeId  bgTypeId,
BattlegroundBracketId  bracket_id 
)
private

Definition at line 303 of file BattlegroundMgr.cpp.

References bgDataStore, and IsArenaType().

Referenced by CreateNewBattleground().

◆ CreateNewBattleground()

◆ DeleteAllBattlegrounds()

void BattlegroundMgr::DeleteAllBattlegrounds ( )

Definition at line 71 of file BattlegroundMgr.cpp.

References bgDataStore.

Referenced by ~BattlegroundMgr().

◆ GetBattleground()

Battleground * BattlegroundMgr::GetBattleground ( uint32  InstanceID,
BattlegroundTypeId  bgTypeId 
)

◆ GetBattlegroundQueue()

BattlegroundQueue & BattlegroundMgr::GetBattlegroundQueue ( BattlegroundQueueTypeId  bgQueueTypeId)
inline

Definition at line 126 of file BattlegroundMgr.h.

Referenced by Update().

◆ GetBattlegroundTemplate()

Battleground * BattlegroundMgr::GetBattlegroundTemplate ( BattlegroundTypeId  bgTypeId)

◆ GetBattlegroundTemplateByMapId()

BattlegroundTemplate const * BattlegroundMgr::GetBattlegroundTemplateByMapId ( uint32  mapId)
inlineprivate

Definition at line 195 of file BattlegroundMgr.h.

Referenced by GetRandomBG().

◆ GetBattlegroundTemplateByTypeId()

BattlegroundTemplate const * BattlegroundMgr::GetBattlegroundTemplateByTypeId ( BattlegroundTypeId  id)
inlineprivate

Definition at line 187 of file BattlegroundMgr.h.

Referenced by GetRandomBG(), and IsValidQueueId().

◆ GetBattlegroundThroughClientInstance()

Battleground * BattlegroundMgr::GetBattlegroundThroughClientInstance ( uint32  instanceId,
BattlegroundTypeId  bgTypeId 
)

◆ GetBattleMasterBG()

BattlegroundTypeId BattlegroundMgr::GetBattleMasterBG ( uint32  entry) const
inline

Definition at line 151 of file BattlegroundMgr.h.

References BATTLEGROUND_TYPE_NONE.

◆ GetBGFreeSlotQueueStore()

BGFreeSlotQueueContainer & BattlegroundMgr::GetBGFreeSlotQueueStore ( BattlegroundTypeId  bgTypeId)

Definition at line 899 of file BattlegroundMgr.cpp.

References bgDataStore.

◆ GetMaxRatingDifference()

uint32 BattlegroundMgr::GetMaxRatingDifference ( ) const

Definition at line 767 of file BattlegroundMgr.cpp.

References CONFIG_ARENA_MAX_RATING_DIFFERENCE, and sWorld.

◆ GetPrematureFinishTime()

uint32 BattlegroundMgr::GetPrematureFinishTime ( ) const

Definition at line 781 of file BattlegroundMgr.cpp.

References CONFIG_BATTLEGROUND_PREMATURE_FINISH_TIMER, and sWorld.

◆ GetRandomBG()

◆ GetRatingDiscardTimer()

uint32 BattlegroundMgr::GetRatingDiscardTimer ( ) const

Definition at line 776 of file BattlegroundMgr.cpp.

References CONFIG_ARENA_RATING_DISCARD_TIMER, and sWorld.

◆ InitAutomaticArenaPointDistribution()

void BattlegroundMgr::InitAutomaticArenaPointDistribution ( )

◆ instance()

BattlegroundMgr * BattlegroundMgr::instance ( )
static

Definition at line 80 of file BattlegroundMgr.cpp.

References instance().

Referenced by instance().

◆ isArenaTesting()

bool BattlegroundMgr::isArenaTesting ( ) const
inline

Definition at line 136 of file BattlegroundMgr.h.

◆ IsArenaType()

bool BattlegroundMgr::IsArenaType ( BattlegroundTypeId  bgTypeId)
staticprivate

◆ IsBGWeekend()

bool BattlegroundMgr::IsBGWeekend ( BattlegroundTypeId  bgTypeId)
static

◆ IsRandomBattleground()

bool BattlegroundMgr::IsRandomBattleground ( uint32  battlemasterListId)
static

Definition at line 694 of file BattlegroundMgr.cpp.

References BATTLEGROUND_RB.

Referenced by WorldSession::HandleBattlemasterJoinOpcode().

◆ isTesting()

bool BattlegroundMgr::isTesting ( ) const
inline

Definition at line 137 of file BattlegroundMgr.h.

◆ IsValidQueueId()

◆ LoadBattlegroundTemplates()

◆ LoadBattleMastersEntry()

◆ operator=() [1/2]

BattlegroundMgr & BattlegroundMgr::operator= ( BattlegroundMgr &&  right)
delete

◆ operator=() [2/2]

BattlegroundMgr & BattlegroundMgr::operator= ( BattlegroundMgr const &  right)
delete

◆ RemoveFromBGFreeSlotQueue()

void BattlegroundMgr::RemoveFromBGFreeSlotQueue ( BattlegroundTypeId  bgTypeId,
uint32  instanceId 
)

Definition at line 909 of file BattlegroundMgr.cpp.

References bgDataStore, and Trinity::Containers::MapGetValuePtr().

◆ ResetHolidays()

void BattlegroundMgr::ResetHolidays ( )

◆ ScheduleQueueUpdate()

void BattlegroundMgr::ScheduleQueueUpdate ( uint32  arenaMatchmakerRating,
BattlegroundQueueTypeId  bgQueueTypeId 
)

Definition at line 758 of file BattlegroundMgr.cpp.

References m_QueueUpdateScheduler.

◆ SendAreaSpiritHealerQueryOpcode()

◆ SendBattlegroundList()

void BattlegroundMgr::SendBattlegroundList ( Player *  player,
ObjectGuid const &  guid,
BattlegroundTypeId  bgTypeId 
)

Definition at line 617 of file BattlegroundMgr.cpp.

References WorldPackets::Battleground::BattlefieldList::Battlefields, BATTLEGROUND_AA, WorldPackets::Battleground::BattlefieldList::BattlemasterGuid, WorldPackets::Battleground::BattlefieldList::BattlemasterListID, 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(), WorldPackets::Battleground::BattlefieldList::HasHolidayWinToday, WorldPackets::Battleground::BattlefieldList::HasRandomWinToday, Trinity::Honor::hk_honor_at_level(), WorldPackets::Battleground::BattlefieldList::HolidayFirstWinArenaCurrencyBonus, WorldPackets::Battleground::BattlefieldList::HolidayLossHonorCurrencyBonus, WorldPackets::Battleground::BattlefieldList::HolidayWinHonorCurrencyBonus, ObjectGuid::IsEmpty(), Trinity::Containers::MapGetValuePtr(), WorldPackets::Battleground::BattlefieldList::MaxLevel, WorldPackets::Battleground::BattlefieldList::MinLevel, WorldPackets::Battleground::BattlefieldList::PvpAnywhere, WorldPackets::Battleground::BattlefieldList::RandomFirstWinArenaCurrencyBonus, WorldPackets::Battleground::BattlefieldList::RandomLossHonorCurrencyBonus, WorldPackets::Battleground::BattlefieldList::RandomWinHonorCurrencyBonus, Player::SendDirectMessage(), sWorld, and WorldPackets::Battleground::BattlefieldList::Write().

◆ SendToBattleground()

◆ SetHolidayActive()

void BattlegroundMgr::SetHolidayActive ( uint32  battlegroundId)

Definition at line 723 of file BattlegroundMgr.cpp.

References GetBattlegroundTemplate().

◆ ToggleArenaTesting()

void BattlegroundMgr::ToggleArenaTesting ( )

Definition at line 710 of file BattlegroundMgr.cpp.

References LANG_DEBUG_ARENA_OFF, LANG_DEBUG_ARENA_ON, m_ArenaTesting, and sWorld.

◆ ToggleTesting()

void BattlegroundMgr::ToggleTesting ( )

Definition at line 704 of file BattlegroundMgr.cpp.

References LANG_DEBUG_BG_OFF, LANG_DEBUG_BG_ON, m_Testing, and sWorld.

◆ Update()

◆ WeekendHolidayIdToBGType()

Member Data Documentation

◆ _battlegroundMapTemplates

BattlegroundMapTemplateContainer BattlegroundMgr::_battlegroundMapTemplates
private

Definition at line 208 of file BattlegroundMgr.h.

Referenced by LoadBattlegroundTemplates().

◆ _battlegroundTemplates

BattlegroundTemplateMap BattlegroundMgr::_battlegroundTemplates
private

Definition at line 207 of file BattlegroundMgr.h.

Referenced by LoadBattlegroundTemplates().

◆ bgDataStore

◆ m_ArenaTesting

bool BattlegroundMgr::m_ArenaTesting
private

Definition at line 183 of file BattlegroundMgr.h.

Referenced by ToggleArenaTesting().

◆ m_AutoDistributionTimeChecker

uint32 BattlegroundMgr::m_AutoDistributionTimeChecker
private

Definition at line 181 of file BattlegroundMgr.h.

Referenced by Update().

◆ m_BattlegroundQueues

std::map<BattlegroundQueueTypeId, BattlegroundQueue> BattlegroundMgr::m_BattlegroundQueues
private

Definition at line 168 of file BattlegroundMgr.h.

Referenced by Update().

◆ m_NextAutoDistributionTime

time_t BattlegroundMgr::m_NextAutoDistributionTime
private

Definition at line 180 of file BattlegroundMgr.h.

Referenced by InitAutomaticArenaPointDistribution(), and Update().

◆ m_NextRatedArenaUpdate

uint32 BattlegroundMgr::m_NextRatedArenaUpdate
private

Definition at line 179 of file BattlegroundMgr.h.

Referenced by Update().

◆ m_QueueUpdateScheduler

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

Definition at line 178 of file BattlegroundMgr.h.

Referenced by ScheduleQueueUpdate(), and Update().

◆ m_Testing

bool BattlegroundMgr::m_Testing
private

Definition at line 184 of file BattlegroundMgr.h.

Referenced by ToggleTesting().

◆ m_UpdateTimer

uint32 BattlegroundMgr::m_UpdateTimer
private

Definition at line 182 of file BattlegroundMgr.h.

Referenced by Update().

◆ mBattleMastersMap

BattleMastersMap BattlegroundMgr::mBattleMastersMap
private

Definition at line 185 of file BattlegroundMgr.h.

Referenced by CheckBattleMasters(), and LoadBattleMastersEntry().


The documentation for this class was generated from the following files: