root/trunk/src/arcemu-shared/Database/DBCStores.h @ 3151

Revision 3151, 47.2 kB (checked in by AlexisB, 7 months ago)

ADDED: You can now log in with 3.3.2 build 11403. Expect client crashes and weird behavior! Thanks to Mangos for the packet/dbc changes.

  • Property svn:eol-style set to native
  • Property ff set to
    *.cpp = svn:eol-style=native
    Makefile = svn:eol-style=native
    README = svn:eol-style=native
    CHANGELOG = svn:eol-style=native
    LICENSE = svn:eol-style=native
Line 
1/*
2 * ArcEmu MMORPG Server
3 * Copyright (C) 2008-2010 <http://www.ArcEmu.org/>
4 *
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU Affero General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 * GNU Affero General Public License for more details.
14 *
15 * You should have received a copy of the GNU Affero General Public License
16 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
17 *
18 */
19
20#ifndef __SPELLSTORE_H
21#define __SPELLSTORE_H
22
23#include "Common.h"
24#include "DataStore.h"
25#include "Timer.h"
26
27#pragma pack(push,1)
28
29struct WorldMapOverlay
30{
31        uint32 ID;           // 0
32//      uint32 worldMapID;   // 1
33        uint32 areaID;       // 2 - index to AreaTable
34        uint32 areaID_2;     // 3 - index to AreaTable
35        uint32 areaID_3;     // 4 - index to AreaTable
36        uint32 areaID_4;     // 5 - index to AreaTable
37// any of the four above indexes is enough to uncover the fragment
38};
39
40#ifdef ENABLE_ACHIEVEMENTS
41struct AchievementEntry
42{
43        uint32    ID;                                           // 0
44        int32     factionFlag;                                  // 1 -1=all, 0=horde, 1=alliance
45        int32     mapID;                                        // 2 -1=none
46        uint32    unknown1;                                     // 20
47        char*     name;                                         // 3-18
48        uint32    name_flags;                                   // 19
49        char*     description;                                  // 21-36
50        uint32    desc_flags;                                   // 37
51        uint32    categoryId;                                   // 38
52        uint32    points;                                       // 39 reward points
53        uint32    orderInCategory;                              // 40
54        uint32    flags;                                        // 41
55        uint32    unknown2;                                     // 42
56        char*     rewardName;                                   // 43-58 title/item reward name
57        uint32    rewardName_flags;                             // 59
58        uint32    count;                                        // 60
59        uint32    refAchievement;                               // 61
60};
61
62struct AchievementCategoryEntry
63{
64        uint32    ID;                                           // 0
65        uint32    parentCategory;                               // 1 -1 for main category
66        char*     name;                                         // 2-17
67        uint32    name_flags;                                   // 18
68        uint32    sortOrder;                                    // 19
69};
70
71struct AchievementCriteriaEntry
72{
73        uint32  ID;                                             // 0
74        uint32  referredAchievement;                            // 1
75        uint32  requiredType;                                   // 2
76        union
77        {
78                // ACHIEVEMENT_CRITERIA_TYPE_KILL_CREATURE = 0
79                // TODO: also used for player deaths..
80                struct
81                {
82                        uint32  creatureID;                             // 3
83                        uint32  creatureCount;                          // 4
84                } kill_creature;
85
86                // ACHIEVEMENT_CRITERIA_TYPE_WIN_BG = 1
87                // TODO: there are further criterias instead just winning
88                struct
89                {
90                        uint32  bgMapID;                                // 3
91                        uint32  winCount;                               // 4
92                } win_bg;
93
94                // ACHIEVEMENT_CRITERIA_TYPE_REACH_LEVEL = 5
95                struct
96                {
97                        uint32  unused;                                 // 3
98                        uint32  level;                                  // 4
99                } reach_level;
100
101                // ACHIEVEMENT_CRITERIA_TYPE_REACH_SKILL_LEVEL = 7
102                struct
103                {
104                        uint32  skillID;                                // 3
105                        uint32  skillLevel;                             // 4
106                } reach_skill_level;
107
108                // ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_ACHIEVEMENT = 8
109                struct
110                {
111                        uint32  linkedAchievement;                      // 3
112                } complete_achievement;
113
114                // ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_QUEST_COUNT = 9
115                struct
116                {
117                        uint32  unused;                                 // 3
118                        uint32  totalQuestCount;                        // 4
119                } complete_quest_count;
120
121                // ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_DAILY_QUEST_DAILY = 10
122                struct
123                {
124                        uint32  unused;                                 // 3
125                        uint32  numberOfDays;                           // 4
126                } complete_daily_quest_daily;
127
128                // ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_QUESTS_IN_ZONE = 11
129                struct
130                {
131                        uint32  zoneID;                                 // 3
132                        uint32  questCount;                             // 4
133                } complete_quests_in_zone;
134
135                // ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_DAILY_QUEST = 14
136                struct
137                {
138                        uint32  unused;                                 // 3
139                        uint32  questCount;                             // 4
140                } complete_daily_quest;
141
142                // ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_BATTLEGROUND= 15
143                struct
144                {
145                        uint32  mapID;                                  // 3
146                } complete_battleground;
147
148                // ACHIEVEMENT_CRITERIA_TYPE_DEATH_AT_MAP= 16
149                struct
150                {
151                        uint32  mapID;                                  // 3
152                } death_at_map;
153
154                // ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_RAID = 19
155                struct
156                {
157                        uint32  groupSize;                              // 3 can be 5, 10 or 25
158                } complete_raid;
159
160                // ACHIEVEMENT_CRITERIA_TYPE_KILLED_BY_CREATURE = 20
161                struct
162                {
163                        uint32  creatureEntry;                          // 3
164                } killed_by_creature;
165
166                // ACHIEVEMENT_CRITERIA_TYPE_FALL_WITHOUT_DYING = 24
167                struct
168                {
169                        uint32  unused;                                 // 3
170                        uint32  fallHeight;                             // 4
171                } fall_without_dying;
172
173                // ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_QUEST = 27
174                struct
175                {
176                        uint32  questID;                                // 3
177                        uint32  questCount;                             // 4
178                } complete_quest;
179
180                // ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET = 28
181                // ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET2= 69
182                struct
183                {
184                        uint32  spellID;                                // 3
185                        uint32  spellCount;                             // 4
186                } be_spell_target;
187
188                // ACHIEVEMENT_CRITERIA_TYPE_CAST_SPELL= 29
189                struct
190                {
191                        uint32  spellID;                                // 3
192                        uint32  castCount;                              // 4
193                } cast_spell;
194
195                // ACHIEVEMENT_CRITERIA_TYPE_HONORABLE_KILL_AT_AREA = 31
196                struct
197                {
198                        uint32  areaID;                                 // 3 Reference to AreaTable.dbc
199                        uint32  killCount;                              // 4
200                } honorable_kill_at_area;
201
202                // ACHIEVEMENT_CRITERIA_TYPE_WIN_ARENA = 32
203                struct
204                {
205                        uint32  mapID;                                  // 3 Reference to Map.dbc
206                } win_arena;
207
208                // ACHIEVEMENT_CRITERIA_TYPE_PLAY_ARENA = 33
209                struct
210                {
211                        uint32  mapID;                                  // 3 Reference to Map.dbc
212                } play_arena;
213
214                // ACHIEVEMENT_CRITERIA_TYPE_LEARN_SPELL = 34
215                struct
216                {
217                        uint32  spellID;                                // 3 Reference to Map.dbc
218                } learn_spell;
219
220                // ACHIEVEMENT_CRITERIA_TYPE_OWN_ITEM = 36
221                struct
222                {
223                        uint32  itemID;                                 // 3
224                        uint32  itemCount;                              // 4
225                } own_item;
226
227                // ACHIEVEMENT_CRITERIA_TYPE_WIN_RATED_ARENA = 37
228                struct
229                {
230                        uint32  unused;                                 // 3
231                        uint32  count;                                  // 4
232                        uint32  flag;                                   // 5 4=in a row
233                } win_rated_arena;
234
235                // ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_TEAM_RATING = 38
236                struct
237                {
238                        uint32  teamtype;                               // 3 {2,3,5}
239                } highest_team_rating;
240
241                // ACHIEVEMENT_CRITERIA_TYPE_REACH_TEAM_RATING = 39
242                struct
243                {
244                        uint32  teamtype;                               // 3 {2,3,5}
245                        uint32  teamrating;                             // 4
246                } reach_team_rating;
247
248                // ACHIEVEMENT_CRITERIA_TYPE_LEARN_SKILL_LEVEL = 40
249                struct
250                {
251                        uint32  skillID;                                // 3
252                        uint32  skillLevel;                             // 4 apprentice=1, journeyman=2, expert=3, artisan=4, master=5, grand master=6
253                } learn_skill_level;
254
255                // ACHIEVEMENT_CRITERIA_TYPE_USE_ITEM = 41
256                struct
257                {
258                        uint32  itemID;                                 // 3
259                        uint32  itemCount;                              // 4
260                } use_item;
261
262                // ACHIEVEMENT_CRITERIA_TYPE_LOOT_ITEM = 42
263                struct
264                {
265                        uint32  itemID;                                 // 3
266                        uint32  itemCount;                              // 4
267                } loot_item;
268
269                // ACHIEVEMENT_CRITERIA_TYPE_EXPLORE_AREA = 43
270                struct
271                {
272                        uint32  areaReference;                          // 3 - this is an index to WorldMapOverlay
273                } explore_area;
274
275                // ACHIEVEMENT_CRITERIA_TYPE_OWN_RANK= 44
276                struct
277                {
278                        // TODO: This rank is _NOT_ the index from CharTitles.dbc
279                        uint32  rank;                                   // 3
280                } own_rank;
281
282                // ACHIEVEMENT_CRITERIA_TYPE_BUY_BANK_SLOT= 45
283                struct
284                {
285                        uint32  unused;                                 // 3
286                        uint32  numberOfSlots;                          // 4
287                } buy_bank_slot;
288
289                // ACHIEVEMENT_CRITERIA_TYPE_GAIN_REPUTATION= 46
290                struct
291                {
292                        uint32  factionID;                              // 3
293                        uint32  reputationAmount;                       // 4 Total reputation amount, so 42000 = exalted
294                } gain_reputation;
295
296                // ACHIEVEMENT_CRITERIA_TYPE_GAIN_EXALTED_REPUTATION= 47
297                struct
298                {
299                        uint32  unused;                                 // 3
300                        uint32  numberOfExaltedFactions;                // 4
301                } gain_exalted_reputation;
302
303                // ACHIEVEMENT_CRITERIA_TYPE_EQUIP_EPIC_ITEM = 49
304                // TODO: where is the required itemlevel stored?
305                struct
306                {
307                        uint32  itemSlot;                               // 3
308                } equip_epic_item;
309
310                // ACHIEVEMENT_CRITERIA_TYPE_ROLL_NEED_ON_LOOT= 50
311                struct
312                {
313                        uint32  rollValue;                              // 3
314                        uint32  count;                                  // 4
315                } roll_need_on_loot;
316
317                // ACHIEVEMENT_CRITERIA_TYPE_HK_CLASS = 52
318                struct
319                {
320                        uint32  classID;                                // 3
321                        uint32  count;                                  // 4
322                } hk_class;
323
324                // ACHIEVEMENT_CRITERIA_TYPE_HK_RACE = 53
325                struct
326                {
327                        uint32  raceID;                                 // 3
328                        uint32  count;                                  // 4
329                } hk_race;
330
331                // ACHIEVEMENT_CRITERIA_TYPE_DO_EMOTE = 54
332                // TODO: where is the information about the target stored?
333                struct
334                {
335                        uint32  emoteID;                                // 3
336                } do_emote;
337
338                // ACHIEVEMENT_CRITERIA_TYPE_HEALING_DONE = 55
339                struct
340                {
341                        uint32  unused;                                 // 3
342                        uint32  count;                                  // 4
343                        uint32  flag;                                   // 5 =3 for battleground healing
344                        uint32  mapid;                                  // 6
345                } healing_done;
346
347                // ACHIEVEMENT_CRITERIA_TYPE_EQUIP_ITEM = 57
348                struct
349                {
350                        uint32  itemID;                                 // 3
351                } equip_item;
352
353                // ACHIEVEMENT_CRITERIA_TYPE_QUEST_REWARD_GOLD = 62
354                struct
355                {
356                        uint32 unknown;                                 // 3
357                        uint32 goldInCopper;                            // 4
358                } quest_reward_money;
359
360                // ACHIEVEMENT_CRITERIA_TYPE_LOOT_MONEY = 67
361                struct
362                {
363                        uint32  unused;                                 // 3
364                        uint32  goldInCopper;                           // 4
365                } loot_money;
366
367                // ACHIEVEMENT_CRITERIA_TYPE_USE_GAMEOBJECT = 68
368                struct
369                {
370                        uint32  goEntry;                                // 3
371                        uint32  useCount;                               // 4
372                } use_gameobject;
373
374                // ACHIEVEMENT_CRITERIA_TYPE_SPECIAL_PVP_KILL= 70
375                // TODO: are those special criteria stored in the dbc or do we have to add another sql table?
376                struct
377                {
378                        uint32  unused;                                 // 3
379                        uint32  killCount;                              // 4
380                } special_pvp_kill;
381
382                // ACHIEVEMENT_CRITERIA_TYPE_FISH_IN_GAMEOBJECT = 72
383                struct
384                {
385                        uint32  goEntry;                                // 3
386                        uint32  lootCount;                              // 4
387                } fish_in_gameobject;
388
389                // ACHIEVEMENT_CRITERIA_TYPE_NUMBER_OF_MOUNTS= 75
390                struct
391                {
392                        uint32  unknown;                                // 3 777=?
393                        uint32  mountCount;                             // 4
394                } number_of_mounts;
395
396                // ACHIEVEMENT_CRITERIA_TYPE_WIN_DUEL = 76
397                struct
398                {
399                        uint32  unused;                                 // 3
400                        uint32  duelCount;                              // 4
401                } win_duel;
402
403                // ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_POWER = 96
404                struct
405                {
406                        uint32  powerType;                              // 3 mana= 0, 1=rage, 3=energy, 6=runic power
407                } highest_power;
408
409                // ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_STAT = 97
410                struct
411                {
412                        uint32  statType;                               // 3 4=spirit, 3=int, 2=stamina, 1=agi, 0=strength
413                } highest_stat;
414
415                // ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_SPELLPOWER = 98
416                struct
417                {
418                        uint32  spellSchool;                            // 3
419                } highest_spellpower;
420
421                // ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_RATING = 100
422                struct
423                {
424                        uint32  ratingType;                             // 3
425                } highest_rating;
426
427                // ACHIEVEMENT_CRITERIA_TYPE_LOOT_TYPE = 109
428                struct
429                {
430                        uint32  lootType;                               // 3 3=fishing, 2=pickpocket, 4=disentchant
431                        uint32  lootTypeCount;                          // 4
432                } loot_type;
433
434                // ACHIEVEMENT_CRITERIA_TYPE_CAST_SPELL2 = 110
435                struct
436                {
437                        uint32  skillLine;                              // 3
438                        uint32  spellCount;                             // 4
439                } cast_spell2;
440
441                // ACHIEVEMENT_CRITERIA_TYPE_LEARN_SKILL_LINE= 112
442                struct
443                {
444                        uint32  skillLine;                              // 3
445                        uint32  spellCount;                             // 4
446                } learn_skill_line;
447
448                // ACHIEVEMENT_CRITERIA_TYPE_EARN_HONORABLE_KILL = 113
449                struct
450                {
451                        uint32  unused;                                 // 3
452                        uint32  killCount;                              // 4
453                } honorable_kill;
454
455                struct
456                {
457                        uint32  field3;                                 // 3 main requirement
458                        uint32  field4;                                 // 4 main requirement count
459                        uint32  additionalRequirement1_type;            // 5 additional requirement 1 type
460                        uint32  additionalRequirement1_value;           // 6 additional requirement 1 value
461                        uint32  additionalRequirement2_type;            // 7 additional requirement 2 type
462                        uint32  additionalRequirement2_value;           // 8 additional requirement 1 value
463                } raw;
464        };
465        char*   name;                                         // 9-24
466        uint32  name_flags;                                   // 25
467        uint32  completionFlag;                               // 26
468        uint32  groupFlag;                                    // 27
469        uint32  unk1;                                         // 28
470        uint32  timeLimit;                                    // 29 time limit in seconds
471        uint32  index;                                        // 30
472};
473#endif
474
475struct BattlemasterListEntry
476{
477        uint32  bg_index;
478        int32   maps[8];
479        uint32  instance_type;
480        uint32  max_players_per_faction;
481        uint32  some_id;
482        int32   zeros[15];
483        uint32  unk[2];
484        uint32  always_same; // Always 16712190
485        uint32  minimum_payer_level; // ??? Is it, 3.0.8 doesn't match 3.0.3 numbers
486                                                                 // Do not use for now (NAQUADA)
487        //char* name;
488};
489
490struct BankSlotPrice
491{
492        uint32 Id;
493        uint32 Price;
494};
495
496struct CharTitlesEntry
497{
498        uint32  ID;                                           // 0, title ids
499        uint32  unk1;                                         // 1 flags?
500        char*   name;                                         // 2-17, unused
501        uint32  name_flag;                                    // 18 string flag, unused
502        char*   name2;                                        // 19-34, unused
503        char*   name2_flag;                                   // 35 string flag, unused
504        uint32  bit_index;                                    // 36 used in PLAYER_CHOSEN_TITLE and 1<<index in PLAYER__FIELD_KNOWN_TITLES
505};
506
507struct CurrencyTypesEntry
508{
509    //uint32    ID;                                       // 0 not used
510    uint32    ItemId;                                     // 1 used as real index
511    //uint32    Category;                                 // 2 may be category
512    uint32    BitIndex;                                   // 3 bit index in PLAYER_FIELD_KNOWN_CURRENCIES (1 << (index-1))
513};
514
515struct ItemSetEntry
516{
517        uint32 id;                  //1
518        char*  name;                //2
519//      uint32 unused_shit[15];     //3 - 9
520//      uint32 localeflag;          //10 constant
521        uint32 itemid[8];           //11 - 18
522//      uint32 more_unused_shit[9]; //19 - 27
523        uint32 SpellID[8];          //28 - 35
524        uint32 itemscount[8];       //36 - 43
525        uint32 RequiredSkillID;     //44
526        uint32 RequiredSkillAmt;    //45
527};
528
529struct ItemLimitCategoryEntry
530{
531        uint32 Id;                                      // 0    - Id
532        char * name;                            // 1    - Displayed name
533        uint32 maxAmount;                       // 18   - Max amount of items
534        uint32 equippedFlag;            // 19   - equipped (bool?)
535};
536
537struct Lock
538{
539        uint32 Id;
540        uint32 locktype[5]; // 0 - no lock, 1 - item needed for lock, 2 - min lockping skill needed
541//      uint32 unk1[3];
542        uint32 lockmisc[5]; // if type is 1 here is a item to unlock, else is unknow for now
543//      uint32 unk2[3];
544        uint32 minlockskill[5]; // min skill in lockpiking to unlock.
545//      uint32 unk3[11];
546
547        /* Actually it is:
548        uint32 Id;
549        uint32 locktype[8];
550        uint32 lockindex[8];
551        uint32 minlockskill[8];
552        uint32 action[8];
553        */
554};
555
556struct emoteentry
557{
558        uint32 Id;
559//      uint32 name;
560        uint32 textid;
561        uint32 textid2;
562        uint32 textid3;
563        uint32 textid4;
564//      uint32 unk1;
565        uint32 textid5;
566//      uint32 unk2;
567        uint32 textid6;
568//      uint32 unk3;
569//      uint32 unk4;
570//      uint32 unk5;
571//      uint32 unk6;
572//      uint32 unk7;
573//      uint32 unk8;
574//      uint32 unk9;
575//      uint32 unk10;
576//      uint32 unk11;
577};
578
579struct skilllinespell //SkillLineAbility.dbc
580{
581        uint32 Id;
582        uint32 skilline;
583        uint32 spell;
584//      uint32 raceMask;
585//      uint32 classMask;
586//      uint32 excludeRace;
587//      uint32 excludeClass;
588        uint32 minSkillLineRank;
589        uint32 next;
590        uint32 acquireMethod;
591        uint32 grey;
592        uint32 green;
593//      uint32 abandonable;
594        uint32 reqTP;
595};
596
597struct EnchantEntry
598{
599        uint32 Id;
600        uint32 type[3];
601        int32  min[3];//for compat, in practice min==max
602        int32  max[3];
603        uint32 spell[3];
604        char*  Name;
605//      uint32 NameAlt1;
606//      uint32 NameAlt2;
607//      uint32 NameAlt3;
608//      uint32 NameAlt4;
609//      uint32 NameAlt5;
610//      uint32 NameAlt6;
611//      uint32 NameAlt7;
612//      uint32 NameAlt8;
613//      uint32 NameAlt9;
614//      uint32 NameAlt10;
615//      uint32 NameAlt11;
616//      uint32 NameAlt12;
617//      uint32 NameAlt13;
618//      uint32 NameAlt14;
619//      uint32 NameAlt15;
620//      uint32 NameFlags;
621        uint32 visual;
622        uint32 EnchantGroups;
623        uint32 GemEntry;
624        uint32 unk7;//Gem Related
625
626};
627
628struct GemPropertyEntry{
629        uint32 Entry;
630        uint32 EnchantmentID;
631        uint32 unk1;//bool
632        uint32 unk2;//bool
633        uint32 SocketMask;
634};
635
636struct GlyphPropertyEntry       //GlyphProperties.dbc
637{
638        uint32 Entry;
639        uint32 SpellID;
640        uint32 Type; // 0 = Major, 1 = Minor
641        uint32 unk; // some flag
642};
643
644struct GlyphSlotEntry
645{
646        uint32 Id;
647        uint32 Type;
648        uint32 Slot;
649};
650
651struct skilllineentry //SkillLine.dbc
652{
653        uint32 id;
654        uint32 type;
655        uint32 skillCostsID;
656        char*  Name;
657//      int32  NameAlt[15];
658//      uint32 NameFlags;
659//      uint32 Description;
660//      uint32 DescriptionAlt[15];
661//      uint32 DescriptionFlags;
662//      uint32 spellIconID;
663};
664
665/*struct SkillRaceClassInfoEntry
666{
667        m_ID;
668        m_skillID;
669        m_raceMask;
670        m_classMask;
671        m_flags;
672        m_minLevel;
673        m_skillTierID;
674        m_skillCostIndex;
675}
676
677struct SkillTiersEntry
678{
679        m_ID;
680        m_cost[16];
681        m_value[16];
682}*/
683
684// Struct for the entry in Spell.dbc
685struct SpellEntry
686{
687        uint32 Id;                              //1
688        uint32 Category;                        //2
689        uint32 DispelType;                      //3
690        uint32 MechanicsType;                   //4
691        uint32 Attributes;                      //5
692        uint32 AttributesEx;                    //6
693        uint32 AttributesExB;                   //7
694        uint32 AttributesExC;                   //8 // Flags to
695        uint32 AttributesExD;                   //9  // Flags....
696        uint32 AttributesExE;                   //10 // Flags 2.0.1 unknown one
697        uint32 AttributesExF;                   //11
698                                                //12 UNK
699        uint32 RequiredShapeShift;              //13 // Flags BitMask for shapeshift spells
700                                                //14 UNK
701        uint32 ShapeshiftExclude;               //15-> this is wrong // Flags BitMask for which shapeshift forms this spell can NOT be used in.
702                                                //16 UNK
703        uint32 Targets;                         //17 - N / M
704        uint32 TargetCreatureType;              //18
705        uint32 RequiresSpellFocus;              //19
706        uint32 FacingCasterFlags;               //20
707        uint32 CasterAuraState;                 //21
708        uint32 TargetAuraState;                 //22
709        uint32 CasterAuraStateNot;              //23
710        uint32 TargetAuraStateNot;              //24
711        uint32 casterAuraSpell;                 //25
712        uint32 targetAuraSpell;                 //26
713        uint32 casterAuraSpellNot;              //27
714        uint32 targetAuraSpellNot;              //28
715        uint32 CastingTimeIndex;                //29
716        uint32 RecoveryTime;                    //30
717        uint32 CategoryRecoveryTime;            //31 recoverytime
718        uint32 InterruptFlags;                  //32
719        uint32 AuraInterruptFlags;              //33
720        uint32 ChannelInterruptFlags;           //34
721        uint32 procFlags;                       //35
722        uint32 procChance;                      //36
723        int32  procCharges;                     //37
724        uint32 maxLevel;                        //38
725        uint32 baseLevel;                       //39
726        uint32 spellLevel;                      //40
727        uint32 DurationIndex;                   //41
728        uint32 powerType;                       //42
729        uint32 manaCost;                        //43
730        uint32 manaCostPerlevel;                //44
731        uint32 manaPerSecond;                   //45
732        uint32 manaPerSecondPerLevel;           //46
733        uint32 rangeIndex;                      //47
734        float  speed;                           //48
735        uint32 modalNextSpell;                  //49
736        uint32 maxstack;                        //50
737        uint32 Totem[2];                        //51 - 52
738        uint32 Reagent[8];                      //53 - 60
739        uint32 ReagentCount[8];                 //61 - 68
740        int32  EquippedItemClass;               //69
741        uint32 EquippedItemSubClass;            //70
742        uint32 RequiredItemFlags;               //71
743        uint32 Effect[3];                       //72 - 74
744        uint32 EffectDieSides[3];               //75 - 77
745        uint32 EffectBaseDice[3];               //78 - 80
746        float  EffectDicePerLevel[3];           //81 - 83
747        float  EffectRealPointsPerLevel[3];     //84 - 86
748        int32  EffectBasePoints[3];             //87 - 89
749        int32  EffectMechanic[3];               //90 - 92       Related to SpellMechanic.dbc
750        uint32 EffectImplicitTargetA[3];        //93 - 95
751        uint32 EffectImplicitTargetB[3];        //96 - 98
752        uint32 EffectRadiusIndex[3];            //99 - 101
753        uint32 EffectApplyAuraName[3];          //102 - 104
754        uint32 EffectAmplitude[3];              //105 - 107
755        float  EffectMultipleValue[3];          //108 - 110     This value is the $ value from description
756        uint32 EffectChainTarget[3];            //111 - 113
757        uint32 EffectItemType[3];               //114 - 116     Not sure maybe we should rename it. its the relation to field: SpellGroupType
758        uint32 EffectMiscValue[3];              //117 - 119
759        uint32 EffectMiscValueB[3];             //120 - 122  2.4.3
760        uint32 EffectTriggerSpell[3];           //123 - 125
761        float  EffectPointsPerComboPoint[3];    //126 - 128
762        uint32 EffectSpellClassMask[3][3];      //129 - 137
763        uint32 SpellVisual;                     //138
764        uint32 field114;                        //139
765        uint32 spellIconID;                     //140
766        uint32 activeIconID;                    //141   activeIconID;
767        uint32 spellPriority;                   //142
768        char*  Name;                            //143
769//      char*  NameAlt[15];                     //144-158 not used
770//      uint32 NameFlags;                       //159 not used
771        char*  Rank;                            //160
772//      char*  RankAlt[15];                     //161-175 not used
773//      uint32 RankFlags;                       //176 not used
774        char*  Description;                     //177
775//      char*  DescriptionAlt[15];              //178-192 not used
776//      uint32 DescriptionFlags;                //193 not used
777        char*  BuffDescription;                 //194
778//      char*  BuffDescription[15];             //195-209 not used
779//      uint32 buffdescflags;                   //210 not used
780        uint32 ManaCostPercentage;              //211
781        uint32 StartRecoveryCategory;           //212
782        uint32 StartRecoveryTime;               //213
783        uint32 MaxTargetLevel;                  //214
784        uint32 SpellFamilyName;                 //215
785        uint32 SpellGroupType[3];               //216-218
786        uint32 MaxTargets;                      //219
787        uint32 Spell_Dmg_Type;                  //220   dmg_class Integer      0=None, 1=Magic, 2=Melee, 3=Ranged
788        uint32 PreventionType;                  //221   0,1,2 related to Spell_Dmg_Type I think
789        int32  StanceBarOrder;                  //222   related to paladin aura's
790        float  dmg_multiplier[3];               //223 - 225   if the name is correct I dono
791        uint32 MinFactionID;                    //226   only one spellid:6994 has this value = 369 UNUSED
792        uint32 MinReputation;                   //227   only one spellid:6994 has this value = 4 UNUSED
793        uint32 RequiredAuraVision;              //228  3 spells 1 or 2
794        uint32 TotemCategory[2];                //229-230
795        int32  RequiresAreaId;                  //231
796        uint32 School;                          //232
797        uint32 RuneCostID;                      //233 from 3.0.1
798//      uint32 SpellMissileID;                  //234 from 3.0.1
799
800        /// CUSTOM: these fields are used for the modifications made in the world.cpp
801        uint32 DiminishStatus;                  //
802        uint32 proc_interval;                   //!!! CUSTOM, <Fill description for variable>
803        //Buff Groupin Rule -> caster can cast this spell only on 1 target. Value represents the group spell is part of. Can be part of only 1 group
804        //caster can only cast on 1 target these spells
805        uint32 BGR_one_buff_from_caster_on_1target; //!!! CUSTOM, <Fill description for variable>
806        //target can have only buff of this type on self. Value represents the group spell is part of. Can be part of only 1 group
807        uint32 BGR_one_buff_on_target;          //!!! CUSTOM, these are related to creating a item through a spell
808        //caster can have only 1 Aura per spell group, ex pal auras
809        uint32 BGR_one_buff_from_caster_on_self;//!!! CUSTOM, these are related to creating a item through a spell
810//      uint32 buffIndexType;                   //!!! CUSTOM, <Fill description for variable>
811        uint32 c_is_flags;                      //!!! CUSTOM, store spell checks in a static way : isdamageind,ishealing
812//      uint32 buffType;                        //!!! CUSTOM, these are related to creating a item through a spell
813        uint32 RankNumber;                      //!!! CUSTOM, this protects players from having >1 rank of a spell
814        uint32 NameHash;                        //!!! CUSTOM, related to custom spells, summon spell quest related spells
815        uint32 talent_tree;                     //!!! CUSTOM,
816        uint32 in_front_status;                 //!!! CUSTOM,
817        uint32 EffectSpellGroupRelation_high[3];     //!!! this is not contained in client dbc but server must have it
818        uint32 ThreatForSpell;
819        float  ThreatForSpellCoef;
820        uint32 ProcOnNameHash[3];
821        uint32 spell_coef_flags;                //!!! CUSTOM, store flags for spell coefficient calculations
822
823        float  base_range_or_radius_sqr;        //!!! CUSTOM, needed for aoe spells most of the time
824        // love me or hate me, all "In a cone in front of the caster" spells don't necessarily mean "in front"
825        float  cone_width;
826        //Spell Coefficient
827        float  casttime_coef;                   //!!! CUSTOM, faster spell bonus calculation
828        float  fixed_dddhcoef;                  //!!! CUSTOM, fixed DD-DH coefficient for some spells
829        float  fixed_hotdotcoef;                //!!! CUSTOM, fixed HOT-DOT coefficient for some spells
830        float  Dspell_coef_override;            //!!! CUSTOM, overrides any spell coefficient calculation and use this value in DD&DH
831        float  OTspell_coef_override;           //!!! CUSTOM, overrides any spell coefficient calculation and use this value in HOT&DOT
832        int    ai_target_type;
833
834        bool   self_cast_only;
835        bool   apply_on_shapeshift_change;
836        bool   always_apply;
837        bool   is_melee_spell;                  //!!! CUSTOM,
838        bool   is_ranged_spell;                 //!!! CUSTOM,
839        bool   spell_can_crit;                  //!!! CUSTOM,
840        bool   noproc;
841
842        uint32 SchoolMask;                      // Custom
843/*
844//3.0.1 client column namings
845m_id
846m_category
847m_castUI
848m_dispelType
849m_mechanic
850m_attributes
851m_attributesEx
852m_attributesExB
853m_attributesExC
854m_attributesExD
855m_attributesExE
856m_attributesExF
857m_shapeshiftMask
858m_shapeshiftExclude
859m_targets
860m_targetCreatureType
861m_requiresSpellFocus
862m_facingCasterFlags
863m_casterAuraState
864m_targetAuraState
865m_excludeCasterAuraState
866m_excludeTargetAuraState
867m_castingTimeIndex
868m_recoveryTime
869m_categoryRecoveryTime
870m_interruptFlags
871m_auraInterruptFlags
872m_channelInterruptFlags
873m_procTypeMask
874m_procChance
875m_procCharges
876m_maxLevel
877m_baseLevel
878m_spellLevel
879m_durationIndex
880m_powerType
881m_manaCost
882m_manaCostPerLevel
883m_manaPerSecond
884m_manaPerSecondPerLevel
885m_rangeIndex
886m_speed
887m_modalNextSpell
888m_cumulativeAura
889m_totem
890m_reagent
891m_reagentCount
892m_equippedItemClass
893m_equippedItemSubclass
894m_equippedItemInvTypes
895m_effect
896m_effectDieSides
897m_effectBaseDice
898m_effectDicePerLevel
899m_effectRealPointsPerLevel
900m_effectBasePoints
901m_effectMechanic
902m_implicitTargetA
903m_implicitTargetB
904m_effectRadiusIndex
905m_effectAura
906m_effectAuraPeriod
907m_effectAmplitude
908m_effectChainTargets
909m_effectItemType
910m_effectMiscValue
911m_effectMiscValueB
912m_effectTriggerSpell
913m_effectPointsPerCombo
914m_spellVisualID
915m_spellIconID
916m_activeIconID
917m_spellPriority
918m_name_lang
919m_nameSubtext_lang
920m_description_lang
921m_auraDescription_lang
922m_manaCostPct
923m_startRecoveryCategory
924m_startRecoveryTime
925m_maxTargetLevel
926m_spellClassSet
927m_spellClassMask
928m_maxTargets
929m_defenseType
930m_preventionType
931m_stanceBarOrder
932m_effectChainAmplitude
933m_minFactionID
934m_minReputation
935m_requiredAuraVision
936m_requiredTotemCategoryID
937m_requiredAreaID
938m_schoolMask
939m_RuneCostID
940m_spellMissileID
941*/
942};
943
944struct SpellRuneCostEntry
945{
946        uint32  ID;
947        uint32  bloodRuneCost;
948        uint32  frostRuneCost;
949        uint32  unholyRuneCost;
950        uint32  runePowerGain;
951};
952
953struct ItemExtendedCostEntry
954{
955        uint32 costid;
956        uint32 honor;
957        uint32 arena;
958        uint32 item[5];
959        uint32 count[5];
960        uint32 personalrating;
961};
962
963struct TalentEntry
964{
965        uint32  TalentID;
966        uint32  TalentTree;
967        uint32  Row;
968        uint32  Col;
969        uint32  RankID[5];
970//      uint32  unk[4];
971        uint32  DependsOn;
972//      uint32  unk1[2];
973        uint32  DependsOnRank;
974//      uint32  unk2[4];
975};
976
977struct TalentTabEntry
978{
979        uint32 TalentTabID;
980//      char*  Name;
981//      uint32 unk3;
982//      uint32 unk4;
983//      uint32 unk5;
984//      uint32 unk6;
985//      uint32 unk7;
986//      uint32 unk8;
987//      uint32 unk9;
988//      uint32 unk10;
989//      uint32 unk11;
990//      uint32 unk12;
991//      uint32 unk13;
992//      uint32 unk14;
993//      uint32 unk15;
994//      uint32 unk16;
995//      uint32 unk17;
996//      uint32 unk18;
997//      uint32 unk19;
998//      uint32 unk20;
999        uint32 ClassMask;
1000        uint32 PetTalentMask;
1001        uint32 TabPage;
1002//      char*  InternalName;
1003};
1004
1005struct Trainerspell
1006{
1007        uint32 Id;
1008        uint32 skilline1;
1009        uint32 skilline2;
1010        uint32 skilline3;
1011        uint32 maxlvl;
1012        uint32 charclass;
1013};
1014
1015struct SpellCastTime
1016{
1017        uint32 ID;
1018        uint32 CastTime;
1019//      uint32 unk1;
1020//      uint32 unk2;
1021};
1022
1023struct SpellRadius
1024{
1025        uint32 ID;
1026        float  Radius;
1027//      float  unk1;
1028        float  Radius2;
1029};
1030
1031struct SpellRange
1032{
1033        uint32 ID;
1034        float  minRange;
1035        float  minRange2;
1036        float  maxRange;
1037        float  maxRange2;
1038//      uint32 unks[35];
1039};
1040
1041struct SpellDuration
1042{
1043        uint32 ID;
1044        uint32 Duration1;
1045        uint32 Duration2;
1046        uint32 Duration3;
1047};
1048
1049struct RandomProps
1050{
1051        uint32 ID;
1052//      uint32 name1;
1053        uint32 spells[3];
1054//      uint32 unk1;
1055//      uint32 unk2;
1056//      uint32 name2;
1057//      uint32 RankAlt1;
1058//      uint32 RankAlt2;
1059//      uint32 RankAlt3;
1060//      uint32 RankAlt4;
1061//      uint32 RankAlt5;
1062//      uint32 RankAlt6;
1063//      uint32 RankAlt7;
1064//      uint32 RankAlt8;
1065//      uint32 RankAlt9;
1066//      uint32 RankAlt10;
1067//      uint32 RankAlt11;
1068//      uint32 RankAlt12;
1069//      uint32 RankAlt13;
1070//      uint32 RankAlt14;
1071//      uint32 RankAlt15;
1072//      uint32 RankFlags;
1073
1074};
1075
1076struct AreaGroup
1077{
1078        uint32 AreaGroupId;
1079        uint32 AreaId[7];
1080};
1081
1082struct AreaTable
1083{
1084        uint32 AreaId;
1085        uint32 mapId;
1086        uint32 ZoneId;
1087        uint32 explorationFlag;
1088        uint32 AreaFlags;
1089//      uint32 unk2;
1090//      uint32 unk3;
1091//      uint32 unk4;
1092        uint32 EXP;//not XP
1093//      uint32 unk5;
1094        uint32 level;
1095        char*  name;
1096//      uint32 nameAlt1;
1097//      uint32 nameAlt2;
1098//      uint32 nameAlt3;
1099//      uint32 nameAlt4;
1100//      uint32 nameAlt5;
1101//      uint32 nameAlt6;
1102//      uint32 nameAlt7;
1103//      uint32 nameAlt8;
1104//      uint32 nameAlt9;
1105//      uint32 nameAlt10;
1106//      uint32 nameAlt11;
1107//      uint32 nameAlt12;
1108//      uint32 nameAlt13;
1109//      uint32 nameAlt14;
1110//      uint32 nameAlt15;
1111//      uint32 nameFlags;
1112        uint32 category;
1113//      uint32 unk7;
1114//      uint32 unk8;
1115//      uint32 unk9;
1116//      uint32 unk10;
1117//      uint32 unk11;
1118//      uint32 unk12;
1119};
1120
1121struct FactionTemplateDBC
1122{
1123        uint32 ID;
1124        uint32 Faction;
1125        uint32 FactionGroup;
1126        uint32 Mask;
1127        uint32 FriendlyMask;
1128        uint32 HostileMask;
1129        uint32 EnemyFactions[4];
1130        uint32 FriendlyFactions[4];
1131};
1132
1133struct AuctionHouseDBC
1134{
1135        uint32 id;
1136        uint32 unk;
1137        uint32 fee;
1138        uint32 tax;
1139//      char*  name;
1140//      char*  nameAlt1;
1141//      char*  nameAlt2;
1142//      char*  nameAlt3;
1143//      char*  nameAlt4;
1144//      char*  nameAlt5;
1145//      char*  nameAlt6;
1146//      char*  nameAlt7;
1147//      char*  nameAlt8;
1148//      char*  nameAlt9;
1149//      char*  nameAlt10;
1150//      char*  nameAlt11;
1151//      char*  nameAlt12;
1152//      char*  nameAlt13;
1153//      char*  nameAlt14;
1154//      char*  nameAlt15;
1155//      char*  nameFlags;
1156};
1157
1158struct FactionDBC
1159{
1160        uint32 ID;
1161        int32  RepListId;
1162        uint32 RaceMask[4];
1163        uint32 ClassMask[4];
1164        int32  baseRepValue[4];
1165        uint32 repFlags[4];
1166        uint32 parentFaction;
1167        char*  Name;
1168//      uint32 poo[16];
1169//      uint32 Description;
1170//      uint32 poo2[16];
1171};
1172
1173struct DBCTaxiNode
1174{
1175        uint32 id;
1176        uint32 mapid;
1177        float  x;
1178        float  y;
1179        float  z;
1180//      uint32 name;
1181//      uint32 namealt1;
1182//      uint32 namealt2;
1183//      uint32 namealt3;
1184//      uint32 namealt4;
1185//      uint32 namealt5;
1186//      uint32 namealt6;
1187//      uint32 namealt7;
1188//      uint32 namealt8;
1189//      uint32 namealt9;
1190//      uint32 namealt10;
1191//      uint32 namealt11;
1192//      uint32 namealt12;
1193//      uint32 namealt13;
1194//      uint32 namealt14;
1195//      uint32 namealt15;
1196//      uint32 nameflags;
1197        uint32 horde_mount;
1198        uint32 alliance_mount;
1199};
1200
1201struct DBCTaxiPath
1202{
1203        uint32 id;
1204        uint32 from;
1205        uint32 to;
1206        uint32 price;
1207};
1208
1209struct DBCTaxiPathNode
1210{
1211        uint32 id;
1212        uint32 path;
1213        uint32 seq;                     // nodeIndex
1214        uint32 mapid;
1215        float  x;
1216        float  y;
1217        float  z;
1218        uint32 flags;
1219        uint32 waittime;
1220//      uint32 arivalEventID;
1221//      uint32 departureEventID;
1222};
1223
1224struct CreatureSpellDataEntry
1225{
1226        uint32 id;
1227        uint32 Spells[3];
1228        uint32 PHSpell;
1229        uint32 Cooldowns[3];
1230        uint32 PH;
1231};
1232
1233struct CharRaceEntry
1234{
1235        uint32 race_id;
1236        uint32 team_id;
1237        uint32 cinematic_id;
1238        char*  name1;
1239};
1240
1241struct CharClassEntry
1242{
1243        uint32 class_id;
1244//      uint32 unk1;
1245        uint32 power_type;
1246//      uint32 unk2;
1247        char*  name;
1248//      uint32 namealt1;
1249//      uint32 namealt2;
1250//      uint32 namealt3;
1251//      uint32 namealt4;
1252//      uint32 namealt5;
1253//      uint32 namealt6;
1254//      uint32 namealt7;
1255//      uint32 namealt8;
1256//      uint32 namealt9;
1257//      uint32 namealt10;
1258//      uint32 namealt11;
1259//      uint32 namealt12;
1260//      uint32 namealt13;
1261//      uint32 namealt14;
1262//      uint32 namealt15;
1263//      uint32 nameflags;
1264//      uint32 unk3;
1265//      uint32 unk4;
1266//      uint32 unk5;
1267};
1268
1269struct CreatureFamilyEntry
1270{
1271        uint32 ID;
1272        float  minsize;
1273        uint32 minlevel;
1274        float  maxsize;
1275        uint32 maxlevel;
1276        uint32 skilline;
1277        uint32 tameable;     //second skill line - 270 Generic
1278        uint32 petdietflags;
1279        uint32 talenttree;   // -1 = none, 0 = ferocity(410), 1 = tenacity(409), 2 = cunning(411)
1280//      uint32 unk;        // some index 0 - 63
1281        char*  name;
1282//      uint32 namealt[15];
1283//      uint32 nameflags;
1284//      uint32 iconFile;
1285};
1286
1287struct MapEntry
1288{
1289        uint32 id;
1290        char*  name_internal;
1291        uint32 map_type;
1292        uint32 is_pvp_zone;
1293        char*  real_name;
1294        uint32 linked_zone;  // common zone for instance and continent map
1295        char*  hordeIntro;   // text for PvP Zones
1296        char*  allianceIntro;// text for PvP Zones
1297        uint32 multimap_id;
1298        char*  normalReqText;// normal mode requirement text
1299        char*  heroicReqText;// heroic mode requirement text
1300        int32  parent_map;   // map_id of parent map
1301        float  start_x;      // enter x coordinate (if exist single entry)
1302        float  start_y;      // enter y coordinate (if exist single entry)
1303        //uint32 resetTimeRaid;   // REMOVED IN 3.2.0
1304        //uint32 resetTimeHeroic; // REMOVED IN 3.2.0
1305        uint32 addon;        // 0-original maps, 1-tbc addon, 2-wotlk addon
1306};
1307
1308struct ItemRandomSuffixEntry
1309{
1310        uint32 id;
1311        uint32 enchantments[3];
1312        uint32 prefixes[3];
1313};
1314
1315struct BarberShopStyleEntry
1316{
1317        uint32  id;           // 0
1318        uint32  type;         // 1 value 0 -> hair, value 2 -> facialhair
1319//      char*   name;         // 2 string hairstyle name
1320//      char*   name[15];     // 3-17 name of hair style
1321//      uint32  name_flags;   // 18
1322//      uint32  unk_name[16]; // 19-34, all empty
1323//      uint32  unk_flags;    // 35
1324//      float   unk3;         // 36 values 1 and 0,75
1325        uint32  race;         // 37 race
1326        uint32  gender;       // 38 0 male, 1 female
1327        uint32  hair_id;      // 39 Hair ID
1328};
1329
1330struct gtFloat
1331{
1332        float val;
1333};
1334
1335struct CombatRatingDBC
1336{
1337        float val;
1338};
1339
1340struct ChatChannelDBC
1341{
1342        uint32 id;
1343        uint32 flags;
1344        char * name_pattern[16];
1345};
1346
1347struct DurabilityQualityEntry
1348{
1349        uint32 id;
1350        float quality_modifier;
1351};
1352
1353struct DurabilityCostsEntry
1354{
1355        uint32 itemlevel;
1356        uint32 modifier[29];
1357};
1358
1359struct SpellShapeshiftForm
1360{
1361        uint32 id;
1362        uint32 Flags;
1363        uint32 unit_type;
1364        uint32 AttackSpeed;
1365        uint32 modelId;
1366        uint32 modelId2;
1367        uint32 spells[8];
1368};
1369
1370struct AreaTriggerEntry
1371{
1372        uint32    id;           // 0
1373        uint32    mapid;        // 1
1374        float     x;            // 2
1375        float     y;            // 3
1376        float     z;            // 4
1377        float     o;            // 5 radius?
1378        float     box_x;        // 6 extent x edge
1379        float     box_y;        // 7 extent y edge
1380        float     box_z;        // 8 extent z edge
1381        float     box_o;        // 9 extent rotation by about z axis
1382};
1383
1384/*struct VehicleEntry
1385{
1386        m_ID;
1387        m_flags;
1388        m_turnSpeed;
1389        m_pitchSpeed;
1390        m_pitchMin;
1391        m_pitchMax;
1392        m_seatID[8];
1393}
1394
1395struct VehicleSeatEntry
1396{
1397        m_ID;
1398        m_flags;
1399        m_attachmentID;
1400        m_attachmentOffsetX;
1401        m_attachmentOffsetY;
1402        m_attachmentOffsetZ;
1403        m_enterPreDelay;
1404        m_enterSpeed;
1405        m_enterGravity;
1406        m_enterMinDuration;
1407        m_enterMaxDuration;
1408        m_enterMinArcHeight;
1409        m_enterMaxArcHeight;
1410        m_enterAnimStart;
1411        m_enterAnimLoop;
1412        m_rideAnimStart;
1413        m_rideAnimLoop;
1414        m_rideUpperAnimStart;
1415        m_rideUpperAnimLoop;
1416        m_exitPreDelay;
1417        m_exitSpeed;
1418        m_exitGravity;
1419        m_exitMinDuration;
1420        m_exitMaxDuration;
1421        m_exitMinArcHeight;
1422        m_exitMaxArcHeight;
1423        m_exitAnimStart;
1424        m_exitAnimLoop;
1425        m_exitAnimEnd;
1426}
1427
1428struct WeatherEntry
1429{
1430        m_ID;
1431        m_ambienceID;
1432        m_effectType;
1433        m_effectColor[3];
1434        m_effectTexture;
1435}
1436*/
1437
1438struct ScalingStatDistributionEntry{
1439        uint32 id;
1440        int32 stat[10];
1441        uint32 statmodifier[10];
1442        uint32 maxlevel;
1443};
1444
1445struct ScalingStatValuesEntry{
1446        uint32 id;
1447        uint32 level;
1448        uint32 multiplier[16];
1449};
1450
1451#pragma pack(pop)
1452
1453ARCEMU_INLINE float GetRadius(SpellRadius *radius)
1454{
1455        return radius->Radius;
1456}
1457ARCEMU_INLINE uint32 GetCastTime(SpellCastTime *time)
1458{
1459        return time->CastTime;
1460}
1461ARCEMU_INLINE float GetMaxRange(SpellRange *range)
1462{
1463        return range->maxRange;
1464}
1465ARCEMU_INLINE float GetMinRange(SpellRange *range)
1466{
1467        return range->minRange;
1468}
1469ARCEMU_INLINE uint32 GetDuration(SpellDuration *dur)
1470{
1471        return dur->Duration1;
1472}
1473
1474#define SAFE_DBC_CODE_RETURNS        /* undefine this to make out of range/nulls return null. */
1475
1476template<class T>
1477class SERVER_DECL DBCStorage
1478{
1479        T * m_heapBlock;
1480        T * m_firstEntry;
1481
1482        T ** m_entries;
1483        uint32 m_max;
1484        uint32 m_numrows;
1485        uint32 m_stringlength;
1486        char * m_stringData;
1487
1488        uint32 rows;
1489        uint32 cols;
1490        uint32 useless_shit;
1491        uint32 header;
1492
1493public:
1494
1495    class iterator{
1496    private:
1497        T *p;
1498    public:
1499        iterator(T* ip = 0) : p(ip){ }
1500        iterator& operator++(){ ++p; return *this; }
1501        bool operator!=(const iterator &i){ return (p != i.p); }
1502        T* operator*(){ return p; }
1503    };
1504
1505    iterator begin(){ 
1506        return iterator(&m_heapBlock[0]);
1507    }
1508    iterator end(){ 
1509        return iterator(&m_heapBlock[m_numrows]); 
1510    }
1511
1512        DBCStorage()
1513        {
1514                m_heapBlock = NULL;
1515                m_entries = NULL;
1516                m_firstEntry = NULL;
1517                m_max = 0;
1518                m_numrows = 0;
1519                m_stringlength= 0;
1520                m_stringData = NULL;
1521        }
1522
1523        ~DBCStorage()
1524        {
1525                Cleanup();
1526        }
1527
1528        void Cleanup()
1529        {
1530                if(m_heapBlock)
1531                {
1532                        free(m_heapBlock);
1533                        m_heapBlock = NULL;
1534                }
1535                if(m_entries)
1536                {
1537                        free(m_entries);
1538                        m_entries = NULL;
1539                }
1540                if( m_stringData != NULL )
1541                {
1542                        free(m_stringData);
1543                        m_stringData = NULL;
1544                }
1545        }
1546
1547        bool Load(const char * filename, const char * format, bool load_indexed, bool load_strings)
1548        {
1549                uint32 i;
1550                uint32 string_length;
1551                long pos;
1552
1553                FILE * f = fopen(filename, "rb");
1554                if(f == NULL)
1555                        return false;
1556
1557                /* read the number of rows, and allocate our block on the heap */
1558                fread(&header,4,1,f);
1559                fread(&rows, 4, 1, f);
1560                fread(&cols, 4, 1, f);
1561                fread(&useless_shit, 4, 1, f);
1562                fread(&string_length, 4, 1, f);
1563                pos = ftell(f);
1564
1565                if( load_strings )
1566                {
1567                        fseek( f, 20 + ( rows * cols * 4 ), SEEK_SET );
1568                        m_stringData = (char*)malloc(string_length);
1569                        m_stringlength = string_length;
1570                        if (m_stringData)
1571                                fread( m_stringData, string_length, 1, f );
1572                }
1573
1574                fseek(f, pos, SEEK_SET);
1575
1576                m_heapBlock = (T*)malloc(rows * sizeof(T));
1577                ASSERT(m_heapBlock);
1578
1579                /* read the data for each row */
1580                for(i = 0; i < rows; ++i)
1581                {
1582                        memset(&m_heapBlock[i], 0, sizeof(T));
1583                        ReadEntry(f, &m_heapBlock[i], format, cols, filename);
1584
1585                        if(load_indexed)
1586                        {
1587                                /* all the time the first field in the dbc is our unique entry */
1588                                if(*(uint32*)&m_heapBlock[i] > m_max)
1589                                        m_max = *(uint32*)&m_heapBlock[i];
1590                        }
1591                }
1592
1593                if(load_indexed)
1594                {
1595                        m_entries = (T**)malloc(sizeof(T*) * (m_max+1));
1596                        ASSERT(m_entries);
1597
1598                        memset(m_entries, 0, (sizeof(T*) * (m_max+1)));
1599                        for(i = 0; i < rows; ++i)
1600                        {
1601                                if(m_firstEntry == NULL)
1602                                        m_firstEntry = &m_heapBlock[i];
1603
1604                                m_entries[*(uint32*)&m_heapBlock[i]] = &m_heapBlock[i];
1605                        }
1606                }
1607
1608                m_numrows = rows;
1609
1610                fclose(f);
1611                return true;
1612        }
1613
1614        void ReadEntry(FILE * f, T * dest, const char * format, uint32 cols, const char * filename)
1615        {
1616                const char * t = format;
1617                uint32 * dest_ptr = (uint32*)dest;
1618                uint32 c = 0;
1619                uint32 val;
1620                size_t len = strlen(format);
1621                if(len!= cols)
1622                        printf("!!! possible invalid format in file %s (us: %u, them: %u)\n", filename, len, cols);
1623
1624                while(*t != 0)
1625                {
1626                        if((++c) > cols)
1627                        {
1628                                ++t;
1629                                printf("!!! Read buffer overflow in DBC reading of file %s\n", filename);
1630                                continue;
1631                        }
1632
1633                        fread(&val, 4, 1, f);
1634                        if(*t == 'x')
1635                        {
1636                                ++t;
1637                                continue;               // skip!
1638                        }
1639
1640                        if(( *t == 's' ) || ( *t=='l' ))
1641                        {
1642                                char ** new_ptr = (char**)dest_ptr;
1643                                static const char * null_str = "";
1644                                char * ptr;
1645                                // if t == 'lxxxxxxxxxxxxxxxx' use localized strings in case
1646                                // the english one is empty. *t ends at most on the locale flag
1647                                for(int count = (*t == 'l') ? 16 : 0 ;
1648                                        val == 0 && count > 0 && *(t+1) == 'x'; t++, count--)
1649                                {
1650                                        fread(&val, 4, 1, f);
1651
1652                                }
1653                                if( val < m_stringlength )
1654                                        ptr = m_stringData + val;
1655                                else
1656                                        ptr = (char*)null_str;
1657
1658                                *new_ptr = ptr;
1659                                new_ptr++;
1660                                dest_ptr = (uint32*)new_ptr;
1661                        }
1662                        else
1663                        {
1664                                *dest_ptr = val;
1665                                dest_ptr++;
1666                        }
1667
1668                        ++t;
1669                }
1670        }
1671
1672        ARCEMU_INLINE uint32 GetNumRows()
1673        {
1674                return m_numrows;
1675        }
1676
1677        T * LookupEntryForced(uint32 i)
1678        {
1679#if 0
1680                if(m_entries)
1681                {
1682                        if(i > m_max || m_entries[i] == NULL)
1683                        {
1684                                printf("LookupEntryForced failed for entry %u\n", i);
1685                                return NULL;
1686                        }
1687                        else
1688                                return m_entries[i];
1689                }
1690                else
1691                {
1692                        if(i >= m_numrows)
1693                                return NULL;
1694                        else
1695                                return &m_heapBlock[i];
1696                }
1697#else
1698                if(m_entries)
1699                {
1700                        if(i > m_max || m_entries[i] == NULL)
1701                                return NULL;
1702                        else
1703                                return m_entries[i];
1704                }
1705                else
1706                {
1707                        if(i >= m_numrows)
1708                                return NULL;
1709                        else
1710                                return &m_heapBlock[i];
1711                }
1712#endif
1713        }
1714
1715        T * LookupRowForced(uint32 i)
1716        {
1717                if(i >= m_numrows)
1718                        return NULL;
1719                else
1720                        return &m_heapBlock[i];
1721        }
1722
1723        T * CreateCopy(T * obj)
1724        {
1725                T * oCopy = (T*)malloc(sizeof(T));
1726                ASSERT(oCopy);
1727                memcpy(oCopy,obj,sizeof(T));
1728                return oCopy;
1729        }
1730        void SetRow(uint32 i, T * t)
1731        {
1732                if(i < m_max && m_entries)
1733                        m_entries[i] = t;
1734        }
1735
1736        T * LookupEntry(uint32 i)
1737        {
1738                if(m_entries)
1739                {
1740                        if(i > m_max || m_entries[i] == NULL)
1741                                return m_firstEntry;
1742                        else
1743                                return m_entries[i];
1744                }
1745                else
1746                {
1747                        if(i >= m_numrows)
1748                                return &m_heapBlock[0];
1749                        else
1750                                return &m_heapBlock[i];
1751                }
1752        }
1753
1754        T * LookupRow(uint32 i)
1755        {
1756                if(i >= m_numrows)
1757                        return &m_heapBlock[0];
1758                else
1759                        return &m_heapBlock[i];
1760        }
1761
1762};
1763
1764extern SERVER_DECL DBCStorage<WorldMapOverlay> dbcWorldMapOverlayStore;
1765#ifdef ENABLE_ACHIEVEMENTS
1766extern SERVER_DECL DBCStorage<AchievementEntry> dbcAchievementStore;
1767extern SERVER_DECL DBCStorage<AchievementCriteriaEntry> dbcAchievementCriteriaStore;
1768extern SERVER_DECL DBCStorage<AchievementCategoryEntry> dbcAchievementCategoryStore;
1769#endif
1770extern SERVER_DECL DBCStorage<BattlemasterListEntry> dbcBattlemasterListStore;
1771extern SERVER_DECL DBCStorage<CharTitlesEntry> dbcCharTitlesEntry;
1772extern SERVER_DECL DBCStorage<CurrencyTypesEntry> dbcCurrencyTypesStore;
1773extern SERVER_DECL DBCStorage<BarberShopStyleEntry> dbcBarberShopStyleStore;
1774extern SERVER_DECL DBCStorage<GemPropertyEntry> dbcGemProperty;
1775extern SERVER_DECL DBCStorage<GlyphPropertyEntry> dbcGlyphProperty;
1776extern SERVER_DECL DBCStorage<GlyphSlotEntry> dbcGlyphSlot;
1777extern SERVER_DECL DBCStorage<ItemSetEntry> dbcItemSet;
1778extern SERVER_DECL DBCStorage<Lock> dbcLock;
1779extern SERVER_DECL DBCStorage<SpellEntry> dbcSpell;
1780extern SERVER_DECL DBCStorage<SpellDuration> dbcSpellDuration;
1781extern SERVER_DECL DBCStorage<SpellRange> dbcSpellRange;
1782extern SERVER_DECL DBCStorage<SpellShapeshiftForm> dbcSpellShapeshiftForm;
1783extern SERVER_DECL DBCStorage<emoteentry> dbcEmoteEntry;
1784extern SERVER_DECL DBCStorage<SpellRadius> dbcSpellRadius;
1785extern SERVER_DECL DBCStorage<SpellCastTime> dbcSpellCastTime;
1786extern SERVER_DECL DBCStorage<AreaGroup> dbcAreaGroup;
1787extern SERVER_DECL DBCStorage<AreaTable> dbcArea;
1788extern SERVER_DECL DBCStorage<FactionTemplateDBC> dbcFactionTemplate;
1789extern SERVER_DECL DBCStorage<FactionDBC> dbcFaction;
1790extern SERVER_DECL DBCStorage<EnchantEntry> dbcEnchant;
1791extern SERVER_DECL DBCStorage<RandomProps> dbcRandomProps;
1792extern SERVER_DECL DBCStorage<skilllinespell> dbcSkillLineSpell;
1793extern SERVER_DECL DBCStorage<skilllineentry> dbcSkillLine;
1794extern SERVER_DECL DBCStorage<DBCTaxiNode> dbcTaxiNode;
1795extern SERVER_DECL DBCStorage<DBCTaxiPath> dbcTaxiPath;
1796extern SERVER_DECL DBCStorage<DBCTaxiPathNode> dbcTaxiPathNode;
1797extern SERVER_DECL DBCStorage<AuctionHouseDBC> dbcAuctionHouse;
1798extern SERVER_DECL DBCStorage<TalentEntry> dbcTalent;
1799extern SERVER_DECL DBCStorage<TalentTabEntry> dbcTalentTab;
1800extern SERVER_DECL DBCStorage<CreatureSpellDataEntry> dbcCreatureSpellData;
1801extern SERVER_DECL DBCStorage<CreatureFamilyEntry> dbcCreatureFamily;
1802extern SERVER_DECL DBCStorage<CharClassEntry> dbcCharClass;
1803extern SERVER_DECL DBCStorage<CharRaceEntry> dbcCharRace;
1804extern SERVER_DECL DBCStorage<MapEntry> dbcMap;
1805extern SERVER_DECL DBCStorage<SpellRuneCostEntry> dbcSpellRuneCost;
1806extern SERVER_DECL DBCStorage<ItemExtendedCostEntry> dbcItemExtendedCost;
1807extern SERVER_DECL DBCStorage<ItemRandomSuffixEntry> dbcItemRandomSuffix;
1808extern SERVER_DECL DBCStorage<CombatRatingDBC> dbcCombatRating;
1809extern SERVER_DECL DBCStorage<ChatChannelDBC> dbcChatChannels;
1810extern SERVER_DECL DBCStorage<DurabilityCostsEntry> dbcDurabilityCosts;
1811extern SERVER_DECL DBCStorage<DurabilityQualityEntry> dbcDurabilityQuality;
1812extern SERVER_DECL DBCStorage<BankSlotPrice> dbcBankSlotPrices;
1813extern SERVER_DECL DBCStorage<BankSlotPrice> dbcStableSlotPrices; //uses same structure as Bank
1814extern SERVER_DECL DBCStorage<gtFloat> dbcBarberShopPrices;
1815extern SERVER_DECL DBCStorage<gtFloat> dbcMeleeCrit;
1816extern SERVER_DECL DBCStorage<gtFloat> dbcMeleeCritBase;
1817extern SERVER_DECL DBCStorage<gtFloat> dbcSpellCrit;
1818extern SERVER_DECL DBCStorage<gtFloat> dbcSpellCritBase;
1819extern SERVER_DECL DBCStorage<gtFloat> dbcManaRegen;
1820extern SERVER_DECL DBCStorage<gtFloat> dbcManaRegenBase;
1821extern SERVER_DECL DBCStorage<gtFloat> dbcHPRegen;
1822extern SERVER_DECL DBCStorage<gtFloat> dbcHPRegenBase;
1823extern SERVER_DECL DBCStorage<AreaTriggerEntry> dbcAreaTrigger;
1824extern SERVER_DECL DBCStorage<ScalingStatDistributionEntry> dbcScalingStatDistribution;
1825extern SERVER_DECL DBCStorage<ScalingStatValuesEntry> dbcScalingStatValues;
1826extern SERVER_DECL DBCStorage<ItemLimitCategoryEntry> dbcItemLimitCategory;
1827
1828bool LoadDBCs();
1829
1830#endif
Note: See TracBrowser for help on using the browser.