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

#include <Battleground.h>

+ Inheritance diagram for Battleground:

Public Types

typedef std::map< ObjectGuid, BattlegroundPlayer > BattlegroundPlayerMap
 
typedef std::map< ObjectGuid, BattlegroundScore * > BattlegroundScoreMap
 

Public Member Functions

 Battleground (BattlegroundTemplate const *battlegroundTemplate)
 
 Battleground (Battleground const &)
 
virtual ~Battleground ()
 
Battleground & operator= (Battleground const &)=delete
 
void Update (uint32 diff)
 
void Reset ()
 
char const * GetName () const
 
BattlegroundTypeId GetTypeID () const
 
BattlegroundBracketId GetBracketId () const
 
uint32 GetInstanceID () const
 
BattlegroundStatus GetStatus () const
 
uint32 GetClientInstanceID () const
 
uint32 GetElapsedTime () const
 
Milliseconds GetInProgressDuration () const
 
uint32 GetRemainingTime () const
 
uint32 GetMaxPlayers () const
 
uint32 GetMinPlayers () const
 
uint32 GetMinLevel () const
 
uint32 GetMaxLevel () const
 
uint32 GetMaxPlayersPerTeam () const
 
uint32 GetMinPlayersPerTeam () const
 
int32 GetStartDelayTime () const
 
uint8 GetArenaType () const
 
PvPTeamId GetWinner () const
 
uint32 GetScriptId () const
 
uint32 GetBonusHonorFromKill (uint32 kills) const
 
void SetBracket (PVPDifficultyEntry const *bracketEntry)
 
void SetInstanceID (uint32 InstanceID)
 
void SetStatus (BattlegroundStatus Status)
 
void SetClientInstanceID (uint32 InstanceID)
 
void SetElapsedTime (uint32 Time)
 
void SetRemainingTime (uint32 Time)
 
void SetRated (bool state)
 
void SetArenaType (uint8 type)
 
void SetWinner (PvPTeamId winnerTeamId)
 
std::unordered_set< uint32 > const * GetPvpStatIds () const
 
void ModifyStartDelayTime (int diff)
 
void SetStartDelayTime (int Time)
 
void AddToBGFreeSlotQueue ()
 
void RemoveFromBGFreeSlotQueue ()
 
void RemoveFromBGFreeSlotQueueOnShutdown ()
 
void DecreaseInvitedCount (Team team)
 
void IncreaseInvitedCount (Team team)
 
uint32 GetInvitedCount (Team team) const
 
bool HasFreeSlots () const
 
uint32 GetFreeSlotsForTeam (Team team) const
 
bool isArena () const
 
bool isBattleground () const
 
bool isRated () const
 
BattlegroundPlayerMap const & GetPlayers () const
 
uint32 GetPlayersSize () const
 
uint32 GetPlayerScoresSize () const
 
void StartBattleground ()
 
GameObject * GetBGObject (uint32 type, bool logError=true)
 
Creature * GetBGCreature (uint32 type, bool logError=true)
 
uint32 GetMapId () const
 
void SetBgMap (BattlegroundMap *map)
 
BattlegroundMap * GetBgMap () const
 
BattlegroundMap * FindBgMap () const
 
WorldSafeLocsEntry const * GetTeamStartPosition (TeamId teamId) const
 
float GetStartMaxDist () const
 
void SendPacketToTeam (Team team, WorldPacket const *packet, Player *except=nullptr) const
 
void SendPacketToAll (WorldPacket const *packet) const
 
void SendChatMessage (Creature *source, uint8 textId, WorldObject *target=nullptr)
 
void SendBroadcastText (uint32 id, ChatMsg msgType, WorldObject const *target=nullptr)
 
template<class Do >
void BroadcastWorker (Do &_do)
 
void PlaySoundToTeam (uint32 SoundID, Team team)
 
void PlaySoundToAll (uint32 SoundID)
 
void CastSpellOnTeam (uint32 SpellID, Team team)
 
void RemoveAuraOnTeam (uint32 SpellID, Team team)
 
void RewardHonorToTeam (uint32 Honor, Team team)
 
void RewardReputationToTeam (uint32 faction_id, uint32 Reputation, Team team)
 
void UpdateWorldState (int32 worldStateId, int32 value, bool hidden=false)
 
virtual void EndBattleground (Team winner)
 
void BlockMovement (Player *player)
 
void SendMessageToAll (uint32 entry, ChatMsg type, Player const *source=nullptr)
 
Group * GetBgRaid (Team team) const
 
void SetBgRaid (Team team, Group *bg_raid)
 
virtual void BuildPvPLogDataPacket (WorldPackets::Battleground::PVPMatchStatistics &pvpLogData) const
 
BattlegroundScore const * GetBattlegroundScore (Player *player) const
 
bool UpdatePlayerScore (Player *player, uint32 type, uint32 value, bool doAddHonor=true, Optional< HonorGainSource > source={})
 
void UpdatePvpStat (Player *player, uint32 pvpStatId, uint32 value)
 
uint32 GetPlayersCountByTeam (Team team) const
 
uint32 GetAlivePlayersCountByTeam (Team team) const
 
void UpdatePlayersCountByTeam (Team team, bool remove)
 
virtual void CheckWinConditions ()
 
void SetArenaMatchmakerRating (Team team, uint32 MMR)
 
uint32 GetArenaMatchmakerRating (Team team) const
 
virtual void HandleKillPlayer (Player *player, Player *killer)
 
virtual void HandleKillUnit (Creature *, Unit *)
 
void EventPlayerLoggedIn (Player *player)
 
void EventPlayerLoggedOut (Player *player)
 
virtual WorldSafeLocsEntry const * GetExploitTeleportLocation (Team)
 
void TeleportPlayerToExploitLocation (Player *player)
 
virtual void AddPlayer (Player *player, BattlegroundQueueTypeId queueId)
 
void AddOrSetPlayerToCorrectBgGroup (Player *player, Team team)
 
virtual void RemovePlayerAtLeave (ObjectGuid guid, bool Transport, bool SendPacket)
 
virtual bool HandlePlayerUnderMap (Player *)
 
Team GetPlayerTeam (ObjectGuid guid) const
 
