diff --git a/src/game/DBCStores.cpp b/src/game/DBCStores.cpp index aaf0d37e5..5b3d12ee4 100644 --- a/src/game/DBCStores.cpp +++ b/src/game/DBCStores.cpp @@ -869,16 +869,26 @@ MapDifficulty const* GetMapDifficultyData(uint32 mapId, Difficulty difficulty) PvPDifficultyEntry const* GetBattlegroundBracketByLevel( uint32 mapid, uint32 level ) { - // prevent out-of-range levels for dbc data - if (level > DEFAULT_MAX_LEVEL) - level = DEFAULT_MAX_LEVEL; - + PvPDifficultyEntry const* maxEntry = NULL; // used for level > max listed level case for(uint32 i = 0; i < sPvPDifficultyStore.GetNumRows(); ++i) + { if (PvPDifficultyEntry const* entry = sPvPDifficultyStore.LookupEntry(i)) - if (entry->mapId == mapid && entry->minLevel <= level && entry->maxLevel >= level) + { + // skip unrelated and too-high brackets + if (entry->mapId != mapid || entry->minLevel > level) + continue; + + // exactly fit + if (entry->maxLevel >= level) return entry; - return NULL; + // remember for possible out-of-range case (search higher from existed) + if (!maxEntry || maxEntry->maxLevel < entry->maxLevel) + maxEntry = entry; + } + } + + return maxEntry; } PvPDifficultyEntry const* GetBattlegroundBracketById(uint32 mapid, BattleGroundBracketId id) diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 228267ada..408087a55 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "10327" + #define REVISION_NR "10328" #endif // __REVISION_NR_H__