fix(Core/LFG): Fixed showing dungeon access requirements only for lea… (#14116)

fix(Core/LFG): Fixed showing dungeon access requirements only for leaders in LFG.

Fixes #14070
This commit is contained in:
UltraNix
2022-12-25 14:17:15 +01:00
committed by GitHub
parent 2e001e7a6d
commit 49ad7402d9
4 changed files with 32 additions and 23 deletions
+12 -4
View File
@@ -269,7 +269,7 @@ namespace lfg
// Recalculate locked dungeons // Recalculate locked dungeons
for (LfgPlayerDataContainer::const_iterator it = PlayersStore.begin(); it != PlayersStore.end(); ++it) for (LfgPlayerDataContainer::const_iterator it = PlayersStore.begin(); it != PlayersStore.end(); ++it)
if (Player* player = ObjectAccessor::FindConnectedPlayer(it->first)) if (Player* player = ObjectAccessor::FindConnectedPlayer(it->first))
InitializeLockedDungeons(player); InitializeLockedDungeons(player, nullptr);
} }
} }
@@ -388,11 +388,10 @@ namespace lfg
@param[in] player Player we need to initialize the lock status map @param[in] player Player we need to initialize the lock status map
*/ */
void LFGMgr::InitializeLockedDungeons(Player* player, uint8 level /* = 0 */) void LFGMgr::InitializeLockedDungeons(Player* player, Group const* group)
{ {
ObjectGuid guid = player->GetGUID(); ObjectGuid guid = player->GetGUID();
if (!level) uint8 level = player->getLevel();
level = player->getLevel();
uint8 expansion = player->GetSession()->Expansion(); uint8 expansion = player->GetSession()->Expansion();
LfgDungeonSet const& dungeons = GetDungeonsByRandom(0); LfgDungeonSet const& dungeons = GetDungeonsByRandom(0);
LfgLockMap lock; LfgLockMap lock;
@@ -428,6 +427,8 @@ namespace lfg
{ {
// Check required items // Check required items
for (const ProgressionRequirement* itemRequirement : ar->items) for (const ProgressionRequirement* itemRequirement : ar->items)
{
if (!itemRequirement->checkLeaderOnly || !group || group->GetLeaderGUID() == player->GetGUID())
{ {
if (itemRequirement->faction == TEAM_NEUTRAL || itemRequirement->faction == player->GetTeamId(true)) if (itemRequirement->faction == TEAM_NEUTRAL || itemRequirement->faction == player->GetTeamId(true))
{ {
@@ -438,9 +439,12 @@ namespace lfg
} }
} }
} }
}
//Check for quests //Check for quests
for (const ProgressionRequirement* questRequirement : ar->quests) for (const ProgressionRequirement* questRequirement : ar->quests)
{
if (!questRequirement->checkLeaderOnly || !group || group->GetLeaderGUID() == player->GetGUID())
{ {
if (questRequirement->faction == TEAM_NEUTRAL || questRequirement->faction == player->GetTeamId(true)) if (questRequirement->faction == TEAM_NEUTRAL || questRequirement->faction == player->GetTeamId(true))
{ {
@@ -451,6 +455,7 @@ namespace lfg
} }
} }
} }
}
//Check for ilvl //Check for ilvl
if (ar->reqItemLevel && (float)ar->reqItemLevel > avgItemLevel) if (ar->reqItemLevel && (float)ar->reqItemLevel > avgItemLevel)
@@ -460,6 +465,8 @@ namespace lfg
//Check if player has the required achievements //Check if player has the required achievements
for (const ProgressionRequirement* achievementRequirement : ar->achievements) for (const ProgressionRequirement* achievementRequirement : ar->achievements)
{
if (!achievementRequirement->checkLeaderOnly || !group || group->GetLeaderGUID() == player->GetGUID())
{ {
if (achievementRequirement->faction == TEAM_NEUTRAL || achievementRequirement->faction == player->GetTeamId(true)) if (achievementRequirement->faction == TEAM_NEUTRAL || achievementRequirement->faction == player->GetTeamId(true))
{ {
@@ -471,6 +478,7 @@ namespace lfg
} }
} }
} }
}
sScriptMgr->OnInitializeLockedDungeons(player, level, lockData, dungeon); sScriptMgr->OnInitializeLockedDungeons(player, level, lockData, dungeon);
+1 -1
View File
@@ -491,7 +491,7 @@ namespace lfg
/// Get leader of the group (using internal data) /// Get leader of the group (using internal data)
ObjectGuid GetLeader(ObjectGuid guid); ObjectGuid GetLeader(ObjectGuid guid);
/// Initializes locked dungeons for given player (called at login or level change) /// Initializes locked dungeons for given player (called at login or level change)
void InitializeLockedDungeons(Player* player, uint8 level = 0); void InitializeLockedDungeons(Player* player, Group const* group = nullptr);
/// Sets player team /// Sets player team
void SetTeam(ObjectGuid guid, TeamId teamId); void SetTeam(ObjectGuid guid, TeamId teamId);
/// Sets player group /// Sets player group
@@ -36,7 +36,7 @@ namespace lfg
if (!sLFGMgr->isOptionEnabled(LFG_OPTION_ENABLE_DUNGEON_FINDER | LFG_OPTION_ENABLE_RAID_BROWSER | LFG_OPTION_ENABLE_SEASONAL_BOSSES)) if (!sLFGMgr->isOptionEnabled(LFG_OPTION_ENABLE_DUNGEON_FINDER | LFG_OPTION_ENABLE_RAID_BROWSER | LFG_OPTION_ENABLE_SEASONAL_BOSSES))
return; return;
sLFGMgr->InitializeLockedDungeons(player); sLFGMgr->InitializeLockedDungeons(player, player->GetGroup());
} }
void LFGPlayerScript::OnLogout(Player* player) void LFGPlayerScript::OnLogout(Player* player)
@@ -68,7 +68,8 @@ namespace lfg
ObjectGuid guid = player->GetGUID(); ObjectGuid guid = player->GetGUID();
ObjectGuid gguid = sLFGMgr->GetGroup(guid); ObjectGuid gguid = sLFGMgr->GetGroup(guid);
if (Group const* group = player->GetGroup()) Group const* group = player->GetGroup();
if (group)
{ {
ObjectGuid gguid2 = group->GetGUID(); ObjectGuid gguid2 = group->GetGUID();
if (gguid != gguid2) if (gguid != gguid2)
@@ -77,7 +78,7 @@ namespace lfg
} }
} }
sLFGMgr->InitializeLockedDungeons(player); sLFGMgr->InitializeLockedDungeons(player, group);
sLFGMgr->SetTeam(player->GetGUID(), player->GetTeamId()); sLFGMgr->SetTeam(player->GetGUID(), player->GetTeamId());
// TODO - Restore LfgPlayerData and send proper status to player if it was in a group // TODO - Restore LfgPlayerData and send proper status to player if it was in a group
} }
@@ -86,7 +87,7 @@ namespace lfg
{ {
MapEntry const* mapEntry = sMapStore.LookupEntry(mapId); MapEntry const* mapEntry = sMapStore.LookupEntry(mapId);
if (mapEntry->IsDungeon() && difficulty > DUNGEON_DIFFICULTY_NORMAL) if (mapEntry->IsDungeon() && difficulty > DUNGEON_DIFFICULTY_NORMAL)
sLFGMgr->InitializeLockedDungeons(player); sLFGMgr->InitializeLockedDungeons(player, player->GetGroup());
} }
void LFGPlayerScript::OnMapChanged(Player* player) void LFGPlayerScript::OnMapChanged(Player* player)
+2 -2
View File
@@ -157,7 +157,7 @@ void WorldSession::HandleLfgPlayerLockInfoRequestOpcode(WorldPacket& /*recvData*
sLFGMgr->GetRandomAndSeasonalDungeons(level, GetPlayer()->GetSession()->Expansion()); sLFGMgr->GetRandomAndSeasonalDungeons(level, GetPlayer()->GetSession()->Expansion());
// Get player locked Dungeons // Get player locked Dungeons
sLFGMgr->InitializeLockedDungeons(GetPlayer()); // pussywizard sLFGMgr->InitializeLockedDungeons(GetPlayer(), GetPlayer()->GetGroup()); // pussywizard
lfg::LfgLockMap const& lock = sLFGMgr->GetLockedDungeons(guid); lfg::LfgLockMap const& lock = sLFGMgr->GetLockedDungeons(guid);
uint32 rsize = uint32(randomDungeons.size()); uint32 rsize = uint32(randomDungeons.size());
uint32 lsize = uint32(lock.size()); uint32 lsize = uint32(lock.size());
@@ -239,7 +239,7 @@ void WorldSession::HandleLfgPartyLockInfoRequestOpcode(WorldPacket& /*recvData*
if (pguid == guid) if (pguid == guid)
continue; continue;
sLFGMgr->InitializeLockedDungeons(plrg); // pussywizard sLFGMgr->InitializeLockedDungeons(plrg, group); // pussywizard
lockMap[pguid] = sLFGMgr->GetLockedDungeons(pguid); lockMap[pguid] = sLFGMgr->GetLockedDungeons(pguid);
} }