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

#include "Battleground.h"

Inheritance diagram for Battleground:
Arena BattlegroundAB BattlegroundAV BattlegroundEY BattlegroundIC BattlegroundSA BattlegroundWS BattlegroundBE BattlegroundDS BattlegroundNA BattlegroundRL BattlegroundRV

Public Types

typedef std::set< Player * > SpectatorList
 
typedef std::map< ObjectGuid, ObjectGuidToBeTeleportedMap
 
typedef std::map< ObjectGuid, Player * > BattlegroundPlayerMap
 
typedef std::unordered_map< ObjectGuid::LowType, BattlegroundScore * > BattlegroundScoreMap
 
typedef std::unordered_map< ObjectGuid, ArenaLogEntryDataArenaLogEntryDataMap
 
typedef GuidVector BGObjects
 
typedef GuidVector BGCreatures
 

Public Member Functions

 Battleground ()
 
virtual ~Battleground ()
 
void Update (uint32 diff)
 
virtual bool SetupBattleground ()
 
virtual void Init ()
 
virtual void StartingEventCloseDoors ()
 
virtual void StartingEventOpenDoors ()
 
virtual void ResetBGSubclass ()
 
virtual void DestroyGate (Player *, GameObject *)
 
virtual bool AllNodesConrolledByTeam (TeamId) const
 
void StartTimedAchievement (AchievementCriteriaTimedTypes type, uint32 entry)
 
std::string GetName () const
 
BattlegroundTypeId GetBgTypeID (bool GetRandom=false) const
 
BattlegroundBracketId GetBracketId () const
 
uint32 GetInstanceID () const
 
BattlegroundStatus GetStatus () const
 
uint32 GetClientInstanceID () const
 
uint32 GetStartTime () const
 
uint32 GetEndTime () const
 
uint32 GetLastResurrectTime () 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
 
bool IsRandom ()
 
void SetName (std::string_view name)
 
void SetBgTypeID (BattlegroundTypeId TypeID)
 
void SetRandomTypeID (BattlegroundTypeId TypeID)
 
void SetBracket (PvPDifficultyEntry const *bracketEntry)
 
void SetInstanceID (uint32 InstanceID)
 
void SetStatus (BattlegroundStatus Status)
 
void SetClientInstanceID (uint32 InstanceID)
 
void SetStartTime (uint32 Time)
 
void SetEndTime (uint32 Time)
 
void SetLastResurrectTime (uint32 Time)
 
void SetLevelRange (uint32 min, uint32 max)
 
void SetRated (bool state)
 
void SetArenaType (uint8 type)
 
void SetArenaorBGType (bool _isArena)
 
void SetWinner (PvPTeamId winner)
 
void SetScriptId (uint32 scriptId)
 
void SetRandom (bool isRandom)
 
void ModifyStartDelayTime (int32 diff)
 
void SetStartDelayTime (int32 Time)
 
void SetMaxPlayersPerTeam (uint32 MaxPlayers)
 
void SetMinPlayersPerTeam (uint32 MinPlayers)
 
void AddToBGFreeSlotQueue ()
 
void RemoveFromBGFreeSlotQueue ()
 
void DecreaseInvitedCount (TeamId teamId)
 
void IncreaseInvitedCount (TeamId teamId)
 
uint32 GetInvitedCount (TeamId teamId) const
 
bool HasFreeSlots () const
 
uint32 GetFreeSlotsForTeam (TeamId teamId) const
 
uint32 GetMaxFreeSlots () const
 
void AddSpectator (Player *p)
 
void RemoveSpectator (Player *p)
 
bool HaveSpectators ()
 
const SpectatorListGetSpectators () const
 
void AddToBeTeleported (ObjectGuid spectator, ObjectGuid participant)
 
void RemoveToBeTeleported (ObjectGuid spectator)
 
void SpectatorsSendPacket (WorldPacket &data)
 
bool isArena () const
 
bool isBattleground () const
 
bool isRated () const
 
BattlegroundPlayerMap const & GetPlayers () const
 
uint32 GetPlayersSize () const
 
void ReadyMarkerClicked (Player *p)
 
BattlegroundScoreMap const * GetPlayerScores () const
 
std::size_t GetPlayerScoresSize () const
 
uint32 GetReviveQueueSize () const
 
void AddPlayerToResurrectQueue (ObjectGuid npc_guid, ObjectGuid player_guid)
 
void RemovePlayerFromResurrectQueue (Player *player)
 
void RelocateDeadPlayers (ObjectGuid queueIndex)
 Relocate all players in ReviveQueue to the closest graveyard.
 
void StartBattleground ()
 
GameObjectGetBGObject (uint32 type)
 
CreatureGetBGCreature (uint32 type)
 
void SetMapId (uint32 MapID)
 
uint32 GetMapId () const
 
void SetBgMap (BattlegroundMap *map)
 
BattlegroundMapGetBgMap () const
 
BattlegroundMapFindBgMap () const
 
void SetTeamStartPosition (TeamId teamId, Position const &pos)
 
Position const * GetTeamStartPosition (TeamId teamId) const
 
void SetStartMaxDist (float startMaxDist)
 
float GetStartMaxDist () const
 
virtual void FillInitialWorldStates (WorldPacket &)
 
void SendPacketToTeam (TeamId teamId, WorldPacket const *packet, Player *sender=nullptr, bool self=true)
 
void SendPacketToAll (WorldPacket const *packet)
 
void YellToAll (Creature *creature, const char *text, uint32 language)
 
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 PlaySoundToAll (uint32 soundId)
 
void CastSpellOnTeam (uint32 spellId, TeamId teamId)
 
void RemoveAuraOnTeam (uint32 spellId, TeamId teamId)
 
void RewardHonorToTeam (uint32 honor, TeamId teamId)
 
void RewardReputationToTeam (uint32 factionId, uint32 reputation, TeamId teamId)
 
uint32 GetRealRepFactionForPlayer (uint32 factionId, Player *player)
 
void UpdateWorldState (uint32 variable, uint32 value)
 
void EndBattleground (PvPTeamId winnerTeamId)
 
virtual void EndBattleground (TeamId winnerTeamId)
 
void BlockMovement (Player *player)
 
void SendWarningToAll (uint32 entry,...)
 
void SendMessageToAll (uint32 entry, ChatMsg type, Player const *source=nullptr)
 
void PSendMessageToAll (uint32 entry, ChatMsg type, Player const *source,...)
 
void SendMessage2ToAll (uint32 entry, ChatMsg type, Player const *source, uint32 strId1=0, uint32 strId2=0)
 
GroupGetBgRaid (TeamId teamId) const
 
void SetBgRaid (TeamId teamId, Group *bg_raid)
 
void BuildPvPLogDataPacket (WorldPacket &data)
 
virtual bool UpdatePlayerScore (Player *player, uint32 type, uint32 value, bool doAddHonor=true)
 
uint32 GetPlayersCountByTeam (TeamId teamId) const
 
uint32 GetAlivePlayersCountByTeam (TeamId teamId) const
 
void UpdatePlayersCountByTeam (TeamId teamId, bool remove)
 
virtual void CheckWinConditions ()
 
void SetArenaTeamIdForTeam (TeamId teamId, uint32 ArenaTeamId)
 
uint32 GetArenaTeamIdForTeam (TeamId teamId) const
 
void SetArenaMatchmakerRating (TeamId teamId, uint32 MMR)
 
uint32 GetArenaMatchmakerRating (TeamId teamId) const
 
virtual void HandleAreaTrigger (Player *, uint32)
 
virtual void HandleKillPlayer (Player *player, Player *killer)
 
virtual void HandleKillUnit (Creature *, Player *)
 
virtual void EventPlayerDroppedFlag (Player *)
 
virtual void EventPlayerClickedOnFlag (Player *, GameObject *)
 
virtual void EventPlayerDamagedGO (Player *, GameObject *, uint32)
 
virtual void EventPlayerUsedGO (Player *, GameObject *)
 
virtual void DoAction (uint32, ObjectGuid)
 
virtual void HandlePlayerResurrect (Player *)
 
virtual GraveyardStruct const * GetClosestGraveyard (Player *player)
 
virtual void AddPlayer (Player *player)
 
void AddOrSetPlayerToCorrectBgGroup (Player *player, TeamId teamId)
 
virtual void RemovePlayerAtLeave (Player *player)
 
void HandleTriggerBuff (GameObject *gameObject)
 
void SetHoliday (bool is_holiday)
 
void SpawnBGObject (uint32 type, uint32 respawntime, uint32 forceRespawnDelay=0)
 
bool AddObject (uint32 type, uint32 entry, float x, float y, float z, float o, float rotation0, float rotation1, float rotation2, float rotation3, uint32 respawnTime=0, GOState goState=GO_STATE_READY)
 
CreatureAddCreature (uint32 entry, uint32 type, float x, float y, float z, float o, uint32 respawntime=0, MotionTransport *transport=nullptr)
 
bool DelCreature (uint32 type)
 
bool DelObject (uint32 type)
 
bool AddSpiritGuide (uint32 type, float x, float y, float z, float o, TeamId teamId)
 
int32 GetObjectType (ObjectGuid guid)
 
void DoorOpen (uint32 type)
 
void DoorClose (uint32 type)
 
const char * GetAcoreString (int32 entry)
 
virtual bool HandlePlayerUnderMap (Player *)
 
bool IsPlayerInBattleground (ObjectGuid guid) const
 
bool ToBeDeleted () const
 
void RewardXPAtKill (Player *killer, Player *victim)
 
virtual ObjectGuid GetFlagPickerGUID (TeamId=TEAM_NEUTRAL) const
 
virtual void SetDroppedFlagGUID (ObjectGuid, TeamId=TEAM_NEUTRAL)
 
uint32 GetTeamScore (TeamId teamId) const
 
virtual TeamId GetPrematureWinner ()
 
uint8 GetUniqueBracketId () const
 
BattlegroundAVToBattlegroundAV ()
 
BattlegroundAV const * ToBattlegroundAV () const
 
BattlegroundWSToBattlegroundWS ()
 
BattlegroundWS const * ToBattlegroundWS () const
 
BattlegroundABToBattlegroundAB ()
 
BattlegroundAB const * ToBattlegroundAB () const
 
BattlegroundNAToBattlegroundNA ()
 
BattlegroundNA const * ToBattlegroundNA () const
 
BattlegroundBEToBattlegroundBE ()
 
BattlegroundBE const * ToBattlegroundBE () const
 
BattlegroundEYToBattlegroundEY ()
 
BattlegroundEY const * ToBattlegroundEY () const
 
BattlegroundRLToBattlegroundRL ()
 
BattlegroundRL const * ToBattlegroundRL () const
 
BattlegroundSAToBattlegroundSA ()
 
BattlegroundSA const * ToBattlegroundSA () const
 
BattlegroundDSToBattlegroundDS ()
 
BattlegroundDS const * ToBattlegroundDS () const
 
BattlegroundRVToBattlegroundRV ()
 
BattlegroundRV const * ToBattlegroundRV () const
 
BattlegroundICToBattlegroundIC ()
 
BattlegroundIC const * ToBattlegroundIC () const
 

Static Public Member Functions

static TeamId GetOtherTeamId (TeamId teamId)
 

Public Attributes

GuidSet readyMarkerClickedSet
 
ArenaLogEntryDataMap ArenaLogEntries
 
BGObjects BgObjects
 
BGCreatures BgCreatures
 

Protected Member Functions

void EndNow ()
 
void PlayerAddedToBGCheckIfBGIsRunning (Player *player)
 
void _ProcessResurrect (uint32 diff)
 
void _ProcessProgress (uint32 diff)
 
void _ProcessLeave (uint32 diff)
 
void _ProcessJoin (uint32 diff)
 
void _CheckSafePositions (uint32 diff)
 
virtual void RemovePlayer (Player *)
 

Protected Attributes

BattlegroundScoreMap PlayerScores
 
BattlegroundPlayerMap m_Players
 
std::map< ObjectGuid, GuidVectorm_ReviveQueue
 
uint8 m_Events
 
BattlegroundStartTimeIntervals StartDelayTimes [BG_STARTING_EVENT_COUNT]
 
uint32 StartMessageIds [BG_STARTING_EVENT_COUNT]
 
bool m_BuffChange
 
bool m_IsRandom
 
BGHonorMode m_HonorMode
 
int32 m_TeamScores [PVP_TEAMS_COUNT]
 
ArenaTeamScore _arenaTeamScores [PVP_TEAMS_COUNT]
 
uint32 m_UpdateTimer
 
EventProcessor _reviveEvents
 

Private Member Functions

virtual bool PreUpdateImpl (uint32)
 Pre-update hook.
 
virtual void PostUpdateImpl (uint32)
 Post-update hook.
 

Private Attributes

BattlegroundTypeId m_RealTypeID
 
BattlegroundTypeId m_RandomTypeID
 
uint32 m_InstanceID
 
BattlegroundStatus m_Status
 
uint32 m_ClientInstanceID
 
uint32 m_StartTime
 
uint32 m_ResetStatTimer
 
uint32 m_ValidStartPositionTimer
 
int32 m_EndTime
 
uint32 m_LastResurrectTime
 
BattlegroundBracketId m_BracketId { BG_BRACKET_ID_FIRST }
 
uint8 m_ArenaType
 
bool _InBGFreeSlotQueue { false }
 
bool m_SetDeleteThis
 
bool m_IsArena
 
PvPTeamId m_WinnerId
 
int32 m_StartDelayTime
 
bool m_IsRated
 
bool m_PrematureCountDown
 
uint32 m_PrematureCountDownTimer
 
std::string m_Name {}
 
GuidVector m_ResurrectQueue
 
GuidDeque m_OfflineQueue
 
uint32 m_BgInvitedPlayers [PVP_TEAMS_COUNT]
 
Groupm_BgRaids [PVP_TEAMS_COUNT]
 
SpectatorList m_Spectators
 
ToBeTeleportedMap m_ToBeTeleported
 
uint32 m_PlayersCount [PVP_TEAMS_COUNT]
 
uint32 m_ArenaTeamIds [PVP_TEAMS_COUNT]
 
uint32 m_ArenaTeamMMR [PVP_TEAMS_COUNT]
 
uint32 m_LevelMin
 
uint32 m_LevelMax
 
uint32 m_MaxPlayersPerTeam
 
uint32 m_MinPlayersPerTeam
 
uint32 m_MapId
 
BattlegroundMapm_Map
 
float m_StartMaxDist
 
std::array< Position, PVP_TEAMS_COUNT_startPosition
 
uint32 ScriptId
 

Detailed Description

Member Typedef Documentation

◆ ArenaLogEntryDataMap

◆ BattlegroundPlayerMap

◆ BattlegroundScoreMap

◆ BGCreatures

◆ BGObjects

Todo:
: make this protected:

◆ SpectatorList

typedef std::set<Player*> Battleground::SpectatorList

◆ ToBeTeleportedMap

Constructor & Destructor Documentation

◆ Battleground()

Battleground::Battleground ( )
139{
142 m_InstanceID = 0;
145 m_EndTime = 0;
147 m_ArenaType = 0;
148 m_IsArena = false;
150 m_StartTime = 0;
153 m_Events = 0;
155 m_IsRated = false;
156 m_BuffChange = false;
157 m_IsRandom = false;
158 m_LevelMin = 0;
159 m_LevelMax = 0;
160 m_SetDeleteThis = false;
161
164
165 m_MapId = 0;
166 m_Map = nullptr;
167 m_StartMaxDist = 0.0f;
168 ScriptId = 0;
169
172
175
176 m_BgRaids[TEAM_ALLIANCE] = nullptr;
177 m_BgRaids[TEAM_HORDE] = nullptr;
178
181
184
187
188 m_PrematureCountDown = false;
190
192
197
202
203 // pussywizard:
204 m_UpdateTimer = 0;
205}
@ BG_TEXT_START_TWO_MINUTES
Definition: Battleground.h:72
@ BG_TEXT_BATTLE_HAS_BEGUN
Definition: Battleground.h:75
@ BG_TEXT_START_ONE_MINUTE
Definition: Battleground.h:73
@ BG_TEXT_START_HALF_MINUTE
Definition: Battleground.h:74
@ BG_NORMAL
Definition: Battleground.h:268
@ BG_START_DELAY_1M
Definition: Battleground.h:175
@ BG_START_DELAY_30S
Definition: Battleground.h:176
@ BG_START_DELAY_2M
Definition: Battleground.h:174
@ BG_START_DELAY_NONE
Definition: Battleground.h:178
@ STATUS_NONE
Definition: Battleground.h:194
@ BG_STARTING_EVENT_THIRD
Definition: Battleground.h:236
@ BG_STARTING_EVENT_SECOND
Definition: Battleground.h:235
@ BG_STARTING_EVENT_FIRST
Definition: Battleground.h:234
@ BG_STARTING_EVENT_FOURTH
Definition: Battleground.h:237
@ PVP_TEAM_NEUTRAL
Definition: SharedDefines.h:3414
@ TEAM_ALLIANCE
Definition: SharedDefines.h:732
@ TEAM_HORDE
Definition: SharedDefines.h:733
@ BATTLEGROUND_TYPE_NONE
Definition: SharedDefines.h:3452
uint32 m_ArenaTeamMMR[PVP_TEAMS_COUNT]
Definition: Battleground.h:713
bool m_SetDeleteThis
Definition: Battleground.h:654
BGHonorMode m_HonorMode
Definition: Battleground.h:629
uint32 m_MapId
Definition: Battleground.h:722
uint32 m_ArenaTeamIds[PVP_TEAMS_COUNT]
Definition: Battleground.h:712
uint32 m_ValidStartPositionTimer
Definition: Battleground.h:648
int32 m_StartDelayTime
Definition: Battleground.h:657
uint32 m_ClientInstanceID
Definition: Battleground.h:645
uint32 m_LevelMax
Definition: Battleground.h:717
PvPTeamId m_WinnerId
Definition: Battleground.h:656
uint32 m_LastResurrectTime
Definition: Battleground.h:650
uint32 m_BgInvitedPlayers[PVP_TEAMS_COUNT]
Definition: Battleground.h:700
BattlegroundTypeId m_RandomTypeID
Definition: Battleground.h:642
bool m_IsArena
Definition: Battleground.h:655
bool m_IsRated
Definition: Battleground.h:658
bool m_PrematureCountDown
Definition: Battleground.h:659
uint32 m_PlayersCount[PVP_TEAMS_COUNT]
Definition: Battleground.h:709
Group * m_BgRaids[PVP_TEAMS_COUNT]
Definition: Battleground.h:703
uint32 m_PrematureCountDownTimer
Definition: Battleground.h:660
int32 m_TeamScores[PVP_TEAMS_COUNT]
Definition: Battleground.h:630
uint32 m_UpdateTimer
Definition: Battleground.h:635
bool m_IsRandom
Definition: Battleground.h:627
BattlegroundTypeId m_RealTypeID
Definition: Battleground.h:641
BattlegroundStartTimeIntervals StartDelayTimes[BG_STARTING_EVENT_COUNT]
Definition: Battleground.h:622
int32 m_EndTime
Definition: Battleground.h:649
uint32 ScriptId
Definition: Battleground.h:726
uint32 m_InstanceID
Definition: Battleground.h:643
uint32 m_ResetStatTimer
Definition: Battleground.h:647
bool m_BuffChange
Definition: Battleground.h:626
uint32 m_MinPlayersPerTeam
Definition: Battleground.h:719
uint8 m_ArenaType
Definition: Battleground.h:652
uint8 m_Events
Definition: Battleground.h:621
float m_StartMaxDist
Definition: Battleground.h:724
uint32 m_MaxPlayersPerTeam
Definition: Battleground.h:718
uint32 m_LevelMin
Definition: Battleground.h:716
uint32 m_StartTime
Definition: Battleground.h:646
BattlegroundMap * m_Map
Definition: Battleground.h:723
BattlegroundStatus m_Status
Definition: Battleground.h:644
uint32 StartMessageIds[BG_STARTING_EVENT_COUNT]
Definition: Battleground.h:624

References BATTLEGROUND_TYPE_NONE, BG_NORMAL, BG_START_DELAY_1M, BG_START_DELAY_2M, BG_START_DELAY_30S, BG_START_DELAY_NONE, BG_STARTING_EVENT_FIRST, BG_STARTING_EVENT_FOURTH, BG_STARTING_EVENT_SECOND, BG_STARTING_EVENT_THIRD, BG_TEXT_BATTLE_HAS_BEGUN, BG_TEXT_START_HALF_MINUTE, BG_TEXT_START_ONE_MINUTE, BG_TEXT_START_TWO_MINUTES, m_ArenaTeamIds, m_ArenaTeamMMR, m_ArenaType, m_BgInvitedPlayers, m_BgRaids, m_BuffChange, m_ClientInstanceID, m_EndTime, m_Events, m_HonorMode, m_InstanceID, m_IsArena, m_IsRandom, m_IsRated, m_LastResurrectTime, m_LevelMax, m_LevelMin, m_Map, m_MapId, m_MaxPlayersPerTeam, m_MinPlayersPerTeam, m_PlayersCount, m_PrematureCountDown, m_PrematureCountDownTimer, m_RandomTypeID, m_RealTypeID, m_ResetStatTimer, m_SetDeleteThis, m_StartDelayTime, m_StartMaxDist, m_StartTime, m_Status, m_TeamScores, m_UpdateTimer, m_ValidStartPositionTimer, m_WinnerId, PVP_TEAM_NEUTRAL, ScriptId, StartDelayTimes, StartMessageIds, STATUS_NONE, TEAM_ALLIANCE, and TEAM_HORDE.

◆ ~Battleground()