bool IsPlayerInBattleground (ObjectGuid guid) const
 
bool IsPlayerMercenaryInBattleground (ObjectGuid guid) const
 
bool ToBeDeleted () const
 
void SetDeleteThis ()
 
void RewardXPAtKill (Player *killer, Player *victim)
 
bool CanAwardArenaPoints () const
 
uint32 GetTeamScore (TeamId teamId) const
 
Team GetPrematureWinner ()
 
uint8 GetUniqueBracketId () const
 
void AddPlayerPosition (WorldPackets::Battleground::BattlegroundPlayerPosition const &position)
 
void RemovePlayerPosition (ObjectGuid guid)
 
BattlegroundPlayer const * GetBattlegroundPlayerData (ObjectGuid const &playerGuid) const
 
void AddPoint (Team team, uint32 points=1)
 
void SetTeamPoint (Team team, uint32 points=0)
 
void RemovePoint (Team team, uint32 points=1)
 
Trinity::unique_weak_ptr< Battleground > GetWeakPtr () const
 
void SetWeakPtr (Trinity::unique_weak_ptr< Battleground > weakRef)
 

Static Public Member Functions

static TeamId GetTeamIndexByTeamId (Team team)
 

Protected Member Functions

void EndNow ()
 
void PlayerAddedToBGCheckIfBGIsRunning (Player *player)
 
Player * _GetPlayer (ObjectGuid guid, bool offlineRemove, char const *context) const
 
Player * _GetPlayer (BattlegroundPlayerMap::iterator itr, char const *context)
 
Player * _GetPlayer (BattlegroundPlayerMap::const_iterator itr, char const *context) const
 
Player * _GetPlayerForTeam (Team team, BattlegroundPlayerMap::const_iterator itr, char const *context) const
 
virtual bool PreUpdateImpl (uint32)
 Pre-update hook.
 
virtual void PostUpdateImpl (uint32)
 Post-update hook.
 
void _ProcessOfflineQueue ()
 
void _ProcessProgress (uint32 diff)
 
void _ProcessLeave (uint32 diff)
 
void _ProcessJoin (uint32 diff)
 
void _CheckSafePositions (uint32 diff)
 
void _ProcessPlayerPositionBroadcast (uint32 diff)
 
virtual void RemovePlayer (Player *, ObjectGuid, uint32)
 

Protected Attributes

BattlegroundScoreMap PlayerScores
 
BattlegroundPlayerMap m_Players
 
uint8 m_Events
 
BattlegroundStartTimeIntervals StartDelayTimes [BG_STARTING_EVENT_COUNT]
 
uint32 StartMessageIds [BG_STARTING_EVENT_COUNT]
 
int32 m_TeamScores [PVP_TEAMS_COUNT]
 

Private Attributes

uint32 m_InstanceID
 
BattlegroundStatus m_Status
 
uint32 m_ClientInstanceID
 
uint32 m_StartTime
 
uint32 m_ResetStatTimer
 
uint32 m_ValidStartPositionTimer
 
int32 m_EndTime
 
uint8 m_ArenaType
 
bool m_InBGFreeSlotQueue
 
bool m_SetDeleteThis
 
PvPTeamId _winnerTeamId
 
int32 m_StartDelayTime
 
bool m_IsRated
 
bool m_PrematureCountDown
 
uint32 m_LastPlayerPositionBroadcast
 
std::deque< ObjectGuid > m_OfflineQueue
 
uint32 m_InvitedAlliance
 
uint32 m_InvitedHorde
 
Group * m_BgRaids [PVP_TEAMS_COUNT]
 
uint32 m_PlayersCount [PVP_TEAMS_COUNT]
 
uint32 m_ArenaTeamMMR [PVP_TEAMS_COUNT]
 
BattlegroundMap * m_Map
 
Position StartPosition [PVP_TEAMS_COUNT]
 
BattlegroundTemplate const * _battlegroundTemplate
 
PVPDifficultyEntry const * _pvpDifficultyEntry
 
std::unordered_set< uint32 > const * _pvpStatIds
 
std::vector< WorldPackets::Battleground::BattlegroundPlayerPosition > _playerPositions
 
time_t _preparationStartTime
 
Trinity::unique_weak_ptr< Battleground > m_weakRef
 

Detailed Description

Definition at line 258 of file Battleground.h.

Member Typedef Documentation

◆ BattlegroundPlayerMap

◆ BattlegroundScoreMap

Definition at line 332 of file Battleground.h.

Constructor & Destructor Documentation

◆ Battleground() [1/2]

◆ Battleground() [2/2]

Battleground::Battleground ( Battleground const &  )
default

◆ ~Battleground()

Member Function Documentation

◆ _CheckSafePositions()

◆ _GetPlayer() [1/3]

Player * Battleground::_GetPlayer ( BattlegroundPlayerMap::const_iterator  itr,
char const *  context 
) const
inlineprotected

Definition at line 467 of file Battleground.h.

References _GetPlayer().

Referenced by _GetPlayer().

◆ _GetPlayer() [2/3]

Player * Battleground::_GetPlayer ( BattlegroundPlayerMap::iterator  itr,
char const *  context 
)
inlineprotected

Definition at line 466 of file Battleground.h.

References _GetPlayer().

Referenced by _GetPlayer().

◆ _GetPlayer() [3/3]

Player * Battleground::_GetPlayer ( ObjectGuid  guid,
bool  offlineRemove,
char const *  context 
) const
protected

◆ _GetPlayerForTeam()

Player * Battleground::_GetPlayerForTeam ( Team  team,
BattlegroundPlayerMap::const_iterator  itr,
char const *  context 
) const
protected

◆ _ProcessJoin()

void Battleground::_ProcessJoin ( uint32  diff)
inlineprotected
Todo:
add arena sound PlaySoundToAll(SOUND_ARENA_START);

Definition at line 329 of file Battleground.cpp.

