fix(Core/LFG): Don't include disabled maps in the LFG queue (#24057)

This commit is contained in:
Andrew
2025-12-10 10:40:34 -03:00
committed by GitHub
parent b73028f6f5
commit d1ff286c0d
4 changed files with 56 additions and 27 deletions
+30 -21
View File
@@ -388,30 +388,39 @@ bool DisableMgr::IsDisabledFor(DisableType type, uint32 entry, Unit const* unit,
} }
case DISABLE_TYPE_MAP: case DISABLE_TYPE_MAP:
case DISABLE_TYPE_LFG_MAP: case DISABLE_TYPE_LFG_MAP:
if (Player const* player = unit->ToPlayer()) {
MapEntry const* mapEntry = sMapStore.LookupEntry(entry);
if (!mapEntry)
return false;
if (!mapEntry->IsDungeon())
return mapEntry->map_type == MAP_COMMON;
uint8 disabledModes = itr->second.flags;
Difficulty targetDifficulty;
if (unit && unit->IsPlayer())
targetDifficulty = unit->ToPlayer()->GetDifficulty(mapEntry->IsRaid());
else
targetDifficulty = Difficulty(flags);
GetDownscaledMapDifficultyData(entry, targetDifficulty);
switch (targetDifficulty)
{ {
MapEntry const* mapEntry = sMapStore.LookupEntry(entry); case DUNGEON_DIFFICULTY_NORMAL:
if (mapEntry->IsDungeon()) return disabledModes & DUNGEON_STATUSFLAG_NORMAL;
{ case DUNGEON_DIFFICULTY_HEROIC:
uint8 disabledModes = itr->second.flags; return disabledModes & DUNGEON_STATUSFLAG_HEROIC;
Difficulty targetDifficulty = player->GetDifficulty(mapEntry->IsRaid()); case RAID_DIFFICULTY_10MAN_HEROIC:
GetDownscaledMapDifficultyData(entry, targetDifficulty); return disabledModes & RAID_STATUSFLAG_10MAN_HEROIC;
switch (targetDifficulty) case RAID_DIFFICULTY_25MAN_HEROIC:
{ return disabledModes & RAID_STATUSFLAG_25MAN_HEROIC;
case DUNGEON_DIFFICULTY_NORMAL: default:
return disabledModes & DUNGEON_STATUSFLAG_NORMAL; return false;
case DUNGEON_DIFFICULTY_HEROIC:
return disabledModes & DUNGEON_STATUSFLAG_HEROIC;
case RAID_DIFFICULTY_10MAN_HEROIC:
return disabledModes & RAID_STATUSFLAG_10MAN_HEROIC;
case RAID_DIFFICULTY_25MAN_HEROIC:
return disabledModes & RAID_STATUSFLAG_25MAN_HEROIC;
}
}
else if (mapEntry->map_type == MAP_COMMON)
return true;
} }
return false; return false;
}
case DISABLE_TYPE_VMAP: case DISABLE_TYPE_VMAP:
return flags & itr->second.flags; return flags & itr->second.flags;
case DISABLE_TYPE_QUEST: case DISABLE_TYPE_QUEST:
+8
View File
@@ -100,6 +100,14 @@ namespace lfg
LFG_ANSWER_AGREE = 1 LFG_ANSWER_AGREE = 1
}; };
enum LfgRandomDungeonIds : uint32
{
RANDOM_DUNGEON_NORMAL_TBC = 259,
RANDOM_DUNGEON_HEROIC_TBC = 260,
RANDOM_DUNGEON_NORMAL_WOTLK = 261,
RANDOM_DUNGEON_HEROIC_WOTLK = 262
};
class Lfg5Guids; class Lfg5Guids;
typedef std::list<Lfg5Guids> Lfg5GuidsList; typedef std::list<Lfg5Guids> Lfg5GuidsList;
+15 -5
View File
@@ -408,11 +408,10 @@ namespace lfg
DungeonProgressionRequirements const* ar = sObjectMgr->GetAccessRequirement(dungeon->map, Difficulty(dungeon->difficulty)); DungeonProgressionRequirements const* ar = sObjectMgr->GetAccessRequirement(dungeon->map, Difficulty(dungeon->difficulty));
uint32 lockData = 0; uint32 lockData = 0;
if (dungeon->expansion > expansion || (onlySeasonalBosses && !dungeon->seasonal)) if (dungeon->expansion > expansion || (onlySeasonalBosses && !dungeon->seasonal))
lockData = LFG_LOCKSTATUS_INSUFFICIENT_EXPANSION; lockData = LFG_LOCKSTATUS_INSUFFICIENT_EXPANSION;
else if (sDisableMgr->IsDisabledFor(DISABLE_TYPE_MAP, dungeon->map, player)) else if (IsDungeonDisabled(dungeon->map, dungeon->difficulty))
lockData = LFG_LOCKSTATUS_RAID_LOCKED;
else if (sDisableMgr->IsDisabledFor(DISABLE_TYPE_LFG_MAP, dungeon->map, player))
lockData = LFG_LOCKSTATUS_RAID_LOCKED; lockData = LFG_LOCKSTATUS_RAID_LOCKED;
else if (dungeon->difficulty > DUNGEON_DIFFICULTY_NORMAL && (!mapEntry || !mapEntry->IsRaid()) && sInstanceSaveMgr->PlayerIsPermBoundToInstance(player->GetGUID(), dungeon->map, Difficulty(dungeon->difficulty))) else if (dungeon->difficulty > DUNGEON_DIFFICULTY_NORMAL && (!mapEntry || !mapEntry->IsRaid()) && sInstanceSaveMgr->PlayerIsPermBoundToInstance(player->GetGUID(), dungeon->map, Difficulty(dungeon->difficulty)))
lockData = LFG_LOCKSTATUS_RAID_LOCKED; lockData = LFG_LOCKSTATUS_RAID_LOCKED;
@@ -1484,8 +1483,9 @@ namespace lfg
@param[in, out] dungeons Dungeons to check restrictions @param[in, out] dungeons Dungeons to check restrictions
@param[in] players Set of players to check their dungeon restrictions @param[in] players Set of players to check their dungeon restrictions
@param[out] lockMap Map of players Lock status info of given dungeons (Empty if dungeons is not empty) @param[out] lockMap Map of players Lock status info of given dungeons (Empty if dungeons is not empty)
@param[in] randomDungeonId Random dungeon ID (0 for non-random selections), used to filter disabled maps
*/ */
void LFGMgr::GetCompatibleDungeons(LfgDungeonSet& dungeons, LfgGuidSet const& players, LfgLockPartyMap& lockMap, bool isRDF) void LFGMgr::GetCompatibleDungeons(LfgDungeonSet& dungeons, LfgGuidSet const& players, LfgLockPartyMap& lockMap, uint32 randomDungeonId)
{ {
lockMap.clear(); lockMap.clear();
for (LfgGuidSet::const_iterator it = players.begin(); it != players.end() && !dungeons.empty(); ++it) for (LfgGuidSet::const_iterator it = players.begin(); it != players.end() && !dungeons.empty(); ++it)
@@ -1496,7 +1496,11 @@ namespace lfg
{ {
uint32 dungeonId = (it2->first & 0x00FFFFFF); // Compare dungeon ids uint32 dungeonId = (it2->first & 0x00FFFFFF); // Compare dungeon ids
if (it2->second == LFG_LOCKSTATUS_RAID_LOCKED && isRDF && sWorld->getBoolConfig(CONFIG_LFG_ALLOW_COMPLETED)) LFGDungeonData const* dungeon = GetLFGDungeon(dungeonId);
uint8 difficultyFlag = (randomDungeonId == RANDOM_DUNGEON_NORMAL_TBC || randomDungeonId == RANDOM_DUNGEON_NORMAL_WOTLK) ? 0 : 1;
if (dungeon && !IsDungeonDisabled(dungeon->map, (Difficulty)difficultyFlag) && it2->second == LFG_LOCKSTATUS_RAID_LOCKED && randomDungeonId && sWorld->getBoolConfig(CONFIG_LFG_ALLOW_COMPLETED))
continue; continue;
LfgDungeonSet::iterator itDungeon = dungeons.find(dungeonId); LfgDungeonSet::iterator itDungeon = dungeons.find(dungeonId);
@@ -2820,4 +2824,10 @@ namespace lfg
return randomDungeons; return randomDungeons;
} }
bool LFGMgr::IsDungeonDisabled(uint32 mapId, Difficulty difficulty) const
{
return sDisableMgr->IsDisabledFor(DISABLE_TYPE_MAP, mapId, nullptr, difficulty) ||
sDisableMgr->IsDisabledFor(DISABLE_TYPE_LFG_MAP, mapId, nullptr);
}
} // namespace lfg } // namespace lfg
+3 -1
View File
@@ -518,6 +518,8 @@ namespace lfg
LfgUpdateData GetLfgStatus(ObjectGuid guid); LfgUpdateData GetLfgStatus(ObjectGuid guid);
/// Checks if Seasonal dungeon is active /// Checks if Seasonal dungeon is active
bool IsSeasonActive(uint32 dungeonId); bool IsSeasonActive(uint32 dungeonId);
/// Checks if given dungeon map is disabled
bool IsDungeonDisabled(uint32 mapId, Difficulty difficulty) const;
/// Gets the random dungeon reward corresponding to given dungeon and player level /// Gets the random dungeon reward corresponding to given dungeon and player level
LfgReward const* GetRandomDungeonReward(uint32 dungeon, uint8 level); LfgReward const* GetRandomDungeonReward(uint32 dungeon, uint8 level);
/// Returns all random and seasonal dungeons for given level and expansion /// Returns all random and seasonal dungeons for given level and expansion
@@ -589,7 +591,7 @@ namespace lfg
void DecreaseKicksLeft(ObjectGuid guid); void DecreaseKicksLeft(ObjectGuid guid);
void SetState(ObjectGuid guid, LfgState state); void SetState(ObjectGuid guid, LfgState state);
void SetCanOverrideRBState(ObjectGuid guid, bool val); void SetCanOverrideRBState(ObjectGuid guid, bool val);
void GetCompatibleDungeons(LfgDungeonSet& dungeons, LfgGuidSet const& players, LfgLockPartyMap& lockMap, bool isRDF = false); void GetCompatibleDungeons(LfgDungeonSet& dungeons, LfgGuidSet const& players, LfgLockPartyMap& lockMap, uint32 randomDungeonId = 0);
void _SaveToDB(ObjectGuid guid); void _SaveToDB(ObjectGuid guid);
LFGDungeonData const* GetLFGDungeon(uint32 id); LFGDungeonData const* GetLFGDungeon(uint32 id);