TrinityCore
Loading...
Searching...
No Matches
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
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 float Traveler = 0.0f;
60};
61
63{
64 float Wins = 0.0f;
65 float Xp = 0.0f;
66};
67
69{
70 float Amplify = 0.0f;
71 float DefenseSkill = 0.0f;
72 float Dodge = 0.0f;
73 float Parry = 0.0f;
74 float Block = 0.0f;
75 float HitMelee = 0.0f;
76 float HitRanged = 0.0f;
77 float HitSpell = 0.0f;
78 float CritMelee = 0.0f;
79 float CritRanged = 0.0f;
80 float CritSpell = 0.0f;
81 float Corruption = 0.0f;
83 float Speed = 0.0f;
84 float ResilienceCritTaken = 0.0f;
86 float Lifesteal = 0.0f;
87 float HasteMelee = 0.0f;
88 float HasteRanged = 0.0f;
89 float HasteSpell = 0.0f;
90 float Avoidance = 0.0f;
91 float Sturdiness = 0.0f;
92 float Unused7 = 0.0f;
93 float Expertise = 0.0f;
94 float ArmorPenetration = 0.0f;
95 float Mastery = 0.0f;
96 float PvPPower = 0.0f;
97 float Cleave = 0.0f;
101 float Unused12 = 0.0f;
102};
103
105{
106 float ArmorMultiplier = 0.0f;
107 float WeaponMultiplier = 0.0f;
108 float TrinketMultiplier = 0.0f;
109 float JewelryMultiplier = 0.0f;
110};
111
113{
114 float Health = 0.0f;
115};
116
118{
119 float SocketCost = 0.0f;
120};
121
123{
124 float ItemLevel = 0.0f;
125};
126
128{
129 float Scaler = 0.0f;
130};
131
133{
134 float Rogue = 0.0f;
135 float Druid = 0.0f;
136 float Hunter = 0.0f;
137 float Mage = 0.0f;
138 float Paladin = 0.0f;
139 float Priest = 0.0f;
140 float Shaman = 0.0f;
141 float Warlock = 0.0f;
142 float Warrior = 0.0f;
143 float DeathKnight = 0.0f;
144 float Monk = 0.0f;
145 float DemonHunter = 0.0f;
146 float Evoker = 0.0f;
147 float Adventurer = 0.0f;
148 float Traveler = 0.0f;
149 float Item = 0.0f;
150 float Consumable = 0.0f;
151 float Gem1 = 0.0f;
152 float Gem2 = 0.0f;
153 float Gem3 = 0.0f;
154 float Health = 0.0f;
155 float DamageReplaceStat = 0.0f;
156 float DamageSecondary = 0.0f;
157 float ManaConsumable = 0.0f;
158};
159
161{
162 float ArmorMultiplier = 0.0f;
163 float WeaponMultiplier = 0.0f;
164 float TrinketMultiplier = 0.0f;
165 float JewelryMultiplier = 0.0f;
166};
167
169{
170 float Total = 0.0f;
171 float PerKill = 0.0f;
172 float Junk = 0.0f;
173 float Stats = 0.0f;
174 float Divisor = 0.0f;
175};
176
177template<class T>
179{
180public:
181 T const* GetRow(uint32 row) const
182 {
183 if (row >= _data.size())
184 return nullptr;
185
186 return &_data[row];
187 }
188
189 std::size_t GetTableRowCount() const { return _data.size(); }
190
191 void SetData(std::vector<T> data) { _data = std::move(data); }
192
193private:
194 std::vector<T> _data;
195};
196
211
212TC_GAME_API void LoadGameTables(std::string const& dataPath);
213
214template<class T>
215inline float GetGameTableColumnForClass(T const* row, int32 class_)
216{
217 switch (class_)
218 {
219 case CLASS_WARRIOR:
220 return row->Warrior;
221 case CLASS_PALADIN:
222 return row->Paladin;
223 case CLASS_HUNTER:
224 return row->Hunter;
225 case CLASS_ROGUE:
226 return row->Rogue;
227 case CLASS_PRIEST:
228 return row->Priest;
230 return row->DeathKnight;
231 case CLASS_SHAMAN:
232 return row->Shaman;
233 case CLASS_MAGE:
234 return row->Mage;
235 case CLASS_WARLOCK:
236 return row->Warlock;
237 case CLASS_MONK:
238 return row->Monk;
239 case CLASS_DRUID:
240 return row->Druid;
242 return row->DemonHunter;
243 case CLASS_EVOKER:
244 return row->Evoker;
245 case CLASS_ADVENTURER:
246 return row->Adventurer;
247 case CLASS_TRAVELER:
248 return row->Traveler;
249 default:
250 break;
251 }
252
253 return 0.0f;
254}
255
257{
258 switch (class_)
259 {
260 case CLASS_WARRIOR:
261 return row->Warrior;
262 case CLASS_PALADIN:
263 return row->Paladin;
264 case CLASS_HUNTER:
265 return row->Hunter;
266 case CLASS_ROGUE:
267 return row->Rogue;
268 case CLASS_PRIEST:
269 return row->Priest;
271 return row->DeathKnight;
272 case CLASS_SHAMAN:
273 return row->Shaman;
274 case CLASS_MAGE:
275 return row->Mage;
276 case CLASS_WARLOCK:
277 return row->Warlock;
278 case CLASS_MONK:
279 return row->Monk;
280 case CLASS_DRUID:
281 return row->Druid;
283 return row->DemonHunter;
284 case CLASS_EVOKER:
285 return row->Evoker;
286 case CLASS_ADVENTURER:
287 return row->Adventurer;
288 case CLASS_TRAVELER:
289 return row->Traveler;
290 case -1:
291 case -7:
292 return row->Item;
293 case -2:
294 return row->Consumable;
295 case -3:
296 return row->Gem1;
297 case -4:
298 return row->Gem2;
299 case -5:
300 return row->Gem3;
301 case -6:
302 return row->Health;
303 case -8:
304 return row->DamageReplaceStat;
305 case -9:
306 return row->DamageSecondary;
307 case -10:
308 return row->ManaConsumable;
309 default:
310 break;
311 }
312
313 return 0.0f;
314}
315
317{
318 return row->Wins * row->Xp;
319}
320
321template<class T>
322float GetIlvlStatMultiplier(T const* row, InventoryType invType);
323
324#endif // GameTables_h__
#define TC_GAME_API
Definition Define.h:129
uint8_t uint8
Definition Define.h:156
int32_t int32
Definition Define.h:150
uint32_t uint32
Definition Define.h:154
TC_GAME_API GameTable< GtCombatRatingsMultByILvl > sCombatRatingsMultByILvlGameTable
TC_GAME_API GameTable< GtBarberShopCostBaseEntry > sBarberShopCostBaseGameTable
TC_GAME_API GameTable< GtBaseMPEntry > sBaseMPGameTable
TC_GAME_API GameTable< GtHpPerStaEntry > sHpPerStaGameTable
float GetIlvlStatMultiplier(T const *row, InventoryType invType)
TC_GAME_API GameTable< GtStaminaMultByILvl > sStaminaMultByILvlGameTable
TC_GAME_API void LoadGameTables(std::string const &dataPath)
TC_GAME_API GameTable< GtArtifactLevelXPEntry > sArtifactLevelXPGameTable
float GetBattlePetXPPerLevel(GtBattlePetXPEntry const *row)
Definition GameTables.h:316
float GetSpellScalingColumnForClass(GtSpellScalingEntry const *row, int32 class_)
Definition GameTables.h:256
TC_GAME_API GameTable< GtSpellScalingEntry > sSpellScalingGameTable
TC_GAME_API GameTable< GtCombatRatingsEntry > sCombatRatingsGameTable
TC_GAME_API GameTable< GtItemSocketCostPerLevelEntry > sItemSocketCostPerLevelGameTable
TC_GAME_API GameTable< GtXpEntry > sXpGameTable
TC_GAME_API GameTable< GtBattlePetXPEntry > sBattlePetXPGameTable
float GetGameTableColumnForClass(T const *row, int32 class_)
Definition GameTables.h:215
TC_GAME_API GameTable< GtItemLevelByLevelEntry > sItemLevelByLevelTable
TC_GAME_API GameTable< GtArtifactKnowledgeMultiplierEntry > sArtifactKnowledgeMultiplierGameTable
TC_GAME_API GameTable< GtNpcManaCostScalerEntry > sNpcManaCostScalerGameTable
InventoryType
@ 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_TRAVELER
@ CLASS_ROGUE
@ CLASS_EVOKER
Stats
std::size_t GetTableRowCount() const
Definition GameTables.h:189
std::vector< T > _data
Definition GameTables.h:194
T const * GetRow(uint32 row) const
Definition GameTables.h:181
void SetData(std::vector< T > data)
Definition GameTables.h:191
Definition Item.h:179
float Adventurer
Definition GameTables.h:58
float DeathKnight
Definition GameTables.h:54
float DemonHunter
Definition GameTables.h:56
float Total
Definition GameTables.h:170
float Divisor
Definition GameTables.h:174
float Junk
Definition GameTables.h:172
float PerKill
Definition GameTables.h:171