References _preparationStartTime, Battleground, BG_STARTING_EVENT_1, BG_STARTING_EVENT_2, BG_STARTING_EVENT_3, BG_STARTING_EVENT_4, BG_STARTING_EVENT_FIRST, BG_STARTING_EVENT_FOURTH, BG_STARTING_EVENT_SECOND, BG_STARTING_EVENT_THIRD, CHAT_MSG_BG_SYSTEM_NEUTRAL, CheckWinConditions(), CONFIG_BATTLEGROUND_QUEUE_ANNOUNCER_ENABLE, EndNow(), WorldPackets::Battleground::Engaged, FindBgMap(), ObjectAccessor::FindPlayer(), AuraApplication::GetBase(), BattlegroundMap::GetBattlegroundScript(), GetBgMap(), Aura::GetDuration(), GameTime::GetGameTime(), Map::GetId(), GetMapId(), GetMaxLevel(), GetMinLevel(), GetName(), ObjectAccessor::GetPlayer(), GetPlayers(), Aura::GetSpellInfo(), GetStartDelayTime(), SpellInfo::HasAttribute(), Aura::HasEffectType(), IN_MILLISECONDS, isArena(), Aura::IsPermanent(), AuraApplication::IsPositive(), LANG_BG_STARTED_ANNOUNCE_WORLD, m_BgRaids, m_Events, m_InstanceID, m_ResetStatTimer, ModifyStartDelayTime(), BattlegroundScript::OnPrepareStage1(), BattlegroundScript::OnPrepareStage2(), BattlegroundScript::OnPrepareStage3(), BattlegroundScript::OnStart(), PlaySoundToAll(), Pvp, SendBroadcastText(), SendPacketToAll(), SetStartDelayTime(), SetStatus(), SOUND_BG_START, SPELL_ARENA_PREPARATION, SPELL_ATTR0_NO_IMMUNITIES, SPELL_AURA_MOD_INVISIBILITY, SPELL_PREPARATION, StartBattleground, StartDelayTimes, StartMessageIds, STATUS_IN_PROGRESS, sWorld, and TC_LOG_ERROR.

Referenced by Update().

◆ _ProcessLeave()

void Battleground::_ProcessLeave ( uint32  diff)
inlineprotected

Definition at line 455 of file Battleground.cpp.

References GetRemainingTime(), m_Players, RemovePlayerAtLeave(), and SetRemainingTime().

Referenced by Update().

◆ _ProcessOfflineQueue()

void Battleground::_ProcessOfflineQueue ( )
inlineprotected

Definition at line 255 of file Battleground.cpp.

References GameTime::GetGameTime(), m_OfflineQueue, m_Players, and RemovePlayerAtLeave().

Referenced by Update().

◆ _ProcessPlayerPositionBroadcast()

◆ _ProcessProgress()

◆ AddOrSetPlayerToCorrectBgGroup()

◆ AddPlayer()

void Battleground::AddPlayer ( Player *  player,
BattlegroundQueueTypeId  queueId 
)
virtual

Reimplemented in Arena.

Definition at line 973 of file Battleground.cpp.

References _pvpStatIds, AddOrSetPlayerToCorrectBgGroup(), WorldPackets::Battleground::PVPMatchInitialize::AffectsRating, ALLIANCE, WorldPackets::Battleground::PVPMatchInitialize::ArenaFaction, BattlegroundQueueTypeId::BattlemasterListId, WorldPackets::Battleground::PVPMatchInitialize::BattlemasterListID, BG_START_DELAY_2M, WorldObject::CastSpell(), WorldPackets::Battleground::Complete, Player::DestroyConjuredItems(), WorldPackets::Battleground::PVPMatchInitialize::Duration, WorldPackets::Battleground::Engaged, BattlegroundMap::GetBattlegroundScript(), GetBgMap(), Player::GetBGTeam(), GetElapsedTime(), BaseEntity::GetGUID(), GetMapId(), GetStatus(), GameTime::GetSystemTime(), WorldPackets::Battleground::BattlegroundPlayerJoined::Guid, HORDE, WorldPackets::Battleground::Inactive, Player::isAFK(), isArena(), Player::IsMercenaryForBattlegroundQueueType(), IsPlayerInBattleground(), isRated(), m_Players, WorldPackets::Battleground::PVPMatchInitialize::MapID, BattlegroundPlayer::Mercenary, BattlegroundPlayer::OfflineRemoveTime, BattlegroundScript::OnPlayerJoined(), PLAYER_FLAGS_EX_MERCENARY_MODE, PlayerAddedToBGCheckIfBGIsRunning(), PlayerScores, PVP_TEAM_ALLIANCE, PVP_TEAM_HORDE, BattlegroundPlayer::queueTypeId, WorldPackets::Battleground::PVPMatchInitialize::Registered, Player::RemoveArenaEnchantments(), Unit::RemoveAurasByType(), Player::ResetAllPowers(), Player::SendDirectMessage(), SendPacketToTeam(), Player::SetPlayerFlagEx(), SPELL_ARENA_PREPARATION, SPELL_AURA_MOUNTED, SPELL_MERCENARY_ALLIANCE_1, SPELL_MERCENARY_ALLIANCE_REACTIONS, SPELL_MERCENARY_HORDE_1, SPELL_MERCENARY_HORDE_REACTIONS, SPELL_MERCENARY_SHAPESHIFT, SPELL_PREPARATION, WorldPackets::Battleground::PVPMatchInitialize::StartTime, WorldPackets::Battleground::StartUp, WorldPackets::Battleground::PVPMatchInitialize::State, STATUS_IN_PROGRESS, STATUS_NONE, STATUS_WAIT_JOIN, STATUS_WAIT_LEAVE, STATUS_WAIT_QUEUE, BattlegroundPlayer::Team, TEMP_ENCHANTMENT_SLOT, Player::ToggleAFK(), Player::UnsummonPetTemporaryIfAny(), UpdatePlayersCountByTeam(), WorldPackets::Battleground::BattlegroundPlayerJoined::Write(), and WorldPackets::Battleground::PVPMatchInitialize::Write().

Referenced by Arena::AddPlayer(), and Player::LoadFromDB().

◆ AddPlayerPosition()

void Battleground::AddPlayerPosition ( WorldPackets::Battleground::BattlegroundPlayerPosition const &  position)

Definition at line 1336 of file Battleground.cpp.

References _playerPositions.

Referenced by AuraEffect::HandleBattlegroundPlayerPosition().

◆ AddPoint()

◆ AddToBGFreeSlotQueue()