Battleground::~Battleground ( )
virtual
208{
209 LOG_DEBUG("bg.battleground", "> Remove Battleground {} {} {}", GetName(), GetBgTypeID(), GetInstanceID());
210
212
213 // remove objects and creatures
214 // (this is done automatically in mapmanager update, when the instance is reset after the reset time)
215 uint32 size = uint32(BgCreatures.size());
216 for (uint32 i = 0; i < size; ++i)
217 DelCreature(i);
218
219 size = uint32(BgObjects.size());
220 for (uint32 i = 0; i < size; ++i)
221 DelObject(i);
222
223 sScriptMgr->OnBattlegroundDestroy(this);
224
225 sBattlegroundMgr->RemoveBattleground(GetBgTypeID(), GetInstanceID());
226 // unload map
227 if (m_Map)
228 {
229 m_Map->SetUnload();
230 //unlink to prevent crash, always unlink all pointer reference before destruction
231 m_Map->SetBG(nullptr);
232 m_Map = nullptr;
233 }
234
235 // remove from bg free slot queue
237
238 for (auto const& itr : PlayerScores)
239 delete itr.second;
240}
std::uint32_t uint32
Definition: Define.h:108
#define LOG_DEBUG(filterType__,...)
Definition: Log.h:171
#define sBattlegroundMgr
Definition: BattlegroundMgr.h:188
#define sScriptMgr
Definition: ScriptMgr.h:2702
void KillAllEvents(bool force)
Definition: EventProcessor.cpp:82
bool DelCreature(uint32 type)
Definition: Battleground.cpp:1554
EventProcessor _reviveEvents
Definition: Battleground.h:637
uint32 GetInstanceID() const
Definition: Battleground.h:321
BGObjects BgObjects
Definition: Battleground.h:531
bool DelObject(uint32 type)
Definition: Battleground.cpp:1573
BattlegroundScoreMap PlayerScores
Definition: Battleground.h:611
void RemoveFromBGFreeSlotQueue()
Definition: Battleground.cpp:1185
BGCreatures BgCreatures
Definition: Battleground.h:532
std::string GetName() const
Definition: Battleground.h:318
BattlegroundTypeId GetBgTypeID(bool GetRandom=false) const
Definition: Battleground.h:319
void SetUnload()
Definition: Map.cpp:3274
void SetBG(Battleground *bg)
Definition: Map.h:861

References _reviveEvents, BgCreatures, BgObjects, DelCreature(), DelObject(), GetBgTypeID(), GetInstanceID(), GetName(), EventProcessor::KillAllEvents(), LOG_DEBUG, m_Map, PlayerScores, RemoveFromBGFreeSlotQueue(), sBattlegroundMgr, BattlegroundMap::SetBG(), BattlegroundMap::SetUnload(), and sScriptMgr.

Member Function Documentation

◆ _CheckSafePositions()

void Battleground::_CheckSafePositions ( uint32  diff)
inlineprotected
319{
320 float maxDist = GetStartMaxDist();
321 if (!maxDist)
322 return;
323
325
327 {
329
330 for (auto const& [playerGuid, player] : GetPlayers())
331 {
332 Position pos = player->GetPosition();
333 Position const* startPos = GetTeamStartPosition(player->GetBgTeamId());
334
335 if (pos.GetExactDistSq(startPos) > maxDist)
336 {
337 LOG_DEBUG("bg.battleground", "BATTLEGROUND: Sending {} back to start location (map: {}) (possible exploit)", player->GetName(), GetMapId());
338 player->TeleportTo(GetMapId(), startPos->GetPositionX(), startPos->GetPositionY(), startPos->GetPositionZ(), startPos->GetOrientation());
339 }
340 }
341 }
342}
@ CHECK_PLAYER_POSITION_INVERVAL
Definition: Battleground.h:157
uint32 GetMapId() const
Definition: Battleground.h:420
Position const * GetTeamStartPosition(TeamId teamId) const
Definition: Battleground.cpp:654
BattlegroundPlayerMap const & GetPlayers() const
Definition: Battleground.h:393
float GetStartMaxDist() const
Definition: Battleground.h:431
Definition: Position.h:28
float GetPositionZ() const
Definition: Position.h:119
float GetOrientation() const
Definition: Position.h:120
float GetPositionX() const
Definition: Position.h:117
void GetPosition(float &x, float &y) const
Definition: Position.h:122
float GetPositionY() const
Definition: Position.h:118
float GetExactDistSq(float x, float y, float z) const
Definition: Position.h:170

References CHECK_PLAYER_POSITION_INVERVAL, Position::GetExactDistSq(), GetMapId(), Position::GetOrientation(), GetPlayers(), Position::GetPosition(), Position::GetPositionX(), Position::GetPositionY(), Position::GetPositionZ(), GetStartMaxDist(), GetTeamStartPosition(), LOG_DEBUG, and m_ValidStartPositionTimer.

Referenced by Update().

◆ _ProcessJoin()

