mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-15 23:20:36 +01:00
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)"
This commit is contained in:
@@ -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->GetRawValue();
|
||||
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->GetRawValue();
|
||||
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() > MAXGROUPSIZE || 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 MAXGROUPSIZE members always compatible
|
||||
if (check.size() == 1 && numPlayers != MAXGROUPSIZE)
|
||||
{
|
||||
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 > MAXGROUPSIZE)
|
||||
{
|
||||
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.GetRawValue() << ": " << 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 != MAXGROUPSIZE)
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -88,6 +88,7 @@ class LFGQueue
|
||||
public:
|
||||
|
||||
// Add/Remove from queue
|
||||
std::string GetDetailedMatchRoles(GuidList const& check);
|
||||
void AddToQueue(ObjectGuid guid);
|
||||
void RemoveFromQueue(ObjectGuid guid);
|
||||
void AddQueueData(ObjectGuid guid, time_t joinTime, LfgDungeonSet const& dungeons, LfgRolesMap const& rolesMap);
|
||||
|
||||
Reference in New Issue
Block a user