void Battleground::AddToBGFreeSlotQueue ( )

Definition at line 1161 of file Battleground.cpp.

References isBattleground(), m_InBGFreeSlotQueue, and sBattlegroundMgr.

Referenced by RemovePlayerAtLeave(), and StartBattleground().

◆ BlockMovement()

void Battleground::BlockMovement ( Player *  player)

Definition at line 797 of file Battleground.cpp.

References Player::SetClientControl().

Referenced by EndBattleground(), and PlayerAddedToBGCheckIfBGIsRunning().

◆ BroadcastWorker()

template<class Do >
void Battleground::BroadcastWorker ( Do &  _do)

Definition at line 54 of file Battleground.cpp.

References _GetPlayer(), and m_Players.

Referenced by SendBroadcastText(), and SendMessageToAll().

◆ BuildPvPLogDataPacket()

◆ CanAwardArenaPoints()

bool Battleground::CanAwardArenaPoints ( ) const
inline

Definition at line 432 of file Battleground.h.

References BG_AWARD_ARENA_POINTS_MIN_LEVEL.

◆ CastSpellOnTeam()

◆ CheckWinConditions()

virtual void Battleground::CheckWinConditions ( )
inlinevirtual

Reimplemented in Arena.

Definition at line 397 of file Battleground.h.

Referenced by _ProcessJoin().

◆ DecreaseInvitedCount()

void Battleground::DecreaseInvitedCount ( Team  team)
inline

Definition at line 317 of file Battleground.h.

References ALLIANCE.

Referenced by RemovePlayerAtLeave().

◆ EndBattleground()

void Battleground::EndBattleground ( Team  winner)
virtual

Reimplemented in Arena.

Definition at line 615 of file Battleground.cpp.

References _GetPlayer(), ALLIANCE, BG_START_DELAY_2M, BG_TEXT_ALLIANCE_WINS, BG_TEXT_HORDE_WINS, BGCompletion, BlockMovement(), BuildPvPLogDataPacket(), CHAR_INS_PVPSTATS_BATTLEGROUND, CHAR_INS_PVPSTATS_PLAYER, CHAR_SEL_PVPSTATS_MAXID, CharacterDatabase, CHAT_MSG_BG_SYSTEM_NEUTRAL, Unit::CombatStop(), Unit::CombatStopWithPets(), CONFIG_BATTLEGROUND_STORE_STATISTICS_ENABLE, CONFIG_BG_REWARD_LOSER_HONOR_FIRST, CONFIG_BG_REWARD_LOSER_HONOR_LAST, CONFIG_BG_REWARD_WINNER_HONOR_FIRST, CONFIG_BG_REWARD_WINNER_HONOR_LAST, WorldPackets::Battleground::PVPMatchComplete::Duration, GetBattlegroundPlayerData(), BattlegroundMap::GetBattlegroundScript(), GetBgMap(), Player::GetBGTeam(), GetBonusHonorFromKill(), ObjectGuid::GetCounter(), GetElapsedTime(), BaseEntity::GetGUID(), WorldLocation::GetMapId(), Player::GetRandomWinner(), WorldPackets::Packet::GetRawPacket(), GetTypeID(), Field::GetUInt64(), GetUniqueBracketId(), GetWinner(), Unit::HasAuraType(), HolidayBGCompletion, HORDE, Unit::IsAlive(), isBattleground(), BattlegroundMgr::IsBGWeekend(), BattlegroundMgr::IsRandomBattleground(), WorldPackets::Battleground::PVPMatchComplete::LogData, m_Players, BattlegroundScript::OnEnd(), ParticipateInBattleground, PlayerScores, PlaySoundToAll(), PVP_TEAM_ALLIANCE, PVP_TEAM_HORDE, PVP_TEAM_NEUTRAL, RandomBGCompletion, Unit::RemoveAura(), Unit::RemoveAurasByType(), RemoveFromBGFreeSlotQueue(), Player::ResetAllPowers(), Player::ResurrectPlayer(), SCORE_BONUS_HONOR, SendBroadcastText(), Player::SendDirectMessage(), PreparedStatementBase::setBool(), Player::SetRandomWinner(), SetRemainingTime(), SetStatus(), PreparedStatementBase::setUInt32(), PreparedStatementBase::setUInt64(), PreparedStatementBase::setUInt8(), SetWinner(), sGuildMgr, SOUND_ALLIANCE_WINS, SOUND_HORDE_WINS, Player::SpawnCorpseBones(), SPELL_AURA_MOD_SHAPESHIFT, SPELL_AURA_SPIRIT_OF_REDEMPTION, SPELL_HONORABLE_DEFENDER_25Y, SPELL_HONORABLE_DEFENDER_60Y, STATUS_WAIT_LEAVE, sWorld, TIME_AUTOCLOSE_BATTLEGROUND, Player::UpdateCriteria(), UpdatePlayerScore(), WinBattleground, WorldPackets::Battleground::PVPMatchComplete::Winner, and WorldPackets::Battleground::PVPMatchComplete::Write().

Referenced by _ProcessProgress(), battleground_silvershard_mines::CheckWinner(), battleground_temple_of_kotmogu::CheckWinner(), Arena::EndBattleground(), EventPlayerLoggedOut(), battleground_seething_shore::HandleAssaultPoint(), bg_commandscript::HandleBgStopCommand(), battleground_twin_peaks::OnCaptureFlag(), battleground_warsong_gulch::OnCaptureFlag(), battleground_isle_of_conquest::OnPlayerKilled(), battleground_isle_of_conquest::OnUnitKilled(), battleground_alterac_valley::OnUnitKilled(), battleground_arathi_basin::OnUpdate(), battleground_battle_for_gilneas::OnUpdate(), battleground_strand_of_the_ancients::OnUpdate(), battleground_twin_peaks::OnUpdate(), battleground_warsong_gulch::OnUpdate(), battleground_strand_of_the_ancients::TitanRelicActivated(), Update(), battleground_alterac_valley::UpdateScore(), and battleground_eye_of_the_storm::UpdateTeamScore().

◆ EndNow()

void Battleground::EndNow ( )
protected

◆ EventPlayerLoggedIn()

