TrinityCore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
DBCStores.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2008-2016 TrinityCore <http://www.trinitycore.org/>
3  * Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
4  *
5  * This program is free software; you can redistribute it and/or modify it
6  * under the terms of the GNU General Public License as published by the
7  * Free Software Foundation; either version 2 of the License, or (at your
8  * option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful, but WITHOUT
11  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
13  * more details.
14  *
15  * You should have received a copy of the GNU General Public License along
16  * with this program. If not, see <http://www.gnu.org/licenses/>.
17  */
18 
19 #ifndef TRINITY_DBCSTORES_H
20 #define TRINITY_DBCSTORES_H
21 
22 #include "DBCStore.h"
23 #include "DBCStructure.h"
24 #include "DB2Structure.h"
25 #include "SharedDefines.h"
26 
27 // CharSections
28 TC_GAME_API CharSectionsEntry const* GetCharSectionEntry(uint8 race, CharSectionType genType, uint8 gender, uint8 type, uint8 color);
29 
30 // ChrClasses
31 TC_GAME_API char const* GetClassName(uint8 class_, uint8 locale);
32 
33 // ChrRaces
34 TC_GAME_API char const* GetRaceName(uint8 race, uint8 locale);
35 
36 // ChrSpecialization
38 
39 // CreatureFamilty
40 TC_GAME_API char const* GetCreatureFamilyPetName(uint32 petfamily, uint32 locale);
41 
42 // EmotesText
44 
45 // Faction
46 TC_GAME_API std::vector<uint32> const* GetFactionTeamList(uint32 faction);
47 
48 // ItemSetSpells
49 typedef std::vector<ItemSetSpellEntry const*> ItemSetSpells;
50 typedef std::unordered_map<uint32, ItemSetSpells> ItemSetSpellsStore;
51 
52 // LfgDungeons
54 
55 // Light
57 
58 // LiquidType
60 
61 // MapDifficulty
62 typedef std::unordered_map<uint32, std::unordered_map<uint32, MapDifficultyEntry const*>> MapDifficultyMap;
63 TC_GAME_API MapDifficultyEntry const* GetDefaultMapDifficulty(uint32 mapId, Difficulty* difficulty = nullptr);
66 
67 // PvpDifficulty
70 
71 // SkillRaceClassInfo
72 typedef std::unordered_multimap<uint32, SkillRaceClassInfoEntry const*> SkillRaceClassInfoMap;
73 typedef std::pair<SkillRaceClassInfoMap::iterator, SkillRaceClassInfoMap::iterator> SkillRaceClassInfoBounds;
75 
76 // SpellEffectScaling
77 typedef std::unordered_map<uint32, uint32> SpellEffectScallingByEffectId;
78 
79 // Talent
80 typedef std::vector<TalentEntry const*> TalentsByPosition[MAX_CLASSES][MAX_TALENT_TIERS][MAX_TALENT_COLUMNS];
81 
82 // TotemCategory
83 TC_GAME_API bool IsTotemCategoryCompatibleWith(uint32 itemTotemCategoryId, uint32 requiredTotemCategoryId);
84 
85 // WMOAreaTable
87 
88 // WorldMapArea
90 TC_GAME_API void Zone2MapCoordinates(float &x, float &y, uint32 worldMapAreaId);
91 TC_GAME_API void Map2ZoneCoordinates(float &x, float &y, uint32 worldMapAreaId);
92 
93 // WorldMapTransforms
94 TC_GAME_API void DeterminaAlternateMapPosition(uint32 mapId, float x, float y, float z, uint32* newMapId = nullptr, DBCPosition2D* newPos = nullptr);
95 
98 
99 template<class T>
101 {
102 public:
103  GameTable(char const* format) : _storage(format), _gtEntry(nullptr) { }
104 
105  void SetGameTableEntry(GameTablesEntry const* gtEntry) { _gtEntry = gtEntry; }
106 
107  T const* EvaluateTable(uint32 row, uint32 column) const
108  {
109  ASSERT(row < _gtEntry->NumRows, "Requested row %u from GameTable %s but there are only %u rows!", row, _gtEntry->Name->Str[0], _gtEntry->NumRows);
110  ASSERT(column < _gtEntry->NumColumns, "Requested column %u from GameTable %s but there are only %u columns!", column, _gtEntry->Name->Str[0], _gtEntry->NumColumns);
111 
112  return _storage.LookupEntry(_gtEntry->NumRows * column + row);
113  }
114 
115  char const* GetFormat() const { return _storage.GetFormat(); }
116  uint32 GetFieldCount() const { return _storage.GetFieldCount(); }
117  bool Load(char const* fileName) { return _storage.Load(fileName, nullptr); }
118 
121 
122 private:
125 };
126 
209 
230 
231 TC_GAME_API void LoadDBCStores(const std::string& dataPath, uint32 defaultLocale);
232 TC_GAME_API void LoadGameTables(const std::string& dataPath, uint32 defaultLocale);
233 
234 #endif
TC_GAME_API DBCStorage< SpellEquippedItemsEntry > sSpellEquippedItemsStore
void format(BasicFormatter< Char > &f, const Char *&format_str, const T &value)
Definition: format.h:2963
TC_GAME_API DBCStorage< PowerDisplayEntry > sPowerDisplayStore
std::vector< TalentEntry const * > TalentsByPosition[MAX_CLASSES][MAX_TALENT_TIERS][MAX_TALENT_COLUMNS]
Definition: DBCStores.h:80
TC_GAME_API GameTable< GtNpcTotalHpExp3Entry > sGtNpcTotalHpExp3Store
TC_GAME_API DBCStorage< CreatureDisplayInfoExtraEntry > sCreatureDisplayInfoExtraStore
TC_GAME_API GameTable< GtBarberShopCostBaseEntry > sGtBarberShopCostBaseStore
std::vector< ItemSetSpellEntry const * > ItemSetSpells
Definition: DBCStores.h:49
std::unordered_map< uint32, std::unordered_map< uint32, MapDifficultyEntry const * > > MapDifficultyMap
Definition: DBCStores.h:62
TC_GAME_API DBCStorage< SpellShapeshiftEntry > sSpellShapeshiftStore
Difficulty
Definition: DBCEnums.h:402
TC_GAME_API DBCStorage< ItemSetSpellEntry > sItemSetSpellStore
TC_GAME_API DBCStorage< CharTitlesEntry > sCharTitlesStore
TC_GAME_API DBCStorage< ItemSetEntry > sItemSetStore
TC_GAME_API DBCStorage< LFGDungeonEntry > sLFGDungeonStore
TC_GAME_API DBCStorage< PhaseEntry > sPhaseStore
TC_GAME_API TalentsByPosition sTalentByPos
Definition: DBCStores.cpp:150
TC_GAME_API SkillRaceClassInfoEntry const * GetSkillRaceClassInfo(uint32 skill, uint8 race, uint8 class_)
Definition: DBCStores.cpp:845
TC_GAME_API DBCStorage< WMOAreaTableEntry > sWMOAreaTableStore
void SetGameTableEntry(GameTablesEntry const *gtEntry)
Definition: DBCStores.h:105
TC_GAME_API DBCStorage< RandomPropertiesPointsEntry > sRandomPropertiesPointsStore
TC_GAME_API DBCStorage< ItemBagFamilyEntry > sItemBagFamilyStore
TC_GAME_API DBCStorage< CreatureFamilyEntry > sCreatureFamilyStore
TC_GAME_API GameTable< GtOCTBaseHPByClassEntry > sGtOCTBaseHPByClassStore
TC_GAME_API DBCStorage< CharSectionsEntry > sCharSectionsStore
TC_GAME_API DBCStorage< DifficultyEntry > sDifficultyStore
TC_GAME_API uint32 GetExpansionForLevel(uint32 level)
Definition: DBCStores.cpp:632
TC_GAME_API DBCStorage< DurabilityCostsEntry > sDurabilityCostsStore
TC_GAME_API DBCStorage< GuildColorBackgroundEntry > sGuildColorBackgroundStore
TC_GAME_API DBCStorage< SpellAuraOptionsEntry > sSpellAuraOptionsStore
TC_GAME_API DBCStorage< LockEntry > sLockStore
Definition: DBCStructure.h:396
TC_GAME_API MapDifficultyEntry const * GetDownscaledMapDifficultyData(uint32 mapId, Difficulty &difficulty)
Definition: DBCStores.cpp:737
TC_GAME_API uint32 GetDefaultMapLight(uint32 mapId)
Definition: DBCStores.cpp:830
Definition: DBCStore.h:74
TC_GAME_API DBCStorage< SpellTargetRestrictionsEntry > sSpellTargetRestrictionsStore
BattlegroundBracketId
Definition: DBCEnums.h:57
TC_GAME_API DBCStorage< ChatChannelsEntry > sChatChannelsStore
TC_GAME_API DBCStorage< ChrRacesEntry > sChrRacesStore
TC_GAME_API DBCStorage< SpellItemEnchantmentEntry > sSpellItemEnchantmentStore
TC_GAME_API GameTable< GtNpcTotalHpExp1Entry > sGtNpcTotalHpExp1Store
TC_GAME_API DBCStorage< GemPropertiesEntry > sGemPropertiesStore
TC_GAME_API DBCStorage< FactionEntry > sFactionStore
TC_GAME_API ChrSpecializationByIndexArray sChrSpecializationByIndexStore
Definition: DBCStores.cpp:67
TC_GAME_API MapDifficultyMap sMapDifficultyMap
Definition: DBCStores.cpp:115
char const * GetFormat() const
Definition: DBCStores.h:115
Definition: DBCEnums.h:26
TC_GAME_API void Map2ZoneCoordinates(float &x, float &y, uint32 worldMapAreaId)
Definition: DBCStores.cpp:681
TC_GAME_API MapDifficultyEntry const * GetMapDifficultyData(uint32 mapId, Difficulty difficulty)
Definition: DBCStores.cpp:724
Definition: DBCStores.h:100
TC_GAME_API char const * GetClassName(uint8 class_, uint8 locale)
Definition: DBCStores.cpp:593
TC_GAME_API GameTable< GtNpcTotalHpEntry > sGtNpcTotalHpStore
bool Load(char const *fileName)
Definition: DBCStores.h:117
TC_GAME_API GameTable< GtNpcTotalHpExp4Entry > sGtNpcTotalHpExp4Store
TC_GAME_API GameTable< GtItemSocketCostPerLevelEntry > sGtItemSocketCostPerLevelStore
TC_GAME_API DBCStorage< SpellCategoriesEntry > sSpellCategoriesStore
TC_GAME_API WMOAreaTableEntry const * GetWMOAreaTableEntryByTripple(int32 rootid, int32 adtid, int32 groupid)
Definition: DBCStores.cpp:579
TC_GAME_API GameTable< GtChanceToMeleeCritEntry > sGtChanceToMeleeCritStore
TC_GAME_API bool IsTotemCategoryCompatibleWith(uint32 itemTotemCategoryId, uint32 requiredTotemCategoryId)
Definition: DBCStores.cpp:648
TC_GAME_API DBCStorage< SpellEffectScalingEntry > sSpellEffectScalingStore
TC_GAME_API GameTable< GtChanceToMeleeCritBaseEntry > sGtChanceToMeleeCritBaseStore
LocalizedString * Name
Definition: DB2Structure.h:422
TC_GAME_API MapDifficultyEntry const * GetDefaultMapDifficulty(uint32 mapId, Difficulty *difficulty=nullptr)
Definition: DBCStores.cpp:694
TC_GAME_API void Zone2MapCoordinates(float &x, float &y, uint32 worldMapAreaId)
Definition: DBCStores.cpp:668
TC_GAME_API DBCStorage< SpellEffectEntry > sSpellEffectStore
TC_GAME_API DBCStorage< SpellEntry > sSpellStore
TC_GAME_API DBCStorage< BannedAddOnsEntry > sBannedAddOnsStore
TC_GAME_API DBCStorage< ItemDamageEntry > sItemDamageOneHandStore
TC_GAME_API DBCStorage< ItemArmorShieldEntry > sItemArmorShieldStore
TC_GAME_API DBCStorage< LiquidTypeEntry > sLiquidTypeStore
TC_GAME_API char const * GetRaceName(uint8 race, uint8 locale)
Definition: DBCStores.cpp:587
TC_GAME_API DBCStorage< ItemArmorTotalEntry > sItemArmorTotalStore
TC_GAME_API DBCStorage< SpellLevelsEntry > sSpellLevelsStore
TC_GAME_API DBCStorage< SummonPropertiesEntry > sSummonPropertiesStore
TC_GAME_API GameTable< GtCombatRatingsEntry > sGtCombatRatingsStore
Definition: DBCStructure.h:742
std::unordered_map< uint32, uint32 > SpellEffectScallingByEffectId
Definition: DBCStores.h:77
Definition: DB2Structure.h:419
TC_GAME_API DBCStorage< AnimKitEntry > sAnimKitStore
#define MAX_SPECIALIZATIONS
Definition: SharedDefines.h:856
Definition: DBCStructure.h:1383
TC_GAME_API SpellEffectScallingByEffectId sSpellEffectScallingByEffectId
Definition: DBCStores.cpp:136
char const * Str[TOTAL_LOCALES]
Definition: Common.h:148
TC_GAME_API DBCStorage< CreatureModelDataEntry > sCreatureModelDataStore
TC_GAME_API DBCStorage< ItemArmorQualityEntry > sItemArmorQualityStore
CharSectionType
Definition: DBCStructure.h:140
T const * EvaluateTable(uint32 row, uint32 column) const
Definition: DBCStores.h:107
TC_GAME_API DBCStorage< SpellScalingEntry > sSpellScalingStore
Definition: DBCStructure.h:245
TC_GAME_API DBCStorage< VehicleSeatEntry > sVehicleSeatStore
TC_GAME_API DBCStorage< FactionTemplateEntry > sFactionTemplateStore
TC_GAME_API DBCStorage< ItemDamageEntry > sItemDamageAmmoStore
ChrSpecializationEntry const * ChrSpecializationByIndexArray[MAX_CLASSES][MAX_SPECIALIZATIONS]
Definition: DBCStores.h:37
TC_GAME_API uint32 GetMaxLevelForExpansion(uint32 expansion)
Definition: DBCStores.cpp:610
TC_GAME_API DBCStorage< BattlemasterListEntry > sBattlemasterListStore
G3D::int16 z
Definition: Vector3int16.h:46
TC_GAME_API GameTable< GtSpellScalingEntry > sGtSpellScalingStore
TC_GAME_API DBCStorage< SkillLineEntry > sSkillLineStore
uint32 NumRows
Definition: DB2Structure.h:423
TC_GAME_API GameTable< GtOCTLevelExperienceEntry > sGtOCTLevelExperienceStore
std::unordered_map< uint32, ItemSetSpells > ItemSetSpellsStore
Definition: DBCStores.h:50
TC_GAME_API DBCStorage< ItemDamageEntry > sItemDamageOneHandCasterStore
TC_GAME_API LFGDungeonEntry const * GetLFGDungeon(uint32 mapId, Difficulty difficulty)
Returns LFGDungeonEntry for a specific map and difficulty. Will return first found entry if multiple ...
Definition: DBCStores.cpp:815
int32_t int32
Definition: Define.h:146
TC_GAME_API GameTable< GtOCTHpPerStaminaEntry > sGtOCTHpPerStaminaStore
uint32_t uint32
Definition: Define.h:150
TC_GAME_API DBCStorage< QuestFactionRewEntry > sQuestFactionRewardStore
G3D::int16 y
Definition: Vector2int16.h:38
std::unordered_multimap< uint32, SkillRaceClassInfoEntry const * > SkillRaceClassInfoMap
Definition: DBCStores.h:72
TC_GAME_API GameTable< GtNPCManaCostScalerEntry > sGtNPCManaCostScalerStore
TC_GAME_API DBCStorage< DungeonEncounterEntry > sDungeonEncounterStore
TC_GAME_API DBCStorage< GuildColorBorderEntry > sGuildColorBorderStore
TC_GAME_API PvPDifficultyEntry const * GetBattlegroundBracketByLevel(uint32 mapid, uint32 level)
Definition: DBCStores.cpp:760
Definition: DBCStructure.h:982
uint32 GetTableColumnCount() const
Definition: DBCStores.h:120
TC_GAME_API void LoadGameTables(const std::string &dataPath, uint32 defaultLocale)
Definition: DBCStores.cpp:500
TC_GAME_API DBCStorage< ItemDamageEntry > sItemDamageTwoHandStore
TC_GAME_API DBCStorage< SpellInterruptsEntry > sSpellInterruptsStore
TC_GAME_API PvPDifficultyEntry const * GetBattlegroundBracketById(uint32 mapid, BattlegroundBracketId id)
Definition: DBCStores.cpp:784
TC_GAME_API GameTable< GtOCTBaseMPByClassEntry > sGtOCTBaseMPByClassStore
uint32 GetTableRowCount() const
Definition: DBCStores.h:119
GameTablesEntry const * _gtEntry
Definition: DBCStores.h:124
#define MAX_CLASSES
Definition: SharedDefines.h:181
std::pair< SkillRaceClassInfoMap::iterator, SkillRaceClassInfoMap::iterator > SkillRaceClassInfoBounds
Definition: DBCStores.h:73
TC_GAME_API DBCStorage< EmotesTextEntry > sEmotesTextStore
TC_GAME_API DBCStorage< SpellCooldownsEntry > sSpellCooldownsStore
TC_GAME_API GameTable< GtNpcTotalHpExp2Entry > sGtNpcTotalHpExp2Store
TC_GAME_API GameTable< GtNpcTotalHpExp5Entry > sGtNpcTotalHpExp5Store
TC_GAME_API uint32 GetVirtualMapForMapAndZone(uint32 mapid, uint32 zoneId)
Definition: DBCStores.cpp:599
TC_GAME_API DBCStorage< ChrSpecializationEntry > sChrSpecializationStore
TC_GAME_API DBCStorage< TalentEntry > sTalentStore
Definition: DBCStructure.h:885
TC_GAME_API DBCStorage< ItemDamageEntry > sItemDamageRangedStore
Definition: DBCStructure.h:926
TC_GAME_API std::vector< uint32 > const * GetFactionTeamList(uint32 faction)
Definition: DBCStores.cpp:552
#define TC_GAME_API
Definition: Define.h:134
uint32 NumColumns
Definition: DB2Structure.h:424
TC_GAME_API DBCStorage< AreaTableEntry > sAreaTableStore
TC_GAME_API DBCStorage< SpellCategoryEntry > sSpellCategoryStore
TC_GAME_API DBCStorage< VehicleEntry > sVehicleStore
TC_GAME_API DBCStorage< MovieEntry > sMovieStore
TC_GAME_API void LoadDBCStores(const std::string &dataPath, uint32 defaultLocale)
Definition: DBCStores.cpp:288
TC_GAME_API DBCStorage< GameObjectDisplayInfoEntry > sGameObjectDisplayInfoStore
uint8_t uint8
Definition: Define.h:152
TC_GAME_API char const * GetCreatureFamilyPetName(uint32 petfamily, uint32 locale)
Definition: DBCStores.cpp:561
#define ASSERT
Definition: Errors.h:55
TC_GAME_API CharSectionsEntry const * GetCharSectionEntry(uint8 race, CharSectionType genType, uint8 gender, uint8 type, uint8 color)
Definition: DBCStores.cpp:802
TC_GAME_API DBCStorage< ArmorLocationEntry > sArmorLocationStore
TC_GAME_API GameTable< GtChanceToSpellCritBaseEntry > sGtChanceToSpellCritBaseStore
TC_GAME_API DBCStorage< BankBagSlotPricesEntry > sBankBagSlotPricesStore
DBCStorage< T > _storage
Definition: DBCStores.h:123
TC_GAME_API DBCStorage< ChrClassesEntry > sChrClassesStore
TC_GAME_API EmotesTextSoundEntry const * FindTextSoundEmoteFor(uint32 emote, uint32 race, uint32 gender)
Definition: DBCStores.cpp:573
G3D::int16 x
Definition: Vector2int16.h:37
TC_GAME_API DBCStorage< GlyphPropertiesEntry > sGlyphPropertiesStore
TC_GAME_API DBCStorage< ItemDamageEntry > sItemDamageTwoHandCasterStore
TC_GAME_API DBCStorage< SkillLineAbilityEntry > sSkillLineAbilityStore
GameTable(char const *format)
Definition: DBCStores.h:103
TC_GAME_API DBCStorage< ItemDamageEntry > sItemDamageThrownStore
TC_GAME_API GameTable< GtRegenMPPerSptEntry > sGtRegenMPPerSptStore
#define MAX_TALENT_COLUMNS
Definition: DBCStructure.h:1253
TC_GAME_API DBCStorage< SpellFocusObjectEntry > sSpellFocusObjectStore
TC_GAME_API uint32 GetLiquidFlags(uint32 liquidType)
Definition: DBCStores.cpp:794
TC_GAME_API GameTable< GtChanceToSpellCritEntry > sGtChanceToSpellCritStore
TC_GAME_API DBCStorage< WorldSafeLocsEntry > sWorldSafeLocsStore
TC_GAME_API void DeterminaAlternateMapPosition(uint32 mapId, float x, float y, float z, uint32 *newMapId=nullptr, DBCPosition2D *newPos=nullptr)
Definition: DBCStores.cpp:861
Definition: DBCStructure.h:149
TC_GAME_API DBCStorage< MapEntry > sMapStore
TC_GAME_API DBCStorage< ItemDamageEntry > sItemDamageWandStore
#define MAX_TALENT_TIERS
Definition: DBCStructure.h:1252
TC_GAME_API DBCStorage< AreaTriggerEntry > sAreaTriggerStore
TC_GAME_API DBCStorage< GuildColorEmblemEntry > sGuildColorEmblemStore
TC_GAME_API ItemSetSpellsStore sItemSetSpellsStore
Definition: DBCStores.cpp:106
uint32 GetFieldCount() const
Definition: DBCStores.h:116
TC_GAME_API DBCStorage< SkillRaceClassInfoEntry > sSkillRaceClassInfoStore
TC_GAME_API DBCStorage< EmotesEntry > sEmotesStore
TC_GAME_API DBCStorage< SpellShapeshiftFormEntry > sSpellShapeshiftFormStore