diff options
author | n0n4m3 <none@none> | 2010-02-15 15:31:27 +0100 |
---|---|---|
committer | n0n4m3 <none@none> | 2010-02-15 15:31:27 +0100 |
commit | 3dd6fdedf739ac87fa9da9a294bdc9ffdca28441 (patch) | |
tree | ed560ee6b3d45e18487abf73d17475b6cac16101 /src/game/DBCStores.cpp | |
parent | 535068d7401720e6f36410a4e953a94ac4da84ec (diff) |
Use PVPDificulty.dbc for bg/arena bracket selection (levels and difficulty). Rename BG/arena queue_id to bracket_id and related functions/etc. Author: VladimirMangos.
--HG--
branch : trunk
Diffstat (limited to 'src/game/DBCStores.cpp')
-rw-r--r-- | src/game/DBCStores.cpp | 34 |
1 files changed, 33 insertions, 1 deletions
diff --git a/src/game/DBCStores.cpp b/src/game/DBCStores.cpp index 989e94fb2d5..3056b863516 100644 --- a/src/game/DBCStores.cpp +++ b/src/game/DBCStores.cpp @@ -107,6 +107,8 @@ MapDifficultyMap sMapDifficultyMap; DBCStorage <MovieEntry> sMovieStore(MovieEntryfmt); +DBCStorage <PvPDifficultyEntry> sPvPDifficultyStore(PvPDifficultyfmt); + DBCStorage <QuestSortEntry> sQuestSortStore(QuestSortEntryfmt); DBCStorage <QuestXPEntry> sQuestXPStore(QuestXPfmt); DBCStorage <QuestFactionRewEntry> sQuestFactionRewardStore(QuestFactionRewardfmt); @@ -216,7 +218,7 @@ void LoadDBCStores(const std::string& dataPath) { std::string dbcPath = dataPath+"dbc/"; - const uint32 DBCFilesCount = 83; + const uint32 DBCFilesCount = 84; barGoLink bar(DBCFilesCount); @@ -329,6 +331,12 @@ void LoadDBCStores(const std::string& dataPath) LoadDBC(availableDbcLocales,bar,bad_dbc_files,sMovieStore, dbcPath,"Movie.dbc"); LoadDBC(availableDbcLocales,bar,bad_dbc_files,sQuestSortStore, dbcPath,"QuestSort.dbc"); + LoadDBC(availableDbcLocales,bar,bad_dbc_files,sPvPDifficultyStore, dbcPath,"PvpDifficulty.dbc"); + for(uint32 i = 0; i < sPvPDifficultyStore.GetNumRows(); ++i) + if (PvPDifficultyEntry const* entry = sPvPDifficultyStore.LookupEntry(i)) + if (entry->bracketId > MAX_BATTLEGROUND_BRACKETS) + assert(false && "Need update MAX_BATTLEGROUND_BRACKETS by DBC data"); + LoadDBC(availableDbcLocales,bar,bad_dbc_files,sQuestXPStore, dbcPath,"QuestXP.dbc"); LoadDBC(availableDbcLocales,bar,bad_dbc_files,sQuestFactionRewardStore, dbcPath,"QuestFactionReward.dbc"); LoadDBC(availableDbcLocales,bar,bad_dbc_files,sRandomPropertiesPointsStore, dbcPath,"RandPropPoints.dbc"); @@ -720,6 +728,30 @@ MapDifficulty const* GetMapDifficultyData(uint32 mapId, Difficulty difficulty) return itr != sMapDifficultyMap.end() ? &itr->second : NULL; } +PvPDifficultyEntry const* GetBattlegroundBracketByLevel( uint32 mapid, uint32 level ) +{ + // prevent out-of-range levels for dbc data + if (level > DEFAULT_MAX_LEVEL) + level = DEFAULT_MAX_LEVEL; + + 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) + return entry; + + return NULL; +} + +PvPDifficultyEntry const* GetBattlegroundBracketById(uint32 mapid, BattleGroundBracketId id) +{ + for(uint32 i = 0; i < sPvPDifficultyStore.GetNumRows(); ++i) + if (PvPDifficultyEntry const* entry = sPvPDifficultyStore.LookupEntry(i)) + if (entry->mapId == mapid && entry->GetBracketId() == id) + return entry; + + return NULL; +} + uint32 const* GetTalentTabPages(uint8 cls) { return sTalentTabPages[cls]; |