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
|
// 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;
|
||||||
@@ -429,12 +428,15 @@ namespace lfg
|
|||||||
// Check required items
|
// Check required items
|
||||||
for (const ProgressionRequirement* itemRequirement : ar->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;
|
if (!player->HasItemCount(itemRequirement->id, 1))
|
||||||
break;
|
{
|
||||||
|
lockData = LFG_LOCKSTATUS_MISSING_ITEM;
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -442,12 +444,15 @@ namespace lfg
|
|||||||
//Check for quests
|
//Check for quests
|
||||||
for (const ProgressionRequirement* questRequirement : ar->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;
|
if (!player->GetQuestRewardStatus(questRequirement->id))
|
||||||
break;
|
{
|
||||||
|
lockData = LFG_LOCKSTATUS_QUEST_NOT_COMPLETED;
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -461,12 +466,15 @@ 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->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;
|
if (!player->HasAchieved(achievementRequirement->id))
|
||||||
break;
|
{
|
||||||
|
lockData = LFG_LOCKSTATUS_MISSING_ACHIEVEMENT;
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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)
|
||||||
|
|||||||
@@ -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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user