fix(Core/BG): invited count leak when a BG teleport fails + group join checks (#26422)

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
Francesco Borzì
2026-07-03 02:05:23 +02:00
committed by GitHub
parent b66ea07190
commit c606a246bf
3 changed files with 13 additions and 3 deletions
@@ -252,7 +252,7 @@ void WorldSession::HandleBattlemasterJoinOpcode(WorldPacket& recvData)
}
});
if (err)
if (err > 0)
{
err = grp->CanJoinBattlegroundQueue(bg, bgQueueTypeId, 0, bg->GetMaxPlayersPerTeam(), false, 0);
}
@@ -152,7 +152,17 @@ void WorldSession::HandleMoveWorldportAck()
{
// but landed on another map, cleanup data
if (!mEntry->IsBattlegroundOrArena())
{
// release the unconsumed invite, otherwise the BG never satisfies its empty + uninvited deletion gate
if (Battleground* bg = _player->GetBattleground(true))
if (_player->IsInvitedForBattlegroundInstance(bg->GetInstanceID()))
{
bg->DecreaseInvitedCount(_player->GetBgTeamId());
_player->RemoveBattlegroundQueueId(BattlegroundMgr::BGQueueTypeId(bg->GetBgTypeID(), bg->GetArenaType()));
}
_player->SetBattlegroundId(0, BATTLEGROUND_TYPE_NONE, PLAYER_MAX_BATTLEGROUND_QUEUES, false, false, TEAM_NEUTRAL);
}
// everything ok
else if (Battleground* bg = _player->GetBattleground())
{