Skip to content

Commit c976543

Browse files
committed
Core/LFG: Implemented alternative lfg dungeon level requirements based on active account expansion
Closes #21238
1 parent 94d3f9d commit c976543

File tree

6 files changed

+36
-9
lines changed

6 files changed

+36
-9
lines changed

src/server/game/DataStores/DBCStores.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,7 @@ DBCStorage <ItemRandomSuffixEntry> sItemRandomSuffixStore(ItemRandomSuffixfmt);
123123
DBCStorage <ItemSetEntry> sItemSetStore(ItemSetEntryfmt);
124124

125125
DBCStorage <LFGDungeonEntry> sLFGDungeonStore(LFGDungeonEntryfmt);
126+
DBCStorage <LFGDungeonExpansionEntry> sLFGDungeonExpansionStore(LFGDungeonExpansionfmt);
126127
DBCStorage <LightEntry> sLightStore(LightEntryfmt);
127128
DBCStorage <LiquidTypeEntry> sLiquidTypeStore(LiquidTypefmt);
128129
DBCStorage <LockEntry> sLockStore(LockEntryfmt);
@@ -346,6 +347,7 @@ void LoadDBCStores(const std::string& dataPath)
346347
LOAD_DBC(sItemRandomSuffixStore, "ItemRandomSuffix.dbc");
347348
LOAD_DBC(sItemSetStore, "ItemSet.dbc");
348349
LOAD_DBC(sLFGDungeonStore, "LFGDungeons.dbc");
350+
LOAD_DBC(sLFGDungeonExpansionStore, "LFGDungeonExpansion.dbc");
349351
LOAD_DBC(sLightStore, "Light.dbc");
350352
LOAD_DBC(sLiquidTypeStore, "LiquidType.dbc");
351353
LOAD_DBC(sLockStore, "Lock.dbc");

src/server/game/DataStores/DBCStores.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,7 @@ TC_GAME_API extern DBCStorage <ItemRandomPropertiesEntry> sItemRandomProperti
152152
TC_GAME_API extern DBCStorage <ItemRandomSuffixEntry> sItemRandomSuffixStore;
153153
TC_GAME_API extern DBCStorage <ItemSetEntry> sItemSetStore;
154154
TC_GAME_API extern DBCStorage <LFGDungeonEntry> sLFGDungeonStore;
155+
TC_GAME_API extern DBCStorage <LFGDungeonExpansionEntry> sLFGDungeonExpansionStore;
155156
TC_GAME_API extern DBCStorage <LightEntry> sLightStore;
156157
TC_GAME_API extern DBCStorage <LiquidTypeEntry> sLiquidTypeStore;
157158
TC_GAME_API extern DBCStorage <LockEntry> sLockStore;

src/server/game/DungeonFinding/LFGMgr.cpp

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
#include "LFGQueue.h"
3232
#include "Log.h"
3333
#include "Map.h"
34+
#include "MapUtils.h"
3435
#include "ObjectAccessor.h"
3536
#include "ObjectMgr.h"
3637
#include "Player.h"
@@ -43,15 +44,16 @@
4344
namespace lfg
4445
{
4546

46-
LFGDungeonData::LFGDungeonData() : id(0), name(), map(0), type(0), expansion(0), group(0), minlevel(0),
47-
maxlevel(0), difficulty(REGULAR_DIFFICULTY), seasonal(false), x(0.0f), y(0.0f), z(0.0f), o(0.0f)
47+
LFGDungeonData::LFGDungeonData() : id(0), name(), map(0), type(0), expansion(0), group(0), minlevel(),
48+
maxlevel(), difficulty(REGULAR_DIFFICULTY), seasonal(false), x(0.0f), y(0.0f), z(0.0f), o(0.0f)
4849
{
4950
}
5051

5152
LFGDungeonData::LFGDungeonData(LFGDungeonEntry const* dbc) : id(dbc->ID), name(dbc->Name[0]), map(dbc->MapID),
5253
type(dbc->TypeID), expansion(uint8(dbc->ExpansionLevel)), group(uint8(dbc->GroupID)),
53-
minlevel(uint8(dbc->MinLevel)), maxlevel(uint8(dbc->MaxLevel)), difficulty(Difficulty(dbc->Difficulty)),
54-
seasonal((dbc->Flags & LFG_FLAG_SEASONAL) != 0), x(0.0f), y(0.0f), z(0.0f), o(0.0f)
54+
minlevel({ uint8(dbc->MinLevel), uint8(dbc->MinLevel), uint8(dbc->MinLevel) }),
55+
maxlevel({ uint8(dbc->MaxLevel), uint8(dbc->MaxLevel), uint8(dbc->MaxLevel) }),
56+
difficulty(Difficulty(dbc->Difficulty)), seasonal((dbc->Flags & LFG_FLAG_SEASONAL) != 0), x(0.0f), y(0.0f), z(0.0f), o(0.0f)
5557
{
5658
}
5759

@@ -209,6 +211,15 @@ void LFGMgr::LoadLFGDungeons(bool reload /* = false */)
209211
}
210212
}
211213

