mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-15 23:20:36 +01:00
Core/Dungeon Finder: Add some more debug msgs and restore LFG group structure at server load.
This commit is contained in:
@@ -93,11 +93,16 @@ LfgState LfgGroupData::GetOldState() const
|
||||
return m_OldState;
|
||||
}
|
||||
|
||||
const LfgGuidSet &LfgGroupData::GetPlayers() const
|
||||
LfgGuidSet const& LfgGroupData::GetPlayers() const
|
||||
{
|
||||
return m_Players;
|
||||
}
|
||||
|
||||
uint8 LfgGroupData::GetPlayerCount() const
|
||||
{
|
||||
return m_Players.size();
|
||||
}
|
||||
|
||||
uint64 LfgGroupData::GetLeader() const
|
||||
{
|
||||
return m_Leader;
|
||||
|
||||
@@ -54,6 +54,7 @@ class LfgGroupData
|
||||
LfgState GetState() const;
|
||||
LfgState GetOldState() const;
|
||||
LfgGuidSet const& GetPlayers() const;
|
||||
uint8 GetPlayerCount() const;
|
||||
uint64 GetLeader() const;
|
||||
|
||||
// Dungeon
|
||||
|
||||
@@ -1626,6 +1626,18 @@ uint32 LFGMgr::GetDungeon(uint64 guid, bool asId /*= true */)
|
||||
return dungeon;
|
||||
}
|
||||
|
||||
uint32 LFGMgr::GetDungeonMapId(uint64 guid)
|
||||
{
|
||||
uint32 dungeonId = m_Groups[guid].GetDungeon(true);
|
||||
uint32 mapId = 0;
|
||||
if (dungeonId)
|
||||
if (LFGDungeonData const* dungeon = GetLFGDungeon(dungeonId))
|
||||
mapId = dungeon->map;
|
||||
|
||||
sLog->outDebug(LOG_FILTER_LFG, "LFGMgr::GetDungeonMapId: [" UI64FMTD "] = %u (DungeonId = %u)", guid, mapId, dungeonId);
|
||||
return mapId;
|
||||
}
|
||||
|
||||
uint8 LFGMgr::GetRoles(uint64 guid)
|
||||
{
|
||||
uint8 roles = m_Players[guid].GetRoles();
|
||||
@@ -1798,11 +1810,16 @@ void LFGMgr::SetGroup(uint64 guid, uint64 group)
|
||||
m_Players[guid].SetGroup(group);
|
||||
}
|
||||
|
||||
const LfgGuidSet& LFGMgr::GetPlayers(uint64 guid)
|
||||
LfgGuidSet const& LFGMgr::GetPlayers(uint64 guid)
|
||||
{
|
||||
return m_Groups[guid].GetPlayers();
|
||||
}
|
||||
|
||||
uint8 LFGMgr::GetPlayerCount(uint64 guid)
|
||||
{
|
||||
return m_Groups[guid].GetPlayerCount();
|
||||
}
|
||||
|
||||
uint64 LFGMgr::GetLeader(uint64 guid)
|
||||
{
|
||||
return m_Groups[guid].GetLeader();
|
||||
@@ -1885,7 +1902,7 @@ LfgQueue& LFGMgr::GetQueue(uint64 guid)
|
||||
return m_Queues[queueId];
|
||||
}
|
||||
|
||||
bool LFGMgr::AllQueued(const LfgGuidList& check)
|
||||
bool LFGMgr::AllQueued(LfgGuidList const& check)
|
||||
{
|
||||
if (check.empty())
|
||||
return false;
|
||||
@@ -1933,7 +1950,7 @@ bool LFGMgr::IsSeasonActive(uint32 dungeonId)
|
||||
return false;
|
||||
}
|
||||
|
||||
std::string LFGMgr::DumpQueueInfo(bool /*full*/)
|
||||
std::string LFGMgr::DumpQueueInfo(bool full)
|
||||
{
|
||||
uint32 size = uint32(m_Queues.size());
|
||||
std::ostringstream o;
|
||||
@@ -1942,15 +1959,19 @@ std::string LFGMgr::DumpQueueInfo(bool /*full*/)
|
||||
for (LfgQueueMap::const_iterator itr = m_Queues.begin(); itr != m_Queues.end(); ++itr)
|
||||
{
|
||||
std::string const& queued = itr->second.DumpQueueInfo();
|
||||
std::string const& compatibles = itr->second.DumpCompatibleInfo();
|
||||
std::string const& compatibles = itr->second.DumpCompatibleInfo(full);
|
||||
o << queued << compatibles;
|
||||
/*
|
||||
if (full)
|
||||
{
|
||||
LfgCompatibleMap const& compatibles = itr->second.GetCompatibleMap();
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
return o.str();
|
||||
}
|
||||
|
||||
void LFGMgr::SetupGroupMember(uint64 guid, uint64 gguid)
|
||||
{
|
||||
LfgDungeonSet dungeons;
|
||||
dungeons.insert(GetDungeon(gguid));
|
||||
SetSelectedDungeons(guid, dungeons);
|
||||
SetState(guid, GetState(gguid));
|
||||
SetGroup(guid, gguid);
|
||||
AddPlayerToGroup(gguid, guid);
|
||||
}
|
||||
|
||||
@@ -328,7 +328,6 @@ class LFGMgr
|
||||
void SetGroup(uint64 guid, uint64 group);
|
||||
void SetLeader(uint64 gguid, uint64 leader);
|
||||
void SetState(uint64 guid, LfgState state);
|
||||
void SetSelectedDungeons(uint64 guid, LfgDungeonSet const& dungeons);
|
||||
|
||||
void _LoadFromDB(Field* fields, uint64 guid);
|
||||
void _SaveToDB(uint64 guid, uint32 db_guid);
|
||||
@@ -341,6 +340,7 @@ class LFGMgr
|
||||
LfgLockMap const& GetLockedDungeons(uint64 guid);
|
||||
LfgDungeonSet const& GetSelectedDungeons(uint64 guid);
|
||||
uint32 GetDungeon(uint64 guid, bool asId = true);
|
||||
uint32 GetDungeonMapId(uint64 guid);
|
||||
LfgState GetState(uint64 guid);
|
||||
uint8 GetKicksLeft(uint64 gguid);
|
||||
uint64 GetLeader(uint64 guid);
|
||||
@@ -348,6 +348,7 @@ class LFGMgr
|
||||
uint8 GetRoles(uint64 guid);
|
||||
std::string const& GetComment(uint64 gguid);
|
||||
LfgGuidSet const& GetPlayers(uint64 guid);
|
||||
uint8 GetPlayerCount(uint64 guid);
|
||||
|
||||
bool IsTeleported(uint64 guid);
|
||||
|
||||
@@ -370,13 +371,15 @@ class LFGMgr
|
||||
void LoadLFGDungeons(bool reload = false);
|
||||
LFGDungeonData const* GetLFGDungeon(uint32 id);
|
||||
LFGDungeonMap& GetLFGDungeonMap();
|
||||
private:
|
||||
|
||||
uint8 GetTeam(uint64 guid);
|
||||
void SetupGroupMember(uint64 guid, uint64 gguid);
|
||||
uint64 GetGroup(uint64 guid);
|
||||
|
||||
private:
|
||||
uint8 GetTeam(uint64 guid);
|
||||
void RestoreState(uint64 guid, char const *debugMsg);
|
||||
void ClearState(uint64 guid, char const *debugMsg);
|
||||
void SetDungeon(uint64 guid, uint32 dungeon);
|
||||
void SetSelectedDungeons(uint64 guid, LfgDungeonSet const& dungeons);
|
||||
void SetLockedDungeons(uint64 guid, LfgLockMap const& lock);
|
||||
void DecreaseKicksLeft(uint64 guid);
|
||||
|
||||
|
||||
@@ -244,9 +244,16 @@ LfgCompatibility LfgQueue::FindNewGroups(LfgGuidList& check, LfgGuidList& all)
|
||||
LfgCompatibility compatibles = GetCompatibles(strGuids);
|
||||
|
||||
sLog->outDebug(LOG_FILTER_LFG, "LFGQueue::FindNewGroup: (%s): %s - all(%s)", strGuids.c_str(), GetCompatibleString(compatibles), ConcatenateGuids(all).c_str());
|
||||
if (compatibles == LFG_COMPATIBILITY_PENDING || compatibles == LFG_COMPATIBLES_BAD_STATES) // Not previously cached, calculate
|
||||
if (compatibles == LFG_COMPATIBILITY_PENDING) // Not previously cached, calculate
|
||||
compatibles = CheckCompatibility(check);
|
||||
|
||||
if (compatibles == LFG_COMPATIBLES_BAD_STATES && sLFGMgr->AllQueued(check))
|
||||
{
|
||||
sLog->outDebug(LOG_FILTER_LFG, "LFGQueue::FindNewGroup: (%s) compatibles (cached) changed from bad states to match", strGuids.c_str());
|
||||
SetCompatibles(strGuids, LFG_COMPATIBLES_MATCH);
|
||||
return LFG_COMPATIBLES_MATCH;
|
||||
}
|
||||
|
||||
if (compatibles != LFG_COMPATIBLES_WITH_LESS_PLAYERS)
|
||||
return compatibles;
|
||||
|
||||
@@ -366,7 +373,7 @@ LfgCompatibility LfgQueue::CheckCompatibility(LfgGuidList check)
|
||||
for (itPlayer = proposalRoles.begin(); itPlayer != proposalRoles.end(); ++itPlayer)
|
||||
{
|
||||
if (itRoles->first == itPlayer->first)
|
||||
sLog->outDebug(LOG_FILTER_LFG, "LFGQueue::CheckCompatibility: ERROR! Player multiple times in queue! [" UI64FMTD "]", itRoles->first);
|
||||
sLog->outError(LOG_FILTER_LFG, "LFGQueue::CheckCompatibility: ERROR! Player multiple times in queue! [" UI64FMTD "]", itRoles->first);
|
||||
else if (sLFGMgr->HasIgnore(itRoles->first, itPlayer->first))
|
||||
break;
|
||||
}
|
||||
@@ -559,23 +566,24 @@ std::string LfgQueue::DumpQueueInfo() const
|
||||
if (IS_GROUP(guid))
|
||||
{
|
||||
groups++;
|
||||
if (Group const* group = sGroupMgr->GetGroupByGUID(GUID_LOPART(guid)))
|
||||
playersInGroup += group->GetMembersCount();
|
||||
else
|
||||
playersInGroup += 2; // Shouldn't happen but just in case
|
||||
playersInGroup += sLFGMgr->GetPlayerCount(guid);
|
||||
}
|
||||
else
|
||||
players++;
|
||||
}
|
||||
}
|
||||
std::ostringstream o;
|
||||
o << "Queued Players: " << players << "(in group: " << playersInGroup << ") Groups: " << groups << "\n";
|
||||
o << "Queued Players: " << players << " (in group: " << playersInGroup << ") Groups: " << groups << "\n";
|
||||
return o.str();
|
||||
}
|
||||
|
||||
std::string LfgQueue::DumpCompatibleInfo() const
|
||||
std::string LfgQueue::DumpCompatibleInfo(bool full /* = false */) const
|
||||
{
|
||||
std::ostringstream o;
|
||||
o << "Compatible Map size: " << m_CompatibleMap.size() << "\n";
|
||||
if (full)
|
||||
for (LfgCompatibleMap::const_iterator itr = m_CompatibleMap.begin(); itr != m_CompatibleMap.end(); ++itr)
|
||||
o << "(" << itr->first << "): " << GetCompatibleString(itr->second) << "\n";
|
||||
|
||||
return o.str();
|
||||
}
|
||||
|
||||
@@ -110,7 +110,7 @@ class LfgQueue
|
||||
// Just for debugging purposes
|
||||
LfgCompatibleMap const& GetCompatibleMap();
|
||||
std::string DumpQueueInfo() const;
|
||||
std::string DumpCompatibleInfo() const;
|
||||
std::string DumpCompatibleInfo(bool full = false) const;
|
||||
private:
|
||||
void AddToNewQueue(uint64 guid);
|
||||
void AddToCurrentQueue(uint64 guid);
|
||||
|
||||
@@ -60,6 +60,21 @@ void LFGPlayerScript::OnLogin(Player* player)
|
||||
if (!sLFGMgr->isOptionEnabled(LFG_OPTION_ENABLE_DUNGEON_FINDER | LFG_OPTION_ENABLE_RAID_BROWSER))
|
||||
return;
|
||||
|
||||
// Temporal: Trying to determine when group data and LFG data gets desynched
|
||||
uint64 guid = player->GetGUID();
|
||||
uint64 gguid = sLFGMgr->GetGroup(guid);
|
||||
|
||||
if (Group const* group = player->GetGroup())
|
||||
{
|
||||
uint64 gguid2 = group->GetGUID();
|
||||
if (gguid != gguid2)
|
||||
{
|
||||
sLog->outError(LOG_FILTER_LFG, "%s on group %u but LFG has group %u saved... Fixing.",
|
||||
player->GetSession()->GetPlayerInfo().c_str(), GUID_LOPART(gguid2), GUID_LOPART(gguid));
|
||||
sLFGMgr->SetupGroupMember(guid, group->GetGUID());
|
||||
}
|
||||
}
|
||||
|
||||
sLFGMgr->InitializeLockedDungeons(player);
|
||||
sLFGMgr->SetTeam(player->GetGUID(), player->GetTeam());
|
||||
// TODO - Restore LfgPlayerData and send proper status to player if it was in a group
|
||||
|
||||
@@ -112,6 +112,7 @@ bool Group::Create(Player* leader)
|
||||
|
||||
if (!isLFGGroup())
|
||||
m_lootMethod = GROUP_LOOT;
|
||||
|
||||
m_lootThreshold = ITEM_QUALITY_UNCOMMON;
|
||||
m_looterGuid = leaderGuid;
|
||||
|
||||
@@ -222,12 +223,7 @@ void Group::LoadMemberFromDB(uint32 guidLow, uint8 memberFlags, uint8 subgroup,
|
||||
SubGroupCounterIncrease(subgroup);
|
||||
|
||||
if (isLFGGroup())
|
||||
{
|
||||
LfgDungeonSet Dungeons;
|
||||
Dungeons.insert(sLFGMgr->GetDungeon(GetGUID()));
|
||||
sLFGMgr->SetSelectedDungeons(member.guid, Dungeons);
|
||||
sLFGMgr->SetState(member.guid, sLFGMgr->GetState(GetGUID()));
|
||||
}
|
||||
sLFGMgr->SetupGroupMember(member.guid, GetGUID());
|
||||
}
|
||||
|
||||
void Group::ConvertToLFG()
|
||||
@@ -601,9 +597,9 @@ bool Group::RemoveMember(uint64 guid, const RemoveMethod &method /*= GROUP_REMOV
|
||||
|
||||
if (isLFGGroup() && GetMembersCount() == 1)
|
||||
{
|
||||
Player* Leader = ObjectAccessor::FindPlayer(GetLeaderGUID());
|
||||
LFGDungeonData const* dungeon = sLFGMgr->GetLFGDungeon(sLFGMgr->GetDungeon(GetGUID()));
|
||||
if ((Leader && dungeon && Leader->isAlive() && Leader->GetMapId() != uint32(dungeon->map)) || !dungeon)
|
||||
Player* leader = ObjectAccessor::FindPlayer(GetLeaderGUID());
|
||||
uint32 mapId = sLFGMgr->GetDungeonMapId(GetGUID());
|
||||
if (!mapId || !leader || (leader->isAlive() && leader->GetMapId() != mapId))
|
||||
{
|
||||
Disband();
|
||||
return false;
|
||||
|
||||
@@ -893,17 +893,6 @@ void WorldSession::HandlePlayerLogin(LoginQueryHolder* holder)
|
||||
}
|
||||
}
|
||||
|
||||
if (Group* group = pCurrChar->GetGroup())
|
||||
{
|
||||
if (group->isLFGGroup())
|
||||
{
|
||||
LfgDungeonSet Dungeons;
|
||||
Dungeons.insert(sLFGMgr->GetDungeon(group->GetGUID()));
|
||||
sLFGMgr->SetSelectedDungeons(pCurrChar->GetGUID(), Dungeons);
|
||||
sLFGMgr->SetState(pCurrChar->GetGUID(), sLFGMgr->GetState(group->GetGUID()));
|
||||
}
|
||||
}
|
||||
|
||||
if (!pCurrChar->GetMap()->AddPlayerToMap(pCurrChar) || !pCurrChar->CheckInstanceLoginValid())
|
||||
{
|
||||
AreaTrigger const* at = sObjectMgr->GetGoBackTrigger(pCurrChar->GetMapId());
|
||||
@@ -1648,7 +1637,7 @@ void WorldSession::HandleCharFactionOrRaceChange(WorldPacket& recv_data)
|
||||
uint32 used_loginFlag = ((recv_data.GetOpcode() == CMSG_CHAR_RACE_CHANGE) ? AT_LOGIN_CHANGE_RACE : AT_LOGIN_CHANGE_FACTION);
|
||||
|
||||
if (!sObjectMgr->GetPlayerInfo(race, playerClass))
|
||||
{ops..
|
||||
{
|
||||
WorldPacket data(SMSG_CHAR_FACTION_CHANGE, 1);
|
||||
data << uint8(CHAR_CREATE_ERROR);
|
||||
SendPacket(&data);
|
||||
|
||||
@@ -114,9 +114,9 @@ public:
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool HandleLfgQueueInfoCommand(ChatHandler* handler, char const* /*args*/)
|
||||
static bool HandleLfgQueueInfoCommand(ChatHandler* handler, char const* args)
|
||||
{
|
||||
handler->SendSysMessage(sLFGMgr->DumpQueueInfo().c_str());
|
||||
handler->SendSysMessage(sLFGMgr->DumpQueueInfo(*args).c_str());
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user