Core/LFG: Fix re-queueing while in a dungeon (#23862)

Fix an issue that wouldn't allow to re-queue after joining a dungeon, having 1 member leave/get kicked, queue, leave, queue.
In this case a message "One or more dungeons was not valid" would be displayed because LFG would try to queue the group as "continue dungeon" but the current group was not marked as "in dungeon" state anymore.
This commit is contained in:
Giacomo Pozzoni
2019-10-07 00:45:56 +02:00
committed by Ovahlord
parent 354927050b
commit e73c7dc2e4

View File

@@ -677,13 +677,22 @@ void LFGMgr::LeaveLfg(ObjectGuid guid, bool disconnected)
LFG_UPDATETYPE_REMOVED_FROM_QUEUE : LFG_UPDATETYPE_LEAVE_RAIDBROWSER;
if (gguid)
{
LfgState newState = LFG_STATE_NONE;
LfgState oldState = GetOldState(gguid);
// Set the new state to LFG_STATE_DUNGEON/LFG_STATE_FINISHED_DUNGEON if the group is already in a dungeon
// This is required in case a LFG group vote-kicks a player in a dungeon, queues, then leaves the queue (maybe to queue later again)
if (Group* group = sGroupMgr->GetGroupByGUID(gguid.GetCounter()))
if (group->isLFGGroup() && GetDungeon(gguid) && (oldState == LFG_STATE_DUNGEON || oldState == LFG_STATE_FINISHED_DUNGEON))
newState = oldState;
LFGQueue& queue = GetQueue(gguid);
queue.RemoveFromQueue(gguid);
SetState(gguid, LFG_STATE_NONE);
SetState(gguid, newState);
GuidSet const& players = GetPlayers(gguid);
for (GuidSet::const_iterator it = players.begin(); it != players.end(); ++it)
{
SetState(*it, LFG_STATE_NONE);
SetState(*it, newState);
SendLfgUpdateStatus(*it, LfgUpdateData(type), true);
}
}