mirror of
https://gitcode.com/GitHub_Trending/az/azerothcore-wotlk.git
synced 2026-07-10 19:03:11 +00:00
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);
|
||||
}
|
||||
|
||||
@@ -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())
|
||||
{
|
||||
|
||||
@@ -1639,7 +1639,7 @@ void World::InitMonthlyQuestResetTime()
|
||||
void World::InitRandomBGResetTime()
|
||||
{
|
||||
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)
|
||||
{
|
||||
@@ -1772,7 +1772,7 @@ void World::ResetRandomBG()
|
||||
if (itr->second->GetPlayer())
|
||||
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());
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user