void Battleground::EventPlayerLoggedIn ( Player *  player)

◆ EventPlayerLoggedOut()

◆ FindBgMap()

BattlegroundMap * Battleground::FindBgMap ( ) const
inline

Definition at line 346 of file Battleground.h.

Referenced by _ProcessJoin().

◆ GetAlivePlayersCountByTeam()

uint32 Battleground::GetAlivePlayersCountByTeam ( Team  team) const

◆ GetArenaMatchmakerRating()

uint32 Battleground::GetArenaMatchmakerRating ( Team  team) const
inline

Definition at line 401 of file Battleground.h.

Referenced by Arena::EndBattleground(), and Arena::RemovePlayerAtLeave().

◆ GetArenaType()

uint8 Battleground::GetArenaType ( ) const
inline

◆ GetBattlegroundPlayerData()

BattlegroundPlayer const * Battleground::GetBattlegroundPlayerData ( ObjectGuid const &  playerGuid) const
inline

◆ GetBattlegroundScore()

BattlegroundScore const * Battleground::GetBattlegroundScore ( Player *  player) const

◆ GetBGCreature()

Creature * Battleground::GetBGCreature ( uint32  type,
bool  logError = true 
)

◆ GetBgMap()

◆ GetBGObject()

GameObject * Battleground::GetBGObject ( uint32  type,
bool  logError = true 
)

◆ GetBgRaid()

Group * Battleground::GetBgRaid ( Team  team) const
inline

◆ GetBonusHonorFromKill()

◆ GetBracketId()

◆ GetClientInstanceID()

uint32 Battleground::GetClientInstanceID ( ) const
inline

Definition at line 278 of file Battleground.h.

Referenced by BattlegroundMgr::Update().

◆ GetElapsedTime()

◆ GetExploitTeleportLocation()

virtual WorldSafeLocsEntry const * Battleground::GetExploitTeleportLocation ( Team  )
inlinevirtual

Definition at line 411 of file Battleground.h.

Referenced by TeleportPlayerToExploitLocation().

◆ GetFreeSlotsForTeam()

◆ GetInProgressDuration()

Milliseconds Battleground::GetInProgressDuration ( ) const
inline

Definition at line 280 of file Battleground.h.

References BG_STARTING_EVENT_4, and BG_STARTING_EVENT_FIRST.

◆ GetInstanceID()

◆ GetInvitedCount()

uint32 Battleground::GetInvitedCount ( Team  team) const
inline

Definition at line 320 of file Battleground.h.

References ALLIANCE.

Referenced by GetFreeSlotsForTeam(), and Update().

◆ GetMapId()

◆ GetMaxLevel()

◆ GetMaxPlayers()

uint32 Battleground::GetMaxPlayers ( ) const

Definition at line 1510 of file Battleground.cpp.

References GetMaxPlayersPerTeam().

Referenced by HasFreeSlots().

◆ GetMaxPlayersPerTeam()

uint32 Battleground::GetMaxPlayersPerTeam ( ) const

◆ GetMinLevel()

uint32 Battleground::GetMinLevel ( ) const

◆ GetMinPlayers()

uint32 Battleground::GetMinPlayers ( ) const

Definition at line 1515 of file Battleground.cpp.

References GetMinPlayersPerTeam().

◆ GetMinPlayersPerTeam()

◆ GetName()

char const * Battleground::GetName ( ) const

◆ GetPlayers()

◆ GetPlayerScoresSize()

uint32 Battleground::GetPlayerScoresSize ( ) const
inline

Definition at line 333 of file Battleground.h.

Referenced by BuildPvPLogDataPacket().

◆ GetPlayersCountByTeam()

◆ GetPlayersSize()

uint32 Battleground::GetPlayersSize ( ) const
inline

Definition at line 330 of file Battleground.h.

Referenced by HasFreeSlots(), and Update().

◆ GetPlayerTeam()

Team Battleground::GetPlayerTeam ( ObjectGuid  guid) const

◆ GetPrematureWinner()

Team Battleground::GetPrematureWinner ( )

Definition at line 273 of file Battleground.cpp.

References ALLIANCE, GetMinPlayersPerTeam(), GetPlayersCountByTeam(), HORDE, and TEAM_OTHER.

Referenced by _ProcessProgress().

◆ GetPvpStatIds()

std::unordered_set< uint32 > const * Battleground::GetPvpStatIds ( ) const
inline

Definition at line 308 of file Battleground.h.

◆ GetRemainingTime()

uint32 Battleground::GetRemainingTime ( ) const
inline

◆ GetScriptId()

uint32 Battleground::GetScriptId ( ) const

Definition at line 785 of file Battleground.cpp.

References _battlegroundTemplate, and BattlegroundTemplate::ScriptId.

◆ GetStartDelayTime()

int32 Battleground::GetStartDelayTime ( ) const
inline

Definition at line 291 of file Battleground.h.

Referenced by _ProcessJoin().

◆ GetStartMaxDist()

float Battleground::GetStartMaxDist ( ) const

Definition at line 517 of file Battleground.cpp.

References _battlegroundTemplate, and BattlegroundTemplate::MaxStartDistSq.

Referenced by _CheckSafePositions().

◆ GetStatus()

◆ GetTeamIndexByTeamId()

◆ GetTeamScore()

◆ GetTeamStartPosition()

WorldSafeLocsEntry const * Battleground::GetTeamStartPosition ( TeamId  teamId) const

◆ GetTypeID()

◆ GetUniqueBracketId()

uint8 Battleground::GetUniqueBracketId ( ) const

Definition at line 1505 of file Battleground.cpp.

References GetMinLevel().

Referenced by EndBattleground().

◆ GetWeakPtr()

Trinity::unique_weak_ptr< Battleground > Battleground::GetWeakPtr ( ) const
inline

Definition at line 457 of file Battleground.h.

◆ GetWinner()

PvPTeamId Battleground::GetWinner ( ) const
inline

Definition at line 293 of file Battleground.h.

Referenced by EndBattleground().

◆ HandleKillPlayer()

◆ HandleKillUnit()

void Battleground::HandleKillUnit ( Creature *  victim,
Unit *  killer 
)
virtual

Definition at line 1398 of file Battleground.cpp.

