From ab1d0512ea7818d64a63a514195dbd9644d284fb Mon Sep 17 00:00:00 2001 From: jackpoz Date: Fri, 25 Apr 2014 00:13:48 +0200 Subject: 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. --- src/server/game/DungeonFinding/LFGMgr.cpp | 141 +++++++++++++----------------- 1 file changed, 61 insertions(+), 80 deletions(-) (limited to 'src/server/game/DungeonFinding/LFGMgr.cpp') diff --git a/src/server/game/DungeonFinding/LFGMgr.cpp b/src/server/game/DungeonFinding/LFGMgr.cpp index 98ca9222e67..264efb49ab3 100644 --- a/src/server/game/DungeonFinding/LFGMgr.cpp +++ b/src/server/game/DungeonFinding/LFGMgr.cpp @@ -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(); -- cgit v1.2.3