67 bool isPremade =
false;
137 bool isInRandomBgQueue = [&]
189 TC_LOG_DEBUG(
"bg.battleground",
"Battleground: player joined queue for bg queue {{ BattlemasterListId: {}, BracketId: {}, TeamSize: {} }}, {}, NAME {}",
210 TC_LOG_DEBUG(
"bg.battleground",
"Battleground: the following players are joining as group:");
211 ginfo = bgQueue.
AddGroup(
_player, grp, bracketEntry,
false, isPremade, 0, 0);
217 Player* member = itr->GetSource();
239 TC_LOG_DEBUG(
"bg.battleground",
"Battleground: player joined queue for bg queue {{ BattlemasterListId: {}, BracketId: {}, TeamSize: {} }}, {}, NAME {}",
243 TC_LOG_DEBUG(
"bg.battleground",
"Battleground: group end");
258 playerPositions.
FlagCarriers.emplace_back(guid, allianceFlagCarrier->GetPosition());
263 playerPositions.
FlagCarriers.emplace_back(guid, hordeFlagCarrier->GetPosition());
286 if (!battlemasterListEntry)
301 TC_LOG_DEBUG(
"bg.battleground",
"CMSG_BATTLEFIELD_PORT {} queue {{ BattlemasterListId: {}, BracketId: {}, TeamSize: {} }}, AcceptedInvite: {}. Invalid queueSlot.",
312 TC_LOG_DEBUG(
"bg.battleground",
"CMSG_BATTLEFIELD_PORT {} queue {{ BattlemasterListId: {}, BracketId: {}, TeamSize: {} }}, AcceptedInvite: {}. Player not in queue (No player Group Info)!",
319 TC_LOG_DEBUG(
"bg.battleground",
"CMSG_BATTLEFIELD_PORT {} queue {{ BattlemasterListId: {}, BracketId: {}, TeamSize: {} }}, AcceptedInvite: {}. Player is not invited to any bg!",
330 TC_LOG_DEBUG(
"bg.battleground",
"CMSG_BATTLEFIELD_PORT {} queue {{ BattlemasterListId: {}, BracketId: {}, TeamSize: {} }}, AcceptedInvite: {}. Cant find BG with id {}!",
338 TC_LOG_ERROR(
"network",
"BattlegroundHandler: BattlegroundTemplate not found for type id {}.", bgTypeId);
343 TC_LOG_DEBUG(
"bg.battleground",
"CMSG_BATTLEFIELD_PORT {} queue {{ BattlemasterListId: {}, BracketId: {}, TeamSize: {} }}, AcceptedInvite: {}.",
367 TC_LOG_ERROR(
"network",
"Player {} {} has level ({}) higher than maxlevel ({}) of battleground ({})! Do not port him to battleground!",
414 TC_LOG_DEBUG(
"bg.battleground",
"Battleground: player {} ({}) joined battle for bg {}, bgtype {}, queue {{ BattlemasterListId: {}, BracketId: {}, TeamSize: {} }}.",
445 TC_LOG_DEBUG(
"bg.battleground",
"Battleground: player {} ({}) left queue for bgtype {}, queue {{ BattlemasterListId: {}, BracketId: {}, TeamSize: {} }}.",
548 uint32 matchmakerRating = 0;
549 uint32 previousOpponents = 0;
555 TC_LOG_ERROR(
"network",
"Battleground: template bg (all arenas) not found");
626 if (arenaRating <= 0)
650 ginfo = bgQueue.
AddGroup(
_player, grp, bracketEntry, packet.
IsRated,
false, arenaRating, matchmakerRating, ateamId, previousOpponents);
656 Player* member = itr->GetSource();
686 TC_LOG_DEBUG(
"bg.battleground",
"Battleground: player joined queue for arena as group bg queue {{ BattlemasterListId: {}, BracketId: {}, TeamSize: {} }}, {}, NAME {}",
701 TC_LOG_DEBUG(
"bg.battleground",
"Battleground: player joined queue for arena, skirmish, bg queue type {{ BattlemasterListId: {}, BracketId: {}, TeamSize: {} }}: {}, NAME {}",
@ BG_DESERTION_TYPE_LEAVE_QUEUE
@ CHAR_INS_DESERTER_TRACK
@ AREA_FLAG_WINTERGRASP_2
DBCStorage< BattlemasterListEntry > sBattlemasterListStore(BattlemasterListEntryfmt)
PvPDifficultyEntry const * GetBattlegroundBracketByLevel(uint32 mapid, uint32 level)
DBCStorage< AreaTableEntry > sAreaTableStore(AreaTableEntryfmt)
DatabaseWorkerPool< CharacterDatabaseConnection > CharacterDatabase
Accessor to the character database.
@ DISABLE_TYPE_BATTLEGROUND
@ LANG_YOUR_BG_LEVEL_REQ_ERROR
#define TC_LOG_DEBUG(filterType__,...)
#define TC_LOG_ERROR(filterType__,...)
#define TC_LOG_INFO(filterType__,...)
GroupJoinBattlegroundResult
@ ERR_BATTLEGROUND_JOIN_TIMED_OUT
@ ERR_BATTLEGROUND_JOIN_FAILED
@ ERR_LFG_CANT_USE_BATTLEGROUND
@ ERR_GROUP_JOIN_BATTLEGROUND_DESERTERS
@ ERR_BATTLEGROUND_TOO_MANY_QUEUES
constexpr BattlegroundQueueTypeId BATTLEGROUND_QUEUE_NONE
#define PLAYER_MAX_BATTLEGROUND_QUEUES
uint32 getMSTimeDiff(uint32 oldMSTime, uint32 newMSTime)
@ UNIT_NPC_FLAG_BATTLEMASTER
void SaveToDB(bool forceMemberSave=false)
uint32 GetPreviousOpponents()
void MemberLost(Player *player, uint32 againstMatchmakerRating, int32 MatchmakerRatingChange=-12)
uint32 GetAverageMMR(Group *group) const
static uint8 GetTypeBySlot(uint8 slot)
static void BuildGroupJoinedBattlegroundPacket(WorldPackets::Battleground::GroupJoinedBattleground *groupJoinedBattleground, BattlegroundTypeId bgTypeId)
static void BuildBattlegroundStatusNeedConfirmation(WorldPackets::Battleground::BattlefieldStatusNeedConfirmation *battlefieldStatus, Battleground const *bg, uint32 queueSlot, uint32 timeout, BattlegroundQueueTypeId queueId)
static BattlegroundQueueTypeId BGQueueTypeId(BattlegroundTypeId bgTypeId, uint8 bracketId, uint8 arenaType)
static void BuildBattlegroundStatusQueued(WorldPackets::Battleground::BattlefieldStatusQueued *battlefieldStatus, Battleground const *bg, uint32 queueSlot, uint32 joinTime, BattlegroundQueueTypeId queueId, uint32 avgWaitTime)
static bool IsRandomBattleground(uint32 battlemasterListId)
static void BuildBattlegroundStatusFailed(WorldPackets::Battleground::BattlefieldStatusFailed *battlefieldStatus, GroupJoinBattlegroundResult result, ObjectGuid const *errorGuid=nullptr)
static void BuildBattlegroundStatusNone(WorldPackets::Battleground::BattlefieldStatusNone *battlefieldStatus, uint32 queueSlot)
static void BuildBattlegroundStatusActive(WorldPackets::Battleground::BattlefieldStatusActive *battlefieldStatus, Battleground const *bg, Player const *player, uint32 queueSlot, BattlegroundQueueTypeId queueId)
BattlegroundQueueTypeId GetQueueId() const
uint32 GetAverageQueueWaitTime(GroupQueueInfo *ginfo) const
bool GetPlayerGroupInfoData(ObjectGuid guid, GroupQueueInfo *ginfo)
void RemovePlayer(ObjectGuid guid, bool decreaseInvitedCount)
GroupQueueInfo * AddGroup(Player *leader, Group const *group, PvPDifficultyEntry const *bracketEntry, bool isRated, bool isPremade, uint32 ArenaRating, uint32 MatchmakerRating, uint32 ArenaTeamId=0, uint32 OpponentsArenaTeamId=0)
virtual ObjectGuid GetFlagPickerGUID(int32=-1) const
BattlegroundTypeId GetTypeID(bool GetRandom=false) const
void BuildPvPLogDataPacket(WorldPackets::Battleground::PVPMatchStatistics &pvpLogData)
uint32 GetMinPlayersPerTeam() const
uint32 GetMaxPlayersPerTeam() const
void SetRated(bool state)
uint32 GetInstanceID() const
BattlegroundPlayer const * GetBattlegroundPlayerData(ObjectGuid const &playerGuid) const
bool isBattleground() const
BattlegroundStatus GetStatus() const
uint32 GetMaxLevel() const
void PSendSysMessage(char const *fmt, Args &&... args)
void SetHomePosition(float x, float y, float z, float o)
CreatureMovementData const & GetMovementTemplate() const
uint32 GetMembersCount() const
GroupReference * GetFirstMember()
GroupJoinBattlegroundResult CanJoinBattlegroundQueue(Battleground const *bgOrTemplate, BattlegroundQueueTypeId bgQueueTypeId, uint32 MinPlayerCount, uint32 MaxPlayerCount, bool isRated, uint32 arenaSlot, ObjectGuid &errorGuid) const
ObjectGuid GetLeaderGUID() const
LowType GetCounter() const
static ObjectGuid const Empty
std::string ToString() const
static ObjectGuid GetGUID(Object const *o)
void SetBGTeam(uint32 team)
void LeaveBattleground(bool teleportToEntryPoint=true, bool withoutDeserterDebuff=false)
void SendDirectMessage(WorldPacket const *data) const
bool IsInvitedForBattlegroundQueueType(BattlegroundQueueTypeId bgQueueTypeId) const
void SetBattlegroundEntryPoint()
bool InBattleground() const
void SpawnCorpseBones(bool triggerSave=true)
bool InBattlegroundQueue(bool ignoreArena=false) const
WorldSession * GetSession() const
void RemoveBattlegroundQueueId(BattlegroundQueueTypeId val)
Creature * GetNPCIfCanInteractWith(ObjectGuid const &guid, NPCFlags npcFlags) const
uint32 GetArenaTeamId(uint8 slot) const
bool HasFreeBattlegroundQueueId() const
Battleground * GetBattleground() const
uint32 AddBattlegroundQueueId(BattlegroundQueueTypeId val)
bool TeleportTo(uint32 mapid, float x, float y, float z, float orientation, uint32 options=0)
bool CanJoinToBattleground(Battleground const *bg) const
uint32 GetBattlegroundQueueIndex(BattlegroundQueueTypeId bgQueueTypeId) const
void ReportedAfkBy(Player *reporter)
This player has been blamed to be inactive in a battleground.
void SetBattlegroundId(uint32 val, BattlegroundTypeId bgTypeId)
BattlegroundQueueTypeId GetBattlegroundQueueTypeId(uint32 index) const
bool GetBGAccessByLevel(BattlegroundTypeId bgTypeId) const
void ResurrectPlayer(float restore_percent, bool applySickness=false)
void setUInt32(uint8 index, uint32 value)
void setUInt8(uint8 index, uint8 value)
void PauseMovement(uint32 timer=0, uint8 slot=0, bool forced=true)
bool HasAura(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint8 reqEffMask=0) const
bool IsSpiritService() const
std::string const & GetName() const
WorldPacket const * Write() override
WorldPacket const * Write() override
WorldPacket const * Write() override
WorldPacket const * Write() override
std::vector< BattlegroundPlayerPosition > FlagCarriers
WorldPacket const * Write() override
ObjectGuid BattlemasterGuid
uint32 BattlemasterListID
WorldPacket const * Write() override
WorldPacket const * Write() override
void HandleHearthAndResurrect(WorldPackets::Battleground::HearthAndResurrect &hearthAndResurrect)
void HandleBattlefieldLeaveOpcode(WorldPackets::Battleground::BattlefieldLeave &battlefieldLeave)
void HandleRequestBattlefieldStatusOpcode(WorldPackets::Battleground::RequestBattlefieldStatus &requestBattlefieldStatus)
void SendPacket(WorldPacket const *packet)
Send a packet to the client.
void SendNotification(const char *format,...) ATTR_PRINTF(2
void SendNotInArenaTeamPacket(uint8 type)
std::string GetPlayerInfo() const
Player * GetPlayer() const
void HandleBattleFieldPortOpcode(WorldPackets::Battleground::BattlefieldPort &battlefieldPort)
void HandleAreaSpiritHealerQueueOpcode(WorldPackets::Battleground::AreaSpiritHealerQueue &areaSpiritHealerQueue)
std::string const & GetRemoteAddress() const
void HandleBattlemasterJoinArena(WorldPackets::Battleground::BattlemasterJoinArena &packet)
void HandleBattlemasterJoinOpcode(WorldPackets::Battleground::BattlemasterJoin &battlemasterJoin)
void HandleBattlegroundPlayerPositionsOpcode(WorldPackets::Battleground::BattlegroundPlayerPositionsRequest &battlegroundPlayerPositionsRequest)
void HandleAreaSpiritHealerQueryOpcode(WorldPackets::Battleground::AreaSpiritHealerQuery &areaSpiritHealerQuery)
void HandlePVPLogDataOpcode(WorldPackets::Battleground::PVPLogDataRequest &pvpLogDataRequest)
void HandleReportPvPAFK(WorldPackets::Battleground::ReportPvPPlayerAFK &reportPvPPlayerAFK)
void HandleBattlefieldListOpcode(WorldPackets::Battleground::BattlefieldListRequest &battlefieldList)
void HandleBattlemasterHelloOpcode(WorldPackets::NPC::Hello &hello)
@ CONFIG_BATTLEGROUND_TRACK_DESERTERS
bool IsDisabledFor(DisableType type, uint32 entry, WorldObject const *ref, uint8 flags)
TC_GAME_API Player * FindPlayer(ObjectGuid const &)
TC_GAME_API Player * GetPlayer(Map const *, ObjectGuid const &guid)
TC_GAME_API Creature * GetCreature(WorldObject const &u, ObjectGuid const &guid)
static constexpr BattlegroundQueueTypeId FromPacked(uint64 packedQueueId)
uint16 BattlemasterListId
uint32 GetInteractionPauseTimer() const
uint32 IsInvitedToBGInstanceGUID
uint32 OpponentsMatchmakerRating
uint32 OpponentsTeamRating
uint32 ArenaMatchmakerRating
float GetOrientation() const
void GetPosition(float &x, float &y) const
BattlegroundBracketId GetBracketId() const