References GetBgMap().

◆ HandlePlayerUnderMap()

virtual bool Battleground::HandlePlayerUnderMap ( Player *  )
inlinevirtual

Definition at line 421 of file Battleground.h.

Referenced by WorldSession::HandleMovementOpcode().

◆ HasFreeSlots()

bool Battleground::HasFreeSlots ( ) const

Definition at line 1257 of file Battleground.cpp.

References GetMaxPlayers(), and GetPlayersSize().

Referenced by BattlegroundQueue::BattlegroundQueueUpdate().

◆ IncreaseInvitedCount()

void Battleground::IncreaseInvitedCount ( Team  team)
inline

Definition at line 318 of file Battleground.h.

References ALLIANCE.

Referenced by BattlegroundQueue::InviteGroupToBG().

◆ isArena()

◆ isBattleground()

◆ IsPlayerInBattleground()

bool Battleground::IsPlayerInBattleground ( ObjectGuid  guid) const

Definition at line 1414 of file Battleground.cpp.

References m_Players.

Referenced by AddPlayer(), EventPlayerLoggedOut(), and Player::LoadFromDB().

◆ IsPlayerMercenaryInBattleground()

bool Battleground::IsPlayerMercenaryInBattleground ( ObjectGuid  guid) const

Definition at line 1422 of file Battleground.cpp.

References m_Players.

Referenced by Player::LoadFromDB().

◆ isRated()

◆ ModifyStartDelayTime()

void Battleground::ModifyStartDelayTime ( int  diff)
inline

Definition at line 310 of file Battleground.h.

Referenced by _ProcessJoin().

◆ operator=()

Battleground & Battleground::operator= ( Battleground const &  )
delete

◆ PlayerAddedToBGCheckIfBGIsRunning()

◆ PlaySoundToAll()

◆ PlaySoundToTeam()

void Battleground::PlaySoundToTeam ( uint32  SoundID,
Team  team 
)

Definition at line 562 of file Battleground.cpp.

References ObjectGuid::Empty, and SendPacketToTeam().

◆ PostUpdateImpl()

virtual void Battleground::PostUpdateImpl ( uint32  )
inlineprotectedvirtual

Post-update hook.

Will be called after battleground update has passed. May be used to implement custom update effects in subclasses.

Parameters
diffa time difference between two worldserver update loops in milliseconds.
See also
Update(), PreUpdateImpl().

Definition at line 498 of file Battleground.h.

Referenced by Update().

◆ PreUpdateImpl()

virtual bool Battleground::PreUpdateImpl ( uint32  )
inlineprotectedvirtual

Pre-update hook.

Will be called before battleground update is started. Depending on the result of this call actual update body may be skipped.

Parameters
diffa time difference between two worldserver update loops in milliseconds.
Returns
true if update must be performed, false otherwise.
See also
Update(), PostUpdateImpl().

Definition at line 485 of file Battleground.h.

Referenced by Update().

◆ RemoveAuraOnTeam()

void Battleground::RemoveAuraOnTeam ( uint32  SpellID,
Team  team 
)

Definition at line 574 of file Battleground.cpp.

References _GetPlayerForTeam(), and m_Players.

Referenced by battleground_strand_of_the_ancients::EndRound().

◆ RemoveFromBGFreeSlotQueue()

void Battleground::RemoveFromBGFreeSlotQueue ( )

◆ RemoveFromBGFreeSlotQueueOnShutdown()

void Battleground::RemoveFromBGFreeSlotQueueOnShutdown ( )
inline

Definition at line 315 of file Battleground.h.

◆ RemovePlayer()

virtual void Battleground::RemovePlayer ( Player *  ,
ObjectGuid  ,
uint32   
)
inlineprotectedvirtual

Reimplemented in Arena.

Definition at line 510 of file Battleground.h.

Referenced by EventPlayerLoggedOut(), and RemovePlayerAtLeave().

◆ RemovePlayerAtLeave()

void Battleground::RemovePlayerAtLeave ( ObjectGuid  guid,
bool  Transport,
bool  SendPacket 
)
virtual

Reimplemented in Arena.

Definition at line 803 of file Battleground.cpp.

References AddToBGFreeSlotQueue(), Unit::AtEndOfEncounter(), Battleground, BATTLEGROUND_QUEUE_NONE, BATTLEGROUND_TYPE_NONE, BattlegroundMgr::BuildBattlegroundStatusNone(), Player::ClearAfkReports(), DecreaseInvitedCount(), Player::FailCriteria(), ObjectAccessor::FindPlayer(), Player::GetBattlegroundQueueIndex(), Player::GetBattlegroundQueueJoinTime(), GetBgRaid(), GetBracketId(), WorldObject::GetName(), GetPlayerTeam(), GetStatus(), WorldPackets::Battleground::BattlegroundPlayerLeft::Guid, Unit::HasAuraType(), Unit::IsAlive(), isArena(), isBattleground(), LeaveArenaOrBattleground, LeaveBattleground, m_Players, Player::OfflineResurrect(), PET_SAVE_NOT_IN_SLOT, PLAYER_FLAGS_EX_MERCENARY_MODE, PlayerScores, Unit::RemoveAura(), Unit::RemoveAurasByType(), Unit::RemoveAurasWithInterruptFlags(), Player::RemoveBattlegroundQueueId(), Player::RemovePet(), RemovePlayer(), Player::RemovePlayerFlagEx(), Player::ResummonPetTemporaryUnSummonedIfAny(), Player::ResurrectPlayer(), sBattlegroundMgr, Player::SendDirectMessage(), SendPacketToTeam(), Player::SetBattlegroundId(), SetBgRaid(), Player::SetBGTeam(), Player::SpawnCorpseBones(), SPELL_AURA_MOD_SHAPESHIFT, SPELL_AURA_MOUNTED, SPELL_AURA_SPIRIT_OF_REDEMPTION, SPELL_MERCENARY_ALLIANCE_1, SPELL_MERCENARY_ALLIANCE_REACTIONS, SPELL_MERCENARY_HORDE_1, SPELL_MERCENARY_HORDE_REACTIONS, SPELL_MERCENARY_SHAPESHIFT, STATUS_WAIT_LEAVE, TC_LOG_DEBUG, TEAM_OTHER, Player::TeleportToBGEntryPoint(), UpdatePlayersCountByTeam(), WorldPackets::Battleground::BattlefieldStatusNone::Write(), and WorldPackets::Battleground::BattlegroundPlayerLeft::Write().

