fix(Core/Battlegrounds): fix invited-count accounting on BG entry (#26556)
This commit is contained in:
@@ -544,7 +544,31 @@ void WorldSession::HandleBattleFieldPortOpcode(WorldPacket& recvData)
|
||||
sLFGMgr->LeaveAllLfgQueues(_player->GetGUID(), false);
|
||||
|
||||
_player->SetBattlegroundId(bg->GetInstanceID(), bg->GetBgTypeID(), queueSlot, true, bgTypeId == BATTLEGROUND_RB, teamId);
|
||||
sBattlegroundMgr->SendToBattleground(_player, ginfo.IsInvitedToBGInstanceGUID, bgTypeId);
|
||||
|
||||
if (!sBattlegroundMgr->SendToBattleground(_player, ginfo.IsInvitedToBGInstanceGUID, bgTypeId))
|
||||
{
|
||||
// The teleport never started (instance gone, or a synchronous
|
||||
// TeleportTo veto such as a DK still locked to Ebon Hold). The accept
|
||||
// already pulled the player out of the queue and he can't decline
|
||||
// now, so undo the accept here -- otherwise the invited reservation
|
||||
// leaks forever, permanently skewing team selection and blocking the
|
||||
// empty instance's cleanup.
|
||||
bg->DecreaseInvitedCount(teamId);
|
||||
_player->RemoveBattlegroundQueueId(bgQueueTypeId);
|
||||
_player->SetBattlegroundId(0, BATTLEGROUND_TYPE_NONE, PLAYER_MAX_BATTLEGROUND_QUEUES, false, false, TEAM_NEUTRAL);
|
||||
|
||||
sBattlegroundMgr->BuildBattlegroundStatusPacket(&data, bg, queueSlot, STATUS_NONE, 0, 0, 0, TEAM_NEUTRAL);
|
||||
SendPacket(&data);
|
||||
|
||||
// Free slot -> let the queue refill it. BG only, like the sibling
|
||||
// leave-queue path: an arena update needs its own type/rating.
|
||||
if (!ginfo.ArenaType)
|
||||
sBattlegroundMgr->ScheduleQueueUpdate(0, 0, bgQueueTypeId, bgTypeId, bracketEntry->GetBracketId());
|
||||
|
||||
LOG_ERROR("bg.battleground", "Battleground: player {} {} failed to teleport into bg {}, bgtype {}; released the invited reservation.",
|
||||
_player->GetName(), _player->GetGUID().ToString(), bg->GetInstanceID(), bg->GetBgTypeID());
|
||||
return;
|
||||
}
|
||||
|
||||
LOG_DEBUG("bg.battleground", "Battleground: player {} {} joined battle for bg {}, bgtype {}, queue type {}.", _player->GetName(), _player->GetGUID().ToString(), bg->GetInstanceID(), bg->GetBgTypeID(), bgQueueTypeId);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user