From c97654362478a8224b18c5349355cac434e3f5e9 Mon Sep 17 00:00:00 2001 From: Shauren Date: Sat, 20 Sep 2025 12:16:01 +0200 Subject: Core/LFG: Implemented alternative lfg dungeon level requirements based on active account expansion Closes #21238 --- src/server/game/DataStores/DBCStores.cpp | 2 ++ src/server/game/DataStores/DBCStores.h | 1 + src/server/game/DungeonFinding/LFGMgr.cpp | 25 ++++++++++++++++++------- src/server/game/DungeonFinding/LFGMgr.h | 4 ++-- src/server/shared/DataStores/DBCStructure.h | 12 ++++++++++++ src/server/shared/DataStores/DBCfmt.h | 1 + 6 files changed, 36 insertions(+), 9 deletions(-) diff --git a/src/server/game/DataStores/DBCStores.cpp b/src/server/game/DataStores/DBCStores.cpp index 544c0a61f2e..cddb7a3c2c5 100644 --- a/src/server/game/DataStores/DBCStores.cpp +++ b/src/server/game/DataStores/DBCStores.cpp @@ -123,6 +123,7 @@ DBCStorage sItemRandomSuffixStore(ItemRandomSuffixfmt); DBCStorage sItemSetStore(ItemSetEntryfmt); DBCStorage sLFGDungeonStore(LFGDungeonEntryfmt); +DBCStorage sLFGDungeonExpansionStore(LFGDungeonExpansionfmt); DBCStorage sLightStore(LightEntryfmt); DBCStorage sLiquidTypeStore(LiquidTypefmt); DBCStorage sLockStore(LockEntryfmt); @@ -346,6 +347,7 @@ void LoadDBCStores(const std::string& dataPath) LOAD_DBC(sItemRandomSuffixStore, "ItemRandomSuffix.dbc"); LOAD_DBC(sItemSetStore, "ItemSet.dbc"); LOAD_DBC(sLFGDungeonStore, "LFGDungeons.dbc"); + LOAD_DBC(sLFGDungeonExpansionStore, "LFGDungeonExpansion.dbc"); LOAD_DBC(sLightStore, "Light.dbc"); LOAD_DBC(sLiquidTypeStore, "LiquidType.dbc"); LOAD_DBC(sLockStore, "Lock.dbc"); diff --git a/src/server/game/DataStores/DBCStores.h b/src/server/game/DataStores/DBCStores.h index 0ac62982c18..c1635c47158 100644 --- a/src/server/game/DataStores/DBCStores.h +++ b/src/server/game/DataStores/DBCStores.h @@ -152,6 +152,7 @@ TC_GAME_API extern DBCStorage sItemRandomProperti TC_GAME_API extern DBCStorage sItemRandomSuffixStore; TC_GAME_API extern DBCStorage sItemSetStore; TC_GAME_API extern DBCStorage sLFGDungeonStore; +TC_GAME_API extern DBCStorage sLFGDungeonExpansionStore; TC_GAME_API extern DBCStorage sLightStore; TC_GAME_API extern DBCStorage sLiquidTypeStore; TC_GAME_API extern DBCStorage sLockStore; diff --git a/src/server/game/DungeonFinding/LFGMgr.cpp b/src/server/game/DungeonFinding/LFGMgr.cpp index 3e4bc2c92e3..e39d5f9c0db 100644 --- a/src/server/game/DungeonFinding/LFGMgr.cpp +++ b/src/server/game/DungeonFinding/LFGMgr.cpp @@ -31,6 +31,7 @@ #include "LFGQueue.h" #include "Log.h" #include "Map.h" +#include "MapUtils.h" #include "ObjectAccessor.h" #include "ObjectMgr.h" #include "Player.h" @@ -43,15 +44,16 @@ namespace lfg { -LFGDungeonData::LFGDungeonData() : id(0), name(), map(0), type(0), expansion(0), group(0), minlevel(0), - maxlevel(0), difficulty(REGULAR_DIFFICULTY), seasonal(false), x(0.0f), y(0.0f), z(0.0f), o(0.0f) +LFGDungeonData::LFGDungeonData() : id(0), name(), map(0), type(0), expansion(0), group(0), minlevel(), + maxlevel(), difficulty(REGULAR_DIFFICULTY), seasonal(false), x(0.0f), y(0.0f), z(0.0f), o(0.0f) { } LFGDungeonData::LFGDungeonData(LFGDungeonEntry const* dbc) : id(dbc->ID), name(dbc->Name[0]), map(dbc->MapID), type(dbc->TypeID), expansion(uint8(dbc->ExpansionLevel)), group(uint8(dbc->GroupID)), - minlevel(uint8(dbc->MinLevel)), maxlevel(uint8(dbc->MaxLevel)), difficulty(Difficulty(dbc->Difficulty)), - seasonal((dbc->Flags & LFG_FLAG_SEASONAL) != 0), x(0.0f), y(0.0f), z(0.0f), o(0.0f) + minlevel({ uint8(dbc->MinLevel), uint8(dbc->MinLevel), uint8(dbc->MinLevel) }), + maxlevel({ uint8(dbc->MaxLevel), uint8(dbc->MaxLevel), uint8(dbc->MaxLevel) }), + difficulty(Difficulty(dbc->Difficulty)), seasonal((dbc->Flags & LFG_FLAG_SEASONAL) != 0), x(0.0f), y(0.0f), z(0.0f), o(0.0f) { } @@ -209,6 +211,15 @@ void LFGMgr::LoadLFGDungeons(bool reload /* = false */) } } + for (LFGDungeonExpansionEntry const* dungeonExpansion : sLFGDungeonExpansionStore) + { + if (LFGDungeonData* dungeon = Trinity::Containers::MapGetValuePtr(LfgDungeonStore, dungeonExpansion->LfgID)) + { + dungeon->minlevel[dungeonExpansion->ExpansionLevel] = dungeonExpansion->HardLevelMin; + dungeon->maxlevel[dungeonExpansion->ExpansionLevel] = dungeonExpansion->HardLevelMax; + } + } + // Fill teleport locations from DB // 0 1 2 3 4 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) 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) + else if (dungeon->minlevel[expansion] > level) lockData = LFG_LOCKSTATUS_TOO_LOW_LEVEL; - else if (dungeon->maxlevel < level) + else if (dungeon->maxlevel[expansion] < level) lockData = LFG_LOCKSTATUS_TOO_HIGH_LEVEL; else if (dungeon->seasonal && !IsSeasonActive(dungeon->id)) lockData = LFG_LOCKSTATUS_NOT_IN_SEASON; @@ -2134,7 +2145,7 @@ LfgDungeonSet LFGMgr::GetRandomAndSeasonalDungeons(uint8 level, uint8 expansion) { lfg::LFGDungeonData const& dungeon = itr->second; if ((dungeon.type == lfg::LFG_TYPE_RANDOM || (dungeon.seasonal && sLFGMgr->IsSeasonActive(dungeon.id))) - && dungeon.expansion <= expansion && dungeon.minlevel <= level && level <= dungeon.maxlevel) + && dungeon.expansion <= expansion && dungeon.minlevel[expansion] <= level && level <= dungeon.maxlevel[expansion]) randomDungeons.insert(dungeon.Entry()); } return randomDungeons; diff --git a/src/server/game/DungeonFinding/LFGMgr.h b/src/server/game/DungeonFinding/LFGMgr.h index 3d9109677c0..71ef7f35a5e 100644 --- a/src/server/game/DungeonFinding/LFGMgr.h +++ b/src/server/game/DungeonFinding/LFGMgr.h @@ -290,8 +290,8 @@ struct LFGDungeonData uint8 type; uint8 expansion; uint8 group; - uint8 minlevel; - uint8 maxlevel; + std::array minlevel; + std::array maxlevel; Difficulty difficulty; bool seasonal; float x, y, z, o; diff --git a/src/server/shared/DataStores/DBCStructure.h b/src/server/shared/DataStores/DBCStructure.h index e2c12efee36..53ef620bcd9 100644 --- a/src/server/shared/DataStores/DBCStructure.h +++ b/src/server/shared/DataStores/DBCStructure.h @@ -1013,6 +1013,18 @@ struct LFGDungeonEntry uint32 Entry() const { return ID + (TypeID << 24); } }; +struct LFGDungeonExpansionEntry +{ + //uint32 ID; // 0 + uint32 LfgID; // 1 + uint32 ExpansionLevel; // 2 + //uint32 RandomID; // 3 + uint32 HardLevelMin; // 4 + uint32 HardLevelMax; // 5 + //uint32 TargetLevelMin; // 6 + //uint32 TargetLevelMax; // 7 +}; + struct LightEntry { uint32 ID; // 0 diff --git a/src/server/shared/DataStores/DBCfmt.h b/src/server/shared/DataStores/DBCfmt.h index 69d4e5f8dcc..da8e920df93 100644 --- a/src/server/shared/DataStores/DBCfmt.h +++ b/src/server/shared/DataStores/DBCfmt.h @@ -84,6 +84,7 @@ char constexpr ItemRandomPropertiesfmt[] = "nxiiixxssssssssssssssssx"; char constexpr ItemRandomSuffixfmt[] = "nssssssssssssssssxxiiixxiiixx"; char constexpr ItemSetEntryfmt[] = "dssssssssssssssssxiiiiiiiiiixxxxxxxiiiiiiiiiiiiiiiiii"; char constexpr LFGDungeonEntryfmt[] = "nssssssssssssssssxiiiiiiiiixxixixxxxxxxxxxxxxxxxx"; +char constexpr LFGDungeonExpansionfmt[] = "diixiixx"; char constexpr LightEntryfmt[] = "nifffxxxxxxxxxx"; char constexpr LiquidTypefmt[] = "nxxixixxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"; char constexpr LockEntryfmt[] = "niiiiiiiiiiiiiiiiiiiiiiiixxxxxxxx"; -- cgit v1.2.3