Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 30 additions & 20 deletions src/server/game/Conditions/DisableMgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -388,30 +388,40 @@ bool DisableMgr::IsDisabledFor(DisableType type, uint32 entry, Unit const* unit,
}
case DISABLE_TYPE_MAP:
case DISABLE_TYPE_LFG_MAP:
{
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 (Player const* player = unit->ToPlayer())
{
MapEntry const* mapEntry = sMapStore.LookupEntry(entry);
if (mapEntry->IsDungeon())
{
uint8 disabledModes = itr->second.flags;
Difficulty targetDifficulty = player->GetDifficulty(mapEntry->IsRaid());
GetDownscaledMapDifficultyData(entry, targetDifficulty);
switch (targetDifficulty)
{
case DUNGEON_DIFFICULTY_NORMAL:
return disabledModes & DUNGEON_STATUSFLAG_NORMAL;
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;
targetDifficulty = player->GetDifficulty(mapEntry->IsRaid());
GetDownscaledMapDifficultyData(entry, targetDifficulty);
}
else
targetDifficulty = Difficulty(flags);

switch (targetDifficulty)
{
case DUNGEON_DIFFICULTY_NORMAL:
return disabledModes & DUNGEON_STATUSFLAG_NORMAL;
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;
default:
return false;
}
return false;
}
case DISABLE_TYPE_VMAP:
return flags & itr->second.flags;
case DISABLE_TYPE_QUEST:
Expand Down
6 changes: 6 additions & 0 deletions src/server/game/DungeonFinding/LFG.h
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,12 @@ namespace lfg
LFG_ANSWER_AGREE = 1
};

enum LfgRandomDungeonIds : uint32
{
RANDOM_DUNGEON_NORMAL = 259,
RANDOM_DUNGEON_HEROIC = 260
};

class Lfg5Guids;

typedef std::list<Lfg5Guids> Lfg5GuidsList;
Expand Down
11 changes: 9 additions & 2 deletions src/server/game/DungeonFinding/LFGMgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1485,7 +1485,7 @@ namespace lfg
@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)
*/
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();
for (LfgGuidSet::const_iterator it = players.begin(); it != players.end() && !dungeons.empty(); ++it)
Expand All @@ -1496,7 +1496,14 @@ namespace lfg
{
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) ? 0 : 1;

bool isDungeonDisabled = dungeon && (sDisableMgr->IsDisabledFor(DISABLE_TYPE_MAP, dungeon->map, nullptr, difficultyFlag)
|| sDisableMgr->IsDisabledFor(DISABLE_TYPE_LFG_MAP, dungeon->map, nullptr, difficultyFlag));

if (!isDungeonDisabled && it2->second == LFG_LOCKSTATUS_RAID_LOCKED && randomDungeonId && sWorld->getBoolConfig(CONFIG_LFG_ALLOW_COMPLETED))
continue;

LfgDungeonSet::iterator itDungeon = dungeons.find(dungeonId);
Expand Down
2 changes: 1 addition & 1 deletion src/server/game/DungeonFinding/LFGMgr.h
Original file line number Diff line number Diff line change
Expand Up @@ -589,7 +589,7 @@ namespace lfg
void DecreaseKicksLeft(ObjectGuid guid);
void SetState(ObjectGuid guid, LfgState state);
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);
LFGDungeonData const* GetLFGDungeon(uint32 id);

Expand Down