void Battleground::_ProcessJoin ( uint32  diff)
inlineprotected
454{
455 // *********************************************************
456 // *** BATTLEGROUND STARTING SYSTEM ***
457 // *********************************************************
459
460 if (m_ResetStatTimer > 5000)
461 {
463 for (BattlegroundPlayerMap::const_iterator itr = GetPlayers().begin(); itr != GetPlayers().end(); ++itr)
464 itr->second->ResetAllPowers();
465 }
466
468 {
470
471 if (!FindBgMap())
472 {
473 LOG_ERROR("bg.battleground", "Battleground::_ProcessJoin: map (map id: {}, instance id: {}) is not created!", m_MapId, m_InstanceID);
474 EndNow();
475 return;
476 }
477
478 // Setup here, only when at least one player has ported to the map
479 if (!SetupBattleground())
480 {
481 EndNow();
482 return;
483 }
484
487
488 // First start warning - 2 or 1 minute
491 }
492 // After 1 minute or 30 seconds, warning is signaled
494 {
496
499 }
500 // After 30 or 15 seconds, warning is signaled
502 {
504
507
508 if (isArena())
509 switch (GetBgTypeID())
510 {
511 case BATTLEGROUND_NA:
514 break;
515 case BATTLEGROUND_BE:
518 break;
519 case BATTLEGROUND_RL:
522 break;
523 case BATTLEGROUND_DS:
526 break;
527 case BATTLEGROUND_RV:
530 break;
531 default:
532 break;
533 }
534 }
535 // Delay expired (after 2 or 1 minute)
536 else if (GetStartDelayTime() <= 0 && !(m_Events & BG_STARTING_EVENT_4))
537 {
539
541
544
547
548 // Remove preparation
549 if (isArena())
550 {
551 // pussywizard: initial visibility range is 30yd, set it to a proper value now:
552 if (BattlegroundMap* map = GetBgMap())
553 map->SetVisibilityRange(World::GetMaxVisibleDistanceInBGArenas());
554
555 for (BattlegroundPlayerMap::const_iterator itr = GetPlayers().begin(); itr != GetPlayers().end(); ++itr)
556 if (Player* player = itr->second)
557 {
558 WorldPacket status;
559 sBattlegroundMgr->BuildBattlegroundStatusPacket(&status, this, player->GetCurrentBattlegroundQueueSlot(), STATUS_IN_PROGRESS, 0, GetStartTime(), GetArenaType(), player->GetBgTeamId());
560 player->GetSession()->SendPacket(&status);
561
562 player->RemoveAurasDueToSpell(SPELL_ARENA_PREPARATION);
563 player->ResetAllPowers();
564 // remove auras with duration lower than 30s
565 Unit::AuraApplicationMap& auraMap = player->GetAppliedAuras();
566 for (Unit::AuraApplicationMap::iterator iter = auraMap.begin(); iter != auraMap.end();)
567 {
568 AuraApplication* aurApp = iter->second;
569 Aura* aura = aurApp->GetBase();
570 if (!aura->IsPermanent()
571 && aura->GetDuration() <= 30 * IN_MILLISECONDS
572 && aurApp->IsPositive()
573 // && (!aura->GetSpellInfo()->HasAttribute(SPELL_ATTR0_NO_IMMUNITIES)) Xinef: condition, ALL buffs should be removed
575 player->RemoveAura(iter);
576 else
577 ++iter;
578 }
579
580 player->UpdateObjectVisibility(true);
581 }
582
583 for (SpectatorList::const_iterator itr = m_Spectators.begin(); itr != m_Spectators.end(); ++itr)
585
587
588 // pussywizard: arena spectator stuff
590 {
591 for (ToBeTeleportedMap::const_iterator itr = m_ToBeTeleported.begin(); itr != m_ToBeTeleported.end(); ++itr)
592 if (Player* p = ObjectAccessor::FindConnectedPlayer(itr->first))
593 if (Player* t = ObjectAccessor::FindPlayer(itr->second))
594 {
595 if (!t->FindMap() || t->FindMap() != GetBgMap())
596 continue;
597
598 p->SetSummonPoint(t->GetMapId(), t->GetPositionX(), t->GetPositionY(), t->GetPositionZ(), 15, true);
599
600 WorldPacket data(SMSG_SUMMON_REQUEST, 8 + 4 + 4);
601 data << t->GetGUID();
602 data << uint32(t->GetZoneId());
603 data << uint32(15 * IN_MILLISECONDS);
604 p->GetSession()->SendPacket(&data);
605 }
606 m_ToBeTeleported.clear();
607 }
608 }
609 else
610 {
612
613 for (BattlegroundPlayerMap::const_iterator itr = GetPlayers().begin(); itr != GetPlayers().end(); ++itr)
614 {
615 itr->second->RemoveAurasDueToSpell(SPELL_PREPARATION);
616 itr->second->ResetAllPowers();
617 }
618
619 // Announce BG starting
621 sWorld->SendWorldText(LANG_BG_STARTED_ANNOUNCE_WORLD, GetName().c_str(), std::min(GetMinLevel(), (uint32)80), std::min(GetMaxLevel(), (uint32)80));
622
623 sScriptMgr->OnBattlegroundStart(this);
624 }
625 }
626}
constexpr auto IN_MILLISECONDS
Definition: Common.h:62
#define LOG_ERROR(filterType__,...)
Definition: Log.h:159
@ BG_STARTING_EVENT_3
Definition: Battleground.h:228
@ BG_STARTING_EVENT_2
Definition: Battleground.h:227
@ BG_STARTING_EVENT_1
Definition: Battleground.h:226
@ BG_STARTING_EVENT_4
Definition: Battleground.h:229
@ SPELL_ARENA_PREPARATION
Definition: Battleground.h:136
@ SPELL_PREPARATION
Definition: Battleground.h:137
@ STATUS_IN_PROGRESS
Definition: Battleground.h:197
@ SOUND_BG_START
Definition: Battleground.h:82
@ BG_BE_OBJECT_READY_MARKER_1
Definition: BattlegroundBE.h:31
@ BG_BE_OBJECT_READY_MARKER_2
Definition: BattlegroundBE.h:32
@ BG_DS_OBJECT_READY_MARKER_1
Definition: BattlegroundDS.h:33
@ BG_DS_OBJECT_READY_MARKER_2
Definition: BattlegroundDS.h:34
@ BG_NA_OBJECT_READY_MARKER_1
Definition: BattlegroundNA.h:31
@ BG_NA_OBJECT_READY_MARKER_2
Definition: BattlegroundNA.h:32
@ BG_RL_OBJECT_READY_MARKER_2
Definition: BattlegroundRL.h:30
@ BG_RL_OBJECT_READY_MARKER_1
Definition: BattlegroundRL.h:29
@ BG_RV_OBJECT_READY_MARKER_2
Definition: BattlegroundRV.h:46
@ BG_RV_OBJECT_READY_MARKER_1
Definition: BattlegroundRV.h:45
@ LANG_BG_STARTED_ANNOUNCE_WORLD
Definition: Language.h:668
@ SPELL_AURA_MOD_INVISIBILITY
Definition: SpellAuraDefines.h:81
@ CONFIG_BATTLEGROUND_QUEUE_ANNOUNCER_ENABLE
Definition: IWorld.h:116
@ CHAT_MSG_BG_SYSTEM_NEUTRAL
Definition: SharedDefines.h:3160
@ 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
@ SMSG_SUMMON_REQUEST
Definition: Opcodes.h:713
#define sWorld
Definition: World.h:451
AC_GAME_API void HandleResetCommand(Player *player)
Definition: ArenaSpectator.cpp:227
Player * FindConnectedPlayer(ObjectGuid const guid)
Definition: ObjectAccessor.cpp:262
Player * FindPlayer(ObjectGuid const guid)
Definition: ObjectAccessor.cpp:250
void EndNow()
Definition: Battleground.cpp:1674
uint32 GetMinLevel() const
Definition: Battleground.h:328
virtual bool SetupBattleground()
Definition: Battleground.h:300
uint8 GetArenaType() const
Definition: Battleground.h:335
SpectatorList m_Spectators
Definition: Battleground.h:705
void SetStartDelayTime(int32 Time)
Definition: Battleground.h:362
BattlegroundMap * GetBgMap() const
Definition: Battleground.h:424
BattlegroundMap * FindBgMap() const
Definition: Battleground.h:425
void SetStatus(BattlegroundStatus Status)
Definition: Battleground.h:348
virtual void StartingEventCloseDoors()
Definition: Battleground.h:306
bool isArena() const
Definition: Battleground.h:388
void SendBroadcastText(uint32 id, ChatMsg msgType, WorldObject const *target=nullptr)
Definition: Battleground.cpp:678
ToBeTeleportedMap m_ToBeTeleported
Definition: Battleground.h:706
uint32 GetStartTime() const
Definition: Battleground.h:324
int32 GetStartDelayTime() const
Definition: Battleground.h:334
virtual void StartingEventOpenDoors()
Definition: Battleground.h:307
BattlegroundStatus GetStatus() const
Definition: Battleground.h:322
void ModifyStartDelayTime(int32 diff)
Definition: Battleground.h:361
virtual void CheckWinConditions()
Definition: Battleground.h:489
uint32 GetMaxLevel() const
Definition: Battleground.h:329
void PlaySoundToAll(uint32 soundId)
Definition: Battleground.cpp:691
Definition: Player.h:1046
std::multimap< uint32, AuraApplication * > AuraApplicationMap
Definition: Unit.h:1299
Definition: Map.h:847
Definition: WorldPacket.h:27
Definition: SpellAuras.h:37
bool IsPositive() const
Definition: SpellAuras.h:68
Aura * GetBase() const
Definition: SpellAuras.h:62
Definition: SpellAuras.h:87
int32 GetDuration() const
Definition: SpellAuras.h:133
bool HasEffectType(AuraType type) const
Definition: SpellAuras.cpp:1236
bool IsPermanent() const
Definition: SpellAuras.h:139
static float GetMaxVisibleDistanceInBGArenas()
Definition: World.h:325

References BATTLEGROUND_BE, BATTLEGROUND_DS, BATTLEGROUND_NA, BATTLEGROUND_RL, BATTLEGROUND_RV, BG_BE_OBJECT_READY_MARKER_1, BG_BE_OBJECT_READY_MARKER_2, BG_DS_OBJECT_READY_MARKER_1, BG_DS_OBJECT_READY_MARKER_2, BG_NA_OBJECT_READY_MARKER_1, BG_NA_OBJECT_READY_MARKER_2, BG_RL_OBJECT_READY_MARKER_1, BG_RL_OBJECT_READY_MARKER_2, BG_RV_OBJECT_READY_MARKER_1, BG_RV_OBJECT_READY_MARKER_2, 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, DelObject(), EndNow(), FindBgMap(), ObjectAccessor::FindConnectedPlayer(), ObjectAccessor::FindPlayer(), GetArenaType(), AuraApplication::GetBase(), GetBgMap(), GetBgTypeID(), Aura::GetDuration(), GetMaxLevel(), World::GetMaxVisibleDistanceInBGArenas(), GetMinLevel(), GetName(), GetPlayers(), GetStartDelayTime(), GetStartTime(), GetStatus(), ArenaSpectator::HandleResetCommand(), Aura::HasEffectType(), IN_MILLISECONDS, isArena(), Aura::IsPermanent(), AuraApplication::IsPositive(), LANG_BG_STARTED_ANNOUNCE_WORLD, LOG_ERROR, m_Events, m_InstanceID, m_MapId, m_ResetStatTimer, m_Spectators, m_ToBeTeleported, ModifyStartDelayTime(), PlaySoundToAll(), sBattlegroundMgr, SendBroadcastText(), SetStartDelayTime(), SetStatus(), SetupBattleground(), SMSG_SUMMON_REQUEST, SOUND_BG_START, SPELL_ARENA_PREPARATION, SPELL_AURA_MOD_INVISIBILITY, SPELL_PREPARATION, sScriptMgr, StartDelayTimes, StartingEventCloseDoors(), StartingEventOpenDoors(), StartMessageIds, STATUS_IN_PROGRESS, and sWorld.

Referenced by Update().

◆ _ProcessLeave()

void Battleground::_ProcessLeave ( uint32  diff)
inlineprotected
629{
630 // *********************************************************
631 // *** BATTLEGROUND ENDING SYSTEM ***
632 // *********************************************************
633 // remove all players from battleground after 2 minutes
634 m_EndTime -= diff;
635 if (m_EndTime <= 0)
636 {
637 m_EndTime = TIME_TO_AUTOREMOVE; // pussywizard: 0 -> TIME_TO_AUTOREMOVE
638 BattlegroundPlayerMap::iterator itr, next;
639 for (itr = m_Players.begin(); itr != m_Players.end(); itr = next)
640 {
641 next = itr;
642 ++next;
643 itr->second->LeaveBattleground(this); //itr is erased here!
644 }
645 }
646}
@ TIME_TO_AUTOREMOVE
Definition: Battleground.h:161
BattlegroundPlayerMap m_Players
Definition: Battleground.h:616

References m_EndTime, m_Players, and TIME_TO_AUTOREMOVE.

Referenced by Update().

◆ _ProcessProgress()

void Battleground::_ProcessProgress ( uint32  diff)
inlineprotected
418{
419 // *********************************************************
420 // *** BATTLEGROUND BALLANCE SYSTEM ***
421 // *********************************************************
422 // if less then minimum players are in on one side, then start premature finish timer
424 {
426 m_PrematureCountDownTimer = sBattlegroundMgr->GetPrematureFinishTime();
427 }
428 else if (m_PrematureCountDownTimer < diff)
429 {
430 // time's up!
432 m_PrematureCountDown = false;
433 }
434 else if (!sBattlegroundMgr->isTesting())
435 {
436 uint32 newtime = m_PrematureCountDownTimer - diff;
437 // announce every minute
438 if (newtime > (MINUTE * IN_MILLISECONDS))
439 {
442 }
443 else
444 {
445 //announce every 15 seconds
446 if (newtime / (15 * IN_MILLISECONDS) != m_PrematureCountDownTimer / (15 * IN_MILLISECONDS))
448 }
450 }
451}
constexpr auto MINUTE
Definition: Common.h:56
@ LANG_BATTLEGROUND_PREMATURE_FINISH_WARNING
Definition: Language.h:701
@ LANG_BATTLEGROUND_PREMATURE_FINISH_WARNING_SECS
Definition: Language.h:702
@ CHAT_MSG_SYSTEM
Definition: SharedDefines.h:3124
void EndBattleground(PvPTeamId winnerTeamId)
Definition: Battleground.cpp:778
void PSendMessageToAll(uint32 entry, ChatMsg type, Player const *source,...)
Definition: Battleground.cpp:1627
virtual TeamId GetPrematureWinner()
Definition: Battleground.cpp:407

References CHAT_MSG_SYSTEM, EndBattleground(), GetPrematureWinner(), IN_MILLISECONDS, LANG_BATTLEGROUND_PREMATURE_FINISH_WARNING, LANG_BATTLEGROUND_PREMATURE_FINISH_WARNING_SECS, m_PrematureCountDown, m_PrematureCountDownTimer, MINUTE, PSendMessageToAll(), and sBattlegroundMgr.

Referenced by Update().

◆ _ProcessResurrect()

void Battleground::_ProcessResurrect ( uint32  diff)
inlineprotected
345{
346 // *********************************************************
347 // *** BATTLEGROUND RESURRECTION SYSTEM ***
348 // *********************************************************
349 // this should be handled by spell system
350
351 _reviveEvents.Update(diff);
352
353 m_LastResurrectTime += diff;
355 {
356 if (GetReviveQueueSize())
357 {
358 for (std::map<ObjectGuid, GuidVector>::iterator itr = m_ReviveQueue.begin(); itr != m_ReviveQueue.end(); ++itr)
359 {
360 Creature* sh = nullptr;
361 for (ObjectGuid const& guid : itr->second)
362 {
363 Player* player = ObjectAccessor::FindPlayer(guid);
364 if (!player)
365 continue;
366
367 if (!sh && player->IsInWorld())
368 {
369 sh = player->GetMap()->GetCreature(itr->first);
370 // only for visual effect
371 if (sh)
372 // Spirit Heal, effect 117
373 sh->CastSpell(sh, SPELL_SPIRIT_HEAL, true);
374 }
375
376 // Resurrection visual
377 player->CastSpell(player, SPELL_RESURRECTION_VISUAL, true);
378 m_ResurrectQueue.push_back(guid);
379 }
380
381 itr->second.clear();
382 }
383
384 m_ReviveQueue.clear();
386 }
387 else
388 // queue is clear and time passed, just update last resurrection time
390 }
391 else if (m_LastResurrectTime > 500) // Resurrect players only half a second later, to see spirit heal effect on NPC
392 {
393 for (ObjectGuid const& guid : m_ResurrectQueue)
394 {
395 Player* player = ObjectAccessor::FindPlayer(guid);
396 if (!player)
397 continue;
398 player->ResurrectPlayer(1.0f);
399 player->CastSpell(player, 6962, true);
400 player->CastSpell(player, SPELL_SPIRIT_HEAL_MANA, true);
401 player->SpawnCorpseBones(false);
402 }
403 m_ResurrectQueue.clear();
404 }
405}
@ SPELL_SPIRIT_HEAL
Definition: Battleground.h:134
@ SPELL_SPIRIT_HEAL_MANA
Definition: Battleground.h:138
@ SPELL_RESURRECTION_VISUAL
Definition: Battleground.h:135
#define RESURRECTION_INTERVAL
Definition: Battleground.h:167
void Update(uint32 p_time)
Definition: EventProcessor.cpp:40
GuidVector m_ResurrectQueue
Definition: Battleground.h:694
uint32 GetReviveQueueSize() const
Definition: Battleground.h:405
std::map< ObjectGuid, GuidVector > m_ReviveQueue
Definition: Battleground.h:618
Definition: Creature.h:46
bool IsInWorld() const
Definition: Object.h:101
Map * GetMap() const
Definition: Object.h:517
Definition: ObjectGuid.h:120
void SpawnCorpseBones(bool triggerSave=true)
Definition: Player.cpp:4587
void ResurrectPlayer(float restore_percent, bool applySickness=false)
Definition: Player.cpp:4375
SpellCastResult CastSpell(SpellCastTargets const &targets, SpellInfo const *spellInfo, CustomSpellValues const *value, TriggerCastFlags triggerFlags=TRIGGERED_NONE, Item *castItem=nullptr, AuraEffect const *triggeredByAura=nullptr, ObjectGuid originalCaster=ObjectGuid::Empty)
Definition: Unit.cpp:1169
Creature * GetCreature(ObjectGuid const guid)
Definition: Map.cpp:3293

References _reviveEvents, Unit::CastSpell(), ObjectAccessor::FindPlayer(), Map::GetCreature(), WorldObject::GetMap(), GetReviveQueueSize(), Object::IsInWorld(), m_LastResurrectTime, m_ResurrectQueue, m_ReviveQueue, RESURRECTION_INTERVAL, Player::ResurrectPlayer(), Player::SpawnCorpseBones(), SPELL_RESURRECTION_VISUAL, SPELL_SPIRIT_HEAL, SPELL_SPIRIT_HEAL_MANA, and EventProcessor::Update().

Referenced by Update().

◆ AddCreature()

Creature * Battleground::AddCreature ( uint32  entry,
uint32  type,
float  x,
float  y,
float  z,
float  o,
uint32  respawntime = 0,
MotionTransport transport = nullptr 
)
1492{
1493 // If the assert is called, means that BgCreatures must be resized!
1494 ASSERT(type < BgCreatures.size());
1495
1496 Map* map = FindBgMap();
1497 if (!map)
1498 return nullptr;
1499
1500 if (transport)
1501 {
1502 transport->CalculatePassengerPosition(x, y, z, &o);
1503 if (Creature* creature = transport->SummonCreature(entry, x, y, z, o, TEMPSUMMON_MANUAL_DESPAWN))
1504 {
1505 transport->AddPassenger(creature, true);
1506 BgCreatures[type] = creature->GetGUID();
1507 return creature;
1508 }
1509
1510 return nullptr;
1511 }
1512
1513 Creature* creature = new Creature();
1514 if (!creature->Create(map->GenerateLowGuid<HighGuid::Unit>(), map, PHASEMASK_NORMAL, entry, 0, x, y, z, o))
1515 {
1516 LOG_ERROR("bg.battleground", "Battleground::AddCreature: cannot create creature (entry: {}) for BG (map: {}, instance id: {})!",
1517 entry, m_MapId, m_InstanceID);
1518 delete creature;
1519 return nullptr;
1520 }
1521
1522 creature->SetHomePosition(x, y, z, o);
1523
1524 CreatureTemplate const* cinfo = sObjectMgr->GetCreatureTemplate(entry);
1525 if (!cinfo)
1526 {
1527 LOG_ERROR("bg.battleground", "Battleground::AddCreature: creature template (entry: {}) does not exist for BG (map: {}, instance id: {})!",
1528 entry, m_MapId, m_InstanceID);
1529 delete creature;
1530 return nullptr;
1531 }
1532 // Force using DB speeds
1533 creature->SetSpeed(MOVE_WALK, cinfo->speed_walk);
1534 creature->SetSpeed(MOVE_RUN, cinfo->speed_run);
1535
1536 if (!map->AddToMap(creature))
1537 {
1538 delete creature;
1539 return nullptr;
1540 }
1541
1542 BgCreatures[type] = creature->GetGUID();
1543
1544 if (respawntime)
1545 creature->SetRespawnDelay(respawntime);
1546
1547 // Xinef: Set PVP state for vehicles, should be for all creatures in bg?
1548 if (creature->IsVehicle())
1549 creature->SetPvP(true);
1550
1551 return creature;
1552}
#define ASSERT
Definition: Errors.h:68
@ PHASEMASK_NORMAL
Definition: Object.h:56
@ TEMPSUMMON_MANUAL_DESPAWN
Definition: Object.h:49
@ MOVE_RUN
Definition: Unit.h:379
@ MOVE_WALK
Definition: Unit.h:378
#define sObjectMgr
Definition: ObjectMgr.h:1640
void SetHomePosition(float x, float y, float z, float o)
Definition: Creature.h:328
void SetRespawnDelay(uint32 delay)
Definition: Creature.h:284
bool Create(ObjectGuid::LowType guidlow, Map *map, uint32 phaseMask, uint32 Entry, uint32 vehId, float x, float y, float z, float ang, const CreatureData *data=nullptr)
Definition: Creature.cpp:1101
Definition: CreatureData.h:176
float speed_run
Definition: CreatureData.h:194
float speed_walk
Definition: CreatureData.h:193
static ObjectGuid GetGUID(Object const *o)
Definition: Object.h:106
TempSummon * SummonCreature(uint32 id, const Position &pos, TempSummonType spwtype=TEMPSUMMON_MANUAL_DESPAWN, uint32 despwtime=0, uint32 vehId=0, SummonPropertiesEntry const *properties=nullptr, bool visibleBySummonerOnly=false) const
Definition: Object.cpp:2318
void CalculatePassengerPosition(float &x, float &y, float &z, float *o=nullptr) const override
This method transforms supplied transport offsets into global coordinates.
Definition: Transport.h:32
void AddPassenger(WorldObject *passenger, bool withAll=false) override
Definition: Transport.cpp:263
bool IsVehicle() const
Definition: Unit.h:1416
void SetPvP(bool state)
Definition: Unit.h:1519
void SetSpeed(UnitMoveType mtype, float rate, bool forced=false)
Definition: Unit.cpp:14323
Definition: Map.h:312
ObjectGuid::LowType GenerateLowGuid()
Definition: Map.h:632
bool AddToMap(T *, bool checkTransport=false)
Definition: Map.cpp:557

References MotionTransport::AddPassenger(), Map::AddToMap(), ASSERT, BgCreatures, Transport::CalculatePassengerPosition(), Creature::Create(), FindBgMap(), Map::GenerateLowGuid(), Object::GetGUID(), Unit::IsVehicle(), LOG_ERROR, m_InstanceID, m_MapId, MOVE_RUN, MOVE_WALK, PHASEMASK_NORMAL, Creature::SetHomePosition(), Unit::SetPvP(), Creature::SetRespawnDelay(), Unit::SetSpeed(), sObjectMgr, CreatureTemplate::speed_run, CreatureTemplate::speed_walk, WorldObject::SummonCreature(), and TEMPSUMMON_MANUAL_DESPAWN.

Referenced by BattlegroundAV::AddAVCreature(), AddSpiritGuide(), BattlegroundSA::CaptureGraveyard(), BattlegroundEY::EventTeamCapturedPoint(), BattlegroundIC::HandleCapturedNodes(), BattlegroundAB::NodeOccupied(), BattlegroundAV::PopulateNode(), BattlegroundSA::ResetObjs(), BattlegroundDS::SetupBattleground(), and BattlegroundIC::SetupBattleground().

◆ AddObject()

bool Battleground::AddObject ( uint32  type,
uint32  entry,
float  x,
float  y,
float  z,
float  o,
float  rotation0,
float  rotation1,
float  rotation2,
float  rotation3,
uint32  respawnTime = 0,
GOState  goState = GO_STATE_READY 
)
1370{
1371 // If the assert is called, means that BgObjects must be resized!
1372 ASSERT(type < BgObjects.size());
1373
1374 Map* map = FindBgMap();
1375 if (!map)
1376 return false;
1377 // Must be created this way, adding to godatamap would add it to the base map of the instance
1378 // and when loading it (in go::LoadFromDB()), a new guid would be assigned to the object, and a new object would be created
1379 // So we must create it specific for this instance
1380 GameObject* go = sObjectMgr->IsGameObjectStaticTransport(entry) ? new StaticTransport() : new GameObject();
1381 if (!go->Create(map->GenerateLowGuid<HighGuid::GameObject>(), entry, GetBgMap(),
1382 PHASEMASK_NORMAL, x, y, z, o, G3D::Quat(rotation0, rotation1, rotation2, rotation3), 100, goState))
1383 {
1384 LOG_ERROR("sql.sql", "Battleground::AddObject: cannot create gameobject (entry: {}) for BG (map: {}, instance id: {})!",
1385 entry, m_MapId, m_InstanceID);
1386 LOG_ERROR("bg.battleground", "Battleground::AddObject: cannot create gameobject (entry: {}) for BG (map: {}, instance id: {})!",
1387 entry, m_MapId, m_InstanceID);
1388 delete go;
1389 return false;
1390 }
1391 /*
1392 ObjectGuid::LowType spawnId = go->GetSpawnId();
1393
1394 // without this, UseButtonOrDoor caused the crash, since it tried to get go info from godata
1395 // iirc that was changed, so adding to go data map is no longer required if that was the only function using godata from GameObject without checking if it existed
1396 GameObjectData& data = sObjectMgr->NewGOData(spawnId);
1397
1398 data.id = entry;
1399 data.mapid = GetMapId();
1400 data.posX = x;
1401 data.posY = y;
1402 data.posZ = z;
1403 data.orientation = o;
1404 data.rotation0 = rotation0;
1405 data.rotation1 = rotation1;
1406 data.rotation2 = rotation2;
1407 data.rotation3 = rotation3;
1408 data.spawntimesecs = respawnTime;
1409 data.spawnMask = 1;
1410 data.animprogress = 100;
1411 data.go_state = 1;
1412 */
1413 // Add to world, so it can be later looked up from HashMapHolder
1414 if (!map->AddToMap(go))
1415 {
1416 delete go;
1417 return false;
1418 }
1419 BgObjects[type] = go->GetGUID();
1420 return true;
1421}
Definition: GameObject.h:122
virtual bool Create(ObjectGuid::LowType guidlow, uint32 name_id, Map *map, uint32 phaseMask, float x, float y, float z, float ang, G3D::Quat const &rotation, uint32 animprogress, GOState go_state, uint32 artKit=0)
Definition: GameObject.cpp:248
Definition: Transport.h:112

References Map::AddToMap(), ASSERT, BgObjects, GameObject::Create(), FindBgMap(), Map::GenerateLowGuid(), GetBgMap(), Object::GetGUID(), LOG_ERROR, m_InstanceID, m_MapId, PHASEMASK_NORMAL, and sObjectMgr.

Referenced by BattlegroundSA::CaptureGraveyard(), BattlegroundIC::EventPlayerClickedOnFlag(), BattlegroundIC::HandleCapturedNodes(), BattlegroundIC::PostUpdateImpl(), BattlegroundSA::ResetObjs(), BattlegroundAB::SetupBattleground(), BattlegroundAV::SetupBattleground(), BattlegroundBE::SetupBattleground(), BattlegroundDS::SetupBattleground(), BattlegroundEY::SetupBattleground(), BattlegroundIC::SetupBattleground(), BattlegroundNA::SetupBattleground(), BattlegroundRL::SetupBattleground(), BattlegroundRV::SetupBattleground(), and BattlegroundWS::SetupBattleground().

◆ AddOrSetPlayerToCorrectBgGroup()

void Battleground::AddOrSetPlayerToCorrectBgGroup ( Player player,
TeamId  teamId 
)
1140{
1141 if (player->GetGroup() && (player->GetGroup()->isBGGroup() || player->GetGroup()->isBFGroup()))
1142 {
1143 LOG_INFO("misc", "Battleground::AddOrSetPlayerToCorrectBgGroup - player is already in {} group!", (player->GetGroup()->isBGGroup() ? "BG" : "BF"));
1144 return;
1145 }
1146
1147 ObjectGuid playerGuid = player->GetGUID();
1148 Group* group = GetBgRaid(teamId);
1149 if (!group) // first player joined
1150 {
1151 group = new Group;
1152 SetBgRaid(teamId, group);
1153 group->Create(player);
1154 sGroupMgr->AddGroup(group);
1155 }
1156 else if (group->IsMember(playerGuid))
1157 {
1158 uint8 subgroup = group->GetMemberGroup(playerGuid);
1159 player->SetBattlegroundOrBattlefieldRaid(group, subgroup);
1160 }
1161 else
1162 {
1163 group->AddMember(player);
1164
1165 if (Group* originalGroup = player->GetOriginalGroup())
1166 if (originalGroup->IsLeader(playerGuid))
1167 {
1168 group->ChangeLeader(playerGuid);
1169 group->SendUpdate();
1170 }
1171 }
1172}
std::uint8_t uint8
Definition: Define.h:110
#define LOG_INFO(filterType__,...)
Definition: Log.h:167
#define sGroupMgr
Definition: GroupMgr.h:51
Group * GetBgRaid(TeamId teamId) const
Definition: Battleground.h:473
void SetBgRaid(TeamId teamId, Group *bg_raid)
Definition: Battleground.cpp:1828
Group * GetGroup()
Definition: Player.h:2418
Group * GetOriginalGroup()
Definition: Player.h:2433
void SetBattlegroundOrBattlefieldRaid(Group *group, int8 subgroup=-1)
Definition: Player.cpp:12977
Definition: Group.h:168
uint8 GetMemberGroup(ObjectGuid guid) const
Definition: Group.cpp:2323
bool AddMember(Player *player)
Definition: Group.cpp:390
void SendUpdate()
Definition: Group.cpp:1633
bool isBGGroup() const
Definition: Group.cpp:2215
void ChangeLeader(ObjectGuid guid)
Definition: Group.cpp:712
bool isBFGroup() const
Definition: Group.cpp:2220
bool IsMember(ObjectGuid guid) const
Definition: Group.cpp:2275
bool Create(Player *leader)
Definition: Group.cpp:108

References Group::AddMember(), Group::ChangeLeader(), Group::Create(), GetBgRaid(), Player::GetGroup(), Object::GetGUID(), Group::GetMemberGroup(), Player::GetOriginalGroup(), Group::isBFGroup(), Group::isBGGroup(), Group::IsMember(), LOG_INFO, Group::SendUpdate(), Player::SetBattlegroundOrBattlefieldRaid(), SetBgRaid(), and sGroupMgr.

Referenced by AddPlayer().

◆ AddPlayer()

void Battleground::AddPlayer ( Player player)
virtual

Reimplemented in Arena, BattlegroundAB, BattlegroundAV, BattlegroundEY, BattlegroundIC, BattlegroundSA, and BattlegroundWS.

1078{
1079 // remove afk from player
1080 if (player->HasPlayerFlag(PLAYER_FLAGS_AFK))
1081 player->ToggleAFK();
1082
1083 sScriptMgr->OnBattlegroundBeforeAddPlayer(this, player);
1084
1085 // score struct must be created in inherited class
1086
1087 ObjectGuid guid = player->GetGUID();
1088 TeamId teamId = player->GetBgTeamId();
1089
1090 // Add to list/maps
1091 m_Players[guid] = player;
1092
1093 UpdatePlayersCountByTeam(teamId, false); // +1 player
1094
1095 WorldPacket data;
1096 sBattlegroundMgr->BuildPlayerJoinedBattlegroundPacket(&data, player);
1097 SendPacketToTeam(teamId, &data, player, false);
1098
1100
1101 // add arena specific auras
1102 if (isArena())
1103 {
1104 // restore pets health before remove
1105 if (Pet* pet = player->GetPet())
1106 if (pet->IsAlive())
1107 pet->SetHealth(pet->GetMaxHealth());
1108
1110 player->DestroyConjuredItems(true);
1111 player->UnsummonPetTemporaryIfAny();
1112
1113 if (GetStatus() == STATUS_WAIT_JOIN) // not started yet
1114 {
1115 player->CastSpell(player, SPELL_ARENA_PREPARATION, true);
1116 player->ResetAllPowers();
1117 }
1118 }
1119 else
1120 {
1121 if (GetStatus() == STATUS_WAIT_JOIN) // not started yet
1122 player->CastSpell(player, SPELL_PREPARATION, true); // reduces all mana cost of spells.
1123 }
1124
1125 // Xinef: reset all map criterias on map enter
1127
1128 // setup BG group membership
1130 AddOrSetPlayerToCorrectBgGroup(player, teamId);
1131
1132 sScriptMgr->OnBattlegroundAddPlayer(this, player);
1133
1134 // Log
1135 LOG_DEBUG("bg.battleground", "BATTLEGROUND: Player {} joined the battle.", player->GetName());
1136}
@ STATUS_WAIT_JOIN
Definition: Battleground.h:196
@ TEMP_ENCHANTMENT_SLOT
Definition: Item.h:164
@ PLAYER_FLAGS_AFK
Definition: Player.h:476
@ SPELL_AURA_MOUNTED
Definition: SpellAuraDefines.h:141
@ ACHIEVEMENT_CRITERIA_CONDITION_BG_MAP
Definition: DBCEnums.h:96
TeamId
Definition: SharedDefines.h:731
void PlayerAddedToBGCheckIfBGIsRunning(Player *player)
Definition: Battleground.cpp:1786
void SendPacketToTeam(TeamId teamId, WorldPacket const *packet, Player *sender=nullptr, bool self=true)
Definition: Battleground.cpp:666
void UpdatePlayersCountByTeam(TeamId teamId, bool remove)
Definition: Battleground.h:481
void AddOrSetPlayerToCorrectBgGroup(Player *player, TeamId teamId)
Definition: Battleground.cpp:1139
std::string const & GetName() const
Definition: Object.h:446
Definition: Pet.h:40
Pet * GetPet() const
Definition: Player.cpp:8784
void DestroyConjuredItems(bool update)
Definition: PlayerStorage.cpp:3370
void UnsummonPetTemporaryIfAny()
Definition: Player.cpp:14100
void ResetAchievementCriteria(AchievementCriteriaCondition condition, uint32 value, bool evenIfCriteriaComplete=false)
Definition: Player.cpp:13813
void ToggleAFK()
Definition: Player.cpp:1272
void ResetAllPowers()
Definition: Player.cpp:2010
bool HasPlayerFlag(PlayerFlags flags) const
Definition: Player.h:1090
void RemoveArenaEnchantments(EnchantmentSlot slot)
Definition: PlayerStorage.cpp:4253
TeamId GetBgTeamId() const
Definition: Player.h:2227
void RemoveAurasByType(AuraType auraType, ObjectGuid casterGUID=ObjectGuid::Empty, Aura *except=nullptr, bool negative=true, bool positive=true)
Definition: Unit.cpp:5025

References ACHIEVEMENT_CRITERIA_CONDITION_BG_MAP, AddOrSetPlayerToCorrectBgGroup(), Unit::CastSpell(), Player::DestroyConjuredItems(), Player::GetBgTeamId(), Object::GetGUID(), GetMapId(), WorldObject::GetName(), Player::GetPet(), GetStatus(), Player::HasPlayerFlag(), isArena(), LOG_DEBUG, m_Players, PLAYER_FLAGS_AFK, PlayerAddedToBGCheckIfBGIsRunning(), Player::RemoveArenaEnchantments(), Unit::RemoveAurasByType(), Player::ResetAchievementCriteria(), Player::ResetAllPowers(), sBattlegroundMgr, SendPacketToTeam(), SPELL_ARENA_PREPARATION, SPELL_AURA_MOUNTED, SPELL_PREPARATION, sScriptMgr, STATUS_WAIT_JOIN, TEMP_ENCHANTMENT_SLOT, Player::ToggleAFK(), Player::UnsummonPetTemporaryIfAny(), and UpdatePlayersCountByTeam().

Referenced by Arena::AddPlayer(), BattlegroundAB::AddPlayer(), BattlegroundAV::AddPlayer(), BattlegroundEY::AddPlayer(), BattlegroundIC::AddPlayer(), BattlegroundSA::AddPlayer(), and BattlegroundWS::AddPlayer().

◆ AddPlayerToResurrectQueue()

void Battleground::AddPlayerToResurrectQueue ( ObjectGuid  npc_guid,
ObjectGuid  player_guid 
)
1323{
1324 m_ReviveQueue[npc_guid].push_back(player_guid);
1325
1326 Player* player = ObjectAccessor::FindPlayer(player_guid);
1327 if (!player)
1328 return;
1329
1330 player->CastSpell(player, SPELL_WAITING_FOR_RESURRECT, true);
1331}
@ SPELL_WAITING_FOR_RESURRECT
Definition: Battleground.h:132

References Unit::CastSpell(), ObjectAccessor::FindPlayer(), m_ReviveQueue, and SPELL_WAITING_FOR_RESURRECT.

Referenced by WorldSession::HandleAreaSpiritHealerQueueOpcode(), and WorldSession::HandleGossipHelloOpcode().

◆ AddSpectator()

void Battleground::AddSpectator ( Player p)
inline
380{ m_Spectators.insert(p); }

References m_Spectators.

◆ AddSpiritGuide()

bool Battleground::AddSpiritGuide ( uint32  type,
float  x,
float  y,
float  z,
float  o,
TeamId  teamId 
)
Todo:
: Fix display here
1594{
1596
1597 if (Creature* creature = AddCreature(entry, type, x, y, z, o))
1598 {
1599 creature->setDeathState(DEAD);
1600 creature->SetGuidValue(UNIT_FIELD_CHANNEL_OBJECT, creature->GetGUID());
1601 // aura
1603 // creature->SetVisibleAura(0, SPELL_SPIRIT_HEAL_CHANNEL);
1604 // casting visual effect
1605 creature->SetUInt32Value(UNIT_CHANNEL_SPELL, SPELL_SPIRIT_HEAL_CHANNEL);
1606 // correct cast speed
1607 creature->SetFloatValue(UNIT_MOD_CAST_SPEED, 1.0f);
1608 //creature->CastSpell(creature, SPELL_SPIRIT_HEAL_CHANNEL, true);
1609 return true;
1610 }
1611 LOG_ERROR("bg.battleground", "Battleground::AddSpiritGuide: cannot create spirit guide (type: {}, entry: {}) for BG (map: {}, instance id: {})!",
1612 type, entry, m_MapId, m_InstanceID);
1613 EndNow();
1614 return false;
1615}
@ BG_CREATURE_ENTRY_H_SPIRITGUIDE
Definition: Battleground.h:127
@ BG_CREATURE_ENTRY_A_SPIRITGUIDE
Definition: Battleground.h:126
@ SPELL_SPIRIT_HEAL_CHANNEL
Definition: Battleground.h:133
@ UNIT_FIELD_CHANNEL_OBJECT
Definition: UpdateFields.h:93
@ UNIT_MOD_CAST_SPEED
Definition: UpdateFields.h:137
@ UNIT_CHANNEL_SPELL
Definition: UpdateFields.h:94
@ DEAD
Definition: Unit.h:319
Creature * AddCreature(uint32 entry, uint32 type, float x, float y, float z, float o, uint32 respawntime=0, MotionTransport *transport=nullptr)
Definition: Battleground.cpp:1491

References AddCreature(), BG_CREATURE_ENTRY_A_SPIRITGUIDE, BG_CREATURE_ENTRY_H_SPIRITGUIDE, DEAD, EndNow(), LOG_ERROR, m_InstanceID, m_MapId, SPELL_SPIRIT_HEAL_CHANNEL, TEAM_ALLIANCE, UNIT_CHANNEL_SPELL, UNIT_FIELD_CHANNEL_OBJECT, and UNIT_MOD_CAST_SPEED.

Referenced by BattlegroundSA::CaptureGraveyard(), BattlegroundEY::EventTeamCapturedPoint(), BattlegroundIC::HandleCapturedNodes(), BattlegroundAB::NodeOccupied(), BattlegroundAV::PopulateNode(), BattlegroundSA::ResetObjs(), BattlegroundAB::SetupBattleground(), BattlegroundAV::SetupBattleground(), BattlegroundEY::SetupBattleground(), BattlegroundIC::SetupBattleground(), and BattlegroundWS::SetupBattleground().

◆ AddToBeTeleported()

void Battleground::AddToBeTeleported ( ObjectGuid  spectator,
ObjectGuid  participant 
)
inline
384{ m_ToBeTeleported[spectator] = participant; }

References m_ToBeTeleported.

Referenced by ArenaSpectator::HandleSpectatorSpectateCommand().

◆ AddToBGFreeSlotQueue()

void Battleground::AddToBGFreeSlotQueue ( )
1176{
1178 {
1179 sBattlegroundMgr->AddToBGFreeSlotQueue(m_RealTypeID, this);
1180 _InBGFreeSlotQueue = true;
1181 }
1182}
bool _InBGFreeSlotQueue
Definition: Battleground.h:653
bool isBattleground() const
Definition: Battleground.h:389

References _InBGFreeSlotQueue, isBattleground(), m_RealTypeID, and sBattlegroundMgr.

Referenced by RemovePlayerAtLeave(), and StartBattleground().

◆ AllNodesConrolledByTeam()

virtual bool Battleground::AllNodesConrolledByTeam ( TeamId  ) const
inlinevirtual

Reimplemented in BattlegroundAB, BattlegroundEY, and BattlegroundIC.

313{ return false; }

Referenced by achievement_bg_control_all_nodes::OnCheck().

◆ BlockMovement()

void Battleground::BlockMovement ( Player player)
930{
931 player->SetClientControl(player, 0); // movement disabled NOTE: the effect will be automatically removed by client when the player is teleported from the battleground, so no need to send with uint8(1) in RemovePlayerAtLeave()
932}
void SetClientControl(Unit *target, bool allowMove, bool packetOnly=false)
Definition: Player.cpp:12748

References Player::SetClientControl().

Referenced by EndBattleground(), and PlayerAddedToBGCheckIfBGIsRunning().

◆ BroadcastWorker()

template<class Do >
void Battleground::BroadcastWorker ( Do &  _do)
119{
120 for (BattlegroundPlayerMap::const_iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr)
121 _do(itr->second);
122}

References m_Players.

Referenced by PSendMessageToAll(), SendBroadcastText(), SendMessage2ToAll(), and SendMessageToAll().

◆ BuildPvPLogDataPacket()

void Battleground::BuildPvPLogDataPacket ( WorldPacket data)
1279{
1280 uint8 type = (isArena() ? 1 : 0);
1281
1282 data.Initialize(MSG_PVP_LOG_DATA, 1 + 1 + 4 + 40 * GetPlayerScores()->size());
1283 data << uint8(type); // type (battleground = 0 / arena = 1)
1284
1285 if (type) // arena
1286 {
1287 for (uint8 i = 0; i < PVP_TEAMS_COUNT; ++i)
1288 _arenaTeamScores[i].BuildRatingInfoBlock(data);
1289
1290 for (uint8 i = 0; i < PVP_TEAMS_COUNT; ++i)
1291 _arenaTeamScores[i].BuildTeamInfoBlock(data);
1292 }
1293
1295 {
1296 data << uint8(1); // bg ended
1297 data << uint8(GetWinner()); // who win
1298 }
1299 else
1300 data << uint8(0); // bg not ended
1301
1302 data << uint32(GetPlayerScores()->size());
1303
1304 for (auto const& score : PlayerScores)
1305 score.second->AppendToPacket(data);
1306}
@ STATUS_WAIT_LEAVE
Definition: Battleground.h:198
uint8 constexpr PVP_TEAMS_COUNT
Definition: SharedDefines.h:3417
@ MSG_PVP_LOG_DATA
Definition: Opcodes.h:766
ArenaTeamScore _arenaTeamScores[PVP_TEAMS_COUNT]
Definition: Battleground.h:632
PvPTeamId GetWinner() const
Definition: Battleground.h:336
BattlegroundScoreMap const * GetPlayerScores() const
Definition: Battleground.h:402
void Initialize(uint16 opcode, size_t newres=200)
Definition: WorldPacket.h:69

References _arenaTeamScores, GetPlayerScores(), GetStatus(), GetWinner(), WorldPacket::Initialize(), isArena(), MSG_PVP_LOG_DATA, PlayerScores, PVP_TEAMS_COUNT, and STATUS_WAIT_LEAVE.

Referenced by EndBattleground(), WorldSession::HandlePVPLogDataOpcode(), and PlayerAddedToBGCheckIfBGIsRunning().

◆ CastSpellOnTeam()

void Battleground::CastSpellOnTeam ( uint32  spellId,
TeamId  teamId 
)
697{
698 for (BattlegroundPlayerMap::const_iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr)
699 if (itr->second->GetBgTeamId() == teamId)
700 itr->second->CastSpell(itr->second, spellId, true);
701}

References m_Players.

Referenced by BattlegroundIC::HandleCapturedNodes(), BattlegroundAV::HandleKillUnit(), BattlegroundAB::NodeOccupied(), and BattlegroundAV::PostUpdateImpl().

◆ CheckWinConditions()

virtual void Battleground::CheckWinConditions ( )
inlinevirtual

Reimplemented in Arena.

489{ }

Referenced by _ProcessJoin().

◆ DecreaseInvitedCount()

void Battleground::DecreaseInvitedCount ( TeamId  teamId)
inline
370{ if (m_BgInvitedPlayers[teamId]) --m_BgInvitedPlayers[teamId]; }

References m_BgInvitedPlayers.

Referenced by RemovePlayerAtLeave().

◆ DelCreature()

bool Battleground::DelCreature ( uint32  type)
1555{
1556 if (!BgCreatures[type])
1557 return true;
1558
1559 if (Creature* creature = GetBgMap()->GetCreature(BgCreatures[type]))
1560 {
1561 creature->AddObjectToRemoveList();
1562 BgCreatures[type].Clear();
1563 return true;
1564 }
1565
1566 LOG_ERROR("bg.battleground", "Battleground::DelCreature: creature (type: {}, {}) not found for BG (map: {}, instance id: {})!",
1567 type, BgCreatures[type].ToString(), m_MapId, m_InstanceID);
1568
1569 BgCreatures[type].Clear();
1570 return false;
1571}
std::string ToString(Type &&val, Params &&... params)
Definition: StringConvert.h:250
Creature * GetCreature(WorldObject const &u, ObjectGuid const guid)
Definition: ObjectAccessor.cpp:215

References BgCreatures, GetBgMap(), LOG_ERROR, m_InstanceID, and m_MapId.

Referenced by BattlegroundSA::CaptureGraveyard(), BattlegroundAV::ChangeMineOwner(), BattlegroundAV::DePopulateNode(), BattlegroundAV::EventPlayerAssaultsPoint(), BattlegroundIC::EventPlayerClickedOnFlag(), BattlegroundAV::EventPlayerDestroyedPoint(), BattlegroundEY::EventTeamLostPoint(), BattlegroundIC::HandleContestedNodes(), BattlegroundAV::HandleKillUnit(), BattlegroundAB::NodeDeoccupied(), BattlegroundAV::PopulateNode(), BattlegroundAV::ResetBGSubclass(), BattlegroundSA::ResetObjs(), and ~Battleground().

◆ DelObject()

bool Battleground::DelObject ( uint32  type)
1574{
1575 if (!BgObjects[type])
1576 return true;
1577
1578 if (GameObject* obj = GetBgMap()->GetGameObject(BgObjects[type]))
1579 {
1580 obj->SetRespawnTime(0); // not save respawn time
1581 obj->Delete();
1582 BgObjects[type].Clear();
1583 return true;
1584 }
1585
1586 LOG_ERROR("bg.battleground", "Battleground::DelObject: gameobject (type: {}, {}) not found for BG (map: {}, instance id: {})!",
1587 type, BgObjects[type].ToString(), m_MapId, m_InstanceID);
1588
1589 BgObjects[type].Clear();
1590 return false;
1591}
GameObject * GetGameObject(WorldObject const &u, ObjectGuid const guid)
Definition: ObjectAccessor.cpp:189

References BgObjects, GetBgMap(), LOG_ERROR, m_InstanceID, and m_MapId.

Referenced by _ProcessJoin(), BattlegroundSA::CaptureGraveyard(), BattlegroundSA::DestroyGate(), BattlegroundIC::EventPlayerClickedOnFlag(), BattlegroundIC::HandleContestedNodes(), BattlegroundIC::PostUpdateImpl(), BattlegroundSA::ResetObjs(), and ~Battleground().

◆ DestroyGate()

virtual void Battleground::DestroyGate ( Player ,
GameObject  
)
inlinevirtual

Reimplemented in BattlegroundIC, and BattlegroundSA.

310{}

◆ DoAction()

virtual void Battleground::DoAction ( uint32  ,
ObjectGuid   
)
inlinevirtual

Reimplemented in BattlegroundIC.

511{}

◆ DoorClose()

void Battleground::DoorClose ( uint32  type)
1426{
1427 if (GameObject* obj = GetBgMap()->GetGameObject(BgObjects[type]))
1428 {
1429 // If doors are open, close it
1430 if (obj->getLootState() == GO_ACTIVATED && obj->GetGoState() != GO_STATE_READY)
1431 {
1432 obj->SetLootState(GO_READY);
1433 obj->SetGoState(GO_STATE_READY);
1434 }
1435 }
1436 else
1437 LOG_ERROR("bg.battleground", "Battleground::DoorClose: door gameobject (type: {}, {}) not found for BG (map: {}, instance id: {})!",
1438 type, BgObjects[type].ToString(), m_MapId, m_InstanceID);
1439}
@ GO_ACTIVATED
Definition: GameObject.h:114
@ GO_READY
Definition: GameObject.h:113
@ GO_STATE_READY
Definition: GameObjectData.h:691

References BgObjects, GetBgMap(), GO_ACTIVATED, GO_READY, GO_STATE_READY, LOG_ERROR, m_InstanceID, and m_MapId.

Referenced by BattlegroundDS::PostUpdateImpl(), BattlegroundRV::PostUpdateImpl(), BattlegroundAB::StartingEventCloseDoors(), BattlegroundAV::StartingEventCloseDoors(), and BattlegroundWS::StartingEventCloseDoors().

◆ DoorOpen()

◆ EndBattleground() [1/2]

void Battleground::EndBattleground ( PvPTeamId  winnerTeamId)
779{
780 // xinef: if this is true, it means that endbattleground is called second time
781 // skip to avoid double rating reduce / add
782 // can bug out due to multithreading ?
783 // set as fast as possible
785 return;
786
789 SetWinner(winnerTeamId);
790
791 if (winnerTeamId == PVP_TEAM_ALLIANCE)
792 {
793 if (isBattleground())
795
796 PlaySoundToAll(SOUND_ALLIANCE_WINS); // alliance wins sound
797 }
798 else if (winnerTeamId == PVP_TEAM_HORDE)
799 {
800 if (isBattleground())
802
803 PlaySoundToAll(SOUND_HORDE_WINS); // horde wins sound
804 }
805
807 uint64 battlegroundId = 1;
809 {
810 stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_PVPSTATS_MAXID);
811 PreparedQueryResult result = CharacterDatabase.Query(stmt);
812
813 if (result)
814 {
815 Field* fields = result->Fetch();
816 battlegroundId = fields[0].Get<uint64>() + 1;
817 }
818
819 stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_PVPSTATS_BATTLEGROUND);
820 stmt->SetData(0, battlegroundId);
821 stmt->SetData(1, GetWinner());
822 stmt->SetData(2, GetUniqueBracketId());
823 stmt->SetData(3, GetBgTypeID(true));
824 CharacterDatabase.Execute(stmt);
825 }
826
827 //we must set it this way, because end time is sent in packet!
829
830 WorldPacket pvpLogData;
831 BuildPvPLogDataPacket(pvpLogData);
832
833 for (auto const& [playerGuid, player] : m_Players)
834 {
835 TeamId bgTeamId = player->GetBgTeamId();
836
837 // should remove spirit of redemption
838 if (player->HasAuraType(SPELL_AURA_SPIRIT_OF_REDEMPTION))
839 player->RemoveAurasByType(SPELL_AURA_MOD_SHAPESHIFT);
840
841 if (!player->IsAlive())
842 {
843 player->ResurrectPlayer(1.0f);
844 player->SpawnCorpseBones();
845 }
846 else
847 {
848 //needed cause else in av some creatures will kill the players at the end
849 player->CombatStop();
850 player->getHostileRefMgr().deleteReferences();
851 }
852
853 uint32 winner_kills = player->GetRandomWinner() ? sWorld->getIntConfig(CONFIG_BG_REWARD_WINNER_HONOR_LAST) : sWorld->getIntConfig(CONFIG_BG_REWARD_WINNER_HONOR_FIRST);
854 uint32 loser_kills = player->GetRandomWinner() ? sWorld->getIntConfig(CONFIG_BG_REWARD_LOSER_HONOR_LAST) : sWorld->getIntConfig(CONFIG_BG_REWARD_LOSER_HONOR_FIRST);
855 uint32 winner_arena = player->GetRandomWinner() ? sWorld->getIntConfig(CONFIG_BG_REWARD_WINNER_ARENA_LAST) : sWorld->getIntConfig(CONFIG_BG_REWARD_WINNER_ARENA_FIRST);
856
857 // Reward winner team
858 if (bgTeamId == GetTeamId(winnerTeamId))
859 {
861 {
863
864 // Xinef: check player level and not bracket level if (CanAwardArenaPoints())
865 if (player->GetLevel() >= BG_AWARD_ARENA_POINTS_MIN_LEVEL)
866 player->ModifyArenaPoints(winner_arena);
867
868 if (!player->GetRandomWinner())
869 player->SetRandomWinner(true);
870 }
871
872 player->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_WIN_BG, player->GetMapId());
873 }
874 else
875 {
878 }
879
880 sScriptMgr->OnBattlegroundEndReward(this, player, GetTeamId(winnerTeamId));
881
882 player->ResetAllPowers();
883 player->CombatStopWithPets(true);
884
885 BlockMovement(player);
886
887 player->GetSession()->SendPacket(&pvpLogData);
888
890 {
891 stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_PVPSTATS_PLAYER);
892 auto const& score = PlayerScores.find(player->GetGUID().GetCounter());
893
894 stmt->SetData(0, battlegroundId);
895 stmt->SetData(1, player->GetGUID().GetCounter());
896 stmt->SetData(2, bgTeamId == GetTeamId(winnerTeamId));
897 stmt->SetData(3, score->second->GetKillingBlows());
898 stmt->SetData(4, score->second->GetDeaths());
899 stmt->SetData(5, score->second->GetHonorableKills());
900 stmt->SetData(6, score->second->GetBonusHonor());
901 stmt->SetData(7, score->second->GetDamageDone());
902 stmt->SetData(8, score->second->GetHealingDone());
903 stmt->SetData(9, score->second->GetAttr1());
904 stmt->SetData(10, score->second->GetAttr2());
905 stmt->SetData(11, score->second->GetAttr3());
906 stmt->SetData(12, score->second->GetAttr4());
907 stmt->SetData(13, score->second->GetAttr5());
908
909 CharacterDatabase.Execute(stmt);
910 }
911
912 WorldPacket data;
913 sBattlegroundMgr->BuildBattlegroundStatusPacket(&data, this, player->GetCurrentBattlegroundQueueSlot(), STATUS_IN_PROGRESS, TIME_TO_AUTOREMOVE, GetStartTime(), GetArenaType(), player->GetBgTeamId());
914 player->GetSession()->SendPacket(&data);
915
916 player->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_BATTLEGROUND, player->GetMapId());
917 }
918
919 sScriptMgr->OnBattlegroundEnd(this, GetTeamId(winnerTeamId));
920}
std::uint64_t uint64
Definition: Define.h:107
DatabaseWorkerPool< CharacterDatabaseConnection > CharacterDatabase
Accessor to the character database.
Definition: DatabaseEnv.cpp:21
std::shared_ptr< PreparedResultSet > PreparedQueryResult
Definition: DatabaseEnvFwd.h:46
@ CHAR_SEL_PVPSTATS_MAXID
Definition: CharacterDatabase.h:490
@ CHAR_INS_PVPSTATS_PLAYER
Definition: CharacterDatabase.h:492
@ CHAR_INS_PVPSTATS_BATTLEGROUND
Definition: CharacterDatabase.h:491
@ BG_TEXT_ALLIANCE_WINS
Definition: Battleground.h:69
@ BG_TEXT_HORDE_WINS
Definition: Battleground.h:70
#define BG_AWARD_ARENA_POINTS_MIN_LEVEL
Definition: Battleground.h:273
@ SOUND_ALLIANCE_WINS
Definition: Battleground.h:81
@ SOUND_HORDE_WINS
Definition: Battleground.h:80
@ SCORE_BONUS_HONOR
Definition: BattlegroundScore.h:32
@ SPELL_AURA_MOD_SHAPESHIFT
Definition: SpellAuraDefines.h:99
@ SPELL_AURA_SPIRIT_OF_REDEMPTION
Definition: SpellAuraDefines.h:239
@ 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
@ CONFIG_BATTLEGROUND_STORE_STATISTICS_ENABLE
Definition: IWorld.h:119
@ ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_BATTLEGROUND
Definition: DBCEnums.h:138
@ ACHIEVEMENT_CRITERIA_TYPE_WIN_BG
Definition: DBCEnums.h:129
@ PVP_TEAM_HORDE
Definition: SharedDefines.h:3412
@ PVP_TEAM_ALLIANCE
Definition: SharedDefines.h:3413
TeamId GetTeamId(PvPTeamId teamId)
Definition: SharedDefines.h:3434
Definition: PreparedStatement.h:158
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
Acore::Types::is_default< T > SetData(const uint8 index, T value)
Definition: PreparedStatement.h:78
uint8 GetUniqueBracketId() const
Definition: Battleground.cpp:1870
void BlockMovement(Player *player)
Definition: Battleground.cpp:929
void SetWinner(PvPTeamId winner)
Definition: Battleground.h:357
void BuildPvPLogDataPacket(WorldPacket &data)
Definition: Battleground.cpp:1278
virtual bool UpdatePlayerScore(Player *player, uint32 type, uint32 value, bool doAddHonor=true)
Definition: Battleground.cpp:1308
bool IsRandom()
Definition: Battleground.h:340
uint32 GetBonusHonorFromKill(uint32 kills) const
Definition: Battleground.cpp:922
static bool IsBGWeekend(BattlegroundTypeId bgTypeId)
Definition: BattlegroundMgr.cpp:895

References ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_BATTLEGROUND, ACHIEVEMENT_CRITERIA_TYPE_WIN_BG, BG_AWARD_ARENA_POINTS_MIN_LEVEL, BG_TEXT_ALLIANCE_WINS, BG_TEXT_HORDE_WINS, BlockMovement(), BuildPvPLogDataPacket(), CHAR_INS_PVPSTATS_BATTLEGROUND, CHAR_INS_PVPSTATS_PLAYER, CHAR_SEL_PVPSTATS_MAXID, CharacterDatabase, CHAT_MSG_BG_SYSTEM_NEUTRAL, CONFIG_BATTLEGROUND_STORE_STATISTICS_ENABLE, 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, Field::Get(), GetArenaType(), GetBgTypeID(), GetBonusHonorFromKill(), GetStartTime(), GetStatus(), GetTeamId(), GetUniqueBracketId(), GetWinner(), isBattleground(), BattlegroundMgr::IsBGWeekend(), IsRandom(), m_EndTime, m_Players, PlayerScores, PlaySoundToAll(), PVP_TEAM_ALLIANCE, PVP_TEAM_HORDE, RemoveFromBGFreeSlotQueue(), sBattlegroundMgr, SCORE_BONUS_HONOR, SendBroadcastText(), PreparedStatementBase::SetData(), SetStatus(), SetWinner(), SOUND_ALLIANCE_WINS, SOUND_HORDE_WINS, SPELL_AURA_MOD_SHAPESHIFT, SPELL_AURA_SPIRIT_OF_REDEMPTION, sScriptMgr, STATUS_IN_PROGRESS, STATUS_WAIT_LEAVE, sWorld, TIME_TO_AUTOREMOVE, and UpdatePlayerScore().