Referenced by _ProcessLeave(), _ProcessOfflineQueue(), Player::LeaveBattleground(), Player::LoadFromDB(), and Arena::RemovePlayerAtLeave().

◆ RemovePlayerPosition()

void Battleground::RemovePlayerPosition ( ObjectGuid  guid)

◆ RemovePoint()

void Battleground::RemovePoint ( Team  team,
uint32  points = 1 
)
inline

Definition at line 455 of file Battleground.h.

◆ Reset()

◆ RewardHonorToTeam()

◆ RewardReputationToTeam()

◆ RewardXPAtKill()

void Battleground::RewardXPAtKill ( Player *  killer,
Player *  victim 
)

Definition at line 1472 of file Battleground.cpp.

References CONFIG_BG_XP_FOR_KILL, KillRewarder::Reward(), and sWorld.

Referenced by HandleKillPlayer().

◆ SendBroadcastText()

void Battleground::SendBroadcastText ( uint32  id,
ChatMsg  msgType,
WorldObject const *  target = nullptr 
)

◆ SendChatMessage()

void Battleground::SendChatMessage ( Creature *  source,
uint8  textId,
WorldObject *  target = nullptr 
)

◆ SendMessageToAll()

void Battleground::SendMessageToAll ( uint32  entry,
ChatMsg  type,
Player const *  source = nullptr 
)

Definition at line 1326 of file Battleground.cpp.

References BroadcastWorker().

Referenced by battleground_deephaul_ravine::OnFlagStateChange().

◆ SendPacketToAll()

void Battleground::SendPacketToAll ( WorldPacket const *  packet) const

Definition at line 522 of file Battleground.cpp.

References _GetPlayer(), and m_Players.

Referenced by _ProcessJoin(), _ProcessPlayerPositionBroadcast(), and PlaySoundToAll().

◆ SendPacketToTeam()

void Battleground::SendPacketToTeam ( Team  team,
WorldPacket const *  packet,
Player *  except = nullptr 
) const

Definition at line 529 of file Battleground.cpp.

References _GetPlayerForTeam(), and m_Players.

Referenced by AddPlayer(), PlaySoundToTeam(), and RemovePlayerAtLeave().

◆ SetArenaMatchmakerRating()

void Battleground::SetArenaMatchmakerRating ( Team  team,
uint32  MMR 
)
inline

◆ SetArenaType()

void Battleground::SetArenaType ( uint8  type)
inline

Definition at line 306 of file Battleground.h.

Referenced by BattlegroundMgr::CreateNewBattleground().

◆ SetBgMap()

void Battleground::SetBgMap ( BattlegroundMap *  map)

◆ SetBgRaid()

void Battleground::SetBgRaid ( Team  team,
Group *  bg_raid 
)

◆ SetBracket()

void Battleground::SetBracket ( PVPDifficultyEntry const *  bracketEntry)

Definition at line 1467 of file Battleground.cpp.

References _pvpDifficultyEntry.

Referenced by BattlegroundMgr::CreateNewBattleground().

◆ SetClientInstanceID()

void Battleground::SetClientInstanceID ( uint32  InstanceID)
inline

Definition at line 302 of file Battleground.h.

Referenced by BattlegroundMgr::CreateNewBattleground().

◆ SetDeleteThis()

void Battleground::SetDeleteThis ( )
inline

Definition at line 429 of file Battleground.h.

◆ SetElapsedTime()

void Battleground::SetElapsedTime ( uint32  Time)
inline

Definition at line 303 of file Battleground.h.

References Time.

Referenced by Reset(), StartBattleground(), and Update().

◆ SetInstanceID()

void Battleground::SetInstanceID ( uint32  InstanceID)
inline

Definition at line 300 of file Battleground.h.

Referenced by BattlegroundMgr::CreateNewBattleground().

◆ SetRated()

void Battleground::SetRated ( bool  state)
inline

Definition at line 305 of file Battleground.h.

Referenced by BattlegroundMgr::CreateNewBattleground().

◆ SetRemainingTime()

void Battleground::SetRemainingTime ( uint32  Time)
inline

Definition at line 304 of file Battleground.h.

References Time.

Referenced by _ProcessLeave(), _ProcessProgress(), EndBattleground(), EndNow(), and Reset().

◆ SetStartDelayTime()

void Battleground::SetStartDelayTime ( int  Time)
inline

Definition at line 311 of file Battleground.h.

References Time.

Referenced by _ProcessJoin(), and bg_commandscript::HandleBgStartCommand().

◆ SetStatus()

◆ SetTeamPoint()

void Battleground::SetTeamPoint ( Team  team,
uint32  points = 0 
)
inline

◆ SetWeakPtr()

void Battleground::SetWeakPtr ( Trinity::unique_weak_ptr< Battleground >  weakRef)
inline

Definition at line 458 of file Battleground.h.

Referenced by BattlegroundMgr::AddBattleground().

◆ SetWinner()

void Battleground::SetWinner ( PvPTeamId  winnerTeamId)
inline

Definition at line 307 of file Battleground.h.

Referenced by EndBattleground(), and Reset().

◆ StartBattleground()

void Battleground::StartBattleground ( )

◆ TeleportPlayerToExploitLocation()

void Battleground::TeleportPlayerToExploitLocation ( Player *  player)

◆ ToBeDeleted()

bool Battleground::ToBeDeleted ( ) const
inline

Definition at line 428 of file Battleground.h.

Referenced by BattlegroundMgr::Update().

◆ Update()

◆ UpdatePlayerScore()

bool Battleground::UpdatePlayerScore ( Player *  player,
uint32  type,
uint32  value,
bool  doAddHonor = true,
Optional< HonorGainSource >  source = {} 
)

◆ UpdatePlayersCountByTeam()

void Battleground::UpdatePlayersCountByTeam ( Team  team,
bool  remove 
)
inline

Definition at line 389 of file Battleground.h.

