aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/DungeonFinding/LFGMgr.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/server/game/DungeonFinding/LFGMgr.cpp')
-rw-r--r--src/server/game/DungeonFinding/LFGMgr.cpp45
1 files changed, 27 insertions, 18 deletions
diff --git a/src/server/game/DungeonFinding/LFGMgr.cpp b/src/server/game/DungeonFinding/LFGMgr.cpp
index bd8f1f81c1c..77c1bef1900 100644
--- a/src/server/game/DungeonFinding/LFGMgr.cpp
+++ b/src/server/game/DungeonFinding/LFGMgr.cpp
@@ -422,7 +422,7 @@ void LFGMgr::JoinLfg(Player* player, uint8 roles, LfgDungeonSet& dungeons)
// Check player or group member restrictions
if (!player->GetSession()->HasPermission(rbac::RBAC_PERM_JOIN_DUNGEON_FINDER))
- joinData.result = LFG_JOIN_NO_SLOTS_PLAYER;
+ joinData.result = LFG_JOIN_NO_SLOTS;
else if (player->InBattleground() || player->InArena() || player->InBattlegroundQueue())
joinData.result = LFG_JOIN_CANT_USE_DUNGEONS;
else if (player->HasAura(LFG_SPELL_DUNGEON_DESERTER))
@@ -430,9 +430,9 @@ void LFGMgr::JoinLfg(Player* player, uint8 roles, LfgDungeonSet& dungeons)
else if (player->HasAura(LFG_SPELL_DUNGEON_COOLDOWN))
joinData.result = LFG_JOIN_RANDOM_COOLDOWN_PLAYER;
else if (dungeons.empty())
- joinData.result = LFG_JOIN_NO_SLOTS_PLAYER;
+ joinData.result = LFG_JOIN_NO_SLOTS;
else if (player->HasAura(9454)) // check Freeze debuff
- joinData.result = LFG_JOIN_NO_SLOTS_PLAYER;
+ joinData.result = LFG_JOIN_NO_SLOTS;
else if (grp)
{
if (grp->GetMembersCount() > MAX_GROUP_SIZE)
@@ -453,7 +453,10 @@ void LFGMgr::JoinLfg(Player* player, uint8 roles, LfgDungeonSet& dungeons)
else if (plrg->InBattleground() || plrg->InArena() || plrg->InBattlegroundQueue())
joinData.result = LFG_JOIN_CANT_USE_DUNGEONS;
else if (plrg->HasAura(9454)) // check Freeze debuff
- joinData.result = LFG_JOIN_PARTY_NOT_MEET_REQS;
+ {
+ joinData.result = LFG_JOIN_NO_SLOTS;
+ joinData.playersMissingRequirement.push_back(&plrg->GetName());
+ }
++memberCount;
players.insert(plrg->GetGUID());
}
@@ -507,9 +510,9 @@ void LFGMgr::JoinLfg(Player* player, uint8 roles, LfgDungeonSet& dungeons)
dungeons = GetDungeonsByRandom(rDungeonId);
// if we have lockmap then there are no compatible dungeons
- GetCompatibleDungeons(dungeons, players, joinData.lockmap, isContinue);
+ GetCompatibleDungeons(&dungeons, players, &joinData.lockmap, &joinData.playersMissingRequirement, isContinue);
if (dungeons.empty())
- joinData.result = grp ? LFG_JOIN_NO_LFG_OBJECT : LFG_JOIN_NO_SLOTS_PLAYER;
+ joinData.result = LFG_JOIN_NO_SLOTS;
}
}
@@ -782,22 +785,23 @@ void LFGMgr::UpdateRoleCheck(ObjectGuid gguid, ObjectGuid guid /* = ObjectGuid::
@param[in] players Set of players to check their dungeon restrictions
@param[out] lockMap Map of players Lock status info of given dungeons (Empty if dungeons is not empty)
*/
-void LFGMgr::GetCompatibleDungeons(LfgDungeonSet& dungeons, GuidSet const& players, LfgLockPartyMap& lockMap, bool isContinue)
+void LFGMgr::GetCompatibleDungeons(LfgDungeonSet* dungeons, GuidSet const& players, LfgLockPartyMap* lockMap, std::vector<std::string const*>* playersMissingRequirement, bool isContinue)
{
- lockMap.clear();
+ lockMap->clear();
std::map<uint32, uint32> lockedDungeons;
+ std::unordered_set<uint32> dungeonsToRemove;
- for (GuidSet::const_iterator it = players.begin(); it != players.end() && !dungeons.empty(); ++it)
+ for (GuidSet::const_iterator it = players.begin(); it != players.end() && !dungeons->empty(); ++it)
{
ObjectGuid guid = (*it);
- LfgLockMap const& cachedLockMap = GetLockedDungeons(guid);
+ LfgLockMap cachedLockMap = GetLockedDungeons(guid);
Player* player = ObjectAccessor::FindConnectedPlayer(guid);
- for (LfgLockMap::const_iterator it2 = cachedLockMap.begin(); it2 != cachedLockMap.end() && !dungeons.empty(); ++it2)
+ for (LfgLockMap::const_iterator it2 = cachedLockMap.begin(); it2 != cachedLockMap.end() && !dungeons->empty(); ++it2)
{
uint32 dungeonId = (it2->first & 0x00FFFFFF); // Compare dungeon ids
- LfgDungeonSet::iterator itDungeon = dungeons.find(dungeonId);
- if (itDungeon != dungeons.end())
+ LfgDungeonSet::iterator itDungeon = dungeons->find(dungeonId);
+ if (itDungeon != dungeons->end())
{
bool eraseDungeon = true;
@@ -822,14 +826,19 @@ void LFGMgr::GetCompatibleDungeons(LfgDungeonSet& dungeons, GuidSet const& playe
}
if (eraseDungeon)
- dungeons.erase(itDungeon);
+ dungeonsToRemove.insert(dungeonId);
- lockMap[guid][dungeonId] = it2->second;
+ (*lockMap)[guid][dungeonId] = it2->second;
+ playersMissingRequirement->push_back(&player->GetName());
}
}
}
- if (!dungeons.empty())
- lockMap.clear();
+
+ for (uint32 dungeonIdToRemove : dungeonsToRemove)
+ dungeons->erase(dungeonIdToRemove);
+
+ if (!dungeons->empty())
+ lockMap->clear();
}
/**
@@ -1601,7 +1610,7 @@ LfgDungeonSet const& LFGMgr::GetSelectedDungeons(ObjectGuid guid)
return PlayersStore[guid].GetSelectedDungeons();
}
-LfgLockMap const LFGMgr::GetLockedDungeons(ObjectGuid guid)
+LfgLockMap LFGMgr::GetLockedDungeons(ObjectGuid guid)
{
TC_LOG_TRACE("lfg.data.player.dungeons.locked.get", "Player: %s, LockedDungeons.", guid.ToString().c_str());
LfgLockMap lock;