Referenced by _ProcessProgress(), EndBattleground(), Arena::EndBattleground(), BattlegroundAB::EndBattleground(), BattlegroundAV::EndBattleground(), BattlegroundEY::EndBattleground(), BattlegroundSA::EndBattleground(), BattlegroundWS::EndBattleground(), BattlegroundIC::HandleKillPlayer(), BattlegroundIC::HandleKillUnit(), and Update().

◆ EndBattleground() [2/2]

virtual void Battleground::EndBattleground ( TeamId  winnerTeamId)
inlinevirtual
Deprecated:
need delete

Reimplemented in Arena, BattlegroundAB, BattlegroundAV, BattlegroundEY, BattlegroundSA, and BattlegroundWS.

459 {
460 EndBattleground(GetPvPTeamId(winnerTeamId));
461 }
PvPTeamId GetPvPTeamId(TeamId teamId)
Definition: SharedDefines.h:3419

References EndBattleground(), and GetPvPTeamId().

◆ EndNow()

void Battleground::EndNow ( )
protected
1675{
1678 SetEndTime(0);
1679}
void SetEndTime(uint32 Time)
Definition: Battleground.h:351

References RemoveFromBGFreeSlotQueue(), SetEndTime(), SetStatus(), and STATUS_WAIT_LEAVE.

Referenced by _ProcessJoin(), and AddSpiritGuide().

◆ EventPlayerClickedOnFlag()

virtual void Battleground::EventPlayerClickedOnFlag ( Player ,
GameObject  
)
inlinevirtual

◆ EventPlayerDamagedGO()

virtual void Battleground::EventPlayerDamagedGO ( Player ,
GameObject ,
uint32   
)
inlinevirtual

Reimplemented in BattlegroundIC, and BattlegroundSA.

507{}

◆ EventPlayerDroppedFlag()

virtual void Battleground::EventPlayerDroppedFlag ( Player )
inlinevirtual

Reimplemented in BattlegroundEY, and BattlegroundWS.

505{}

◆ EventPlayerUsedGO()

virtual void Battleground::EventPlayerUsedGO ( Player ,
GameObject  
)
inlinevirtual

Reimplemented in BattlegroundSA.

508{}

◆ FillInitialWorldStates()

virtual void Battleground::FillInitialWorldStates ( WorldPacket )
inlinevirtual

◆ FindBgMap()

◆ GetAcoreString()

char const * Battleground::GetAcoreString ( int32  entry)
1683{
1684 // FIXME: now we have different DBC locales and need localized message for each target client
1685 return sObjectMgr->GetAcoreStringForDBCLocale(entry);
1686}

References sObjectMgr.

Referenced by BattlegroundAV::ChangeMineOwner(), BattlegroundAV::EventPlayerAssaultsPoint(), BattlegroundAV::EventPlayerDefendsPoint(), BattlegroundAV::EventPlayerDestroyedPoint(), BattlegroundAV::GetNodeName(), and BattlegroundAV::HandleKillUnit().

◆ GetAlivePlayersCountByTeam()

uint32 Battleground::GetAlivePlayersCountByTeam ( TeamId  teamId) const
1802{
1803 uint32 count = 0;
1804 for (BattlegroundPlayerMap::const_iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr)
1805 if (itr->second->IsAlive() && !itr->second->HasByteFlag(UNIT_FIELD_BYTES_2, 3, FORM_SPIRITOFREDEMPTION) && itr->second->GetBgTeamId() == teamId)
1806 ++count;
1807
1808 return count;
1809}
@ UNIT_FIELD_BYTES_2
Definition: UpdateFields.h:161
@ FORM_SPIRITOFREDEMPTION
Definition: Unit.h:120

References FORM_SPIRITOFREDEMPTION, m_Players, and UNIT_FIELD_BYTES_2.

Referenced by Arena::CheckWinConditions(), Arena::EndBattleground(), Arena::FillInitialWorldStates(), and Arena::UpdateArenaWorldState().

◆ GetArenaMatchmakerRating()

uint32 Battleground::GetArenaMatchmakerRating ( TeamId  teamId) const
inline
495{ return m_ArenaTeamMMR[teamId]; }

References m_ArenaTeamMMR.

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

◆ GetArenaTeamIdForTeam()

uint32 Battleground::GetArenaTeamIdForTeam ( TeamId  teamId) const
inline
493{ return m_ArenaTeamIds[teamId]; }

References m_ArenaTeamIds.

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

◆ GetArenaType()

◆ GetBGCreature()

◆ GetBgMap()

◆ GetBGObject()

◆ GetBgRaid()

Group * Battleground::GetBgRaid ( TeamId  teamId) const
inline
473{ return m_BgRaids[teamId]; }

References m_BgRaids.

Referenced by AddOrSetPlayerToCorrectBgGroup(), RemovePlayerAtLeave(), and Group::~Group().

◆ GetBgTypeID()

◆ GetBonusHonorFromKill()

uint32 Battleground::GetBonusHonorFromKill ( uint32  kills) const
923{
924 //variable kills means how many honorable kills you scored (so we need kills * honor_for_one_kill)
925 uint32 maxLevel = std::min<uint32>(GetMaxLevel(), 80U);
926 return Acore::Honor::hk_honor_at_level(maxLevel, float(kills));
927}
uint32 hk_honor_at_level(uint8 level, float multiplier=1.0f)
Definition: Formulas.h:33

References GetMaxLevel(), and Acore::Honor::hk_honor_at_level().

Referenced by BattlegroundEY::AddPoints(), BattlegroundSA::DestroyGate(), EndBattleground(), BattlegroundAB::EndBattleground(), BattlegroundAV::EndBattleground(), BattlegroundEY::EndBattleground(), BattlegroundSA::EndBattleground(), BattlegroundWS::EndBattleground(), BattlegroundWS::EventPlayerCapturedFlag(), BattlegroundAV::EventPlayerDestroyedPoint(), BattlegroundAV::HandleKillUnit(), and BattlegroundAB::PostUpdateImpl().

◆ GetBracketId()

BattlegroundBracketId Battleground::GetBracketId ( ) const
inline

◆ GetClientInstanceID()

uint32 Battleground::GetClientInstanceID ( ) const
inline

◆ GetClosestGraveyard()

GraveyardStruct const * Battleground::GetClosestGraveyard ( Player player)
virtual

Reimplemented in BattlegroundAB, BattlegroundAV, BattlegroundEY, BattlegroundIC, BattlegroundSA, and BattlegroundWS.

1839{
1840 return sGraveyard->GetClosestGraveyard(player, player->GetBgTeamId());
1841}
#define sGraveyard
Definition: GameGraveyard.h:75

References Player::GetBgTeamId(), and sGraveyard.

Referenced by RelocateDeadPlayers().

◆ GetEndTime()

uint32 Battleground::GetEndTime ( ) const
inline
325{ return m_EndTime; }

References m_EndTime.

Referenced by PlayerAddedToBGCheckIfBGIsRunning().

◆ GetFlagPickerGUID()

virtual ObjectGuid Battleground::GetFlagPickerGUID ( TeamId  = TEAM_NEUTRAL) const
inlinevirtual

Reimplemented in BattlegroundWS, and BattlegroundEY.

557{ return ObjectGuid::Empty; }
static ObjectGuid const Empty
Definition: ObjectGuid.h:122

References ObjectGuid::Empty.

Referenced by WorldSession::HandleBattlegroundPlayerPositionsOpcode().

◆ GetFreeSlotsForTeam()

uint32 Battleground::GetFreeSlotsForTeam ( TeamId  teamId) const
1195{
1197 return 0;
1198
1199 // if CONFIG_BATTLEGROUND_INVITATION_TYPE == BG_QUEUE_INVITATION_TYPE_NO_BALANCE, invite everyone unless the BG is full
1201 return (GetInvitedCount(teamId) < GetMaxPlayersPerTeam()) ? GetMaxPlayersPerTeam() - GetInvitedCount(teamId) : 0;
1202
1203 // if BG is already started or CONFIG_BATTLEGROUND_INVITATION_TYPE != BG_QUEUE_INVITATION_TYPE_NO_BALANCE, do not allow to join too many players of one faction
1204 uint32 thisTeamInvitedCount = teamId == TEAM_ALLIANCE ? GetInvitedCount(TEAM_ALLIANCE) : GetInvitedCount(TEAM_HORDE);
1206 uint32 otherTeamInvitedCount = teamId == TEAM_ALLIANCE ? GetInvitedCount(TEAM_HORDE) : GetInvitedCount(TEAM_ALLIANCE);
1208
1209 // difference based on ppl invited (not necessarily entered battle)
1210 // default: allow 0
1211 uint32 diff = 0;
1212 uint32 maxPlayersPerTeam = GetMaxPlayersPerTeam();
1213 uint32 minPlayersPerTeam = GetMinPlayersPerTeam();
1214
1215 // allow join one person if the sides are equal (to fill up bg to minPlayerPerTeam)
1216 if (otherTeamInvitedCount == thisTeamInvitedCount)
1217 diff = 1;
1218 else if (otherTeamInvitedCount > thisTeamInvitedCount) // allow join more ppl if the other side has more players
1219 diff = otherTeamInvitedCount - thisTeamInvitedCount;
1220
1221 // difference based on max players per team (don't allow inviting more)
1222 uint32 diff2 = (thisTeamInvitedCount < maxPlayersPerTeam) ? maxPlayersPerTeam - thisTeamInvitedCount : 0;
1223
1224 // difference based on players who already entered
1225 // default: allow 0
1226 uint32 diff3 = 0;
1227
1228 // allow join one person if the sides are equal (to fill up bg minPlayerPerTeam)
1229 if (otherTeamPlayersCount == thisTeamPlayersCount)
1230 diff3 = 1;
1231 else if (otherTeamPlayersCount > thisTeamPlayersCount) // allow join more ppl if the other side has more players
1232 diff3 = otherTeamPlayersCount - thisTeamPlayersCount;
1233 else if (thisTeamInvitedCount <= minPlayersPerTeam) // or other side has less than minPlayersPerTeam
1234 diff3 = minPlayersPerTeam - thisTeamInvitedCount + 1;
1235
1236 // return the minimum of the 3 differences
1237 // min of diff, diff2 and diff3
1238 return std::min({ diff, diff2, diff3 });
1239}
@ BG_QUEUE_INVITATION_TYPE_NO_BALANCE
Definition: Battleground.h:287
@ CONFIG_BATTLEGROUND_INVITATION_TYPE
Definition: IWorld.h:312
uint32 GetMinPlayersPerTeam() const
Definition: Battleground.h:332
uint32 GetMaxPlayersPerTeam() const
Definition: Battleground.h:331
uint32 GetInvitedCount(TeamId teamId) const
Definition: Battleground.h:372
uint32 GetPlayersCountByTeam(TeamId teamId) const
Definition: Battleground.h:479

References BG_QUEUE_INVITATION_TYPE_NO_BALANCE, CONFIG_BATTLEGROUND_INVITATION_TYPE, GetInvitedCount(), GetMaxPlayersPerTeam(), GetMinPlayersPerTeam(), GetPlayersCountByTeam(), GetStatus(), STATUS_IN_PROGRESS, STATUS_WAIT_JOIN, sWorld, TEAM_ALLIANCE, and TEAM_HORDE.

Referenced by BattlegroundQueue::FillPlayersToBG(), GetMaxFreeSlots(), and HasFreeSlots().

◆ GetInstanceID()

◆ GetInvitedCount()

uint32 Battleground::GetInvitedCount ( TeamId  teamId) const
inline
372{ return m_BgInvitedPlayers[teamId]; }

References m_BgInvitedPlayers.

Referenced by GetFreeSlotsForTeam(), and Update().

◆ GetLastResurrectTime()

uint32 Battleground::GetLastResurrectTime ( ) const
inline

◆ GetMapId()

◆ GetMaxFreeSlots()

uint32 Battleground::GetMaxFreeSlots ( ) const
1242{
1244}
uint32 GetFreeSlotsForTeam(TeamId teamId) const
Definition: Battleground.cpp:1194

References GetFreeSlotsForTeam(), TEAM_ALLIANCE, and TEAM_HORDE.

◆ GetMaxLevel()

◆ GetMaxPlayersPerTeam()

uint32 Battleground::GetMaxPlayersPerTeam ( ) const
inline

◆ GetMinLevel()

uint32 Battleground::GetMinLevel ( ) const
inline

◆ GetMinPlayersPerTeam()

◆ GetName()

std::string Battleground::GetName ( ) const
inline

◆ GetObjectType()

int32 Battleground::GetObjectType ( ObjectGuid  guid)
1817{
1818 for (uint32 i = 0; i < BgObjects.size(); ++i)
1819 if (BgObjects[i] == guid)
1820 return i;
1821
1822 LOG_ERROR("bg.battleground", "Battleground::GetObjectType: player used gameobject ({}) which is not in internal data for BG (map: {}, instance id: {}), cheating?",
1823 guid.ToString(), m_MapId, m_InstanceID);
1824
1825 return -1;
1826}
std::string ToString() const
Definition: ObjectGuid.cpp:47

References BgObjects, LOG_ERROR, m_InstanceID, m_MapId, and ObjectGuid::ToString().

Referenced by BattlegroundAV::EventPlayerClickedOnFlag().

◆ GetOtherTeamId()

◆ GetPlayers()

◆ GetPlayerScores()

BattlegroundScoreMap const * Battleground::GetPlayerScores ( ) const
inline
402{ return &PlayerScores; }

References PlayerScores.

Referenced by BuildPvPLogDataPacket().

◆ GetPlayerScoresSize()

std::size_t Battleground::GetPlayerScoresSize ( ) const
inline
403{ return PlayerScores.size(); }

References PlayerScores.

◆ GetPlayersCountByTeam()

uint32 Battleground::GetPlayersCountByTeam ( TeamId  teamId) const
inline

◆ GetPlayersSize()

uint32 Battleground::GetPlayersSize ( ) const
inline
394{ return m_Players.size(); }

References m_Players.

Referenced by HandleTriggerBuff(), and Update().

◆ GetPrematureWinner()

◆ GetRealRepFactionForPlayer()

uint32 Battleground::GetRealRepFactionForPlayer ( uint32  factionId,
Player player 
)
743{
744 if (player)
745 {
746 // if the bg team is not the original team, reverse reputation
747 if (player->GetBgTeamId() != player->GetTeamId(true))
748 {
749 switch (factionId)
750 {
752 return BG_REP_AB_HORDE;
753 case BG_REP_AB_HORDE:
754 return BG_REP_AB_ALLIANCE;
756 return BG_REP_AV_HORDE;
757 case BG_REP_AV_HORDE:
758 return BG_REP_AV_ALLIANCE;
760 return BG_REP_WS_HORDE;
761 case BG_REP_WS_HORDE:
762 return BG_REP_WS_ALLIANCE;
763 }
764 }
765 }
766
767 return factionId;
768}
@ BG_REP_AV_HORDE
Definition: Battleground.h:147
@ BG_REP_AB_HORDE
Definition: Battleground.h:149
@ BG_REP_WS_HORDE
Definition: Battleground.h:151
@ BG_REP_WS_ALLIANCE
Definition: Battleground.h:152
@ BG_REP_AV_ALLIANCE
Definition: Battleground.h:148
@ BG_REP_AB_ALLIANCE
Definition: Battleground.h:150
TeamId GetTeamId(bool original=false) const
Definition: Player.h:2059

References BG_REP_AB_ALLIANCE, BG_REP_AB_HORDE, BG_REP_AV_ALLIANCE, BG_REP_AV_HORDE, BG_REP_WS_ALLIANCE, BG_REP_WS_HORDE, Player::GetBgTeamId(), and Player::GetTeamId().

Referenced by RewardReputationToTeam().

◆ GetReviveQueueSize()

uint32 Battleground::GetReviveQueueSize ( ) const
inline
405{ return m_ReviveQueue.size(); }

References m_ReviveQueue.

Referenced by _ProcessResurrect().

◆ GetScriptId()

uint32 Battleground::GetScriptId ( ) const
inline
337{ return ScriptId; }

References ScriptId.

◆ GetSpectators()

const SpectatorList & Battleground::GetSpectators ( ) const
inline
383{ return m_Spectators; }

References m_Spectators.

◆ GetStartDelayTime()

int32 Battleground::GetStartDelayTime ( ) const
inline

◆ GetStartMaxDist()

float Battleground::GetStartMaxDist ( ) const
inline
431{ return m_StartMaxDist; }

References m_StartMaxDist.

Referenced by _CheckSafePositions().

◆ GetStartTime()

◆ GetStatus()

BattlegroundStatus Battleground::GetStatus ( ) const
inline
322{ return m_Status; }

References m_Status.

Referenced by _ProcessJoin(), AddPlayer(), BattlegroundQueue::BattlegroundQueueUpdate(), BuildPvPLogDataPacket(), BattlegroundWS::CheckFlagKeeperInArea(), MapInstanced::CreateInstanceForPlayer(), EndBattleground(), Arena::EndBattleground(), BattlegroundAV::EventPlayerAssaultsPoint(), BattlegroundWS::EventPlayerCapturedFlag(), BattlegroundEY::EventPlayerClickedOnFlag(), BattlegroundWS::EventPlayerClickedOnFlag(), BattlegroundIC::EventPlayerClickedOnFlag(), BattlegroundAB::EventPlayerClickedOnFlag(), BattlegroundAV::EventPlayerClickedOnFlag(), BattlegroundAV::EventPlayerDefendsPoint(), BattlegroundEY::EventPlayerDroppedFlag(), BattlegroundWS::EventPlayerDroppedFlag(), BGQueueRemoveEvent::Execute(), BattlegroundAV::FillInitialWorldStates(), BattlegroundWS::FillInitialWorldStates(), BattlegroundWS::GetClosestGraveyard(), GetFreeSlotsForTeam(), BattlegroundAB::HandleAreaTrigger(), BattlegroundAV::HandleAreaTrigger(), BattlegroundBE::HandleAreaTrigger(), BattlegroundDS::HandleAreaTrigger(), BattlegroundEY::HandleAreaTrigger(), BattlegroundIC::HandleAreaTrigger(), BattlegroundNA::HandleAreaTrigger(), BattlegroundRL::HandleAreaTrigger(), BattlegroundRV::HandleAreaTrigger(), BattlegroundSA::HandleAreaTrigger(), BattlegroundWS::HandleAreaTrigger(), WorldSession::HandleBattleFieldPortOpcode(), Arena::HandleKillPlayer(), BattlegroundAV::HandleKillPlayer(), BattlegroundEY::HandleKillPlayer(), BattlegroundIC::HandleKillPlayer(), BattlegroundWS::HandleKillPlayer(), BattlegroundAV::HandleKillUnit(), BattlegroundIC::HandleKillUnit(), BattlegroundAV::HandleQuestComplete(), ArenaSpectator::HandleResetCommand(), ArenaSpectator::HandleSpectatorSpectateCommand(), ArenaSpectator::HandleSpectatorWatchCommand(), HandleTriggerBuff(), HasFreeSlots(), Player::LeaveBattleground(), Player::NeedSendSpectatorData(), PlayerAddedToBGCheckIfBGIsRunning(), BattlegroundAB::PostUpdateImpl(), BattlegroundAV::PostUpdateImpl(), BattlegroundDS::PostUpdateImpl(), BattlegroundEY::PostUpdateImpl(), BattlegroundIC::PostUpdateImpl(), BattlegroundRV::PostUpdateImpl(), BattlegroundSA::PostUpdateImpl(), BattlegroundWS::PostUpdateImpl(), ReadyMarkerClicked(), Arena::RemovePlayer(), RemovePlayerAtLeave(), Arena::RemovePlayerAtLeave(), Player::ReportedAfkBy(), BattlegroundWS::RespawnFlagAfterDrop(), and Update().

◆ GetTeamScore()

uint32 Battleground::GetTeamScore ( TeamId  teamId) const

◆ GetTeamStartPosition()

Position const * Battleground::GetTeamStartPosition ( TeamId  teamId) const
655{
656 ASSERT(teamId < TEAM_NEUTRAL);
657 return &_startPosition[teamId];
658}
std::array< Position, PVP_TEAMS_COUNT > _startPosition
Definition: Battleground.h:725

References _startPosition, ASSERT, and TEAM_NEUTRAL.

Referenced by _CheckSafePositions().

◆ GetUniqueBracketId()

uint8 Battleground::GetUniqueBracketId ( ) const
1871{
1872 return GetMaxLevel() / 10;
1873}

References GetMaxLevel().

Referenced by EndBattleground().

◆ GetWinner()

PvPTeamId Battleground::GetWinner ( ) const
inline

◆ HandleAreaTrigger()

virtual void Battleground::HandleAreaTrigger ( Player ,
uint32   
)
inlinevirtual

◆ HandleKillPlayer()

void Battleground::HandleKillPlayer ( Player player,
Player killer 
)
virtual

Reimplemented in Arena, BattlegroundAV, BattlegroundEY, BattlegroundIC, and BattlegroundWS.

