TrinityCore
GameTables.h
Go to the documentation of this file.
1/*
2 * This file is part of the TrinityCore Project. See AUTHORS file for Copyright information
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License as published by the
6 * Free Software Foundation; either version 2 of the License, or (at your
7 * option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18#ifndef GameTables_h__
19#define GameTables_h__
20
21#include "SharedDefines.h"
22#include "Common.h"
23#include <vector>
24
25enum InventoryType : uint8;
26
28{
29 float Multiplier = 0.0f;
30};
31
33{
34 float XP = 0.0f;
35 float XP2 = 0.0f;
36};
37
39{
40 float Cost = 0.0f;
41};
42
44{
45 float Rogue = 0.0f;
46 float Druid = 0.0f;
47 float Hunter = 0.0f;
48 float Mage = 0.0f;
49 float Paladin = 0.0f;
50 float Priest = 0.0f;
51 float Shaman = 0.0f;
52 float Warlock = 0.0f;
53 float Warrior = 0.0f;
54 float DeathKnight = 0.0f;
55 float Monk = 0.0f;
56 float DemonHunter = 0.0f;
57 float Evoker = 0.0f;
58 float Adventurer = 0.0f;
59};
60
62{
63 float Wins = 0.0f;
64 float Xp = 0.0f;
65};
66
68{
69 float Amplify = 0.0f;
70 float DefenseSkill = 0.0f;
71 float Dodge = 0.0f;
72 float Parry = 0.0f;
73 float Block = 0.0f;
74 float HitMelee = 0.0f;
75 float HitRanged = 0.0f;
76 float HitSpell = 0.0f;
77 float CritMelee = 0.0f;
78 float CritRanged = 0.0f;
79 float CritSpell = 0.0f;
80 float Corruption = 0.0f;
82 float Speed = 0.0f;
83 float ResilienceCritTaken = 0.0f;
85 float Lifesteal = 0.0f;
86 float HasteMelee = 0.0f;
87 float HasteRanged = 0.0f;
88 float HasteSpell = 0.0f;
89 float Avoidance = 0.0f;
90 float Sturdiness = 0.0f;
91 float Unused7 = 0.0f;
92 float Expertise = 0.0f;
93 float ArmorPenetration = 0.0f;
94 float Mastery = 0.0f;
95 float PvPPower = 0.0f;
96 float Cleave = 0.0f;
100 float Unused12 = 0.0f;
101};
102
104{
105 float ArmorMultiplier = 0.0f;
106 float WeaponMultiplier = 0.0f;
107 float TrinketMultiplier = 0.0f;
108 float JewelryMultiplier = 0.0f;
109};
110
112{
113 float Health = 0.0f;
114};
115
117{
118 float SocketCost = 0.0f;
119};
120
122{
123 float Scaler = 0.0f;
124};
125
127{
128 float Rogue = 0.0f;
129 float Druid = 0.0f;
130 float Hunter = 0.0f;
131 float Mage = 0.0f;
132 float Paladin = 0.0f;
133 float Priest = 0.0f;
134 float Shaman = 0.0f;
135 float Warlock = 0.0f;
136 float Warrior = 0.0f;
137 float DeathKnight = 0.0f;
138 float Monk = 0.0f;
139 float DemonHunter = 0.0f;
140 float Evoker = 0.0f;
141 float Adventurer = 0.0f;
142 float Item = 0.0f;
143 float Consumable = 0.0f;
144 float Gem1 = 0.0f;
145 float Gem2 = 0.0f;
146 float Gem3 = 0.0f;
147 float Health = 0.0f;
148 float DamageReplaceStat = 0.0f;
149 float DamageSecondary = 0.0f;
150 float ManaConsumable = 0.0f;
151};
152
154{
155 float ArmorMultiplier = 0.0f;
156 float WeaponMultiplier = 0.0f;
157 float TrinketMultiplier = 0.0f;
158 float JewelryMultiplier = 0.0f;
159};
160
162{
163 float Total = 0.0f;
164 float PerKill = 0.0f;
165 float Junk = 0.0f;
166 float Stats = 0.0f;
167 float Divisor = 0.0f;
168};
169
170template<class T>
172{
173public:
174 T const* GetRow(uint32 row) const
175 {
176 if (row >= _data.size())
177 return nullptr;
178
179 return &_data[row];
180 }
181
182 std::size_t GetTableRowCount() const { return _data.size(); }
183
184 void SetData(std::vector<T> data) { _data = std::move(data); }
185
186private:
187 std::vector<T> _data;
188};
189
203
204TC_GAME_API void LoadGameTables(std::string const& dataPath);
205
206template<class T>
207inline float GetGameTableColumnForClass(T const* row, int32 class_)
208{
209 switch (class_)
210 {
211 case CLASS_WARRIOR:
212 return row->Warrior;
213 case CLASS_PALADIN:
214 return row->Paladin;
215 case CLASS_HUNTER:
216 return row->Hunter;
217 case CLASS_ROGUE:
218 return row->Rogue;
219 case CLASS_PRIEST:
220 return row->Priest;
222 return row->DeathKnight;
223 case CLASS_SHAMAN:
224 return row->Shaman;
225 case CLASS_MAGE:
226 return row->Mage;
227 case CLASS_WARLOCK:
228 return row->Warlock;
229 case CLASS_MONK:
230 return row->Monk;
231 case CLASS_DRUID:
232 return row->Druid;
234 return row->DemonHunter;
235 case CLASS_EVOKER:
236 return row->Evoker;
237 case CLASS_ADVENTURER:
238 return row->Adventurer;
239 default:
240 break;
241 }
242
243 return 0.0f;
244}
245
247{
248 switch (class_)
249 {
250 case CLASS_WARRIOR:
251 return row->Warrior;
252 case CLASS_PALADIN:
253 return row->Paladin;
254 case CLASS_HUNTER:
255 return row->Hunter;
256 case CLASS_ROGUE:
257 return row->Rogue;
258 case CLASS_PRIEST:
259 return row->Priest;
261 return row->DeathKnight;
262 case CLASS_SHAMAN:
263 return row->Shaman;
264 case CLASS_MAGE:
265 return row->Mage;
266 case CLASS_WARLOCK:
267 return row->Warlock;
268 case CLASS_MONK:
269 return row->Monk;
270 case CLASS_DRUID:
271 return row->Druid;
273 return row->DemonHunter;
274 case CLASS_EVOKER:
275 return row->Evoker;
276 case CLASS_ADVENTURER:
277 return row->Adventurer;
278 case -1:
279 case -7:
280 return row->Item;
281 case -2:
282 return row->Consumable;
283 case -3:
284 return row->Gem1;
285 case -4:
286 return row->Gem2;
287 case -5:
288 return row->Gem3;
289 case -6:
290 return row->Health;
291 case -8:
292 return row->DamageReplaceStat;
293 case -9:
294 return row->DamageSecondary;
295 case -10:
296 return row->ManaConsumable;
297 default:
298 break;
299 }
300
301 return 0.0f;
302}
303
305{
306 return row->Wins * row->Xp;
307}
308
309template<class T>
310float GetIlvlStatMultiplier(T const* row, InventoryType invType);
311
312#endif // GameTables_h__
#define TC_GAME_API
Definition: Define.h:123
uint8_t uint8
Definition: Define.h:144
int32_t int32
Definition: Define.h:138
uint32_t uint32
Definition: Define.h:142
TC_GAME_API GameTable< GtCombatRatingsMultByILvl > sCombatRatingsMultByILvlGameTable
Definition: GameTables.cpp:34
TC_GAME_API GameTable< GtBarberShopCostBaseEntry > sBarberShopCostBaseGameTable
Definition: GameTables.cpp:30
TC_GAME_API GameTable< GtBaseMPEntry > sBaseMPGameTable
Definition: GameTables.cpp:31
TC_GAME_API GameTable< GtHpPerStaEntry > sHpPerStaGameTable
Definition: GameTables.cpp:35
float GetIlvlStatMultiplier(T const *row, InventoryType invType)
Definition: GameTables.cpp:149
TC_GAME_API GameTable< GtStaminaMultByILvl > sStaminaMultByILvlGameTable
Definition: GameTables.cpp:39
TC_GAME_API void LoadGameTables(std::string const &dataPath)
Definition: GameTables.cpp:103
TC_GAME_API GameTable< GtArtifactLevelXPEntry > sArtifactLevelXPGameTable
Definition: GameTables.cpp:29
float GetBattlePetXPPerLevel(GtBattlePetXPEntry const *row)
Definition: GameTables.h:304
float GetSpellScalingColumnForClass(GtSpellScalingEntry const *row, int32 class_)
Definition: GameTables.h:246
TC_GAME_API GameTable< GtSpellScalingEntry > sSpellScalingGameTable
Definition: GameTables.cpp:38
TC_GAME_API GameTable< GtCombatRatingsEntry > sCombatRatingsGameTable
Definition: GameTables.cpp:33
TC_GAME_API GameTable< GtItemSocketCostPerLevelEntry > sItemSocketCostPerLevelGameTable
Definition: GameTables.cpp:36
TC_GAME_API GameTable< GtXpEntry > sXpGameTable
Definition: GameTables.cpp:40
TC_GAME_API GameTable< GtBattlePetXPEntry > sBattlePetXPGameTable
Definition: GameTables.cpp:32
float GetGameTableColumnForClass(T const *row, int32 class_)
Definition: GameTables.h:207
TC_GAME_API GameTable< GtArtifactKnowledgeMultiplierEntry > sArtifactKnowledgeMultiplierGameTable
Definition: GameTables.cpp:28
TC_GAME_API GameTable< GtNpcManaCostScalerEntry > sNpcManaCostScalerGameTable
Definition: GameTables.cpp:37
InventoryType
Definition: ItemTemplate.h:378
@ CLASS_HUNTER
@ CLASS_DRUID
@ CLASS_SHAMAN
@ CLASS_MONK
@ CLASS_PRIEST
@ CLASS_WARRIOR
@ CLASS_WARLOCK
@ CLASS_ADVENTURER
@ CLASS_MAGE
@ CLASS_DEATH_KNIGHT
@ CLASS_DEMON_HUNTER
@ CLASS_PALADIN
@ CLASS_ROGUE
@ CLASS_EVOKER
Stats
std::size_t GetTableRowCount() const
Definition: GameTables.h:182
std::vector< T > _data
Definition: GameTables.h:187
T const * GetRow(uint32 row) const
Definition: GameTables.h:174
void SetData(std::vector< T > data)
Definition: GameTables.h:184
Definition: Item.h:170
float Warlock
Definition: GameTables.h:52
float Paladin
Definition: GameTables.h:49
float Hunter
Definition: GameTables.h:47
float Adventurer
Definition: GameTables.h:58
float Warrior
Definition: GameTables.h:53
float DeathKnight
Definition: GameTables.h:54
float DemonHunter
Definition: GameTables.h:56
float Priest
Definition: GameTables.h:50
float Evoker
Definition: GameTables.h:57
float Shaman
Definition: GameTables.h:51
float VersatilityDamageTaken
Definition: GameTables.h:99
float ResiliencePlayerDamage
Definition: GameTables.h:84
float VersatilityHealingDone
Definition: GameTables.h:98
float CorruptionResistance
Definition: GameTables.h:81
float VersatilityDamageDone
Definition: GameTables.h:97
float Total
Definition: GameTables.h:163
float Divisor
Definition: GameTables.h:167
float Junk
Definition: GameTables.h:165
float PerKill
Definition: GameTables.h:164