mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-16 07:30:42 +01:00
Core/Dungeon Finder: Fix some errors in Join
- return Internal error if group/player already in queue (They shouldn't be able to join when already queued) - Fix crash when trying to delete player selected dungeons (cause was forcing a leave in join to keep consistency) and return a proper lfg error - Fixes issue 4262 --HG-- branch : trunk
This commit is contained in:
@@ -561,6 +561,7 @@ bool LFGMgr::RemoveFromQueue(uint64 guid)
|
||||
/// <param name="Player*">Player</param>
|
||||
void LFGMgr::Join(Player* plr)
|
||||
{
|
||||
LfgDungeonSet* dungeons = NULL;
|
||||
Group* grp = plr->GetGroup();
|
||||
|
||||
if (grp && grp->GetLeaderGUID() != plr->GetGUID())
|
||||
@@ -573,8 +574,12 @@ void LFGMgr::Join(Player* plr)
|
||||
LfgQueueInfoMap::iterator itQueue = m_QueueInfoMap.find(guid);
|
||||
if (itQueue != m_QueueInfoMap.end())
|
||||
{
|
||||
sLog.outError("LFGMgr::Join: [" UI64FMTD "] trying to join but is already in queue! Forcing leave before readding", guid);
|
||||
time_t now = time_t(time(NULL));
|
||||
time_t joinTime = itQueue->second->joinTime;
|
||||
uint32 diff = uint32(now - joinTime);
|
||||
sLog.outError("LFGMgr::Join: [" UI64FMTD "] trying to join but is already in queue! diff %u (" UI64FMTD " - " UI64FMTD ")", guid, diff, uint64(now), uint64(joinTime));
|
||||
Leave(plr, grp);
|
||||
result = LFG_JOIN_INTERNAL_ERROR;
|
||||
}
|
||||
else if (plr->InBattleground() || plr->InArena() || plr->InBattlegroundQueue())
|
||||
result = LFG_JOIN_USING_BG_SYSTEM;
|
||||
@@ -584,15 +589,18 @@ void LFGMgr::Join(Player* plr)
|
||||
result = LFG_JOIN_RANDOM_COOLDOWN;
|
||||
else
|
||||
{
|
||||
// Check if all dungeons are valid
|
||||
for (LfgDungeonSet::const_iterator it = plr->GetLfgDungeons()->begin(); it != plr->GetLfgDungeons()->end(); ++it)
|
||||
{
|
||||
if (!GetDungeonGroupType(*it))
|
||||
dungeons = plr->GetLfgDungeons();
|
||||
if (!dungeons || dungeons->size())
|
||||
result = LFG_JOIN_NOT_MEET_REQS;
|
||||
else // Check if all dungeons are valid
|
||||
for (LfgDungeonSet::const_iterator it = dungeons->begin(); it != dungeons->end(); ++it)
|
||||
{
|
||||
result = LFG_JOIN_DUNGEON_INVALID;
|
||||
break;
|
||||
if (!GetDungeonGroupType(*it))
|
||||
{
|
||||
result = LFG_JOIN_DUNGEON_INVALID;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Group checks
|
||||
@@ -633,7 +641,6 @@ void LFGMgr::Join(Player* plr)
|
||||
return;
|
||||
}
|
||||
|
||||
LfgDungeonSet* dungeons = NULL;
|
||||
if (grp)
|
||||
{
|
||||
Player* plrg = NULL;
|
||||
@@ -666,19 +673,17 @@ void LFGMgr::Join(Player* plr)
|
||||
players.insert(plr);
|
||||
dungeons = GetDungeonsByRandom(*plr->GetLfgDungeons()->begin());
|
||||
playersLockMap = CheckCompatibleDungeons(dungeons, &players);
|
||||
if (dungeons && !dungeons->size())
|
||||
{
|
||||
delete dungeons;
|
||||
dungeons = NULL;
|
||||
}
|
||||
}
|
||||
else
|
||||
dungeons = plr->GetLfgDungeons();
|
||||
|
||||
if (!dungeons || !dungeons->size())
|
||||
{
|
||||
if (dungeons)
|
||||
{
|
||||
delete dungeons;
|
||||
dungeons = NULL;
|
||||
}
|
||||
plr->GetSession()->SendLfgJoinResult(LFG_JOIN_NOT_MEET_REQS, 0, playersLockMap);
|
||||
}
|
||||
else
|
||||
{
|
||||
plr->GetSession()->SendLfgJoinResult(LFG_JOIN_OK, 0);
|
||||
|
||||
Reference in New Issue
Block a user