214+
for (LFGDungeonExpansionEntry const* dungeonExpansion : sLFGDungeonExpansionStore)
215+
{
216+
if (LFGDungeonData* dungeon = Trinity::Containers::MapGetValuePtr(LfgDungeonStore, dungeonExpansion->LfgID))
217+
{
218+
dungeon->minlevel[dungeonExpansion->ExpansionLevel] = dungeonExpansion->HardLevelMin;
219+
dungeon->maxlevel[dungeonExpansion->ExpansionLevel] = dungeonExpansion->HardLevelMax;
220+
}
221+
}
222+
212223
// Fill teleport locations from DB
213224
// 0 1 2 3 4
214225
QueryResult result = WorldDatabase.Query("SELECT dungeonId, position_x, position_y, position_z, orientation FROM lfg_dungeon_template");
@@ -1700,9 +1711,9 @@ LfgLockMap const LFGMgr::GetLockedDungeons(ObjectGuid guid)
17001711
lockData = LFG_LOCKSTATUS_RAID_LOCKED;
17011712
else if (dungeon->difficulty > DUNGEON_DIFFICULTY_NORMAL && player->GetBoundInstance(dungeon->map, Difficulty(dungeon->difficulty)))
17021713
lockData = LFG_LOCKSTATUS_RAID_LOCKED;
1703-
else if (dungeon->minlevel > level)
1714+
else if (dungeon->minlevel[expansion] > level)
17041715
lockData = LFG_LOCKSTATUS_TOO_LOW_LEVEL;
1705-
else if (dungeon->maxlevel < level)
1716+
else if (dungeon->maxlevel[expansion] < level)
17061717
lockData = LFG_LOCKSTATUS_TOO_HIGH_LEVEL;
17071718
else if (dungeon->seasonal && !IsSeasonActive(dungeon->id))
17081719
lockData = LFG_LOCKSTATUS_NOT_IN_SEASON;
@@ -2134,7 +2145,7 @@ LfgDungeonSet LFGMgr::GetRandomAndSeasonalDungeons(uint8 level, uint8 expansion)
21342145
{
21352146
lfg::LFGDungeonData const& dungeon = itr->second;
21362147
if ((dungeon.type == lfg::LFG_TYPE_RANDOM || (dungeon.seasonal && sLFGMgr->IsSeasonActive(dungeon.id)))
2137-
&& dungeon.expansion <= expansion && dungeon.minlevel <= level && level <= dungeon.maxlevel)
2148+
&& dungeon.expansion <= expansion && dungeon.minlevel[expansion] <= level && level <= dungeon.maxlevel[expansion])
21382149
randomDungeons.insert(dungeon.Entry());
21392150
}
21402151
return randomDungeons;

src/server/game/DungeonFinding/LFGMgr.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -290,8 +290,8 @@ struct LFGDungeonData
290290
uint8 type;
291291
uint8 expansion;
292292
uint8 group;
293-
uint8 minlevel;
294-
uint8 maxlevel;
293+
std::array<uint8, MAX_EXPANSIONS> minlevel;
294+
std::array<uint8, MAX_EXPANSIONS> maxlevel;
295295
Difficulty difficulty;
296296
bool seasonal;
297297
float x, y, z, o;

src/server/shared/DataStores/DBCStructure.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1013,6 +1013,18 @@ struct LFGDungeonEntry
10131013
uint32 Entry() const { return ID + (TypeID << 24); }
10141014
};
10151015

1016+
struct LFGDungeonExpansionEntry
1017+
{
1018+
//uint32 ID; // 0
1019+
uint32 LfgID; // 1
1020+
uint32 ExpansionLevel; // 2
1021+
//uint32 RandomID; // 3
1022+
uint32 HardLevelMin; // 4
1023+
uint32 HardLevelMax; // 5
1024+
//uint32 TargetLevelMin; // 6
1025+
//uint32 TargetLevelMax; // 7
1026+
};
1027+
10161028
struct LightEntry
10171029
{
10181030
uint32 ID; // 0

src/server/shared/DataStores/DBCfmt.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ char constexpr ItemRandomPropertiesfmt[] = "nxiiixxssssssssssssssssx";
8484
char constexpr ItemRandomSuffixfmt[] = "nssssssssssssssssxxiiixxiiixx";
8585
char constexpr ItemSetEntryfmt[] = "dssssssssssssssssxiiiiiiiiiixxxxxxxiiiiiiiiiiiiiiiiii";
8686
char constexpr LFGDungeonEntryfmt[] = "nssssssssssssssssxiiiiiiiiixxixixxxxxxxxxxxxxxxxx";
87+
char constexpr LFGDungeonExpansionfmt[] = "diixiixx";
8788
char constexpr LightEntryfmt[] = "nifffxxxxxxxxxx";
8889
char constexpr LiquidTypefmt[] = "nxxixixxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
8990
char constexpr LockEntryfmt[] = "niiiiiiiiiiiiiiiiiiiiiiiixxxxxxxx";

0 commit comments

Comments
 (0)