diff options
author | jackpoz <giacomopoz@gmail.com> | 2015-08-31 22:45:45 +0200 |
---|---|---|
committer | Carbenium <carbenium@outlook.com> | 2015-09-24 23:39:23 +0200 |
commit | f570a0064cc1cf8e53a5e6ed8f3e24003581955c (patch) | |
tree | c0f2ba5af1b18d0c06679a57ba6ede5357a5a52b /src/server/game/DungeonFinding/LFGQueue.cpp | |
parent | 7a2b87cefb1596520ad8882d5723ed8837b0486f (diff) |
Core/Dungeon Finder: Add LFG roles of group members in LFG logs
This changes logs like "(1|18)" to "(1 Healer, Dps|18 Tank, Healer, Dps)"
(cherry picked from commit 1e71aba2ee656a8407dec63a69d0879e16a070e2)
Diffstat (limited to 'src/server/game/DungeonFinding/LFGQueue.cpp')
-rw-r--r-- | src/server/game/DungeonFinding/LFGQueue.cpp | 69 |
1 files changed, 56 insertions, 13 deletions
diff --git a/src/server/game/DungeonFinding/LFGQueue.cpp b/src/server/game/DungeonFinding/LFGQueue.cpp index 20aeaa4ea6e..c5083ae8b0a 100644 --- a/src/server/game/DungeonFinding/LFGQueue.cpp +++ b/src/server/game/DungeonFinding/LFGQueue.cpp @@ -80,6 +80,49 @@ char const* GetCompatibleString(LfgCompatibility compatibles) } } +std::string LFGQueue::GetDetailedMatchRoles(GuidList const& check) +{ + if (check.empty()) + return ""; + + // need the guids in order to avoid duplicates + GuidSet guids(check.begin(), check.end()); + + std::ostringstream o; + + GuidSet::const_iterator it = guids.begin(); + o << it->ToString(); + LfgQueueDataContainer::iterator itQueue = QueueDataStore.find(*it); + if (itQueue == QueueDataStore.end()) + { + TC_LOG_ERROR("lfg.queue.data.details", "Queue data not found for [%s]", it->ToString().c_str()); + o << ' ' << GetRolesString(PLAYER_ROLE_NONE); + } + else + { + // skip leader flag, log only dps/tank/healer + o << ' ' << GetRolesString(itQueue->second.roles[*it] & uint8(~PLAYER_ROLE_LEADER)); + } + + for (++it; it != guids.end(); ++it) + { + o << '|' << it->ToString(); + itQueue = QueueDataStore.find(*it); + if (itQueue == QueueDataStore.end()) + { + TC_LOG_ERROR("lfg.queue.data.details", "Queue data not found for [%s]", it->ToString().c_str()); + o << ' ' << GetRolesString(PLAYER_ROLE_NONE); + } + else + { + // skip leader flag, log only dps/tank/healer + o << ' ' << GetRolesString(itQueue->second.roles[*it] & uint8(~PLAYER_ROLE_LEADER)); + } + } + + return o.str(); +} + void LFGQueue::AddToQueue(ObjectGuid guid) { LfgQueueDataContainer::iterator itQueue = QueueDataStore.find(guid); @@ -278,13 +321,13 @@ LfgCompatibility LFGQueue::FindNewGroups(GuidList& check, GuidList& all) std::string strGuids = ConcatenateGuids(check); LfgCompatibility compatibles = GetCompatibles(strGuids); - TC_LOG_DEBUG("lfg.queue.match.check", "Guids: (%s): %s - all(%s)", strGuids.c_str(), GetCompatibleString(compatibles), ConcatenateGuids(all).c_str()); + TC_LOG_DEBUG("lfg.queue.match.check", "Guids: (%s): %s - all(%s)", GetDetailedMatchRoles(check).c_str(), GetCompatibleString(compatibles), GetDetailedMatchRoles(all).c_str()); if (compatibles == LFG_COMPATIBILITY_PENDING) // Not previously cached, calculate compatibles = CheckCompatibility(check); if (compatibles == LFG_COMPATIBLES_BAD_STATES && sLFGMgr->AllQueued(check)) { - TC_LOG_DEBUG("lfg.queue.match.check", "Guids: (%s) compatibles (cached) changed from bad states to match", strGuids.c_str()); + TC_LOG_DEBUG("lfg.queue.match.check", "Guids: (%s) compatibles (cached) changed from bad states to match", GetDetailedMatchRoles(check).c_str()); SetCompatibles(strGuids, LFG_COMPATIBLES_MATCH); return LFG_COMPATIBLES_MATCH; } @@ -322,7 +365,7 @@ LfgCompatibility LFGQueue::CheckCompatibility(GuidList check) // Check for correct size if (check.size() > MAX_GROUP_SIZE || check.empty()) { - TC_LOG_DEBUG("lfg.queue.match.compatibility.check", "Guids: (%s): Size wrong - Not compatibles", strGuids.c_str()); + TC_LOG_DEBUG("lfg.queue.match.compatibility.check", "Guids: (%s): Size wrong - Not compatibles", GetDetailedMatchRoles(check).c_str()); return LFG_INCOMPATIBLES_WRONG_GROUP_SIZE; } @@ -336,7 +379,7 @@ LfgCompatibility LFGQueue::CheckCompatibility(GuidList check) LfgCompatibility child_compatibles = CheckCompatibility(check); if (child_compatibles < LFG_COMPATIBLES_WITH_LESS_PLAYERS) // Group not compatible { - TC_LOG_DEBUG("lfg.queue.match.compatibility.check", "Guids: (%s) child %s not compatibles", strGuids.c_str(), ConcatenateGuids(check).c_str()); + TC_LOG_DEBUG("lfg.queue.match.compatibility.check", "Guids: (%s) child %s not compatibles", strGuids.c_str(), GetDetailedMatchRoles(check).c_str()); SetCompatibles(strGuids, child_compatibles); return child_compatibles; } @@ -374,7 +417,7 @@ LfgCompatibility LFGQueue::CheckCompatibility(GuidList check) // Group with less that MAX_GROUP_SIZE members always compatible if (check.size() == 1 && numPlayers != MAX_GROUP_SIZE) { - TC_LOG_DEBUG("lfg.queue.match.compatibility.check", "Guids: (%s) single group. Compatibles", strGuids.c_str()); + TC_LOG_DEBUG("lfg.queue.match.compatibility.check", "Guids: (%s) single group. Compatibles", GetDetailedMatchRoles(check).c_str()); LfgQueueDataContainer::iterator itQueue = QueueDataStore.find(check.front()); LfgCompatibilityData data(LFG_COMPATIBLES_WITH_LESS_PLAYERS); @@ -388,14 +431,14 @@ LfgCompatibility LFGQueue::CheckCompatibility(GuidList check) if (numLfgGroups > 1) { - TC_LOG_DEBUG("lfg.queue.match.compatibility.check", "Guids: (%s) More than one Lfggroup (%u)", strGuids.c_str(), numLfgGroups); + TC_LOG_DEBUG("lfg.queue.match.compatibility.check", "Guids: (%s) More than one Lfggroup (%u)", GetDetailedMatchRoles(check).c_str(), numLfgGroups); SetCompatibles(strGuids, LFG_INCOMPATIBLES_MULTIPLE_LFG_GROUPS); return LFG_INCOMPATIBLES_MULTIPLE_LFG_GROUPS; } if (numPlayers > MAX_GROUP_SIZE) { - TC_LOG_DEBUG("lfg.queue.match.compatibility.check", "Guids: (%s) Too much players (%u)", strGuids.c_str(), numPlayers); + TC_LOG_DEBUG("lfg.queue.match.compatibility.check", "Guids: (%s) Too much players (%u)", GetDetailedMatchRoles(check).c_str(), numPlayers); SetCompatibles(strGuids, LFG_INCOMPATIBLES_TOO_MUCH_PLAYERS); return LFG_INCOMPATIBLES_TOO_MUCH_PLAYERS; } @@ -423,7 +466,7 @@ LfgCompatibility LFGQueue::CheckCompatibility(GuidList check) if (uint8 playersize = numPlayers - proposalRoles.size()) { - TC_LOG_DEBUG("lfg.queue.match.compatibility.check", "Guids: (%s) not compatible, %u players are ignoring each other", strGuids.c_str(), playersize); + TC_LOG_DEBUG("lfg.queue.match.compatibility.check", "Guids: (%s) not compatible, %u players are ignoring each other", GetDetailedMatchRoles(check).c_str(), playersize); SetCompatibles(strGuids, LFG_INCOMPATIBLES_HAS_IGNORES); return LFG_INCOMPATIBLES_HAS_IGNORES; } @@ -435,7 +478,7 @@ LfgCompatibility LFGQueue::CheckCompatibility(GuidList check) for (LfgRolesMap::const_iterator it = debugRoles.begin(); it != debugRoles.end(); ++it) o << ", " << it->first << ": " << GetRolesString(it->second); - TC_LOG_DEBUG("lfg.queue.match.compatibility.check", "Guids: (%s) Roles not compatible%s", strGuids.c_str(), o.str().c_str()); + TC_LOG_DEBUG("lfg.queue.match.compatibility.check", "Guids: (%s) Roles not compatible%s", GetDetailedMatchRoles(check).c_str(), o.str().c_str()); SetCompatibles(strGuids, LFG_INCOMPATIBLES_NO_ROLES); return LFG_INCOMPATIBLES_NO_ROLES; } @@ -455,7 +498,7 @@ LfgCompatibility LFGQueue::CheckCompatibility(GuidList check) if (proposalDungeons.empty()) { - TC_LOG_DEBUG("lfg.queue.match.compatibility.check", "Guids: (%s) No compatible dungeons%s", strGuids.c_str(), o.str().c_str()); + TC_LOG_DEBUG("lfg.queue.match.compatibility.check", "Guids: (%s) No compatible dungeons%s", GetDetailedMatchRoles(check).c_str(), o.str().c_str()); SetCompatibles(strGuids, LFG_INCOMPATIBLES_NO_DUNGEONS); return LFG_INCOMPATIBLES_NO_DUNGEONS; } @@ -472,7 +515,7 @@ LfgCompatibility LFGQueue::CheckCompatibility(GuidList check) // Enough players? if (numPlayers != MAX_GROUP_SIZE) { - TC_LOG_DEBUG("lfg.queue.match.compatibility.check", "Guids: (%s) Compatibles but not enough players(%u)", strGuids.c_str(), numPlayers); + TC_LOG_DEBUG("lfg.queue.match.compatibility.check", "Guids: (%s) Compatibles but not enough players(%u)", GetDetailedMatchRoles(check).c_str(), numPlayers); LfgCompatibilityData data(LFG_COMPATIBLES_WITH_LESS_PLAYERS); data.roles = proposalRoles; @@ -489,7 +532,7 @@ LfgCompatibility LFGQueue::CheckCompatibility(GuidList check) if (!sLFGMgr->AllQueued(check)) { - TC_LOG_DEBUG("lfg.queue.match.compatibility.check", "Guids: (%s) Group MATCH but can't create proposal!", strGuids.c_str()); + TC_LOG_DEBUG("lfg.queue.match.compatibility.check", "Guids: (%s) Group MATCH but can't create proposal!", GetDetailedMatchRoles(check).c_str()); SetCompatibles(strGuids, LFG_COMPATIBLES_BAD_STATES); return LFG_COMPATIBLES_BAD_STATES; } @@ -531,7 +574,7 @@ LfgCompatibility LFGQueue::CheckCompatibility(GuidList check) sLFGMgr->AddProposal(proposal); - TC_LOG_DEBUG("lfg.queue.match.compatibility.check", "Guids: (%s) MATCH! Group formed", strGuids.c_str()); + TC_LOG_DEBUG("lfg.queue.match.compatibility.check", "Guids: (%s) MATCH! Group formed", GetDetailedMatchRoles(check).c_str()); SetCompatibles(strGuids, LFG_COMPATIBLES_MATCH); return LFG_COMPATIBLES_MATCH; } |