aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/DungeonFinding/LFGMgr.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/server/game/DungeonFinding/LFGMgr.cpp')
-rw-r--r--src/server/game/DungeonFinding/LFGMgr.cpp141
1 files changed, 61 insertions, 80 deletions
diff --git a/src/server/game/DungeonFinding/LFGMgr.cpp b/src/server/game/DungeonFinding/LFGMgr.cpp
index b205e890f48..9ab52508ce3 100644
--- a/src/server/game/DungeonFinding/LFGMgr.cpp
+++ b/src/server/game/DungeonFinding/LFGMgr.cpp
@@ -256,10 +256,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)
}
/**
- 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
to the new queue.
@@ -1613,10 +1541,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)
@@ -1694,12 +1681,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();