Referenced by AddPlayer(), and RemovePlayerAtLeave().

◆ UpdatePvpStat()

◆ UpdateWorldState()

void Battleground::UpdateWorldState ( int32  worldStateId,
int32  value,
bool  hidden = false 
)

Member Data Documentation

◆ _battlegroundTemplate

◆ _playerPositions

std::vector<WorldPackets::Battleground::BattlegroundPlayerPosition> Battleground::_playerPositions
private

◆ _preparationStartTime

time_t Battleground::_preparationStartTime
private

Definition at line 570 of file Battleground.h.

Referenced by _ProcessJoin(), and AddOrSetPlayerToCorrectBgGroup().

◆ _pvpDifficultyEntry

PVPDifficultyEntry const* Battleground::_pvpDifficultyEntry
private

Definition at line 564 of file Battleground.h.

Referenced by GetBracketId(), GetMaxLevel(), GetMinLevel(), and SetBracket().

◆ _pvpStatIds

std::unordered_set<uint32> const* Battleground::_pvpStatIds
private

Definition at line 565 of file Battleground.h.

Referenced by AddPlayer(), and SetBgMap().

◆ _winnerTeamId

PvPTeamId Battleground::_winnerTeamId
private

Definition at line 536 of file Battleground.h.

Referenced by Battleground().

◆ m_ArenaTeamMMR

uint32 Battleground::m_ArenaTeamMMR[PVP_TEAMS_COUNT]
private

Definition at line 557 of file Battleground.h.

Referenced by Battleground().

◆ m_ArenaType

uint8 Battleground::m_ArenaType
private

Definition at line 532 of file Battleground.h.

Referenced by Battleground(), and StartBattleground().

◆ m_BgRaids

Group* Battleground::m_BgRaids[PVP_TEAMS_COUNT]
private

Definition at line 552 of file Battleground.h.

Referenced by _ProcessJoin(), Battleground(), SetBgRaid(), and ~Battleground().

◆ m_ClientInstanceID

uint32 Battleground::m_ClientInstanceID
private

Definition at line 527 of file Battleground.h.

Referenced by Battleground().

◆ m_EndTime

int32 Battleground::m_EndTime
private

Definition at line 531 of file Battleground.h.

Referenced by _ProcessProgress(), and Battleground().

◆ m_Events

uint8 Battleground::m_Events
protected

Definition at line 516 of file Battleground.h.

Referenced by _ProcessJoin(), Battleground(), and Reset().

◆ m_InBGFreeSlotQueue

bool Battleground::m_InBGFreeSlotQueue
private

◆ m_InstanceID

uint32 Battleground::m_InstanceID
private

◆ m_InvitedAlliance

uint32 Battleground::m_InvitedAlliance
private

Definition at line 548 of file Battleground.h.

Referenced by Battleground(), and Reset().

◆ m_InvitedHorde

uint32 Battleground::m_InvitedHorde
private

Definition at line 549 of file Battleground.h.

Referenced by Battleground(), and Reset().

◆ m_IsRated

bool Battleground::m_IsRated
private

Definition at line 538 of file Battleground.h.

Referenced by Battleground(), and StartBattleground().

◆ m_LastPlayerPositionBroadcast

uint32 Battleground::m_LastPlayerPositionBroadcast
private

Definition at line 540 of file Battleground.h.

Referenced by _ProcessPlayerPositionBroadcast(), and Battleground().

◆ m_Map

BattlegroundMap* Battleground::m_Map
private

Definition at line 560 of file Battleground.h.

Referenced by Battleground(), GetBgMap(), SetBgMap(), and ~Battleground().

◆ m_OfflineQueue

std::deque<ObjectGuid> Battleground::m_OfflineQueue
private

Definition at line 543 of file Battleground.h.

Referenced by _ProcessOfflineQueue(), EventPlayerLoggedIn(), and EventPlayerLoggedOut().

◆ m_Players

◆ m_PlayersCount

uint32 Battleground::m_PlayersCount[PVP_TEAMS_COUNT]
private

Definition at line 555 of file Battleground.h.

Referenced by Battleground().

◆ m_PrematureCountDown

bool Battleground::m_PrematureCountDown
private

Definition at line 539 of file Battleground.h.

Referenced by _ProcessProgress(), and Battleground().

◆ m_ResetStatTimer

uint32 Battleground::m_ResetStatTimer
private

Definition at line 529 of file Battleground.h.

Referenced by _ProcessJoin(), Battleground(), and Update().

◆ m_SetDeleteThis

bool Battleground::m_SetDeleteThis
private

Definition at line 534 of file Battleground.h.

Referenced by Battleground(), and Update().

◆ m_StartDelayTime

int32 Battleground::m_StartDelayTime
private

Definition at line 537 of file Battleground.h.

Referenced by Battleground().

◆ m_StartTime

uint32 Battleground::m_StartTime
private

Definition at line 528 of file Battleground.h.

Referenced by Battleground().

◆ m_Status

BattlegroundStatus Battleground::m_Status
private

Definition at line 526 of file Battleground.h.

Referenced by Battleground().

◆ m_TeamScores

int32 Battleground::m_TeamScores[PVP_TEAMS_COUNT]
protected

Definition at line 521 of file Battleground.h.

Referenced by Battleground(), and GetTeamScore().

◆ m_ValidStartPositionTimer

uint32 Battleground::m_ValidStartPositionTimer
private

Definition at line 530 of file Battleground.h.

Referenced by _CheckSafePositions(), and Battleground().

◆ m_weakRef

Trinity::unique_weak_ptr<Battleground> Battleground::m_weakRef
private

Definition at line 572 of file Battleground.h.

◆ PlayerScores

◆ StartDelayTimes

BattlegroundStartTimeIntervals Battleground::StartDelayTimes[BG_STARTING_EVENT_COUNT]
protected

◆ StartMessageIds

uint32 Battleground::StartMessageIds[BG_STARTING_EVENT_COUNT]
protected

Definition at line 519 of file Battleground.h.

Referenced by _ProcessJoin(), Arena::Arena(), and Battleground().

◆ StartPosition

Position Battleground::StartPosition[PVP_TEAMS_COUNT]
private

Definition at line 561 of file Battleground.h.


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