1739{
1740 // Keep in mind that for arena this will have to be changed a bit
1741
1742 // Add +1 deaths
1743 UpdatePlayerScore(victim, SCORE_DEATHS, 1);
1744 // Add +1 kills to group and +1 killing_blows to killer
1745 if (killer)
1746 {
1747 // Don't reward credit for killing ourselves, like fall damage of hellfire (warlock)
1748 if (killer == victim)
1749 return;
1750
1753
1754 for (BattlegroundPlayerMap::const_iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr)
1755 {
1756 Player* creditedPlayer = itr->second;
1757 if (creditedPlayer == killer)
1758 continue;
1759
1760 if (creditedPlayer->GetBgTeamId() == killer->GetBgTeamId() && (creditedPlayer == killer || creditedPlayer->IsAtGroupRewardDistance(victim)))
1761 UpdatePlayerScore(creditedPlayer, SCORE_HONORABLE_KILLS, 1);
1762 }
1763 }
1764
1765 if (!isArena())
1766 {
1767 // To be able to remove insignia -- ONLY IN Battlegrounds
1768 victim->SetUnitFlag(UNIT_FLAG_SKINNABLE);
1769 RewardXPAtKill(killer, victim);
1770 }
1771}
@ SCORE_KILLING_BLOWS
Definition: BattlegroundScore.h:29
@ SCORE_DEATHS
Definition: BattlegroundScore.h:30
@ SCORE_HONORABLE_KILLS
Definition: BattlegroundScore.h:31
@ UNIT_FLAG_SKINNABLE
Definition: Unit.h:474
void RewardXPAtKill(Player *killer, Player *victim)
Definition: Battleground.cpp:1864
bool IsAtGroupRewardDistance(WorldObject const *pRewardSource) const
Definition: Player.cpp:12655

References Player::GetBgTeamId(), isArena(), Player::IsAtGroupRewardDistance(), m_Players, RewardXPAtKill(), SCORE_DEATHS, SCORE_HONORABLE_KILLS, SCORE_KILLING_BLOWS, Unit::SetUnitFlag(), UNIT_FLAG_SKINNABLE, and UpdatePlayerScore().

Referenced by Arena::HandleKillPlayer(), BattlegroundAV::HandleKillPlayer(), BattlegroundEY::HandleKillPlayer(), BattlegroundIC::HandleKillPlayer(), and BattlegroundWS::HandleKillPlayer().

◆ HandleKillUnit()

virtual void Battleground::HandleKillUnit ( Creature ,
Player  
)
inlinevirtual

Reimplemented in BattlegroundSA, BattlegroundAV, and BattlegroundIC.

502{ }

◆ HandlePlayerResurrect()

virtual void Battleground::HandlePlayerResurrect ( Player )
inlinevirtual

Reimplemented in BattlegroundIC.

513{}

◆ HandlePlayerUnderMap()

virtual bool Battleground::HandlePlayerUnderMap ( Player )
inlinevirtual

◆ HandleTriggerBuff()

void Battleground::HandleTriggerBuff ( GameObject gameObject)
1689{
1690 // Xinef: crash fix?
1691 if (GetStatus() != STATUS_IN_PROGRESS || !GetPlayersSize() || BgObjects.empty())
1692 return;
1693
1694 uint32 index = 0;
1695 for (; index < BgObjects.size() && BgObjects[index] != gameObject->GetGUID(); ++index);
1696 if (BgObjects[index] != gameObject->GetGUID())
1697 {
1698 return;
1699 }
1700
1701 if (m_BuffChange)
1702 {
1703 uint8 buff = urand(0, 2);
1704 if (gameObject->GetEntry() != Buff_Entries[buff])
1705 {
1707 for (uint8 currBuffTypeIndex = 0; currBuffTypeIndex < 3; ++currBuffTypeIndex)
1708 if (gameObject->GetEntry() == Buff_Entries[currBuffTypeIndex])
1709 {
1710 index -= currBuffTypeIndex;
1711 index += buff;
1712 }
1713 }
1714 }
1715
1716 uint32 respawnTime = SPEED_BUFF_RESPAWN_TIME;
1717 if (Map* map = FindBgMap())
1718 {
1719 if (GameObject* obj = map->GetGameObject(BgObjects[index]))
1720 {
1721 switch (obj->GetEntry())
1722 {
1724 respawnTime = RESTORATION_BUFF_RESPAWN_TIME;
1725 break;
1727 respawnTime = BERSERKING_BUFF_RESPAWN_TIME;
1728 break;
1729 default:
1730 break;
1731 }
1732 }
1733 }
1734
1735 SpawnBGObject(index, respawnTime);
1736}
uint32 urand(uint32 min, uint32 max)
Definition: Random.cpp:44
@ RESPAWN_ONE_DAY
Definition: Battleground.h:163
const uint32 Buff_Entries[3]
Definition: Battleground.h:190
#define SPEED_BUFF_RESPAWN_TIME
Definition: Battleground.h:170
@ BG_OBJECTID_REGENBUFF_ENTRY
Definition: Battleground.h:186
@ BG_OBJECTID_BERSERKERBUFF_ENTRY
Definition: Battleground.h:187
#define RESTORATION_BUFF_RESPAWN_TIME
Definition: Battleground.h:168
#define BERSERKING_BUFF_RESPAWN_TIME
Definition: Battleground.h:169
void SpawnBGObject(uint32 type, uint32 respawntime, uint32 forceRespawnDelay=0)
Definition: Battleground.cpp:1471
uint32 GetPlayersSize() const
Definition: Battleground.h:394
uint32 GetEntry() const
Definition: Object.h:109

References BERSERKING_BUFF_RESPAWN_TIME, BG_OBJECTID_BERSERKERBUFF_ENTRY, BG_OBJECTID_REGENBUFF_ENTRY, BgObjects, Buff_Entries, FindBgMap(), Object::GetEntry(), Object::GetGUID(), GetPlayersSize(), GetStatus(), m_BuffChange, RESPAWN_ONE_DAY, RESTORATION_BUFF_RESPAWN_TIME, SpawnBGObject(), SPEED_BUFF_RESPAWN_TIME, STATUS_IN_PROGRESS, and urand().

◆ HasFreeSlots()

bool Battleground::HasFreeSlots ( ) const
1247{
1249 return false;
1250 for (uint8 i = 0; i < PVP_TEAMS_COUNT; ++i)
1251 if (GetFreeSlotsForTeam((TeamId)i) > 0)
1252 return true;
1253 return false;
1254}

References GetFreeSlotsForTeam(), GetStatus(), PVP_TEAMS_COUNT, STATUS_IN_PROGRESS, and STATUS_WAIT_JOIN.

Referenced by BattlegroundQueue::BattlegroundQueueUpdate().

◆ HaveSpectators()

bool Battleground::HaveSpectators ( )
inline
382{ return !m_Spectators.empty(); }

References m_Spectators.

Referenced by Player::NeedSendSpectatorData().

◆ IncreaseInvitedCount()

void Battleground::IncreaseInvitedCount ( TeamId  teamId)
inline
371{ ++m_BgInvitedPlayers[teamId]; }

References m_BgInvitedPlayers.

Referenced by BattlegroundQueue::InviteGroupToBG().

◆ Init()

void Battleground::Init ( )
virtual

Reimplemented in BattlegroundAB, BattlegroundEY, BattlegroundRV, BattlegroundSA, and BattlegroundWS.

1029{
1032 SetStartTime(0);
1033 SetEndTime(0);
1035
1036 m_Events = 0;
1037
1039 {
1040 LOG_ERROR("bg.battleground", "Battleground::Reset: one of the counters is not 0 (alliance: {}, horde: {}) for BG (map: {}, instance id: {})!", m_BgInvitedPlayers[TEAM_ALLIANCE], m_BgInvitedPlayers[TEAM_HORDE], m_MapId, m_InstanceID);
1041 ABORT();
1042 }
1043
1046 _InBGFreeSlotQueue = false;
1047
1048 m_Players.clear();
1049
1050 for (auto const& itr : PlayerScores)
1051 delete itr.second;
1052
1053 PlayerScores.clear();
1054
1055 for (auto& itr : _arenaTeamScores)
1056 itr.Reset();
1057
1059}
#define ABORT
Definition: Errors.h:76
@ STATUS_WAIT_QUEUE
Definition: Battleground.h:195
virtual void ResetBGSubclass()
Definition: Battleground.h:308
void SetStartTime(uint32 Time)
Definition: Battleground.h:350
void SetLastResurrectTime(uint32 Time)
Definition: Battleground.h:352

References _arenaTeamScores, _InBGFreeSlotQueue, ABORT, LOG_ERROR, m_BgInvitedPlayers, m_Events, m_InstanceID, m_MapId, m_Players, PlayerScores, PVP_TEAM_NEUTRAL, ResetBGSubclass(), SetEndTime(), SetLastResurrectTime(), SetStartTime(), SetStatus(), SetWinner(), STATUS_WAIT_QUEUE, TEAM_ALLIANCE, and TEAM_HORDE.

Referenced by BattlegroundMgr::CreateNewBattleground(), BattlegroundAB::Init(), BattlegroundEY::Init(), BattlegroundRV::Init(), BattlegroundSA::Init(), and BattlegroundWS::Init().

◆ isArena()

◆ isBattleground()

◆ IsPlayerInBattleground()

bool Battleground::IsPlayerInBattleground ( ObjectGuid  guid) const
1779{
1780 BattlegroundPlayerMap::const_iterator itr = m_Players.find(guid);
1781 if (itr != m_Players.end())
1782 return true;
1783 return false;
1784}

References m_Players.

Referenced by ArenaSpectator::HandleSpectatorWatchCommand().

◆ IsRandom()

bool Battleground::IsRandom ( )
inline
340{ return m_IsRandom; }

References m_IsRandom.

Referenced by EndBattleground().

◆ isRated()

◆ ModifyStartDelayTime()

void Battleground::ModifyStartDelayTime ( int32  diff)
inline
361{ m_StartDelayTime -= diff; }

References m_StartDelayTime.

Referenced by _ProcessJoin().

◆ PlayerAddedToBGCheckIfBGIsRunning()

void Battleground::PlayerAddedToBGCheckIfBGIsRunning ( Player player)
protected
1787{
1789 return;
1790
1791 WorldPacket data;
1792 BlockMovement(player);
1793
1795 player->GetSession()->SendPacket(&data);
1796
1797 sBattlegroundMgr->BuildBattlegroundStatusPacket(&data, this, player->GetCurrentBattlegroundQueueSlot(), STATUS_IN_PROGRESS, GetEndTime(), GetStartTime(), GetArenaType(), player->GetBgTeamId());
1798 player->GetSession()->SendPacket(&data);
1799}
uint32 GetEndTime() const
Definition: Battleground.h:325
uint32 GetCurrentBattlegroundQueueSlot() const
Definition: Player.h:2205
WorldSession * GetSession() const
Definition: Player.h:1948
void SendPacket(WorldPacket const *packet)
Send a packet to the client.
Definition: WorldSession.cpp:207

References BlockMovement(), BuildPvPLogDataPacket(), GetArenaType(), Player::GetBgTeamId(), Player::GetCurrentBattlegroundQueueSlot(), GetEndTime(), Player::GetSession(), GetStartTime(), GetStatus(), sBattlegroundMgr, WorldSession::SendPacket(), STATUS_IN_PROGRESS, and STATUS_WAIT_LEAVE.

Referenced by AddPlayer().

◆ PlaySoundToAll()

◆ PostUpdateImpl()

virtual void Battleground::PostUpdateImpl ( uint32  )
inlineprivatevirtual

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().

Reimplemented in BattlegroundAB, BattlegroundAV, BattlegroundDS, BattlegroundEY, BattlegroundIC, BattlegroundRV, BattlegroundSA, and BattlegroundWS.

691{ }

Referenced by Update().

◆ PreUpdateImpl()

virtual bool Battleground::PreUpdateImpl ( uint32  )
inlineprivatevirtual

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().
678{ return true; }

Referenced by Update().

◆ PSendMessageToAll()

void Battleground::PSendMessageToAll ( uint32  entry,
ChatMsg  type,
Player const *  source,
  ... 
)
1628{
1629 if (!entry)
1630 return;
1631
1632 va_list ap;
1633 va_start(ap, source);
1634
1635 Acore::BattlegroundChatBuilder bg_builder(type, entry, source, &ap);
1637 BroadcastWorker(bg_do);
1638
1639 va_end(ap);
1640}
Definition: Battleground.cpp:54
void BroadcastWorker(Do &_do)
Definition: Battleground.cpp:118
Definition: GridNotifiers.h:1703

References BroadcastWorker().

Referenced by _ProcessProgress().

◆ ReadyMarkerClicked()

