|
31 | 31 | #include "LFGQueue.h" |
32 | 32 | #include "Log.h" |
33 | 33 | #include "Map.h" |
| 34 | +#include "MapUtils.h" |
34 | 35 | #include "ObjectAccessor.h" |
35 | 36 | #include "ObjectMgr.h" |
36 | 37 | #include "Player.h" |
|
43 | 44 | namespace lfg |
44 | 45 | { |
45 | 46 |
|
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) |
48 | 49 | { |
49 | 50 | } |
50 | 51 |
|
51 | 52 | LFGDungeonData::LFGDungeonData(LFGDungeonEntry const* dbc) : id(dbc->ID), name(dbc->Name[0]), map(dbc->MapID), |
52 | 53 | 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) |
55 | 57 | { |
56 | 58 | } |
57 | 59 |
|
@@ -209,6 +211,15 @@ void LFGMgr::LoadLFGDungeons(bool reload /* = false */) |
209 | 211 | } |
210 | 212 | } |
211 | 213 |
|
| 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 | + |
212 | 223 | // Fill teleport locations from DB |
213 | 224 | // 0 1 2 3 4 |
214 | 225 | 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) |
1700 | 1711 | lockData = LFG_LOCKSTATUS_RAID_LOCKED; |
1701 | 1712 | else if (dungeon->difficulty > DUNGEON_DIFFICULTY_NORMAL && player->GetBoundInstance(dungeon->map, Difficulty(dungeon->difficulty))) |
1702 | 1713 | lockData = LFG_LOCKSTATUS_RAID_LOCKED; |
1703 | | - else if (dungeon->minlevel > level) |
| 1714 | + else if (dungeon->minlevel[expansion] > level) |
1704 | 1715 | lockData = LFG_LOCKSTATUS_TOO_LOW_LEVEL; |
1705 | | - else if (dungeon->maxlevel < level) |
| 1716 | + else if (dungeon->maxlevel[expansion] < level) |
1706 | 1717 | lockData = LFG_LOCKSTATUS_TOO_HIGH_LEVEL; |
1707 | 1718 | else if (dungeon->seasonal && !IsSeasonActive(dungeon->id)) |
1708 | 1719 | lockData = LFG_LOCKSTATUS_NOT_IN_SEASON; |
@@ -2134,7 +2145,7 @@ LfgDungeonSet LFGMgr::GetRandomAndSeasonalDungeons(uint8 level, uint8 expansion) |
2134 | 2145 | { |
2135 | 2146 | lfg::LFGDungeonData const& dungeon = itr->second; |
2136 | 2147 | 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]) |
2138 | 2149 | randomDungeons.insert(dungeon.Entry()); |
2139 | 2150 | } |
2140 | 2151 | return randomDungeons; |
|
0 commit comments