aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/DungeonFinding/LFGMgr.cpp
diff options
context:
space:
mode:
authorGiacomo Pozzoni <giacomopoz@gmail.com>2019-10-06 22:24:13 +0200
committerShauren <shauren.trinity@gmail.com>2021-12-18 22:43:38 +0100
commit4062c9763ff1230830bc18bb22308a5d3a7c152d (patch)
tree78810c207aebcc6646ac6b82cc98111ad04a097c /src/server/game/DungeonFinding/LFGMgr.cpp
parent6c0412c3d92926dd83d0182419795875b9c4f4b8 (diff)
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. (cherry picked from commit abcad7cda5375478f475bb9624c578169e84c559)
Diffstat (limited to 'src/server/game/DungeonFinding/LFGMgr.cpp')
-rw-r--r--src/server/game/DungeonFinding/LFGMgr.cpp13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/server/game/DungeonFinding/LFGMgr.cpp b/src/server/game/DungeonFinding/LFGMgr.cpp
index 6de7f3f449a..69820676e53 100644
--- a/src/server/game/DungeonFinding/LFGMgr.cpp
+++ b/src/server/game/DungeonFinding/LFGMgr.cpp
@@ -626,13 +626,22 @@ void LFGMgr::LeaveLfg(ObjectGuid guid, bool disconnected)
case LFG_STATE_QUEUED:
if (!gguid.IsEmpty())
{
+ 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))
+ 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(LFG_UPDATETYPE_REMOVED_FROM_QUEUE), true);
}
}