AzerothCore 3.3.5a
OpenSource WoW Emulator
|
#include "BattlegroundMgr.h"
Static Public Member Functions | |
static BattlegroundMgr * | instance () |
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, BattlegroundQueueTypeId > | bgToQueue |
static std::unordered_map< int, BattlegroundTypeId > | queueToBg |
static std::unordered_map< int, Battleground * > | bgtypeToBattleground |
static std::unordered_map< int, bgRef > | bgTypeToTemplate |
static std::unordered_map< int, bgMapRef > | getBgFromMap = {} |
static std::unordered_map< int, bgTypeRef > | getBgFromTypeID |
static std::unordered_map< uint32, BattlegroundQueueTypeId > | ArenaTypeToQueue |
static std::unordered_map< uint32, ArenaType > | QueueToArenaType |
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, uint32 minLevel) |
BattlegroundTemplate const * | GetBattlegroundTemplateByTypeId (BattlegroundTypeId id) |
BattlegroundTemplate const * | GetBattlegroundTemplateByMapId (uint32 mapId) |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
References DeleteAllBattlegrounds().
void BattlegroundMgr::AddBattleground | ( | Battleground * | bg | ) |
References bgDataStore, Battleground::GetBgTypeID(), Battleground::GetInstanceID(), and sScriptMgr.
Referenced by CreateBattleground().
void BattlegroundMgr::AddToBGFreeSlotQueue | ( | BattlegroundTypeId | bgTypeId, |
Battleground * | bg | ||
) |
References bgDataStore.
|
static |
References QueueToArenaType, and sScriptMgr.
Referenced by Update().
|
static |
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().
|
static |
References queueToBg.
Referenced by BattlegroundQueue::BattlegroundQueueAnnouncerUpdate(), and WorldSession::HandleBattlefieldStatusOpcode().
|
static |
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().
void BattlegroundMgr::BuildBattlegroundListPacket | ( | WorldPacket * | data, |
ObjectGuid | guid, | ||
Player * | player, | ||
BattlegroundTypeId | bgTypeId, | ||
uint8 | fromWhere | ||
) |
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().
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 |
||
) |
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.
void BattlegroundMgr::BuildGroupJoinedBattlegroundPacket | ( | WorldPacket * | data, |
GroupJoinBattlegroundResult | result | ||
) |
References ERR_BATTLEGROUND_JOIN_FAILED, ERR_BATTLEGROUND_JOIN_TIMED_OUT, WorldPacket::Initialize(), and SMSG_GROUP_JOINED_BATTLEGROUND.
void BattlegroundMgr::BuildPlayerJoinedBattlegroundPacket | ( | WorldPacket * | data, |
Player * | player | ||
) |
References Object::GetGUID(), WorldPacket::Initialize(), and SMSG_BATTLEGROUND_PLAYER_JOINED.
void BattlegroundMgr::BuildPlayerLeftBattlegroundPacket | ( | WorldPacket * | data, |
ObjectGuid | guid | ||
) |
References WorldPacket::Initialize(), and SMSG_BATTLEGROUND_PLAYER_LEFT.
void BattlegroundMgr::CheckBattleMasters | ( | ) |
References LOG_ERROR, mBattleMastersMap, sObjectMgr, and UNIT_NPC_FLAG_BATTLEMASTER.
Referenced by LoadBattleMastersEntry().
|
private |
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().
|
private |
References bgDataStore, and IsArenaType().
Referenced by CreateNewBattleground().
Battleground * BattlegroundMgr::CreateNewBattleground | ( | BattlegroundTypeId | bgTypeId, |
PvPDifficultyEntry const * | bracketEntry, | ||
uint8 | arenaType, | ||
bool | isRated | ||
) |
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.
void BattlegroundMgr::DeleteAllBattlegrounds | ( | ) |
References bgDataStore.
Referenced by ~BattlegroundMgr().
Battleground * BattlegroundMgr::GetBattleground | ( | uint32 | instanceID, |
BattlegroundTypeId | bgTypeId | ||
) |
References BATTLEGROUND_TYPE_NONE, and bgDataStore.
Referenced by GetBattlegroundThroughClientInstance(), and SendToBattleground().
|
inline |
References m_BattlegroundQueues.
Battleground * BattlegroundMgr::GetBattlegroundTemplate | ( | BattlegroundTypeId | bgTypeId | ) |
References bgDataStore.
Referenced by CreateBattleground(), CreateNewBattleground(), GetBattlegroundThroughClientInstance(), and SetHolidayWeekends().
|
inlineprivate |
References _battlegroundMapTemplates.
Referenced by GetRandomBG().
|
inlineprivate |
References _battlegroundTemplates.
Referenced by GetRandomBG().
Battleground * BattlegroundMgr::GetBattlegroundThroughClientInstance | ( | uint32 | instanceId, |
BattlegroundTypeId | bgTypeId | ||
) |
References bgDataStore, GetBattleground(), GetBattlegroundTemplate(), and Battleground::isArena().
|
inline |
References BATTLEGROUND_TYPE_NONE, and mBattleMastersMap.
BGFreeSlotQueueContainer & BattlegroundMgr::GetBGFreeSlotQueueStore | ( | BattlegroundTypeId | bgTypeId | ) |
References bgDataStore.
uint32 BattlegroundMgr::GetMaxRatingDifference | ( | ) | const |
References CONFIG_ARENA_MAX_RATING_DIFFERENCE, and sWorld.
uint32 BattlegroundMgr::GetPrematureFinishTime | ( | ) | const |
References CONFIG_BATTLEGROUND_PREMATURE_FINISH_TIMER, and sWorld.
|
private |
References BATTLEGROUND_TYPE_NONE, GetBattlegroundTemplateByMapId(), GetBattlegroundTemplateByTypeId(), and Acore::Containers::SelectRandomWeightedContainerElement().
Referenced by CreateNewBattleground().
uint32 BattlegroundMgr::GetRatingDiscardTimer | ( | ) | const |
References CONFIG_ARENA_RATING_DISCARD_TIMER, and sWorld.
void BattlegroundMgr::InitAutomaticArenaPointDistribution | ( | ) |
References CONFIG_ARENA_AUTO_DISTRIBUTE_POINTS, GameTime::GetGameTime(), LOG_INFO, m_NextAutoDistributionTime, sWorld, and WS_ARENA_DISTRIBUTION_TIME.
|
static |
|
inline |
References m_ArenaTesting.
|
static |
References BATTLEGROUND_AA, BATTLEGROUND_BE, BATTLEGROUND_DS, BATTLEGROUND_NA, BATTLEGROUND_RL, and BATTLEGROUND_RV.
Referenced by CreateClientVisibleInstanceId().
|
static |
References BGTypeToWeekendHolidayId(), and IsHolidayActive().
Referenced by Battleground::EndBattleground(), BattlegroundAB::Init(), BattlegroundEY::Init(), and Player::SendBGWeekendWorldStates().
void BattlegroundMgr::LoadBattlegroundTemplates | ( | ) |
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.
void BattlegroundMgr::LoadBattleMastersEntry | ( | ) |
References CheckBattleMasters(), Field::Get(), getMSTime(), GetMSTimeDiffToNow(), LOG_ERROR, LOG_INFO, LOG_WARN, mBattleMastersMap, sBattlemasterListStore, sObjectMgr, UNIT_NPC_FLAG_BATTLEMASTER, and WorldDatabase.
void BattlegroundMgr::RemoveBattleground | ( | BattlegroundTypeId | bgTypeId, |
uint32 | instanceId | ||
) |
References bgDataStore.
void BattlegroundMgr::RemoveFromBGFreeSlotQueue | ( | BattlegroundTypeId | bgTypeId, |
uint32 | instanceId | ||
) |
References bgDataStore.
void BattlegroundMgr::ScheduleQueueUpdate | ( | uint32 | arenaMatchmakerRating, |
uint8 | arenaType, | ||
BattlegroundQueueTypeId | bgQueueTypeId, | ||
BattlegroundTypeId | bgTypeId, | ||
BattlegroundBracketId | bracket_id | ||
) |
References m_QueueUpdateScheduler.
void BattlegroundMgr::SendAreaSpiritHealerQueryOpcode | ( | Player * | player, |
Battleground * | bg, | ||
ObjectGuid | guid | ||
) |
References Battleground::GetLastResurrectTime(), Player::GetSession(), RESURRECTION_INTERVAL, WorldSession::SendPacket(), and SMSG_AREA_SPIRIT_HEALER_TIME.
void BattlegroundMgr::SendToBattleground | ( | Player * | player, |
uint32 | InstanceID, | ||
BattlegroundTypeId | bgTypeId | ||
) |
References GetBattleground(), Player::GetBgTeamId(), WorldObject::GetName(), Position::GetOrientation(), Position::GetPositionX(), Position::GetPositionY(), Position::GetPositionZ(), LOG_DEBUG, LOG_ERROR, Player::TeleportTo(), and Position::ToString().
void BattlegroundMgr::SetHolidayWeekends | ( | uint32 | mask | ) |
References BATTLEGROUND_RB, GetBattlegroundTemplate(), and MAX_BATTLEGROUND_TYPE_ID.
void BattlegroundMgr::ToggleArenaTesting | ( | ) |
References CONFIG_DEBUG_ARENA, LANG_DEBUG_ARENA_CONF, LANG_DEBUG_ARENA_OFF, LANG_DEBUG_ARENA_ON, m_ArenaTesting, ChatHandler::SendWorldText(), and sWorld.
void BattlegroundMgr::ToggleTesting | ( | ) |
References CONFIG_DEBUG_BATTLEGROUND, LANG_DEBUG_BG_CONF, LANG_DEBUG_BG_OFF, LANG_DEBUG_BG_ON, m_Testing, ChatHandler::SendWorldText(), and sWorld.
void BattlegroundMgr::Update | ( | uint32 | diff | ) |
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.
|
static |
References BATTLEGROUND_AB, BATTLEGROUND_AV, BATTLEGROUND_EY, BATTLEGROUND_IC, BATTLEGROUND_SA, BATTLEGROUND_TYPE_NONE, 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, and HOLIDAY_CALL_TO_ARMS_WS.
Referenced by GameEventMgr::UpdateWorldStates().
|
private |
Referenced by GetBattlegroundTemplateByMapId(), and LoadBattlegroundTemplates().
|
private |
Referenced by GetBattlegroundTemplateByTypeId(), and LoadBattlegroundTemplates().
|
static |
Referenced by BGQueueTypeId().
|
private |
Referenced by AddBattleground(), AddToBGFreeSlotQueue(), BuildBattlegroundListPacket(), CreateClientVisibleInstanceId(), DeleteAllBattlegrounds(), GetBattleground(), GetBattlegroundTemplate(), GetBattlegroundThroughClientInstance(), GetBGFreeSlotQueueStore(), RemoveBattleground(), RemoveFromBGFreeSlotQueue(), and Update().
|
static |
Referenced by BGQueueTypeId().
|
static |
Referenced by CreateBattleground().
|
static |
Referenced by CreateNewBattleground().
|
static |
|
static |
|
private |
Referenced by isArenaTesting(), and ToggleArenaTesting().
|
private |
Referenced by GetBattlegroundQueue(), and Update().
|
private |
Referenced by InitAutomaticArenaPointDistribution(), and Update().
|
private |
Referenced by ScheduleQueueUpdate(), and Update().
|
private |
Referenced by isTesting(), and ToggleTesting().
|
private |
Referenced by CheckBattleMasters(), GetBattleMasterBG(), and LoadBattleMastersEntry().
Referenced by BGArenaType().
|
static |
Referenced by BGTemplateId().