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>
|
/// <param name="Player*">Player</param>
|
||||||
void LFGMgr::Join(Player* plr)
|
void LFGMgr::Join(Player* plr)
|
||||||
{
|
{
|
||||||
|
LfgDungeonSet* dungeons = NULL;
|
||||||
Group* grp = plr->GetGroup();
|
Group* grp = plr->GetGroup();
|
||||||
|
|
||||||
if (grp && grp->GetLeaderGUID() != plr->GetGUID())
|
if (grp && grp->GetLeaderGUID() != plr->GetGUID())
|
||||||
@@ -573,8 +574,12 @@ void LFGMgr::Join(Player* plr)
|
|||||||
LfgQueueInfoMap::iterator itQueue = m_QueueInfoMap.find(guid);
|
LfgQueueInfoMap::iterator itQueue = m_QueueInfoMap.find(guid);
|
||||||
if (itQueue != m_QueueInfoMap.end())
|
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);
|
Leave(plr, grp);
|
||||||
|
result = LFG_JOIN_INTERNAL_ERROR;
|
||||||
}
|
}
|
||||||
else if (plr->InBattleground() || plr->InArena() || plr->InBattlegroundQueue())
|
else if (plr->InBattleground() || plr->InArena() || plr->InBattlegroundQueue())
|
||||||
result = LFG_JOIN_USING_BG_SYSTEM;
|
result = LFG_JOIN_USING_BG_SYSTEM;
|
||||||
@@ -584,15 +589,18 @@ void LFGMgr::Join(Player* plr)
|
|||||||
result = LFG_JOIN_RANDOM_COOLDOWN;
|
result = LFG_JOIN_RANDOM_COOLDOWN;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Check if all dungeons are valid
|
dungeons = plr->GetLfgDungeons();
|
||||||
for (LfgDungeonSet::const_iterator it = plr->GetLfgDungeons()->begin(); it != plr->GetLfgDungeons()->end(); ++it)
|
if (!dungeons || dungeons->size())
|
||||||
{
|
result = LFG_JOIN_NOT_MEET_REQS;
|
||||||
if (!GetDungeonGroupType(*it))
|
else // Check if all dungeons are valid
|
||||||
|
for (LfgDungeonSet::const_iterator it = dungeons->begin(); it != dungeons->end(); ++it)
|
||||||
{
|
{
|
||||||
result = LFG_JOIN_DUNGEON_INVALID;
|
if (!GetDungeonGroupType(*it))
|
||||||
break;
|
{
|
||||||
|
result = LFG_JOIN_DUNGEON_INVALID;
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Group checks
|
// Group checks
|
||||||
@@ -633,7 +641,6 @@ void LFGMgr::Join(Player* plr)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
LfgDungeonSet* dungeons = NULL;
|
|
||||||
if (grp)
|
if (grp)
|
||||||
{
|
{
|
||||||
Player* plrg = NULL;
|
Player* plrg = NULL;
|
||||||
@@ -666,19 +673,17 @@ void LFGMgr::Join(Player* plr)
|
|||||||
players.insert(plr);
|
players.insert(plr);
|
||||||
dungeons = GetDungeonsByRandom(*plr->GetLfgDungeons()->begin());
|
dungeons = GetDungeonsByRandom(*plr->GetLfgDungeons()->begin());
|
||||||
playersLockMap = CheckCompatibleDungeons(dungeons, &players);
|
playersLockMap = CheckCompatibleDungeons(dungeons, &players);
|
||||||
|
if (dungeons && !dungeons->size())
|
||||||
|
{
|
||||||
|
delete dungeons;
|
||||||
|
dungeons = NULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
dungeons = plr->GetLfgDungeons();
|
dungeons = plr->GetLfgDungeons();
|
||||||
|
|
||||||
if (!dungeons || !dungeons->size())
|
if (!dungeons || !dungeons->size())
|
||||||
{
|
|
||||||
if (dungeons)
|
|
||||||
{
|
|
||||||
delete dungeons;
|
|
||||||
dungeons = NULL;
|
|
||||||
}
|
|
||||||
plr->GetSession()->SendLfgJoinResult(LFG_JOIN_NOT_MEET_REQS, 0, playersLockMap);
|
plr->GetSession()->SendLfgJoinResult(LFG_JOIN_NOT_MEET_REQS, 0, playersLockMap);
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
plr->GetSession()->SendLfgJoinResult(LFG_JOIN_OK, 0);
|
plr->GetSession()->SendLfgJoinResult(LFG_JOIN_OK, 0);
|
||||||
|
|||||||
Reference in New Issue
Block a user