Skip to content

Commit

Permalink
fix: expansion
Browse files Browse the repository at this point in the history
  • Loading branch information
FrancescoBorzi committed Oct 1, 2021
1 parent 08f1e86 commit 563c3d0
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 1 deletion.
35 changes: 34 additions & 1 deletion src/server/game/DungeonFinding/LFGMgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,7 @@ namespace lfg
DungeonProgressionRequirements const* ar = sObjectMgr->GetAccessRequirement(dungeon->map, Difficulty(dungeon->difficulty));

uint32 lockData = 0;
if (dungeon->expansion > expansion || dungeon->expansion > sWorld->getIntConfig(CONFIG_LFG_DUNGEON_FINDER_EXPANSION))
if (dungeon->expansion > expansion)
lockData = LFG_LOCKSTATUS_INSUFFICIENT_EXPANSION;
else if (DisableMgr::IsDisabledFor(DISABLE_TYPE_MAP, dungeon->map, player))
lockData = LFG_LOCKSTATUS_RAID_LOCKED;
Expand Down Expand Up @@ -572,6 +572,7 @@ namespace lfg
else
{
rDungeonId = (*dungeons.begin());
setRandomDungeonId(rDungeonId);
}
// No break on purpose (Random can only be dungeon or heroic dungeon)
[[fallthrough]];
Expand Down Expand Up @@ -779,6 +780,38 @@ namespace lfg
}*/
}

void LFGMgr::setRandomDungeonId(uint32 & rDungeonId) const
{
// values from LFGDungeons.dbc
constexpr const uint32 RDF_CLASSIC = 258;
constexpr const uint32 RDF_THE_BURNING_CRUSADE = 259;
constexpr const uint32 RDF_THE_BURNING_CRUSADE_HEROIC = 260;
constexpr const uint32 RDF_WRATH_OF_THE_LICH_KING = 261;
constexpr const uint32 RDF_WRATH_OF_THE_LICH_KING_HEROIC = 262;

switch (sWorld->getIntConfig(CONFIG_LFG_DUNGEON_FINDER_EXPANSION))
{
case EXPANSION_CLASSIC:
// always force classic RDF
rDungeonId = RDF_CLASSIC;
break;
case EXPANSION_THE_BURNING_CRUSADE:
// select at most RDF_THE_BURNING_CRUSADE_*
if (rDungeonId == RDF_WRATH_OF_THE_LICH_KING)
{
rDungeonId = RDF_THE_BURNING_CRUSADE;
}
else if (rDungeonId == RDF_WRATH_OF_THE_LICH_KING_HEROIC)
{
rDungeonId = RDF_THE_BURNING_CRUSADE_HEROIC;
}
case EXPANSION_WRATH_OF_THE_LICH_KING:
default:
// keep the original value
break;
}
}

void LFGMgr::ToggleTesting()
{
m_Testing = !m_Testing;
Expand Down
2 changes: 2 additions & 0 deletions src/server/game/DungeonFinding/LFGMgr.h
Original file line number Diff line number Diff line change
Expand Up @@ -620,6 +620,8 @@ namespace lfg
LfgPlayerDataContainer PlayersStore; ///< Player data
LfgGroupDataContainer GroupsStore; ///< Group data
bool m_Testing;

void setRandomDungeonId(uint32 & rDungeonId) const;
};

} // namespace lfg
Expand Down

0 comments on commit 563c3d0

Please sign in to comment.