aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rwxr-xr-xsrc/server/game/DungeonFinding/LFGMgr.cpp142
1 files changed, 83 insertions, 59 deletions
diff --git a/src/server/game/DungeonFinding/LFGMgr.cpp b/src/server/game/DungeonFinding/LFGMgr.cpp
index efb217ad803..3c4dc24e973 100755
--- a/src/server/game/DungeonFinding/LFGMgr.cpp
+++ b/src/server/game/DungeonFinding/LFGMgr.cpp
@@ -547,6 +547,9 @@ void LFGMgr::Join(Player* plr)
uint64 guid = grp ? grp->GetGUID() : plr->GetGUID();
LfgJoinResult result = LFG_JOIN_OK;
+ bool isDungeon = false;
+ bool isRaid = false;
+ LfgLockStatusMap* playersLockMap = NULL;
// Previous checks before joining
LfgQueueInfoMap::iterator itQueue = m_QueueInfoMap.find(guid);
if (itQueue != m_QueueInfoMap.end())
@@ -568,11 +571,12 @@ void LFGMgr::Join(Player* plr)
{
dungeons = plr->GetLfgDungeons();
if (!dungeons || !dungeons->size())
+ {
result = LFG_JOIN_NOT_MEET_REQS;
+ dungeons = NULL;
+ }
else // Check if all dungeons are valid
{
- bool isDungeon = false;
- bool isRaid = false;
LfgType type = LFG_TYPE_NONE;
for (LfgDungeonSet::const_iterator it = dungeons->begin(); it != dungeons->end(); ++it)
{
@@ -598,29 +602,48 @@ void LFGMgr::Join(Player* plr)
}
}
- // Group checks
- if (grp && result == LFG_JOIN_OK)
+ if (result == LFG_JOIN_OK)
{
- if (grp->GetMembersCount() > MAXGROUPSIZE)
- result = LFG_JOIN_TOO_MUCH_MEMBERS;
- else
+ if (grp)
{
- Player* plrg;
- uint8 memberCount = 0;
- for (GroupReference* itr = grp->GetFirstMember(); itr != NULL && result == LFG_JOIN_OK; itr = itr->next())
+ if (grp->GetMembersCount() > MAXGROUPSIZE)
+ result = LFG_JOIN_TOO_MUCH_MEMBERS;
+ else
{
- plrg = itr->getSource();
- if (plrg)
+ Player* plrg;
+ uint8 memberCount = 0;
+ for (GroupReference* itr = grp->GetFirstMember(); itr != NULL && result == LFG_JOIN_OK; itr = itr->next())
{
- if (plrg->HasAura(LFG_SPELL_DUNGEON_DESERTER))
- result = LFG_JOIN_PARTY_DESERTER;
- else if (plrg->HasAura(LFG_SPELL_DUNGEON_COOLDOWN))
- result = LFG_JOIN_PARTY_RANDOM_COOLDOWN;
- ++memberCount;
+ plrg = itr->getSource();
+ if (plrg)
+ {
+ if (plrg->HasAura(LFG_SPELL_DUNGEON_DESERTER))
+ result = LFG_JOIN_PARTY_DESERTER;
+ else if (plrg->HasAura(LFG_SPELL_DUNGEON_COOLDOWN))
+ result = LFG_JOIN_PARTY_RANDOM_COOLDOWN;
+ ++memberCount;
+ }
}
+ if (memberCount != grp->GetMembersCount())
+ result = LFG_JOIN_DISCONNECTED;
}
- if (memberCount != grp->GetMembersCount())
- result = LFG_JOIN_DISCONNECTED;
+ }
+ else
+ {
+ // Expand random dungeons and check restrictions
+ PlayerSet players;
+ players.insert(plr);
+ if (plr->GetLfgDungeons()->size() == 1 && isRandomDungeon(*plr->GetLfgDungeons()->begin()))
+ dungeons = GetDungeonsByRandom(*plr->GetLfgDungeons()->begin());
+ else
+ {
+ dungeons = new LfgDungeonSet();
+ for (LfgDungeonSet::const_iterator it = plr->GetLfgDungeons()->begin(); it != plr->GetLfgDungeons()->end(); ++it)
+ dungeons->insert(*it);
+ }
+ playersLockMap = CheckCompatibleDungeons(dungeons, &players);
+ if (!dungeons || !dungeons->size())
+ result = LFG_JOIN_NOT_MEET_REQS;
}
}
@@ -631,63 +654,64 @@ void LFGMgr::Join(Player* plr)
plr->SetLfgRoles(ROLE_NONE);
if (grp && !grp->isLFGGroup())
plr->SetLfgState(LFG_STATE_NONE);
- plr->GetSession()->SendLfgJoinResult(result);
- return;
- }
-
- if (grp)
- {
- Player* plrg = NULL;
- for (GroupReference* itr = plr->GetGroup()->GetFirstMember(); itr != NULL; itr = itr->next())
+ plr->GetSession()->SendLfgJoinResult(result, 0, playersLockMap);
+ if (playersLockMap)
{
- plrg = itr->getSource(); // Not null, checked earlier
- plrg->SetLfgState(LFG_STATE_LFG);
- if (plrg != plr)
+ for(LfgLockStatusMap::iterator it = playersLockMap->begin(); it != playersLockMap->end(); ++it)
{
- dungeons = plrg->GetLfgDungeons();
- dungeons->clear();
- for (LfgDungeonSet::const_iterator itDungeon = plr->GetLfgDungeons()->begin(); itDungeon != plr->GetLfgDungeons()->end(); ++itDungeon)
- dungeons->insert(*itDungeon);
+ it->second->clear();
+ delete it->second;
}
- plrg->GetSession()->SendLfgUpdateParty(LFG_UPDATETYPE_JOIN_PROPOSAL);
+ playersLockMap->clear();
+ delete playersLockMap;
}
- UpdateRoleCheck(grp, plr);
+ if (dungeons)
+ {
+ dungeons->clear();
+ delete dungeons;
+ }
+ return;
}
- else
- {
- plr->SetLfgState(LFG_STATE_LFG);
- LfgRolesMap roles;
- roles[plr->GetGUIDLow()] = plr->GetLfgRoles();
- // Expand random dungeons
- LfgLockStatusMap* playersLockMap = NULL;
- if (plr->GetLfgDungeons()->size() == 1 && isRandomDungeon(*plr->GetLfgDungeons()->begin()))
+ if (!isRaid) // At the moment do not allow to join Raid Browser
+ {
+ if (grp)
{
- PlayerSet players;
- players.insert(plr);
- dungeons = GetDungeonsByRandom(*plr->GetLfgDungeons()->begin());
- playersLockMap = CheckCompatibleDungeons(dungeons, &players);
- if (dungeons && !dungeons->size())
+ Player* plrg = NULL;
+ for (GroupReference* itr = plr->GetGroup()->GetFirstMember(); itr != NULL; itr = itr->next())
{
- delete dungeons;
- dungeons = NULL;
+ plrg = itr->getSource(); // Not null, checked earlier
+ plrg->SetLfgState(LFG_STATE_LFG);
+ if (plrg != plr)
+ {
+ dungeons = plrg->GetLfgDungeons();
+ dungeons->clear();
+ for (LfgDungeonSet::const_iterator itDungeon = plr->GetLfgDungeons()->begin(); itDungeon != plr->GetLfgDungeons()->end(); ++itDungeon)
+ dungeons->insert(*itDungeon);
+ }
+ plrg->GetSession()->SendLfgUpdateParty(LFG_UPDATETYPE_JOIN_PROPOSAL);
}
+ UpdateRoleCheck(grp, plr);
}
else
- dungeons = plr->GetLfgDungeons();
-
- if (!dungeons || !dungeons->size())
- plr->GetSession()->SendLfgJoinResult(LFG_JOIN_NOT_MEET_REQS, 0, playersLockMap);
- else
{
plr->GetSession()->SendLfgJoinResult(LFG_JOIN_OK, 0);
plr->GetSession()->SendLfgUpdatePlayer(LFG_UPDATETYPE_JOIN_PROPOSAL);
+ plr->SetLfgState(LFG_STATE_LFG);
+ LfgRolesMap roles;
+ roles[plr->GetGUIDLow()] = plr->GetLfgRoles();
AddToQueue(plr->GetGUID(), &roles, dungeons);
+ roles.clear();
}
- roles.clear();
}
- std::string dungeonsstr = ConcatenateDungeons(dungeons);
- sLog.outDebug("LFGMgr::Join: [" UI64FMTD "] joined with %u members. dungeons: %s", guid, grp ? grp->GetMembersCount() : 1, dungeonsstr.c_str());
+
+ if (dungeons)
+ {
+ std::string dungeonsstr = ConcatenateDungeons(dungeons);
+ sLog.outDebug("LFGMgr::Join: [" UI64FMTD "] joined with %u members. dungeons: %s", guid, grp ? grp->GetMembersCount() : 1, dungeonsstr.c_str());
+ dungeons->clear();
+ delete dungeons;
+ }
}
/// <summary>