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:
@@ -252,7 +252,7 @@ void WorldSession::HandleBattlemasterJoinOpcode(WorldPacket& recvData)
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
if (err)
|
if (err > 0)
|
||||||
{
|
{
|
||||||
err = grp->CanJoinBattlegroundQueue(bg, bgQueueTypeId, 0, bg->GetMaxPlayersPerTeam(), false, 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
|
// but landed on another map, cleanup data
|
||||||
if (!mEntry->IsBattlegroundOrArena())
|
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);
|
_player->SetBattlegroundId(0, BATTLEGROUND_TYPE_NONE, PLAYER_MAX_BATTLEGROUND_QUEUES, false, false, TEAM_NEUTRAL);
|
||||||
|
}
|
||||||
// everything ok
|
// everything ok
|
||||||
else if (Battleground* bg = _player->GetBattleground())
|
else if (Battleground* bg = _player->GetBattleground())
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1639,7 +1639,7 @@ void World::InitMonthlyQuestResetTime()
|
|||||||
void World::InitRandomBGResetTime()
|
void World::InitRandomBGResetTime()
|
||||||
{
|
{
|
||||||
Seconds wstime = Seconds(sWorldState->getWorldState(WORLD_STATE_CUSTOM_BG_DAILY_RESET_TIME));
|
Seconds wstime = Seconds(sWorldState->getWorldState(WORLD_STATE_CUSTOM_BG_DAILY_RESET_TIME));
|
||||||
_nextRandomBGReset = wstime > 0s ? wstime : Seconds(Acore::Time::GetNextTimeWithDayAndHour(-1, 6));
|
_nextRandomBGReset = wstime > 0s ? wstime : Seconds(Acore::Time::GetNextTimeWithDayAndHour(-1, getIntConfig(CONFIG_RANDOM_BG_RESET_HOUR)));
|
||||||
|
|
||||||
if (wstime == 0s)
|
if (wstime == 0s)
|
||||||
{
|
{
|
||||||
@@ -1772,7 +1772,7 @@ void World::ResetRandomBG()
|
|||||||
if (itr->second->GetPlayer())
|
if (itr->second->GetPlayer())
|
||||||
itr->second->GetPlayer()->SetRandomWinner(false);
|
itr->second->GetPlayer()->SetRandomWinner(false);
|
||||||
|
|
||||||
_nextRandomBGReset = Seconds(Acore::Time::GetNextTimeWithDayAndHour(-1, 6));
|
_nextRandomBGReset = Seconds(Acore::Time::GetNextTimeWithDayAndHour(-1, getIntConfig(CONFIG_RANDOM_BG_RESET_HOUR)));
|
||||||
sWorldState->setWorldState(WORLD_STATE_CUSTOM_BG_DAILY_RESET_TIME, _nextRandomBGReset.count());
|
sWorldState->setWorldState(WORLD_STATE_CUSTOM_BG_DAILY_RESET_TIME, _nextRandomBGReset.count());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user