mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-23 05:36:23 +00:00
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:
@@ -269,7 +269,7 @@ namespace lfg
|
||||
// Recalculate locked dungeons
|
||||
for (LfgPlayerDataContainer::const_iterator it = PlayersStore.begin(); it != PlayersStore.end(); ++it)
|
||||
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
|
||||
*/
|
||||
void LFGMgr::InitializeLockedDungeons(Player* player, uint8 level /* = 0 */)
|
||||
void LFGMgr::InitializeLockedDungeons(Player* player, Group const* group)
|
||||
{
|
||||
ObjectGuid guid = player->GetGUID();
|
||||
if (!level)
|
||||
level = player->getLevel();
|
||||
uint8 level = player->getLevel();
|
||||
uint8 expansion = player->GetSession()->Expansion();
|
||||
LfgDungeonSet const& dungeons = GetDungeonsByRandom(0);
|
||||
LfgLockMap lock;
|
||||
@@ -429,12 +428,15 @@ namespace lfg
|
||||
// Check required items
|
||||
for (const ProgressionRequirement* itemRequirement : ar->items)
|
||||
{
|
||||
if (itemRequirement->faction == TEAM_NEUTRAL || itemRequirement->faction == player->GetTeamId(true))
|
||||
if (!itemRequirement->checkLeaderOnly || !group || group->GetLeaderGUID() == player->GetGUID())
|
||||
{
|
||||
if (!player->HasItemCount(itemRequirement->id, 1))
|
||||
if (itemRequirement->faction == TEAM_NEUTRAL || itemRequirement->faction == player->GetTeamId(true))
|
||||
{
|
||||
lockData = LFG_LOCKSTATUS_MISSING_ITEM;
|
||||
break;
|
||||
if (!player->HasItemCount(itemRequirement->id, 1))
|
||||
{
|
||||
lockData = LFG_LOCKSTATUS_MISSING_ITEM;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -442,12 +444,15 @@ namespace lfg
|
||||
//Check for quests
|
||||
for (const ProgressionRequirement* questRequirement : ar->quests)
|
||||
{
|
||||
if (questRequirement->faction == TEAM_NEUTRAL || questRequirement->faction == player->GetTeamId(true))
|
||||
if (!questRequirement->checkLeaderOnly || !group || group->GetLeaderGUID() == player->GetGUID())
|
||||
{
|
||||
if (!player->GetQuestRewardStatus(questRequirement->id))
|
||||
if (questRequirement->faction == TEAM_NEUTRAL || questRequirement->faction == player->GetTeamId(true))
|
||||
{
|
||||
lockData = LFG_LOCKSTATUS_QUEST_NOT_COMPLETED;
|
||||
break;
|
||||
if (!player->GetQuestRewardStatus(questRequirement->id))
|
||||
{
|
||||
lockData = LFG_LOCKSTATUS_QUEST_NOT_COMPLETED;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -461,12 +466,15 @@ namespace lfg
|
||||
//Check if player has the required achievements
|
||||
for (const ProgressionRequirement* achievementRequirement : ar->achievements)
|
||||
{
|
||||
if (achievementRequirement->faction == TEAM_NEUTRAL || achievementRequirement->faction == player->GetTeamId(true))
|
||||
if (!achievementRequirement->checkLeaderOnly || !group || group->GetLeaderGUID() == player->GetGUID())
|
||||
{
|
||||
if (!player->HasAchieved(achievementRequirement->id))
|
||||
if (achievementRequirement->faction == TEAM_NEUTRAL || achievementRequirement->faction == player->GetTeamId(true))
|
||||
{
|
||||
lockData = LFG_LOCKSTATUS_MISSING_ACHIEVEMENT;
|
||||
break;
|
||||
if (!player->HasAchieved(achievementRequirement->id))
|
||||
{
|
||||
lockData = LFG_LOCKSTATUS_MISSING_ACHIEVEMENT;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -491,7 +491,7 @@ namespace lfg
|
||||
/// Get leader of the group (using internal data)
|
||||
ObjectGuid GetLeader(ObjectGuid guid);
|
||||
/// 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
|
||||
void SetTeam(ObjectGuid guid, TeamId teamId);
|
||||
/// 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))
|
||||
return;
|
||||
|
||||
sLFGMgr->InitializeLockedDungeons(player);
|
||||
sLFGMgr->InitializeLockedDungeons(player, player->GetGroup());
|
||||
}
|
||||
|
||||
void LFGPlayerScript::OnLogout(Player* player)
|
||||
@@ -68,7 +68,8 @@ namespace lfg
|
||||
ObjectGuid guid = player->GetGUID();
|
||||
ObjectGuid gguid = sLFGMgr->GetGroup(guid);
|
||||
|
||||
if (Group const* group = player->GetGroup())
|
||||
Group const* group = player->GetGroup();
|
||||
if (group)
|
||||
{
|
||||
ObjectGuid gguid2 = group->GetGUID();
|
||||
if (gguid != gguid2)
|
||||
@@ -77,7 +78,7 @@ namespace lfg
|
||||
}
|
||||
}
|
||||
|
||||
sLFGMgr->InitializeLockedDungeons(player);
|
||||
sLFGMgr->InitializeLockedDungeons(player, group);
|
||||
sLFGMgr->SetTeam(player->GetGUID(), player->GetTeamId());
|
||||
// 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);
|
||||
if (mapEntry->IsDungeon() && difficulty > DUNGEON_DIFFICULTY_NORMAL)
|
||||
sLFGMgr->InitializeLockedDungeons(player);
|
||||
sLFGMgr->InitializeLockedDungeons(player, player->GetGroup());
|
||||
}
|
||||
|
||||
void LFGPlayerScript::OnMapChanged(Player* player)
|
||||
|
||||
@@ -157,7 +157,7 @@ void WorldSession::HandleLfgPlayerLockInfoRequestOpcode(WorldPacket& /*recvData*
|
||||
sLFGMgr->GetRandomAndSeasonalDungeons(level, GetPlayer()->GetSession()->Expansion());
|
||||
|
||||
// Get player locked Dungeons
|
||||
sLFGMgr->InitializeLockedDungeons(GetPlayer()); // pussywizard
|
||||
sLFGMgr->InitializeLockedDungeons(GetPlayer(), GetPlayer()->GetGroup()); // pussywizard
|
||||
lfg::LfgLockMap const& lock = sLFGMgr->GetLockedDungeons(guid);
|
||||
uint32 rsize = uint32(randomDungeons.size());
|
||||
uint32 lsize = uint32(lock.size());
|
||||
@@ -239,7 +239,7 @@ void WorldSession::HandleLfgPartyLockInfoRequestOpcode(WorldPacket& /*recvData*
|
||||
if (pguid == guid)
|
||||
continue;
|
||||
|
||||
sLFGMgr->InitializeLockedDungeons(plrg); // pussywizard
|
||||
sLFGMgr->InitializeLockedDungeons(plrg, group); // pussywizard
|
||||
lockMap[pguid] = sLFGMgr->GetLockedDungeons(pguid);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user