43 if (!
_player->GetBGAccessByLevel(bgTypeId))
64 bool isPremade =
false;
70 for (
int i = 0; i < 2; i++)
76 hasRoleMask = !recvData.
ReadBit();
89 SF_LOG_ERROR(
"network",
"Battleground: invalid bgtype (%u) received. possible cheater? player guid %u", bgTypeId_,
_player->GetGUIDLow());
134 if (!
_player->CanJoinToBattleground(bg))
138 _player->GetSession()->SendPacket(&data);
147 _player->GetSession()->SendPacket(&data);
156 _player->GetSession()->SendPacket(&data);
166 if (!
_player->HasFreeBattlegroundQueueId())
170 _player->GetSession()->SendPacket(&data);
178 uint32 queueSlot =
_player->AddBattlegroundQueueId(bgQueueTypeId);
187 SF_LOG_DEBUG(
"bg.battleground",
"Battleground: player joined queue for bg queue type %u bg type %u: GUID %u, NAME %s",
209 SF_LOG_DEBUG(
"bg.battleground",
"Battleground: the following players are joining as group:");
210 ginfo = bgQueue.
AddGroup(
_player, grp, bgTypeId, bracketEntry, 0,
false, isPremade, 0, 0);
216 Player* member = itr->GetSource();
237 SF_LOG_DEBUG(
"bg.battleground",
"Battleground: player joined queue for bg queue type %u bg type %u: GUID %u, NAME %s",
240 SF_LOG_DEBUG(
"bg.battleground",
"Battleground: group end");
248 SF_LOG_DEBUG(
"network",
"WORLD: Recvd CMSG_BATTLEGROUND_PLAYER_POSITIONS Message");
279 for (
uint8 i = 0; i < acount; i++)
292 for (
uint8 i = 0; i < hcount; i++)
306 for (
uint8 i = 0; i < hcount; i++)
320 for (
uint8 i = 0; i < acount; i++)
339 SF_LOG_DEBUG(
"network",
"WORLD: Recvd CMSG_PVP_LOG_DATA Message");
353 SF_LOG_DEBUG(
"network",
"WORLD: Sent SMSG_PVP_LOG_DATA Message");
358 SF_LOG_DEBUG(
"network",
"WORLD: Recvd CMSG_BATTLEFIELD_LIST Message");
361 recvData >> bgTypeId;
370 SF_LOG_DEBUG(
"bg.battleground",
"BattlegroundHandler: invalid bgtype (%u) with player (Name: %s, GUID: %u) received.", bgTypeId,
_player->GetName().c_str(),
_player->GetGUIDLow());
381 SF_LOG_DEBUG(
"network",
"WORLD: Recvd CMSG_BATTLEFIELD_PORT Message");
391 recvData >> queueSlot;
398 if (!
_player->InBattlegroundQueue())
400 SF_LOG_DEBUG(
"bg.battleground",
"CMSG_BATTLEFIELD_PORT %s Slot: %u, Unk: %u, Time: %u, Action: %u. Player not in queue!",
408 SF_LOG_DEBUG(
"bg.battleground",
"CMSG_BATTLEFIELD_PORT %s Slot: %u, Unk: %u, Time: %u, Action: %u. Invalid queueSlot!",
419 SF_LOG_DEBUG(
"bg.battleground",
"CMSG_BATTLEFIELD_PORT %s Slot: %u, Unk: %u, Time: %u, Action: %u. Player not in queue (No player Group Info)!",
426 SF_LOG_DEBUG(
"bg.battleground",
"CMSG_BATTLEFIELD_PORT %s Slot: %u, Unk: %u, Time: %u, Action: %u. Player is not invited to any bg!",
439 SF_LOG_DEBUG(
"bg.battleground",
"CMSG_BATTLEFIELD_PORT %s Slot: %u, Unk: %u, Time: %u, Action: %u. Cant find BG with id %u!",
447 SF_LOG_ERROR(
"network",
"BattlegroundHandler: bg_template not found for type id %u.",
uint32(bgTypeId));
452 SF_LOG_DEBUG(
"bg.battleground",
"CMSG_BATTLEFIELD_PORT %s Slot: %u, Unk: %u, Time: %u, Action: %u.",
467 if (!
_player->CanJoinToBattleground(bg))
472 _player->GetSession()->SendPacket(&data2);
474 SF_LOG_DEBUG(
"bg.battleground",
"Player %s (%u) has a deserter debuff, do not port him to battleground!",
_player->GetName().c_str(),
_player->GetGUIDLow());
479 SF_LOG_DEBUG(
"network",
"Player %s (%u) has level (%u) higher than maxlevel (%u) of battleground (%u)! Do not port him to battleground!",
488 if (!
_player->IsInvitedForBattlegroundQueueType(bgQueueTypeId))
491 if (!
_player->InBattleground())
492 _player->SetBattlegroundEntryPoint();
497 _player->ResurrectPlayer(1.0f);
503 _player->GetMotionMaster()->MovementExpired();
504 _player->CleanupAfterTaxiFlight();
508 _player->GetSession()->SendPacket(&data);
515 currentBg->RemovePlayerAtLeave(
_player->GetGUID(),
false,
true);
545 _player->RemoveBattlegroundQueueId(bgQueueTypeId);
557 SF_LOG_DEBUG(
"network",
"WORLD: Recvd CMSG_BATTLEFIELD_LEAVE Message");
571 SF_LOG_DEBUG(
"network",
"WORLD: Recvd CMSG_BATTLEFIELD_STATUS Message");
583 if (bgTypeId ==
_player->GetBattlegroundTypeId())
585 bg =
_player->GetBattleground();
635 SF_LOG_DEBUG(
"network",
"WORLD: CMSG_BATTLEMASTER_JOIN_ARENA");
639 recvData >> arenaslot;
646 uint32 matchmakerRating = 0;
654 SF_LOG_ERROR(
"network",
"Battleground: template bg (all arenas) not found");
691 matchmakerRating = 1;
701 SF_LOG_DEBUG(
"bg.battleground",
"Battleground: leader %s queued with matchmaker rating %u for type %u",
_player->GetName().c_str(), matchmakerRating, arenatype);
703 ginfo = bgQueue.
AddGroup(
_player, grp, bgTypeId, bracketEntry, arenatype,
true,
false, arenaRating, matchmakerRating);
709 Player* member = itr->GetSource();
731 SF_LOG_DEBUG(
"bg.battleground",
"Battleground: player joined queue for arena as group bg queue type %u bg type %u: GUID %u, NAME %s", bgQueueTypeId,
uint32(bgTypeId), member->
GetGUIDLow(), member->
GetName().c_str());
741 recvData.
ReadGuidMask(playerGuid, 3, 6, 1, 4, 5, 0, 7, 2);
748 SF_LOG_DEBUG(
"bg.battleground",
"WorldSession::HandleReportPvPAFK: player not found");
752 SF_LOG_DEBUG(
"bg.battleground",
"WorldSession::HandleReportPvPAFK: %s reported %s",
_player->GetName().c_str(), reportedPlayer->
GetName().c_str());
759 SF_LOG_DEBUG(
"network",
"WORLD: CMSG_REQUEST_PVP_OPTIONS_ENABLED");
776 SF_LOG_DEBUG(
"network",
"WORLD: CMSG_REQUEST_PVP_REWARDS");
783 SF_LOG_DEBUG(
"network",
"WORLD: CMSG_REQUEST_CONQUEST_FORMULA_CONSTANTS");
788 data << float(1639.28);
789 data << float(0.00412);
791 data << float(1511.26);
DBCStorage< BattlemasterListEntry > sBattlemasterListStore(BattlemasterListEntryfmt)
PvPDifficultyEntry const * GetBattlegroundBracketByLevel(uint32 mapid, uint32 level)
@ DISABLE_TYPE_BATTLEGROUND
@ LANG_YOUR_BG_LEVEL_REQ_ERROR
#define SF_LOG_DEBUG(filterType__,...)
#define SF_LOG_ERROR(filterType__,...)
TypeID GuidHigh2TypeId(uint32 guid_hi)
uint32 GUID_LOPART(uint64 x)
uint32 GUID_HIPART(uint64 guid)
GroupJoinBattlegroundResult
@ ERR_GROUP_JOIN_BATTLEGROUND_DESERTERS
@ ERR_LFG_CANT_USE_BATTLEGROUND
@ ERR_BATTLEGROUND_TOO_MANY_QUEUES
@ BATTLEGROUND_QUEUE_NONE
#define PLAYER_MAX_BATTLEGROUND_QUEUES
uint32 getMSTimeDiff(uint32 oldMSTime, uint32 newMSTime)
static uint8 GetTypeBySlot(uint8 slot)
BattlegroundTypeId GetTypeID(bool GetRandom=false) const
virtual uint64 GetFlagPickerGUID(int32=-1) const
uint32 GetMinPlayersPerTeam() const
uint8 GetArenaType() const
uint32 GetMaxPlayersPerTeam() const
uint32 GetInstanceID() const
uint32 GetMaxLevel() const
uint32 GetElapsedTime() const
static BattlegroundQueueTypeId BGQueueTypeId(BattlegroundTypeId bgTypeId, uint8 arenaType)
static BattlegroundTypeId BGTemplateId(BattlegroundQueueTypeId bgQueueTypeId)
static uint8 BGArenaType(BattlegroundQueueTypeId bgQueueTypeId)
GroupQueueInfo * AddGroup(Player *leader, Group *group, BattlegroundTypeId bgTypeId, PvPDifficultyEntry const *bracketEntry, uint8 ArenaType, bool isRated, bool isPremade, uint32 ArenaRating, uint32 MatchmakerRating)
uint32 GetAverageQueueWaitTime(GroupQueueInfo *ginfo, BattlegroundBracketId bracket_id) const
bool GetPlayerGroupInfoData(uint64 guid, GroupQueueInfo *ginfo)
void RemovePlayer(uint64 guid, bool decreaseInvitedCount)
bool WriteBit(uint32 bit)
void ReadGuidBytes(ObjectGuid &guid, Offsets... offsets)
void ReadGuidMask(ObjectGuid &guid, Offsets... offsets)
void WriteBits(T value, size_t bits)
void WriteByteSeq(uint8 b)
void PSendSysMessage(const char *format,...) ATTR_PRINTF(2
GroupJoinBattlegroundResult CanJoinBattlegroundQueue(Battleground const *bgOrTemplate, BattlegroundQueueTypeId bgQueueTypeId, uint32 MinPlayerCount, uint32 MaxPlayerCount, bool isRated, uint32 arenaSlot)
uint32 GetMembersCount() const
GroupReference * GetFirstMember()
uint64 GetLeaderGUID() const
Creature * GetCreature(uint64 guid)
static Player * FindPlayer(uint64)
uint32 GetGUIDLow() const
void AddBattlegroundQueueJoinTime(BattlegroundTypeId bgTypeId, uint32 joinTime)
WorldSession * GetSession() const
uint32 AddBattlegroundQueueId(BattlegroundQueueTypeId val)
void ReportedAfkBy(Player *reporter)
This player has been blamed to be inactive in a battleground.
bool IsBattleMaster() const
void StopMoving()
-------—End of Pet responses methods-------—
std::string const & GetName() const
void HandleBattlegroundPlayerPositionsOpcode(WorldPacket &recvData)
void HandleBattlemasterJoinOpcode(WorldPacket &recvData)
void SendNotification(const char *format,...) ATTR_PRINTF(2
void HandleBattlefieldLeaveOpcode(WorldPacket &recvData)
void HandleBattlefieldStatusOpcode(WorldPacket &recvData)
std::string GetPlayerInfo() const
Player * GetPlayer() const
void HandlePVPLogDataOpcode(WorldPacket &recvData)
void HandleRequestPvpReward(WorldPacket &recvData)
void HandleBattlemasterHelloOpcode(WorldPacket &recvData)
void SendPacket(WorldPacket const *packet, bool forced=false)
Send a packet to the client.
void HandleReportPvPAFK(WorldPacket &recvData)
void HandleRequestConquestFormulaConstants(WorldPacket &recvData)
void HandleRequestPvpOptions(WorldPacket &recvData)
void HandleBattlefieldListOpcode(WorldPacket &recvData)
void HandleBattleFieldPortOpcode(WorldPacket &recvData)
void SendBattleGroundList(uint64 guid, BattlegroundTypeId bgTypeId=BattlegroundTypeId::BATTLEGROUND_RB)
void HandleBattlemasterJoinArena(WorldPacket &recvData)
@ SMSG_PVP_OPTIONS_ENABLED
@ SMSG_BATTLEFIELD_PLAYER_POSITIONS
@ SMSG_CONQUEST_FORMULA_CONSTANTS
bool IsDisabledFor(DisableType type, uint32 entry, Unit const *unit, uint8 flags)
uint32 IsInvitedToBGInstanceGUID
uint32 ArenaMatchmakerRating
float GetPositionX() const
float GetPositionY() const
BattlegroundBracketId GetBracketId() const