void Battleground::ReadyMarkerClicked ( Player p)
1263{
1265 return;
1266 readyMarkerClickedSet.insert(p->GetGUID());
1267 uint32 count = readyMarkerClickedSet.size();
1269 p->GetSession()->SendNotification("You are marked as ready %u/%u", count, req);
1270 if (count == req)
1271 {
1275 }
1276}
@ BG_START_DELAY_15S
Definition: Battleground.h:177
static uint8 GetReqPlayersForType(uint32 type)
Definition: ArenaTeam.cpp:1011
GuidSet readyMarkerClickedSet
Definition: Battleground.h:397
bool IsSpectator() const
Definition: Player.h:2523
void SendNotification(const char *format,...) ATTR_PRINTF(2
Definition: WorldSession.cpp:787

References BG_START_DELAY_15S, BG_STARTING_EVENT_2, BG_STARTING_EVENT_3, GetArenaType(), Object::GetGUID(), ArenaTeam::GetReqPlayersForType(), Player::GetSession(), GetStartDelayTime(), GetStatus(), isArena(), Player::IsSpectator(), m_Events, m_StartTime, readyMarkerClickedSet, WorldSession::SendNotification(), SetStartDelayTime(), and STATUS_IN_PROGRESS.

◆ RelocateDeadPlayers()

void Battleground::RelocateDeadPlayers ( ObjectGuid  queueIndex)

Relocate all players in ReviveQueue to the closest graveyard.

1346{
1347 // Those who are waiting to resurrect at this node are taken to the closest own node's graveyard
1348 GuidVector& ghostList = m_ReviveQueue[queueIndex];
1349 if (!ghostList.empty())
1350 {
1351 GraveyardStruct const* closestGrave = nullptr;
1352 for (ObjectGuid const& guid : ghostList)
1353 {
1354 Player* player = ObjectAccessor::FindPlayer(guid);
1355 if (!player)
1356 continue;
1357
1358 if (!closestGrave)
1359 closestGrave = GetClosestGraveyard(player);
1360
1361 if (closestGrave)
1362 player->TeleportTo(GetMapId(), closestGrave->x, closestGrave->y, closestGrave->z, player->GetOrientation());
1363 }
1364
1365 ghostList.clear();
1366 }
1367}
std::vector< ObjectGuid > GuidVector
Definition: ObjectGuid.h:258
virtual GraveyardStruct const * GetClosestGraveyard(Player *player)
Definition: Battleground.cpp:1838
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
Definition: GameGraveyard.h:28
float z
Definition: GameGraveyard.h:33
float x
Definition: GameGraveyard.h:31
float y
Definition: GameGraveyard.h:32

References ObjectAccessor::FindPlayer(), GetClosestGraveyard(), GetMapId(), Position::GetOrientation(), m_ReviveQueue, Player::TeleportTo(), GraveyardStruct::x, GraveyardStruct::y, and GraveyardStruct::z.

Referenced by BattlegroundAV::EventPlayerAssaultsPoint(), BattlegroundIC::EventPlayerClickedOnFlag(), BattlegroundEY::EventTeamLostPoint(), and BattlegroundAB::NodeDeoccupied().

◆ RemoveAuraOnTeam()

void Battleground::RemoveAuraOnTeam ( uint32  spellId,
TeamId  teamId 
)
704{
705 for (BattlegroundPlayerMap::const_iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr)
706 if (itr->second->GetBgTeamId() == teamId)
707 itr->second->RemoveAura(spellId);
708}

References m_Players.

Referenced by BattlegroundIC::HandleCapturedNodes().

◆ RemoveFromBGFreeSlotQueue()

void Battleground::RemoveFromBGFreeSlotQueue ( )

◆ RemovePlayer()

virtual void Battleground::RemovePlayer ( Player )
inlineprotectedvirtual

◆ RemovePlayerAtLeave()

void Battleground::RemovePlayerAtLeave ( Player player)
virtual

Reimplemented in Arena.

935{
936 TeamId teamId = player->GetBgTeamId();
937
938 // check if the player was a participant of the match, or only entered through gm command
939 bool participant = false;
940 BattlegroundPlayerMap::iterator itr = m_Players.find(player->GetGUID());
941 if (itr != m_Players.end())
942 {
943 UpdatePlayersCountByTeam(teamId, true); // -1 player
944 m_Players.erase(itr);
945 participant = true;
946 }
947
948 // delete player score if exists
949 auto const& itr2 = PlayerScores.find(player->GetGUID().GetCounter());
950 if (itr2 != PlayerScores.end())
951 {
952 delete itr2->second;
953 PlayerScores.erase(itr2);
954 }
955
957
958 // resurrect on exit
959 if (!player->IsAlive())
960 {
961 player->ResurrectPlayer(1.0f);
962 player->SpawnCorpseBones();
963 }
964
966
967 // GetStatus might be changed in RemovePlayer - define it here
968 BattlegroundStatus status = GetStatus();
969
970 // BG subclass specific code
971 RemovePlayer(player);
972
973 // if the player was a match participant
974 if (participant)
975 {
976 player->ClearAfkReports();
977
978 WorldPacket data;
979 sBattlegroundMgr->BuildBattlegroundStatusPacket(&data, this, player->GetCurrentBattlegroundQueueSlot(), STATUS_NONE, 0, 0, 0, TEAM_NEUTRAL);
980 player->GetSession()->SendPacket(&data);
981
983
984 // this call is important, because player, when joins to battleground, this method is not called, so it must be called when leaving bg
985 player->RemoveBattlegroundQueueId(bgQueueTypeId);
986
987 // remove from raid group if player is member
988 if (Group* group = GetBgRaid(teamId))
989 if (group->IsMember(player->GetGUID()))
990 if (!group->RemoveMember(player->GetGUID())) // group was disbanded
991 SetBgRaid(teamId, nullptr);
992
993 // let others know
994 sBattlegroundMgr->BuildPlayerLeftBattlegroundPacket(&data, player->GetGUID());
995 SendPacketToTeam(teamId, &data, player, false);
996
997 // cast deserter
998 if (isBattleground() && !player->IsGameMaster() && sWorld->getBoolConfig(CONFIG_BATTLEGROUND_CAST_DESERTER))
999 if (status == STATUS_IN_PROGRESS || status == STATUS_WAIT_JOIN)
1001
1002 DecreaseInvitedCount(teamId);
1003
1004 //we should update battleground queue, but only if bg isn't ending
1006 {
1007 BattlegroundTypeId bgTypeId = GetBgTypeID();
1009
1010 // a player has left the battleground, so there are free slots -> add to queue
1012 sBattlegroundMgr->ScheduleQueueUpdate(0, 0, bgQueueTypeId, bgTypeId, GetBracketId());
1013 }
1014 }
1015
1016 // Remove shapeshift auras
1018
1020
1021 // Xinef: remove all criterias on bg leave
1023
1024 sScriptMgr->OnBattlegroundRemovePlayerAtLeave(this, player);
1025}
BattlegroundStatus
Definition: Battleground.h:193
@ DELAYED_SPELL_CAST_DESERTER
Definition: Player.h:897
@ CONFIG_BATTLEGROUND_CAST_DESERTER
Definition: IWorld.h:115
BattlegroundTypeId
Definition: SharedDefines.h:3451
BattlegroundQueueTypeId
Definition: SharedDefines.h:3591
#define PLAYER_MAX_BATTLEGROUND_QUEUES
Definition: SharedDefines.h:148
void DecreaseInvitedCount(TeamId teamId)
Definition: Battleground.h:370
void RemovePlayerFromResurrectQueue(Player *player)
Definition: Battleground.cpp:1333
void AddToBGFreeSlotQueue()
Definition: Battleground.cpp:1175
virtual void RemovePlayer(Player *)
Definition: Battleground.h:613
BattlegroundBracketId GetBracketId() const
Definition: Battleground.h:320
static BattlegroundQueueTypeId BGQueueTypeId(BattlegroundTypeId bgTypeId, uint8 arenaType)
Definition: BattlegroundMgr.cpp:671
LowType GetCounter() const
Definition: ObjectGuid.h:147
void ScheduleDelayedOperation(uint32 operation)
Definition: Player.h:2050
void ClearAfkReports()
Definition: Player.h:2233
void SetBattlegroundId(uint32 id, BattlegroundTypeId bgTypeId, uint32 queueSlot, bool invited, bool isRandom, TeamId teamId)
Definition: Player.cpp:12207
void RemoveBattlegroundQueueId(BattlegroundQueueTypeId val)
Definition: Player.cpp:12169
bool IsGameMaster() const
Definition: Player.h:1136
bool IsAlive() const
Definition: Unit.h:1808

References ACHIEVEMENT_CRITERIA_CONDITION_BG_MAP, AddToBGFreeSlotQueue(), BATTLEGROUND_TYPE_NONE, BattlegroundMgr::BGQueueTypeId(), Player::ClearAfkReports(), CONFIG_BATTLEGROUND_CAST_DESERTER, DecreaseInvitedCount(), DELAYED_SPELL_CAST_DESERTER, GetArenaType(), GetBgRaid(), Player::GetBgTeamId(), GetBgTypeID(), GetBracketId(), ObjectGuid::GetCounter(), Player::GetCurrentBattlegroundQueueSlot(), Object::GetGUID(), GetMapId(), Player::GetSession(), GetStatus(), Unit::IsAlive(), isBattleground(), Player::IsGameMaster(), m_Players, PLAYER_MAX_BATTLEGROUND_QUEUES, PlayerScores, Unit::RemoveAurasByType(), Player::RemoveBattlegroundQueueId(), RemovePlayer(), RemovePlayerFromResurrectQueue(), Player::ResetAchievementCriteria(), Player::ResurrectPlayer(), sBattlegroundMgr, Player::ScheduleDelayedOperation(), WorldSession::SendPacket(), SendPacketToTeam(), Player::SetBattlegroundId(), SetBgRaid(), Player::SpawnCorpseBones(), SPELL_AURA_MOD_SHAPESHIFT, SPELL_AURA_MOUNTED, sScriptMgr, STATUS_IN_PROGRESS, STATUS_NONE, STATUS_WAIT_JOIN, STATUS_WAIT_LEAVE, sWorld, TEAM_NEUTRAL, and UpdatePlayersCountByTeam().

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

◆ RemovePlayerFromResurrectQueue()

void Battleground::RemovePlayerFromResurrectQueue ( Player player)
1334{
1335 for (std::map<ObjectGuid, GuidVector>::iterator itr = m_ReviveQueue.begin(); itr != m_ReviveQueue.end(); ++itr)
1336 for (GuidVector::iterator itr2 = itr->second.begin(); itr2 != itr->second.end(); ++itr2)
1337 if (*itr2 == player->GetGUID())
1338 {
1339 itr->second.erase(itr2);
1341 return;
1342 }
1343}
void RemoveAurasDueToSpell(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, uint8 reqEffMask=0, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition: Unit.cpp:4835

References Object::GetGUID(), m_ReviveQueue, Unit::RemoveAurasDueToSpell(), and SPELL_WAITING_FOR_RESURRECT.

Referenced by RemovePlayerAtLeave().

◆ RemoveSpectator()

void Battleground::RemoveSpectator ( Player p)
inline
381{ m_Spectators.erase(p); }

References m_Spectators.

◆ RemoveToBeTeleported()

void Battleground::RemoveToBeTeleported ( ObjectGuid  spectator)
inline
385{ ToBeTeleportedMap::iterator itr = m_ToBeTeleported.find(spectator); if (itr != m_ToBeTeleported.end()) m_ToBeTeleported.erase(itr); }

References m_ToBeTeleported.

◆ ResetBGSubclass()

virtual void Battleground::ResetBGSubclass ( )
inlinevirtual

Reimplemented in BattlegroundAV.

308{ } // must be implemented in BG subclass

Referenced by Init().

◆ RewardHonorToTeam()

◆ RewardReputationToTeam()

void Battleground::RewardReputationToTeam ( uint32  factionId,
uint32  reputation,
TeamId  teamId 
)
728{
729 for (BattlegroundPlayerMap::const_iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr)
730 if (itr->second->GetBgTeamId() == teamId)
731 {
732 uint32 realFactionId = GetRealRepFactionForPlayer(factionId, itr->second);
733
734 float repGain = static_cast<float>(reputation);
735 AddPct(repGain, itr->second->GetTotalAuraModifier(SPELL_AURA_MOD_REPUTATION_GAIN));
736 AddPct(repGain, itr->second->GetTotalAuraModifierByMiscValue(SPELL_AURA_MOD_FACTION_REPUTATION_GAIN, realFactionId));
737 if (FactionEntry const* factionEntry = sFactionStore.LookupEntry(realFactionId))
738 itr->second->GetReputationMgr().ModifyReputation(factionEntry, repGain);
739 }
740}
T AddPct(T &base, U pct)
Definition: Util.h:67
DBCStorage< FactionEntry > sFactionStore(FactionEntryfmt)
@ SPELL_AURA_MOD_REPUTATION_GAIN
Definition: SpellAuraDefines.h:219
@ SPELL_AURA_MOD_FACTION_REPUTATION_GAIN
Definition: SpellAuraDefines.h:253
uint32 GetRealRepFactionForPlayer(uint32 factionId, Player *player)
Definition: Battleground.cpp:742
Definition: DBCStructure.h:898

References AddPct(), GetRealRepFactionForPlayer(), m_Players, sFactionStore, SPELL_AURA_MOD_FACTION_REPUTATION_GAIN, and SPELL_AURA_MOD_REPUTATION_GAIN.

Referenced by BattlegroundAV::EndBattleground(), BattlegroundWS::EventPlayerCapturedFlag(), BattlegroundAV::EventPlayerDestroyedPoint(), BattlegroundAV::HandleKillUnit(), BattlegroundAV::HandleQuestComplete(), and BattlegroundAB::PostUpdateImpl().

◆ RewardXPAtKill()

void Battleground::RewardXPAtKill ( Player killer,
Player victim 
)
1865{
1866 if (sWorld->getBoolConfig(CONFIG_BG_XP_FOR_KILL) && killer && victim)
1867 killer->RewardPlayerAndGroupAtKill(victim, true);
1868}
@ CONFIG_BG_XP_FOR_KILL
Definition: IWorld.h:121
void RewardPlayerAndGroupAtKill(Unit *victim, bool isBattleGround)
Definition: Player.cpp:12622

References CONFIG_BG_XP_FOR_KILL, Player::RewardPlayerAndGroupAtKill(), and sWorld.

Referenced by HandleKillPlayer().

◆ SendBroadcastText()

◆ SendChatMessage()

void Battleground::SendChatMessage ( Creature source,
uint8  textId,
WorldObject target = nullptr 
)
674{
675 sCreatureTextMgr->SendChat(source, textId, target);
676}
#define sCreatureTextMgr
Definition: CreatureTextMgr.h:119

References sCreatureTextMgr.

◆ SendMessage2ToAll()

void Battleground::SendMessage2ToAll ( uint32  entry,
ChatMsg  type,
Player const *  source,
uint32  strId1 = 0,
uint32  strId2 = 0 
)
1668{
1669 Acore::Battleground2ChatBuilder bg_builder(type, entry, source, arg1, arg2);
1671 BroadcastWorker(bg_do);
1672}
Definition: Battleground.cpp:91

References BroadcastWorker().

◆ SendMessageToAll()

void Battleground::SendMessageToAll ( uint32  entry,
ChatMsg  type,
Player const *  source = nullptr 
)
1618{
1619 if (!entry)
1620 return;
1621
1622 Acore::BattlegroundChatBuilder bg_builder(type, entry, source);
1624 BroadcastWorker(bg_do);
1625}

References BroadcastWorker().

Referenced by BattlegroundSA::EventPlayerUsedGO().

◆ SendPacketToAll()

void Battleground::SendPacketToAll ( WorldPacket const *  packet)
661{
662 for (BattlegroundPlayerMap::const_iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr)
663 itr->second->GetSession()->SendPacket(packet);
664}

References m_Players.

Referenced by PlaySoundToAll(), and UpdateWorldState().

◆ SendPacketToTeam()

void Battleground::SendPacketToTeam ( TeamId  teamId,
WorldPacket const *  packet,
Player sender = nullptr,
bool  self = true 
)
667{
668 for (BattlegroundPlayerMap::const_iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr)
669 if (itr->second->GetBgTeamId() == teamId && (self || sender != itr->second))
670 itr->second->GetSession()->SendPacket(packet);
671}

References m_Players.

Referenced by AddPlayer(), and RemovePlayerAtLeave().

◆ SendWarningToAll()

void Battleground::SendWarningToAll ( uint32  entry,
  ... 
)
1643{
1644 if (!entry)
1645 return;
1646
1647 std::map<uint32, WorldPacket> localizedPackets;
1648 for (BattlegroundPlayerMap::const_iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr)
1649 {
1650 if (localizedPackets.find(itr->second->GetSession()->GetSessionDbLocaleIndex()) == localizedPackets.end())
1651 {
1652 char const* format = sObjectMgr->GetAcoreString(entry, itr->second->GetSession()->GetSessionDbLocaleIndex());
1653
1654 char str[1024];
1655 va_list ap;
1656 va_start(ap, entry);
1657 vsnprintf(str, 1024, format, ap);
1658 va_end(ap);
1659
1660 ChatHandler::BuildChatPacket(localizedPackets[itr->second->GetSession()->GetSessionDbLocaleIndex()], CHAT_MSG_RAID_BOSS_EMOTE, LANG_UNIVERSAL, nullptr, nullptr, str);
1661 }
1662
1663 itr->second->SendDirectMessage(&localizedPackets[itr->second->GetSession()->GetSessionDbLocaleIndex()]);
1664 }
1665}
@ CHAT_MSG_RAID_BOSS_EMOTE
Definition: SharedDefines.h:3165
@ LANG_UNIVERSAL
Definition: SharedDefines.h:707
static size_t BuildChatPacket(WorldPacket &data, ChatMsg chatType, Language language, ObjectGuid senderGUID, ObjectGuid receiverGUID, std::string_view message, uint8 chatTag, std::string const &senderName="", std::string const &receiverName="", uint32 achievementId=0, bool gmMessage=false, std::string const &channelName="")
Definition: Chat.cpp:192

References ChatHandler::BuildChatPacket(), CHAT_MSG_RAID_BOSS_EMOTE, LANG_UNIVERSAL, m_Players, and sObjectMgr.

Referenced by BattlegroundSA::CaptureGraveyard(), BattlegroundSA::EventPlayerDamagedGO(), and BattlegroundSA::PostUpdateImpl().

◆ SetArenaMatchmakerRating()

void Battleground::SetArenaMatchmakerRating ( TeamId  teamId,
uint32  MMR 
)
inline

◆ SetArenaorBGType()

void Battleground::SetArenaorBGType ( bool  _isArena)
inline
356{ m_IsArena = _isArena; }

References m_IsArena.

Referenced by BattlegroundMgr::CreateBattleground().

◆ SetArenaTeamIdForTeam()

void Battleground::SetArenaTeamIdForTeam ( TeamId  teamId,
uint32  ArenaTeamId 
)
inline
492{ m_ArenaTeamIds[teamId] = ArenaTeamId; }

References m_ArenaTeamIds.

Referenced by BattlegroundQueue::InviteGroupToBG().

◆ SetArenaType()

void Battleground::SetArenaType ( uint8  type)
inline
355{ m_ArenaType = type; }

References m_ArenaType.

Referenced by BattlegroundMgr::CreateNewBattleground().

◆ SetBgMap()

void Battleground::SetBgMap ( BattlegroundMap map)
inline

◆ SetBgRaid()

void Battleground::SetBgRaid ( TeamId  teamId,
Group bg_raid 
)
1829{
1830 Group*& old_raid = m_BgRaids[teamId];
1831 if (old_raid)
1832 old_raid->SetBattlegroundGroup(nullptr);
1833 if (bg_raid)
1834 bg_raid->SetBattlegroundGroup(this);
1835 old_raid = bg_raid;
1836}
void SetBattlegroundGroup(Battleground *bg)
Definition: Group.cpp:2331

References m_BgRaids, and Group::SetBattlegroundGroup().

Referenced by AddOrSetPlayerToCorrectBgGroup(), RemovePlayerAtLeave(), and Group::~Group().

◆ SetBgTypeID()

void Battleground::SetBgTypeID ( BattlegroundTypeId  TypeID)
inline
344{ m_RealTypeID = TypeID; }
TypeID
Definition: ObjectGuid.h:33

References m_RealTypeID.

Referenced by BattlegroundMgr::CreateBattleground(), and BattlegroundMgr::CreateNewBattleground().

◆ SetBracket()

void Battleground::SetBracket ( PvPDifficultyEntry const *  bracketEntry)
1844{
1845 m_BracketId = bracketEntry->GetBracketId();
1846 SetLevelRange(bracketEntry->minLevel, bracketEntry->maxLevel);
1847}
void SetLevelRange(uint32 min, uint32 max)
Definition: Battleground.h:353

References PvPDifficultyEntry::GetBracketId(), m_BracketId, PvPDifficultyEntry::maxLevel, PvPDifficultyEntry::minLevel, and SetLevelRange().

Referenced by BattlegroundMgr::CreateNewBattleground().

◆ SetClientInstanceID()

void Battleground::SetClientInstanceID ( uint32  InstanceID)
inline
349{ m_ClientInstanceID = InstanceID; }

References m_ClientInstanceID.

Referenced by BattlegroundMgr::CreateNewBattleground().

◆ SetDroppedFlagGUID()

virtual void Battleground::SetDroppedFlagGUID ( ObjectGuid  ,
TeamId  = TEAM_NEUTRAL 
)
inlinevirtual

Reimplemented in BattlegroundWS, and BattlegroundEY.

558{}

◆ SetEndTime()

void Battleground::SetEndTime ( uint32  Time)
inline
351{ m_EndTime = Time; }

References m_EndTime.

Referenced by EndNow(), and Init().

◆ SetHoliday()

void Battleground::SetHoliday ( bool  is_holiday)
1812{
1813 m_HonorMode = is_holiday ? BG_HOLIDAY : BG_NORMAL;
1814}
@ BG_HOLIDAY
Definition: Battleground.h:269

References BG_HOLIDAY, BG_NORMAL, and m_HonorMode.

◆ SetInstanceID()

void Battleground::SetInstanceID ( uint32  InstanceID)
inline

◆ SetLastResurrectTime()

void Battleground::SetLastResurrectTime ( uint32  Time)
inline
352{ m_LastResurrectTime = Time; }

References m_LastResurrectTime.

Referenced by Init(), and StartBattleground().

◆ SetLevelRange()

void Battleground::SetLevelRange ( uint32  min,
uint32  max 
)
inline
353{ m_LevelMin = min; m_LevelMax = max; }

References m_LevelMax, and m_LevelMin.

Referenced by BattlegroundMgr::CreateBattleground(), and SetBracket().

◆ SetMapId()

void Battleground::SetMapId ( uint32  MapID)
inline
419{ m_MapId = MapID; }

References m_MapId.

Referenced by BattlegroundMgr::CreateBattleground().

◆ SetMaxPlayersPerTeam()

void Battleground::SetMaxPlayersPerTeam ( uint32  MaxPlayers)
inline

◆ SetMinPlayersPerTeam()

void Battleground::SetMinPlayersPerTeam ( uint32  MinPlayers)
inline
365{ m_MinPlayersPerTeam = MinPlayers; }

References m_MinPlayersPerTeam.

Referenced by BattlegroundMgr::CreateBattleground().

◆ SetName()

void Battleground::SetName ( std::string_view  name)
inline
343{ m_Name = std::string(name); }

References m_Name.

Referenced by BattlegroundMgr::CreateBattleground().

◆ SetRandom()

void Battleground::SetRandom ( bool  isRandom)
inline

◆ SetRandomTypeID()

void Battleground::SetRandomTypeID ( BattlegroundTypeId  TypeID)
inline

◆ SetRated()

void Battleground::SetRated ( bool  state)
inline

◆ SetScriptId()

void Battleground::SetScriptId ( uint32  scriptId)
inline
358{ ScriptId = scriptId; }

References ScriptId.

Referenced by BattlegroundMgr::CreateBattleground().

◆ SetStartDelayTime()

void Battleground::SetStartDelayTime ( int32  Time)
inline
362{ m_StartDelayTime = Time; }

References m_StartDelayTime.

Referenced by _ProcessJoin(), and ReadyMarkerClicked().

◆ SetStartMaxDist()

void Battleground::SetStartMaxDist ( float  startMaxDist)
inline
430{ m_StartMaxDist = startMaxDist; }

References m_StartMaxDist.

Referenced by BattlegroundMgr::CreateBattleground().

◆ SetStartTime()

void Battleground::SetStartTime ( uint32  Time)
inline
350{ m_StartTime = Time; }

References m_StartTime.

Referenced by Init(), and StartBattleground().

◆ SetStatus()

◆ SetTeamStartPosition()

void Battleground::SetTeamStartPosition ( TeamId  teamId,
Position const &  pos 
)
649{
650 ASSERT(teamId < TEAM_NEUTRAL);
651 _startPosition[teamId] = pos;
652}

References _startPosition, ASSERT, and TEAM_NEUTRAL.

Referenced by BattlegroundMgr::CreateBattleground().

◆ SetupBattleground()

virtual bool Battleground::SetupBattleground ( )
inlinevirtual

◆ SetWinner()

void Battleground::SetWinner ( PvPTeamId  winner)
inline
357{ m_WinnerId = winner; }

References m_WinnerId.

Referenced by EndBattleground(), and Init().

◆ SpawnBGObject()

void Battleground::SpawnBGObject ( uint32  type,
uint32  respawntime,
uint32  forceRespawnDelay = 0 
)
1472{
1473 if (Map* map = FindBgMap())
1474 if (GameObject* obj = map->GetGameObject(BgObjects[type]))
1475 {
1476 if (respawntime)
1477 obj->SetLootState(GO_JUST_DEACTIVATED);
1478 else if (obj->getLootState() == GO_JUST_DEACTIVATED)
1479 // Change state from GO_JUST_DEACTIVATED to GO_READY in case battleground is starting again
1480 obj->SetLootState(GO_READY);
1481 obj->SetRespawnTime(respawntime);
1482 map->AddToMap(obj);
1483
1484 if (forceRespawnDelay)
1485 {
1486 obj->SetRespawnDelay(forceRespawnDelay);
1487 }
1488 }
1489}
@ GO_JUST_DEACTIVATED
Definition: GameObject.h:115

References BgObjects, FindBgMap(), GO_JUST_DEACTIVATED, and GO_READY.

Referenced by BattlegroundAB::CreateBanner(), BattlegroundAB::DeleteBanner(), BattlegroundAV::EventPlayerAssaultsPoint(), BattlegroundWS::EventPlayerCapturedFlag(), BattlegroundEY::EventPlayerCapturedFlag(), BattlegroundEY::EventPlayerClickedOnFlag(), BattlegroundWS::EventPlayerClickedOnFlag(), BattlegroundAV::EventPlayerDefendsPoint(), BattlegroundAV::EventPlayerDestroyedPoint(), BattlegroundEY::EventTeamCapturedPoint(), BattlegroundEY::EventTeamLostPoint(), BattlegroundAV::HandleKillUnit(), HandleTriggerBuff(), BattlegroundWS::PostUpdateImpl(), BattlegroundSA::ResetObjs(), BattlegroundEY::RespawnFlag(), BattlegroundWS::RespawnFlagAfterDrop(), BattlegroundAV::SetupBattleground(), BattlegroundAB::StartingEventCloseDoors(), BattlegroundAV::StartingEventCloseDoors(), BattlegroundBE::StartingEventCloseDoors(), BattlegroundDS::StartingEventCloseDoors(), BattlegroundEY::StartingEventCloseDoors(), BattlegroundNA::StartingEventCloseDoors(), BattlegroundRL::StartingEventCloseDoors(), BattlegroundWS::StartingEventCloseDoors(), BattlegroundAB::StartingEventOpenDoors(), BattlegroundAV::StartingEventOpenDoors(), BattlegroundBE::StartingEventOpenDoors(), BattlegroundDS::StartingEventOpenDoors(), BattlegroundEY::StartingEventOpenDoors(), BattlegroundNA::StartingEventOpenDoors(), BattlegroundRL::StartingEventOpenDoors(), BattlegroundRV::StartingEventOpenDoors(), and BattlegroundWS::StartingEventOpenDoors().

◆ SpectatorsSendPacket()

void Battleground::SpectatorsSendPacket ( WorldPacket data)
1257{
1258 for (SpectatorList::const_iterator itr = m_Spectators.begin(); itr != m_Spectators.end(); ++itr)
1259 (*itr)->GetSession()->SendPacket(&data);
1260}

References m_Spectators.

◆ StartBattleground()

void Battleground::StartBattleground ( )
1062{
1063 SetStartTime(0);
1065
1066 // add BG to free slot queue
1068
1069 // add bg to update list
1070 // this must be done here, because we need to have already invited some players when first Battleground::Update() method is executed
1071 sBattlegroundMgr->AddBattleground(this);
1072
1073 if (m_IsRated)
1074 LOG_DEBUG("bg.arena", "Arena match type: {} for Team1Id: {} - Team2Id: {} started.", m_ArenaType, m_ArenaTeamIds[TEAM_ALLIANCE], m_ArenaTeamIds[TEAM_HORDE]);
1075}

References AddToBGFreeSlotQueue(), LOG_DEBUG, m_ArenaTeamIds, m_ArenaType, m_IsRated, sBattlegroundMgr, SetLastResurrectTime(), SetStartTime(), TEAM_ALLIANCE, and TEAM_HORDE.

Referenced by BattlegroundQueue::BattlegroundQueueUpdate(), and misc_commandscript::HandleSkirmishCommand().

◆ StartingEventCloseDoors()

virtual void Battleground::StartingEventCloseDoors ( )
inlinevirtual

◆ StartingEventOpenDoors()

virtual void Battleground::StartingEventOpenDoors ( )
inlinevirtual

◆ StartTimedAchievement()

void Battleground::StartTimedAchievement ( AchievementCriteriaTimedTypes  type,
uint32  entry 
)
1850{
1851 for (BattlegroundPlayerMap::const_iterator itr = GetPlayers().begin(); itr != GetPlayers().end(); ++itr)
1852 itr->second->StartTimedAchievement(type, entry);
1853}

References GetPlayers().

Referenced by BattlegroundSA::PostUpdateImpl(), BattlegroundAB::StartingEventOpenDoors(), BattlegroundAV::StartingEventOpenDoors(), BattlegroundEY::StartingEventOpenDoors(), and BattlegroundWS::StartingEventOpenDoors().

◆ ToBattlegroundAB() [1/2]

BattlegroundAB * Battleground::ToBattlegroundAB ( )
inline
572{ if (GetBgTypeID(true) == BATTLEGROUND_AB) return reinterpret_cast<BattlegroundAB*>(this); else return nullptr; }
@ BATTLEGROUND_AB
Definition: SharedDefines.h:3455
Definition: BattlegroundAB.h:291

References BATTLEGROUND_AB, and GetBgTypeID().

Referenced by achievement_resilient_victory::OnCheck().

◆ ToBattlegroundAB() [2/2]

BattlegroundAB const * Battleground::ToBattlegroundAB ( ) const
inline
573{ if (GetBgTypeID(true) == BATTLEGROUND_AB) return reinterpret_cast<const BattlegroundAB*>(this); else return nullptr; }

References BATTLEGROUND_AB, and GetBgTypeID().

◆ ToBattlegroundAV() [1/2]

BattlegroundAV * Battleground::ToBattlegroundAV ( )
inline
566{ if (GetBgTypeID(true) == BATTLEGROUND_AV) return reinterpret_cast<BattlegroundAV*>(this); else return nullptr; }
@ BATTLEGROUND_AV
Definition: SharedDefines.h:3453
Definition: BattlegroundAV.h:1618

References BATTLEGROUND_AV, and GetBgTypeID().

Referenced by achievement_everything_counts::OnCheck(), and achievement_bg_av_perfection::OnCheck().

◆ ToBattlegroundAV() [2/2]

BattlegroundAV const * Battleground::ToBattlegroundAV ( ) const
inline
567{ if (GetBgTypeID(true) == BATTLEGROUND_AV) return reinterpret_cast<const BattlegroundAV*>(this); else return nullptr; }

References BATTLEGROUND_AV, and GetBgTypeID().

◆ ToBattlegroundBE() [1/2]

BattlegroundBE * Battleground::ToBattlegroundBE ( )
inline
578{ if (GetBgTypeID(true) == BATTLEGROUND_BE) return reinterpret_cast<BattlegroundBE*>(this); else return nullptr; }
Definition: BattlegroundBE.h:47

References BATTLEGROUND_BE, and GetBgTypeID().

◆ ToBattlegroundBE() [2/2]

BattlegroundBE const * Battleground::ToBattlegroundBE ( ) const
inline
579{ if (GetBgTypeID(true) == BATTLEGROUND_BE) return reinterpret_cast<const BattlegroundBE*>(this); else return nullptr; }

References BATTLEGROUND_BE, and GetBgTypeID().

◆ ToBattlegroundDS() [1/2]

BattlegroundDS * Battleground::ToBattlegroundDS ( )
inline
590{ if (GetBgTypeID(true) == BATTLEGROUND_DS) return reinterpret_cast<BattlegroundDS*>(this); else return nullptr; }
Definition: BattlegroundDS.h:94

References BATTLEGROUND_DS, and GetBgTypeID().

◆ ToBattlegroundDS() [2/2]

BattlegroundDS const * Battleground::ToBattlegroundDS ( ) const
inline
591{ if (GetBgTypeID(true) == BATTLEGROUND_DS) return reinterpret_cast<const BattlegroundDS*>(this); else return nullptr; }

References BATTLEGROUND_DS, and GetBgTypeID().

◆ ToBattlegroundEY() [1/2]

BattlegroundEY * Battleground::ToBattlegroundEY ( )
inline
581{ if (GetBgTypeID(true) == BATTLEGROUND_EY) return reinterpret_cast<BattlegroundEY*>(this); else return nullptr; }
@ BATTLEGROUND_EY
Definition: SharedDefines.h:3459
Definition: BattlegroundEY.h:380

References BATTLEGROUND_EY, and GetBgTypeID().

◆ ToBattlegroundEY() [2/2]

BattlegroundEY const * Battleground::ToBattlegroundEY ( ) const
inline
582{ if (GetBgTypeID(true) == BATTLEGROUND_EY) return reinterpret_cast<const BattlegroundEY*>(this); else return nullptr; }

References BATTLEGROUND_EY, and GetBgTypeID().

◆ ToBattlegroundIC() [1/2]

BattlegroundIC * Battleground::ToBattlegroundIC ( )
inline
596{ if (GetBgTypeID(true) == BATTLEGROUND_IC) return reinterpret_cast<BattlegroundIC*>(this); else return nullptr; }
@ BATTLEGROUND_IC
Definition: SharedDefines.h:3464
Definition: BattlegroundIC.h:952

References BATTLEGROUND_IC, and GetBgTypeID().

Referenced by SpellArea::IsFitToRequirements(), and achievement_bg_ic_resource_glut::OnCheck().

◆ ToBattlegroundIC() [2/2]

BattlegroundIC const * Battleground::ToBattlegroundIC ( ) const
inline
597{ if (GetBgTypeID(true) == BATTLEGROUND_IC) return reinterpret_cast<const BattlegroundIC*>(this); else return nullptr; }

References BATTLEGROUND_IC, and GetBgTypeID().

◆ ToBattlegroundNA() [1/2]

BattlegroundNA * Battleground::ToBattlegroundNA ( )
inline
575{ if (GetBgTypeID(true) == BATTLEGROUND_NA) return reinterpret_cast<BattlegroundNA*>(this); else return nullptr; }
Definition: BattlegroundNA.h:47

References BATTLEGROUND_NA, and GetBgTypeID().

◆ ToBattlegroundNA() [2/2]

BattlegroundNA const * Battleground::ToBattlegroundNA ( ) const
inline
576{ if (GetBgTypeID(true) == BATTLEGROUND_NA) return reinterpret_cast<const BattlegroundNA*>(this); else return nullptr; }

References BATTLEGROUND_NA, and GetBgTypeID().

◆ ToBattlegroundRL() [1/2]

BattlegroundRL * Battleground::ToBattlegroundRL ( )
inline
584{ if (GetBgTypeID(true) == BATTLEGROUND_RL) return reinterpret_cast<BattlegroundRL*>(this); else return nullptr; }
Definition: BattlegroundRL.h:43

References BATTLEGROUND_RL, and GetBgTypeID().

◆ ToBattlegroundRL() [2/2]

BattlegroundRL const * Battleground::ToBattlegroundRL ( ) const
inline
585{ if (GetBgTypeID(true) == BATTLEGROUND_RL) return reinterpret_cast<const BattlegroundRL*>(this); else return nullptr; }

References BATTLEGROUND_RL, and GetBgTypeID().

◆ ToBattlegroundRV() [1/2]

BattlegroundRV * Battleground::ToBattlegroundRV ( )
inline
593{ if (GetBgTypeID(true) == BATTLEGROUND_RV) return reinterpret_cast<BattlegroundRV*>(this); else return nullptr; }
Definition: BattlegroundRV.h:86

References BATTLEGROUND_RV, and GetBgTypeID().

◆ ToBattlegroundRV() [2/2]

BattlegroundRV const * Battleground::ToBattlegroundRV ( ) const
inline
594{ if (GetBgTypeID(true) == BATTLEGROUND_RV) return reinterpret_cast<const BattlegroundRV*>(this); else return nullptr; }

References BATTLEGROUND_RV, and GetBgTypeID().

◆ ToBattlegroundSA() [1/2]

BattlegroundSA * Battleground::ToBattlegroundSA ( )
inline
587{ if (GetBgTypeID(true) == BATTLEGROUND_SA) return reinterpret_cast<BattlegroundSA*>(this); else return nullptr; }
@ BATTLEGROUND_SA
Definition: SharedDefines.h:3461
Class for manage Strand of Ancient battleground.
Definition: BattlegroundSA.h:456

References BATTLEGROUND_SA, and GetBgTypeID().

Referenced by achievement_sa_defense_of_the_ancients::OnCheck(), and achievement_not_even_a_scratch::OnCheck().

◆ ToBattlegroundSA() [2/2]

BattlegroundSA const * Battleground::ToBattlegroundSA ( ) const
inline
588{ if (GetBgTypeID(true) == BATTLEGROUND_SA) return reinterpret_cast<const BattlegroundSA*>(this); else return nullptr; }

References BATTLEGROUND_SA, and GetBgTypeID().

◆ ToBattlegroundWS() [1/2]

BattlegroundWS * Battleground::ToBattlegroundWS ( )
inline
569{ if (GetBgTypeID(true) == BATTLEGROUND_WS) return reinterpret_cast<BattlegroundWS*>(this); else return nullptr; }
@ BATTLEGROUND_WS
Definition: SharedDefines.h:3454
Definition: BattlegroundWS.h:220

References BATTLEGROUND_WS, and GetBgTypeID().

Referenced by achievement_save_the_day::OnCheck().

◆ ToBattlegroundWS() [2/2]

BattlegroundWS const * Battleground::ToBattlegroundWS ( ) const
inline
570{ if (GetBgTypeID(true) == BATTLEGROUND_WS) return reinterpret_cast<const BattlegroundWS*>(this); else return nullptr; }

References BATTLEGROUND_WS, and GetBgTypeID().

◆ ToBeDeleted()

bool Battleground::ToBeDeleted ( ) const
inline
552{ return m_SetDeleteThis; }

References m_SetDeleteThis.

Referenced by BattlegroundMgr::Update().

◆ Update()

void Battleground::Update ( uint32  diff)
243{
244 // pussywizard:
245 m_UpdateTimer += diff;
247 return;
248
249 diff = BATTLEGROUND_UPDATE_INTERVAL; // just change diff value, no need to replace variable name in many places
251
252 if (!PreUpdateImpl(diff))
253 return;
254
255 if (!GetPlayersSize())
256 {
257 //BG is empty
258 // if there are no players invited, delete BG
259 // this will delete arena or bg object, where any player entered
260 // [[ but if you use battleground object again (more battles possible to be played on 1 instance)
261 // then this condition should be removed and code:
262 // if (!GetInvitedCount(TEAM_HORDE) && !GetInvitedCount(TEAM_ALLIANCE))
263 // AddToFreeBGObjectsQueue(); // not yet implemented
264 // should be used instead of current
265 // ]]
266 // Battleground Template instance cannot be updated, because it would be deleted
268 {
269 m_SetDeleteThis = true;
270 }
271
272 return;
273 }
274
275 switch (GetStatus())
276 {
277 case STATUS_WAIT_JOIN:
278 if (GetPlayersSize())
279 {
280 _ProcessJoin(diff);
282 }
283 break;
285 if (isArena())
286 {
287 if (GetStartTime() >= 46 * MINUTE * IN_MILLISECONDS) // pussywizard: 1min startup + 45min allowed duration
288 {
290 return;
291 }
292 }
293 else
294 {
295 _ProcessResurrect(diff);
297 _ProcessProgress(diff);
298 else if (m_PrematureCountDown)
299 m_PrematureCountDown = false;
300 }
301 break;
303 _ProcessLeave(diff);
304 break;
305 default:
306 break;
307 }
308
309 // Update start time and reset stats timer
310 m_StartTime += diff;
311 m_ResetStatTimer += diff;
312
313 PostUpdateImpl(diff);
314
315 sScriptMgr->OnBattlegroundUpdate(this, diff);
316}
#define BATTLEGROUND_UPDATE_INTERVAL
Definition: Battleground.h:181
virtual void PostUpdateImpl(uint32)
Post-update hook.
Definition: Battleground.h:691
void _ProcessResurrect(uint32 diff)
Definition: Battleground.cpp:344
void _ProcessProgress(uint32 diff)
Definition: Battleground.cpp:417
virtual bool PreUpdateImpl(uint32)
Pre-update hook.
Definition: Battleground.h:678
void _CheckSafePositions(uint32 diff)
Definition: Battleground.cpp:318
void _ProcessJoin(uint32 diff)
Definition: Battleground.cpp:453
void _ProcessLeave(uint32 diff)
Definition: Battleground.cpp:628

References _CheckSafePositions(), _ProcessJoin(), _ProcessLeave(), _ProcessProgress(), _ProcessResurrect(), BATTLEGROUND_UPDATE_INTERVAL, EndBattleground(), GetInvitedCount(), GetMinPlayersPerTeam(), GetPlayersCountByTeam(), GetPlayersSize(), GetStartTime(), GetStatus(), IN_MILLISECONDS, isArena(), m_PrematureCountDown, m_ResetStatTimer, m_SetDeleteThis, m_StartTime, m_UpdateTimer, MINUTE, PostUpdateImpl(), PreUpdateImpl(), PVP_TEAM_NEUTRAL, sBattlegroundMgr, sScriptMgr, STATUS_IN_PROGRESS, STATUS_WAIT_JOIN, STATUS_WAIT_LEAVE, TEAM_ALLIANCE, and TEAM_HORDE.

Referenced by BattlegroundMgr::Update().

◆ UpdatePlayerScore()

bool Battleground::UpdatePlayerScore ( Player player,
uint32  type,
uint32  value,
bool  doAddHonor = true 
)
virtual

Reimplemented in BattlegroundAB, BattlegroundAV, BattlegroundEY, BattlegroundIC, and BattlegroundWS.

1309{
1310 auto const& itr = PlayerScores.find(player->GetGUID().GetCounter());
1311 if (itr == PlayerScores.end()) // player not found...
1312 return false;
1313
1314 if (type == SCORE_BONUS_HONOR && doAddHonor && isBattleground())
1315 player->RewardHonor(nullptr, 1, value); // RewardHonor calls UpdatePlayerScore with doAddHonor = false
1316 else
1317 itr->second->UpdateScore(type, value);
1318
1319 return true;
1320}
bool RewardHonor(Unit *victim, uint32 groupsize, int32 honor=-1, bool awardXP=true)
Definition: Player.cpp:5967

References ObjectGuid::GetCounter(), Object::GetGUID(), isBattleground(), PlayerScores, Player::RewardHonor(), and SCORE_BONUS_HONOR.

Referenced by BattlegroundSA::DestroyGate(), EndBattleground(), HandleKillPlayer(), BattlegroundSA::HandleKillUnit(), RewardHonorToTeam(), BattlegroundAB::UpdatePlayerScore(), BattlegroundAV::UpdatePlayerScore(), BattlegroundEY::UpdatePlayerScore(), BattlegroundIC::UpdatePlayerScore(), and BattlegroundWS::UpdatePlayerScore().

◆ UpdatePlayersCountByTeam()

void Battleground::UpdatePlayersCountByTeam ( TeamId  teamId,
bool  remove 
)
inline
482 {
483 if (remove)
484 --m_PlayersCount[teamId];
485 else
486 ++m_PlayersCount[teamId];
487 }

References m_PlayersCount.

Referenced by AddPlayer(), and RemovePlayerAtLeave().

◆ UpdateWorldState()

void Battleground::UpdateWorldState ( uint32  variable,
uint32  value 
)
771{
773 worldstate.VariableID = variable;
774 worldstate.Value = value;
775 SendPacketToAll(worldstate.Write());
776}
Definition: WorldStatePackets.h:50
int32 Value
Definition: WorldStatePackets.h:57
WorldPacket const * Write() override
Definition: WorldStatePackets.cpp:40
int32 VariableID
Definition: WorldStatePackets.h:56

References SendPacketToAll(), WorldPackets::WorldState::UpdateWorldState::Value, WorldPackets::WorldState::UpdateWorldState::VariableID, and WorldPackets::WorldState::UpdateWorldState::Write().

Referenced by BattlegroundEY::AddPoints(), BattlegroundSA::CaptureGraveyard(), BattlegroundIC::DestroyGate(), BattlegroundSA::DestroyGate(), BattlegroundWS::EventPlayerCapturedFlag(), BattlegroundEY::EventPlayerClickedOnFlag(), BattlegroundSA::EventPlayerDamagedGO(), BattlegroundIC::HandleKillPlayer(), BattlegroundAB::PostUpdateImpl(), BattlegroundIC::PostUpdateImpl(), BattlegroundWS::PostUpdateImpl(), BattlegroundSA::ResetObjs(), BattlegroundEY::RespawnFlag(), BattlegroundAV::SendMineWorldStates(), BattlegroundAB::SendNodeUpdate(), BattlegroundSA::SendTime(), BattlegroundAV::StartingEventOpenDoors(), BattlegroundWS::StartingEventOpenDoors(), BattlegroundSA::ToggleTimer(), Arena::UpdateArenaWorldState(), BattlegroundWS::UpdateFlagState(), BattlegroundAV::UpdateNodeWorldState(), BattlegroundIC::UpdateNodeWorldState(), BattlegroundEY::UpdatePointsCount(), BattlegroundEY::UpdatePointsIcons(), and BattlegroundAV::UpdateScore().

◆ YellToAll()

void Battleground::YellToAll ( Creature creature,
const char *  text,
uint32  language 
)
711{
712 for (BattlegroundPlayerMap::const_iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr)
713 {
714 WorldPacket data;
715 ChatHandler::BuildChatPacket(data, CHAT_MSG_MONSTER_YELL, Language(language), creature, itr->second, text);
716 itr->second->SendDirectMessage(&data);
717 }
718}
@ CHAT_MSG_MONSTER_YELL
Definition: SharedDefines.h:3138
Language
Definition: SharedDefines.h:706

References ChatHandler::BuildChatPacket(), CHAT_MSG_MONSTER_YELL, and m_Players.

Referenced by BattlegroundAV::ChangeMineOwner(), BattlegroundAV::EventPlayerAssaultsPoint(), BattlegroundAV::EventPlayerDefendsPoint(), BattlegroundAV::EventPlayerDestroyedPoint(), BattlegroundAV::HandleKillUnit(), and BattlegroundAV::PostUpdateImpl().

Member Data Documentation

◆ _arenaTeamScores

ArenaTeamScore Battleground::_arenaTeamScores[PVP_TEAMS_COUNT]
protected

◆ _InBGFreeSlotQueue

bool Battleground::_InBGFreeSlotQueue { false }
private

◆ _reviveEvents

◆ _startPosition

std::array<Position, PVP_TEAMS_COUNT> Battleground::_startPosition
private

◆ ArenaLogEntries

ArenaLogEntryDataMap Battleground::ArenaLogEntries

◆ BgCreatures

◆ BgObjects

◆ m_ArenaTeamIds

uint32 Battleground::m_ArenaTeamIds[PVP_TEAMS_COUNT]
private

◆ m_ArenaTeamMMR

uint32 Battleground::m_ArenaTeamMMR[PVP_TEAMS_COUNT]
private

◆ m_ArenaType

uint8 Battleground::m_ArenaType
private

◆ m_BgInvitedPlayers

uint32 Battleground::m_BgInvitedPlayers[PVP_TEAMS_COUNT]
private

◆ m_BgRaids

Group* Battleground::m_BgRaids[PVP_TEAMS_COUNT]
private

Referenced by Battleground(), GetBgRaid(), and SetBgRaid().

◆ m_BracketId

BattlegroundBracketId Battleground::m_BracketId { BG_BRACKET_ID_FIRST }
private

Referenced by GetBracketId(), and SetBracket().

◆ m_BuffChange

bool Battleground::m_BuffChange
protected

◆ m_ClientInstanceID

uint32 Battleground::m_ClientInstanceID
private

◆ m_EndTime

int32 Battleground::m_EndTime
private

◆ m_Events

uint8 Battleground::m_Events
protected

◆ m_HonorMode

BGHonorMode Battleground::m_HonorMode
protected

Referenced by Battleground(), and SetHoliday().

◆ m_InstanceID

◆ m_IsArena

bool Battleground::m_IsArena
private

◆ m_IsRandom

bool Battleground::m_IsRandom
protected

Referenced by Battleground(), IsRandom(), and SetRandom().

◆ m_IsRated

bool Battleground::m_IsRated
private

◆ m_LastResurrectTime

uint32 Battleground::m_LastResurrectTime
private

◆ m_LevelMax

uint32 Battleground::m_LevelMax
private

◆ m_LevelMin

uint32 Battleground::m_LevelMin
private

◆ m_Map

BattlegroundMap* Battleground::m_Map
private

◆ m_MapId

◆ m_MaxPlayersPerTeam

uint32 Battleground::m_MaxPlayersPerTeam
private

◆ m_MinPlayersPerTeam

uint32 Battleground::m_MinPlayersPerTeam
private

◆ m_Name

std::string Battleground::m_Name {}
private

Referenced by GetName(), and SetName().

◆ m_OfflineQueue

GuidDeque Battleground::m_OfflineQueue
private

◆ m_Players

◆ m_PlayersCount

uint32 Battleground::m_PlayersCount[PVP_TEAMS_COUNT]
private

◆ m_PrematureCountDown

bool Battleground::m_PrematureCountDown
private

◆ m_PrematureCountDownTimer

uint32 Battleground::m_PrematureCountDownTimer
private

Referenced by _ProcessProgress(), and Battleground().

◆ m_RandomTypeID

BattlegroundTypeId Battleground::m_RandomTypeID
private

◆ m_RealTypeID

◆ m_ResetStatTimer

uint32 Battleground::m_ResetStatTimer
private

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

◆ m_ResurrectQueue

GuidVector Battleground::m_ResurrectQueue
private

Referenced by _ProcessResurrect().

◆ m_ReviveQueue

◆ m_SetDeleteThis

bool Battleground::m_SetDeleteThis
private

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

◆ m_Spectators

◆ m_StartDelayTime

int32 Battleground::m_StartDelayTime
private

◆ m_StartMaxDist

float Battleground::m_StartMaxDist
private

◆ m_StartTime

uint32 Battleground::m_StartTime
private

◆ m_Status

BattlegroundStatus Battleground::m_Status
private

Referenced by Battleground(), GetStatus(), and SetStatus().

◆ m_TeamScores

◆ m_ToBeTeleported

ToBeTeleportedMap Battleground::m_ToBeTeleported
private

◆ m_UpdateTimer

uint32 Battleground::m_UpdateTimer
protected

Referenced by Battleground(), and Update().

◆ m_ValidStartPositionTimer

uint32 Battleground::m_ValidStartPositionTimer
private

◆ m_WinnerId

PvPTeamId Battleground::m_WinnerId
private

Referenced by Battleground(), GetWinner(), and SetWinner().

◆ PlayerScores

◆ readyMarkerClickedSet

GuidSet Battleground::readyMarkerClickedSet

Referenced by ReadyMarkerClicked().

◆ ScriptId

uint32 Battleground::ScriptId
private

◆ StartDelayTimes

BattlegroundStartTimeIntervals Battleground::StartDelayTimes[BG_STARTING_EVENT_COUNT]
protected

◆ StartMessageIds