mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-15 23:20:36 +01:00
Core/LFG: Fix LFG GS requirement not updated until relog
Fix Player receiving "You do not meet the requirements for the chosen dungeons" for too low Gear Score level even after equipping items with high enough Gear Score.
This commit is contained in:
@@ -257,10 +257,6 @@ void LFGMgr::LoadLFGDungeons(bool reload /* = false */)
|
||||
if (reload)
|
||||
{
|
||||
CachedDungeonMapStore.clear();
|
||||
// Recalculate locked dungeons
|
||||
for (LfgPlayerDataContainer::const_iterator it = PlayersStore.begin(); it != PlayersStore.end(); ++it)
|
||||
if (Player* player = ObjectAccessor::FindPlayer(it->first))
|
||||
InitializeLockedDungeons(player);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -367,74 +363,6 @@ void LFGMgr::Update(uint32 diff)
|
||||
m_QueueTimer += diff;
|
||||
}
|
||||
|
||||
/**
|
||||
Generate the dungeon lock map for a given player
|
||||
|
||||
@param[in] player Player we need to initialize the lock status map
|
||||
*/
|
||||
void LFGMgr::InitializeLockedDungeons(Player* player, uint8 level /* = 0 */)
|
||||
{
|
||||
uint64 guid = player->GetGUID();
|
||||
if (!level)
|
||||
level = player->getLevel();
|
||||
uint8 expansion = player->GetSession()->Expansion();
|
||||
LfgDungeonSet const& dungeons = GetDungeonsByRandom(0);
|
||||
LfgLockMap lock;
|
||||
bool denyJoin = !player->GetSession()->HasPermission(rbac::RBAC_PERM_JOIN_DUNGEON_FINDER);
|
||||
|
||||
for (LfgDungeonSet::const_iterator it = dungeons.begin(); it != dungeons.end(); ++it)
|
||||
{
|
||||
LFGDungeonData const* dungeon = GetLFGDungeon(*it);
|
||||
if (!dungeon) // should never happen - We provide a list from sLFGDungeonStore
|
||||
continue;
|
||||
|
||||
uint32 lockData = 0;
|
||||
if (denyJoin)
|
||||
lockData = LFG_LOCKSTATUS_RAID_LOCKED;
|
||||
else if (dungeon->expansion > expansion)
|
||||
lockData = LFG_LOCKSTATUS_INSUFFICIENT_EXPANSION;
|
||||
else if (DisableMgr::IsDisabledFor(DISABLE_TYPE_MAP, dungeon->map, player))
|
||||
lockData = LFG_LOCKSTATUS_RAID_LOCKED;
|
||||
else if (dungeon->difficulty > DUNGEON_DIFFICULTY_NORMAL && player->GetBoundInstance(dungeon->map, Difficulty(dungeon->difficulty)))
|
||||
lockData = LFG_LOCKSTATUS_RAID_LOCKED;
|
||||
else if (dungeon->minlevel > level)
|
||||
lockData = LFG_LOCKSTATUS_TOO_LOW_LEVEL;
|
||||
else if (dungeon->maxlevel < level)
|
||||
lockData = LFG_LOCKSTATUS_TOO_HIGH_LEVEL;
|
||||
else if (dungeon->seasonal && !IsSeasonActive(dungeon->id))
|
||||
lockData = LFG_LOCKSTATUS_NOT_IN_SEASON;
|
||||
else if (AccessRequirement const* ar = sObjectMgr->GetAccessRequirement(dungeon->map, Difficulty(dungeon->difficulty)))
|
||||
{
|
||||
if (ar->item_level && player->GetAverageItemLevel() < ar->item_level)
|
||||
lockData = LFG_LOCKSTATUS_TOO_LOW_GEAR_SCORE;
|
||||
else if (ar->achievement && !player->HasAchieved(ar->achievement))
|
||||
lockData = LFG_LOCKSTATUS_MISSING_ACHIEVEMENT;
|
||||
else if (player->GetTeam() == ALLIANCE && ar->quest_A && !player->GetQuestRewardStatus(ar->quest_A))
|
||||
lockData = LFG_LOCKSTATUS_QUEST_NOT_COMPLETED;
|
||||
else if (player->GetTeam() == HORDE && ar->quest_H && !player->GetQuestRewardStatus(ar->quest_H))
|
||||
lockData = LFG_LOCKSTATUS_QUEST_NOT_COMPLETED;
|
||||
else
|
||||
if (ar->item)
|
||||
{
|
||||
if (!player->HasItemCount(ar->item) && (!ar->item2 || !player->HasItemCount(ar->item2)))
|
||||
lockData = LFG_LOCKSTATUS_MISSING_ITEM;
|
||||
}
|
||||
else if (ar->item2 && !player->HasItemCount(ar->item2))
|
||||
lockData = LFG_LOCKSTATUS_MISSING_ITEM;
|
||||
}
|
||||
|
||||
/* @todo VoA closed if WG is not under team control (LFG_LOCKSTATUS_RAID_LOCKED)
|
||||
lockData = LFG_LOCKSTATUS_TOO_HIGH_GEAR_SCORE;
|
||||
lockData = LFG_LOCKSTATUS_ATTUNEMENT_TOO_LOW_LEVEL;
|
||||
lockData = LFG_LOCKSTATUS_ATTUNEMENT_TOO_HIGH_LEVEL;
|
||||
*/
|
||||
|
||||
if (lockData)
|
||||
lock[dungeon->Entry()] = lockData;
|
||||
}
|
||||
SetLockedDungeons(guid, lock);
|
||||
}
|
||||
|
||||
/**
|
||||
Adds the player/group to lfg queue. If player is in a group then it is the leader
|
||||
of the group tying to join the group. Join conditions are checked before adding
|
||||
@@ -1610,10 +1538,69 @@ LfgDungeonSet const& LFGMgr::GetSelectedDungeons(uint64 guid)
|
||||
return PlayersStore[guid].GetSelectedDungeons();
|
||||
}
|
||||
|
||||
LfgLockMap const& LFGMgr::GetLockedDungeons(uint64 guid)
|
||||
LfgLockMap const LFGMgr::GetLockedDungeons(uint64 guid)
|
||||
{
|
||||
TC_LOG_TRACE("lfg.data.player.dungeons.locked.get", "Player: %u, LockedDungeons.", GUID_LOPART(guid));
|
||||
return PlayersStore[guid].GetLockedDungeons();
|
||||
Player* player = ObjectAccessor::FindPlayer(guid);
|
||||
|
||||
uint8 level = player->getLevel();
|
||||
uint8 expansion = player->GetSession()->Expansion();
|
||||
LfgDungeonSet const& dungeons = GetDungeonsByRandom(0);
|
||||
LfgLockMap lock;
|
||||
bool denyJoin = !player->GetSession()->HasPermission(rbac::RBAC_PERM_JOIN_DUNGEON_FINDER);
|
||||
|
||||
for (LfgDungeonSet::const_iterator it = dungeons.begin(); it != dungeons.end(); ++it)
|
||||
{
|
||||
LFGDungeonData const* dungeon = GetLFGDungeon(*it);
|
||||
if (!dungeon) // should never happen - We provide a list from sLFGDungeonStore
|
||||
continue;
|
||||
|
||||
uint32 lockData = 0;
|
||||
if (denyJoin)
|
||||
lockData = LFG_LOCKSTATUS_RAID_LOCKED;
|
||||
else if (dungeon->expansion > expansion)
|
||||
lockData = LFG_LOCKSTATUS_INSUFFICIENT_EXPANSION;
|
||||
else if (DisableMgr::IsDisabledFor(DISABLE_TYPE_MAP, dungeon->map, player))
|
||||
lockData = LFG_LOCKSTATUS_RAID_LOCKED;
|
||||
else if (dungeon->difficulty > DUNGEON_DIFFICULTY_NORMAL && player->GetBoundInstance(dungeon->map, Difficulty(dungeon->difficulty)))
|
||||
lockData = LFG_LOCKSTATUS_RAID_LOCKED;
|
||||
else if (dungeon->minlevel > level)
|
||||
lockData = LFG_LOCKSTATUS_TOO_LOW_LEVEL;
|
||||
else if (dungeon->maxlevel < level)
|
||||
lockData = LFG_LOCKSTATUS_TOO_HIGH_LEVEL;
|
||||
else if (dungeon->seasonal && !IsSeasonActive(dungeon->id))
|
||||
lockData = LFG_LOCKSTATUS_NOT_IN_SEASON;
|
||||
else if (AccessRequirement const* ar = sObjectMgr->GetAccessRequirement(dungeon->map, Difficulty(dungeon->difficulty)))
|
||||
{
|
||||
if (ar->item_level && player->GetAverageItemLevel() < ar->item_level)
|
||||
lockData = LFG_LOCKSTATUS_TOO_LOW_GEAR_SCORE;
|
||||
else if (ar->achievement && !player->HasAchieved(ar->achievement))
|
||||
lockData = LFG_LOCKSTATUS_MISSING_ACHIEVEMENT;
|
||||
else if (player->GetTeam() == ALLIANCE && ar->quest_A && !player->GetQuestRewardStatus(ar->quest_A))
|
||||
lockData = LFG_LOCKSTATUS_QUEST_NOT_COMPLETED;
|
||||
else if (player->GetTeam() == HORDE && ar->quest_H && !player->GetQuestRewardStatus(ar->quest_H))
|
||||
lockData = LFG_LOCKSTATUS_QUEST_NOT_COMPLETED;
|
||||
else
|
||||
if (ar->item)
|
||||
{
|
||||
if (!player->HasItemCount(ar->item) && (!ar->item2 || !player->HasItemCount(ar->item2)))
|
||||
lockData = LFG_LOCKSTATUS_MISSING_ITEM;
|
||||
}
|
||||
else if (ar->item2 && !player->HasItemCount(ar->item2))
|
||||
lockData = LFG_LOCKSTATUS_MISSING_ITEM;
|
||||
}
|
||||
|
||||
/* @todo VoA closed if WG is not under team control (LFG_LOCKSTATUS_RAID_LOCKED)
|
||||
lockData = LFG_LOCKSTATUS_TOO_HIGH_GEAR_SCORE;
|
||||
lockData = LFG_LOCKSTATUS_ATTUNEMENT_TOO_LOW_LEVEL;
|
||||
lockData = LFG_LOCKSTATUS_ATTUNEMENT_TOO_HIGH_LEVEL;
|
||||
*/
|
||||
|
||||
if (lockData)
|
||||
lock[dungeon->Entry()] = lockData;
|
||||
}
|
||||
|
||||
return lock;
|
||||
}
|
||||
|
||||
uint8 LFGMgr::GetKicksLeft(uint64 guid)
|
||||
@@ -1691,12 +1678,6 @@ void LFGMgr::SetSelectedDungeons(uint64 guid, LfgDungeonSet const& dungeons)
|
||||
PlayersStore[guid].SetSelectedDungeons(dungeons);
|
||||
}
|
||||
|
||||
void LFGMgr::SetLockedDungeons(uint64 guid, LfgLockMap const& lock)
|
||||
{
|
||||
TC_LOG_TRACE("lfg.data.player.dungeon.locked.set", "Player: %u, LockedDungeons", GUID_LOPART(guid));
|
||||
PlayersStore[guid].SetLockedDungeons(lock);
|
||||
}
|
||||
|
||||
void LFGMgr::DecreaseKicksLeft(uint64 guid)
|
||||
{
|
||||
GroupsStore[guid].DecreaseKicksLeft();
|
||||
|
||||
@@ -351,8 +351,6 @@ class LFGMgr
|
||||
// LFGScripts
|
||||
/// Get leader of the group (using internal data)
|
||||
uint64 GetLeader(uint64 guid);
|
||||
/// Initializes locked dungeons for given player (called at login or level change)
|
||||
void InitializeLockedDungeons(Player* player, uint8 level = 0);
|
||||
/// Sets player team
|
||||
void SetTeam(uint64 guid, uint8 team);
|
||||
/// Sets player group
|
||||
@@ -370,7 +368,7 @@ class LFGMgr
|
||||
|
||||
// LFGHandler
|
||||
/// Get locked dungeons
|
||||
LfgLockMap const& GetLockedDungeons(uint64 guid);
|
||||
LfgLockMap const GetLockedDungeons(uint64 guid);
|
||||
/// Returns current lfg status
|
||||
LfgUpdateData GetLfgStatus(uint64 guid);
|
||||
/// Checks if Seasonal dungeon is active
|
||||
@@ -422,7 +420,6 @@ class LFGMgr
|
||||
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);
|
||||
void SetState(uint64 guid, LfgState state);
|
||||
void RemovePlayerData(uint64 guid);
|
||||
|
||||
@@ -54,11 +54,6 @@ void LfgPlayerData::RestoreState()
|
||||
m_State = m_OldState;
|
||||
}
|
||||
|
||||
void LfgPlayerData::SetLockedDungeons(LfgLockMap const& lockStatus)
|
||||
{
|
||||
m_LockedDungeons = lockStatus;
|
||||
}
|
||||
|
||||
void LfgPlayerData::SetTeam(uint8 team)
|
||||
{
|
||||
m_Team = team;
|
||||
@@ -94,11 +89,6 @@ LfgState LfgPlayerData::GetOldState() const
|
||||
return m_OldState;
|
||||
}
|
||||
|
||||
const LfgLockMap& LfgPlayerData::GetLockedDungeons() const
|
||||
{
|
||||
return m_LockedDungeons;
|
||||
}
|
||||
|
||||
uint8 LfgPlayerData::GetTeam() const
|
||||
{
|
||||
return m_Team;
|
||||
|
||||
@@ -35,7 +35,6 @@ class LfgPlayerData
|
||||
// General
|
||||
void SetState(LfgState state);
|
||||
void RestoreState();
|
||||
void SetLockedDungeons(LfgLockMap const& lock);
|
||||
void SetTeam(uint8 team);
|
||||
void SetGroup(uint64 group);
|
||||
|
||||
@@ -47,7 +46,6 @@ class LfgPlayerData
|
||||
// General
|
||||
LfgState GetState() const;
|
||||
LfgState GetOldState() const;
|
||||
LfgLockMap const& GetLockedDungeons() const;
|
||||
uint8 GetTeam() const;
|
||||
uint64 GetGroup() const;
|
||||
|
||||
@@ -61,7 +59,6 @@ class LfgPlayerData
|
||||
LfgState m_State; ///< State if group in LFG
|
||||
LfgState m_OldState; ///< Old State - Used to restore state after failed Rolecheck/Proposal
|
||||
// Player
|
||||
LfgLockMap m_LockedDungeons; ///< Dungeons player can't do and reason
|
||||
uint8 m_Team; ///< Player team - determines the queue to join
|
||||
uint64 m_Group; ///< Original group of player when joined LFG
|
||||
|
||||
|
||||
@@ -34,14 +34,6 @@ namespace lfg
|
||||
|
||||
LFGPlayerScript::LFGPlayerScript() : PlayerScript("LFGPlayerScript") { }
|
||||
|
||||
void LFGPlayerScript::OnLevelChanged(Player* player, uint8 /*oldLevel*/)
|
||||
{
|
||||
if (!sLFGMgr->isOptionEnabled(LFG_OPTION_ENABLE_DUNGEON_FINDER | LFG_OPTION_ENABLE_RAID_BROWSER))
|
||||
return;
|
||||
|
||||
sLFGMgr->InitializeLockedDungeons(player);
|
||||
}
|
||||
|
||||
void LFGPlayerScript::OnLogout(Player* player)
|
||||
{
|
||||
if (!sLFGMgr->isOptionEnabled(LFG_OPTION_ENABLE_DUNGEON_FINDER | LFG_OPTION_ENABLE_RAID_BROWSER))
|
||||
@@ -74,18 +66,10 @@ void LFGPlayerScript::OnLogin(Player* player)
|
||||
}
|
||||
}
|
||||
|
||||
sLFGMgr->InitializeLockedDungeons(player);
|
||||
sLFGMgr->SetTeam(player->GetGUID(), player->GetTeam());
|
||||
/// @todo - Restore LfgPlayerData and send proper status to player if it was in a group
|
||||
}
|
||||
|
||||
void LFGPlayerScript::OnBindToInstance(Player* player, Difficulty difficulty, uint32 mapId, bool /*permanent*/)
|
||||
{
|
||||
MapEntry const* mapEntry = sMapStore.LookupEntry(mapId);
|
||||
if (mapEntry->IsDungeon() && difficulty > DUNGEON_DIFFICULTY_NORMAL)
|
||||
sLFGMgr->InitializeLockedDungeons(player);
|
||||
}
|
||||
|
||||
void LFGPlayerScript::OnMapChanged(Player* player)
|
||||
{
|
||||
Map const* map = player->GetMap();
|
||||
|
||||
@@ -35,10 +35,8 @@ class LFGPlayerScript : public PlayerScript
|
||||
LFGPlayerScript();
|
||||
|
||||
// Player Hooks
|
||||
void OnLevelChanged(Player* player, uint8 oldLevel);
|
||||
void OnLogout(Player* player);
|
||||
void OnLogin(Player* player);
|
||||
void OnBindToInstance(Player* player, Difficulty difficulty, uint32 mapId, bool permanent);
|
||||
void OnMapChanged(Player* player);
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user