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

Revision 3131, 47.3 kB (checked in by Hypersniper, 8 months ago)

* APPLIED:
- Alterac Valley patch by Artox
- Copyrights patch by Terrorblade
- Earth shield patch by Jackpoz
- Energize patch by Arch1s
- Opcode fix by Sadikum
- Optional config fix by Psychobandit
- Various spells by Catti
- Various spells by Mesox/Ogchaos
- "Summon Myzrael" fix by this_is_junk
- "Torgos" fix by dzjhenghiz
- Worldstates patch by eggnrice
Good work community!

  • 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  min_players_per_faction;
482        uint32  flag; // EOTS AND SOTA have this set to nine, otherwise it's zero
483        uint32  always_true;
484        uint32  some_id;
485        int32   zeros[15];
486        uint32  unk[2];
487        uint32  always_same; // Always 16712190
488        uint32  minimum_payer_level; // ??? Is it, 3.0.8 doesn't match 3.0.3 numbers
489                                                                 // Do not use for now (NAQUADA)
490        //char* name;
491};
492
493struct BankSlotPrice
494{
495        uint32 Id;
496        uint32 Price;
497};
498
499struct CharTitlesEntry
500{
501        uint32  ID;                                           // 0, title ids
502        uint32  unk1;                                         // 1 flags?
503        char*   name;                                         // 2-17, unused
504        uint32  name_flag;                                    // 18 string flag, unused
505        char*   name2;                                        // 19-34, unused
506        char*   name2_flag;                                   // 35 string flag, unused
507        uint32  bit_index;                                    // 36 used in PLAYER_CHOSEN_TITLE and 1<<index in PLAYER__FIELD_KNOWN_TITLES
508};
509
510struct CurrencyTypesEntry
511{
512    //uint32    ID;                                       // 0 not used
513    uint32    ItemId;                                     // 1 used as real index
514    //uint32    Category;                                 // 2 may be category
515    uint32    BitIndex;                                   // 3 bit index in PLAYER_FIELD_KNOWN_CURRENCIES (1 << (index-1))
516};
517
518struct ItemSetEntry
519{
520        uint32 id;                  //1
521        char*  name;                //2
522//      uint32 unused_shit[15];     //3 - 9
523//      uint32 localeflag;          //10 constant
524        uint32 itemid[8];           //11 - 18
525//      uint32 more_unused_shit[9]; //19 - 27
526        uint32 SpellID[8];          //28 - 35
527        uint32 itemscount[8];       //36 - 43
528        uint32 RequiredSkillID;     //44
529        uint32 RequiredSkillAmt;    //45
530};
531
532struct ItemLimitCategoryEntry
533{
534        uint32 Id;                                      // 0    - Id
535        char * name;                            // 1    - Displayed name
536        uint32 maxAmount;                       // 18   - Max amount of items
537        uint32 equippedFlag;            // 19   - equipped (bool?)
538};
539
540struct Lock
541{
542        uint32 Id;
543        uint32 locktype[5]; // 0 - no lock, 1 - item needed for lock, 2 - min lockping skill needed
544//      uint32 unk1[3];
545        uint32 lockmisc[5]; // if type is 1 here is a item to unlock, else is unknow for now
546//      uint32 unk2[3];
547        uint32 minlockskill[5]; // min skill in lockpiking to unlock.
548//      uint32 unk3[11];
549
550        /* Actually it is:
551        uint32 Id;
552        uint32 locktype[8];
553        uint32 lockindex[8];
554        uint32 minlockskill[8];
555        uint32 action[8];
556        */
557};
558
559struct emoteentry
560{
561        uint32 Id;
562//      uint32 name;
563        uint32 textid;
564        uint32 textid2;
565        uint32 textid3;
566        uint32 textid4;
567//      uint32 unk1;
568        uint32 textid5;
569//      uint32 unk2;
570        uint32 textid6;
571//      uint32 unk3;
572//      uint32 unk4;
573//      uint32 unk5;
574//      uint32 unk6;
575//      uint32 unk7;
576//      uint32 unk8;
577//      uint32 unk9;
578//      uint32 unk10;
579//      uint32 unk11;
580};
581
582struct skilllinespell //SkillLineAbility.dbc
583{
584        uint32 Id;
585        uint32 skilline;
586        uint32 spell;
587//      uint32 raceMask;
588//      uint32 classMask;
589//      uint32 excludeRace;
590//      uint32 excludeClass;
591        uint32 minSkillLineRank;
592        uint32 next;
593        uint32 acquireMethod;
594        uint32 grey;
595        uint32 green;
596//      uint32 abandonable;
597        uint32 reqTP;
598};
599
600struct EnchantEntry
601{
602        uint32 Id;
603        uint32 type[3];
604        int32  min[3];//for compat, in practice min==max
605        int32  max[3];
606        uint32 spell[3];
607        char*  Name;
608//      uint32 NameAlt1;
609//      uint32 NameAlt2;
610//      uint32 NameAlt3;
611//      uint32 NameAlt4;
612//      uint32 NameAlt5;
613//      uint32 NameAlt6;
614//      uint32 NameAlt7;
615//      uint32 NameAlt8;
616//      uint32 NameAlt9;
617//      uint32 NameAlt10;
618//      uint32 NameAlt11;
619//      uint32 NameAlt12;
620//      uint32 NameAlt13;
621//      uint32 NameAlt14;
622//      uint32 NameAlt15;
623//      uint32 NameFlags;
624        uint32 visual;
625        uint32 EnchantGroups;
626        uint32 GemEntry;
627        uint32 unk7;//Gem Related
628
629};
630
631struct GemPropertyEntry{
632        uint32 Entry;
633        uint32 EnchantmentID;
634        uint32 unk1;//bool
635        uint32 unk2;//bool
636        uint32 SocketMask;
637};
638
639struct GlyphPropertyEntry       //GlyphProperties.dbc
640{
641        uint32 Entry;
642        uint32 SpellID;
643        uint32 Type; // 0 = Major, 1 = Minor
644        uint32 unk; // some flag
645};
646
647struct GlyphSlotEntry
648{
649        uint32 Id;
650        uint32 Type;
651        uint32 Slot;
652};
653
654struct skilllineentry //SkillLine.dbc
655{
656        uint32 id;
657        uint32 type;
658        uint32 skillCostsID;
659        char*  Name;
660//      int32  NameAlt[15];
661//      uint32 NameFlags;
662//      uint32 Description;
663//      uint32 DescriptionAlt[15];
664//      uint32 DescriptionFlags;
665//      uint32 spellIconID;
666};
667
668/*struct SkillRaceClassInfoEntry
669{
670        m_ID;
671        m_skillID;
672        m_raceMask;
673        m_classMask;
674        m_flags;
675        m_minLevel;
676        m_skillTierID;
677        m_skillCostIndex;
678}
679
680struct SkillTiersEntry
681{
682        m_ID;
683        m_cost[16];
684        m_value[16];
685}*/
686
687// Struct for the entry in Spell.dbc
688struct SpellEntry
689{
690        uint32 Id;                              //1
691        uint32 Category;                        //2
692        uint32 DispelType;                      //3
693        uint32 MechanicsType;                   //4
694        uint32 Attributes;                      //5
695        uint32 AttributesEx;                    //6
696        uint32 AttributesExB;                   //7
697        uint32 AttributesExC;                   //8 // Flags to
698        uint32 AttributesExD;                   //9  // Flags....
699        uint32 AttributesExE;                   //10 // Flags 2.0.1 unknown one
700        uint32 AttributesExF;                   //11
701                                                //12 UNK
702        uint32 RequiredShapeShift;              //13 // Flags BitMask for shapeshift spells
703                                                //14 UNK
704        uint32 ShapeshiftExclude;               //15-> this is wrong // Flags BitMask for which shapeshift forms this spell can NOT be used in.
705                                                //16 UNK
706        uint32 Targets;                         //17 - N / M
707        uint32 TargetCreatureType;              //18
708        uint32 RequiresSpellFocus;              //19
709        uint32 FacingCasterFlags;               //20
710        uint32 CasterAuraState;                 //21
711        uint32 TargetAuraState;                 //22
712        uint32 CasterAuraStateNot;              //23
713        uint32 TargetAuraStateNot;              //24
714        uint32 casterAuraSpell;                 //25
715        uint32 targetAuraSpell;                 //26
716        uint32 casterAuraSpellNot;              //27
717        uint32 targetAuraSpellNot;              //28
718        uint32 CastingTimeIndex;                //29
719        uint32 RecoveryTime;                    //30
720        uint32 CategoryRecoveryTime;            //31 recoverytime
721        uint32 InterruptFlags;                  //32
722        uint32 AuraInterruptFlags;              //33
723        uint32 ChannelInterruptFlags;           //34
724        uint32 procFlags;                       //35
725        uint32 procChance;                      //36
726        int32  procCharges;                     //37
727        uint32 maxLevel;                        //38
728        uint32 baseLevel;                       //39
729        uint32 spellLevel;                      //40
730        uint32 DurationIndex;                   //41
731        uint32 powerType;                       //42
732        uint32 manaCost;                        //43
733        uint32 manaCostPerlevel;                //44
734        uint32 manaPerSecond;                   //45
735        uint32 manaPerSecondPerLevel;           //46
736        uint32 rangeIndex;                      //47
737        float  speed;                           //48
738        uint32 modalNextSpell;                  //49
739        uint32 maxstack;                        //50
740        uint32 Totem[2];                        //51 - 52
741        uint32 Reagent[8];                      //53 - 60
742        uint32 ReagentCount[8];                 //61 - 68
743        int32  EquippedItemClass;               //69
744        uint32 EquippedItemSubClass;            //70
745        uint32 RequiredItemFlags;               //71
746        uint32 Effect[3];                       //72 - 74
747        uint32 EffectDieSides[3];               //75 - 77
748        uint32 EffectBaseDice[3];               //78 - 80
749        float  EffectDicePerLevel[3];           //81 - 83
750        float  EffectRealPointsPerLevel[3];     //84 - 86
751        int32  EffectBasePoints[3];             //87 - 89
752        int32  EffectMechanic[3];               //90 - 92       Related to SpellMechanic.dbc
753        uint32 EffectImplicitTargetA[3];        //93 - 95
754        uint32 EffectImplicitTargetB[3];        //96 - 98
755        uint32 EffectRadiusIndex[3];            //99 - 101
756        uint32 EffectApplyAuraName[3];          //102 - 104
757        uint32 EffectAmplitude[3];              //105 - 107
758        float  EffectMultipleValue[3];          //108 - 110     This value is the $ value from description
759        uint32 EffectChainTarget[3];            //111 - 113
760        uint32 EffectItemType[3];               //114 - 116     Not sure maybe we should rename it. its the relation to field: SpellGroupType
761        uint32 EffectMiscValue[3];              //117 - 119
762        uint32 EffectMiscValueB[3];             //120 - 122  2.4.3
763        uint32 EffectTriggerSpell[3];           //123 - 125
764        float  EffectPointsPerComboPoint[3];    //126 - 128
765        uint32 EffectSpellClassMask[3][3];      //129 - 137
766        uint32 SpellVisual;                     //138
767        uint32 field114;                        //139
768        uint32 spellIconID;                     //140
769        uint32 activeIconID;                    //141   activeIconID;
770        uint32 spellPriority;                   //142
771        char*  Name;                            //143
772//      char*  NameAlt[15];                     //144-158 not used
773//      uint32 NameFlags;                       //159 not used
774        char*  Rank;                            //160
775//      char*  RankAlt[15];                     //161-175 not used
776//      uint32 RankFlags;                       //176 not used
777        char*  Description;                     //177
778//      char*  DescriptionAlt[15];              //178-192 not used
779//      uint32 DescriptionFlags;                //193 not used
780        char*  BuffDescription;                 //194
781//      char*  BuffDescription[15];             //195-209 not used
782//      uint32 buffdescflags;                   //210 not used
783        uint32 ManaCostPercentage;              //211
784        uint32 StartRecoveryCategory;           //212
785        uint32 StartRecoveryTime;               //213
786        uint32 MaxTargetLevel;                  //214
787        uint32 SpellFamilyName;                 //215
788        uint32 SpellGroupType[3];               //216-218
789        uint32 MaxTargets;                      //219
790        uint32 Spell_Dmg_Type;                  //220   dmg_class Integer      0=None, 1=Magic, 2=Melee, 3=Ranged
791        uint32 PreventionType;                  //221   0,1,2 related to Spell_Dmg_Type I think
792        int32  StanceBarOrder;                  //222   related to paladin aura's
793        float  dmg_multiplier[3];               //223 - 225   if the name is correct I dono
794        uint32 MinFactionID;                    //226   only one spellid:6994 has this value = 369 UNUSED
795        uint32 MinReputation;                   //227   only one spellid:6994 has this value = 4 UNUSED
796        uint32 RequiredAuraVision;              //228  3 spells 1 or 2
797        uint32 TotemCategory[2];                //229-230
798        int32  RequiresAreaId;                  //231
799        uint32 School;                          //232
800        uint32 RuneCostID;                      //233 from 3.0.1
801//      uint32 SpellMissileID;                  //234 from 3.0.1
802
803        /// CUSTOM: these fields are used for the modifications made in the world.cpp
804        uint32 DiminishStatus;                  //
805        uint32 proc_interval;                   //!!! CUSTOM, <Fill description for variable>
806        //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
807        //caster can only cast on 1 target these spells
808        uint32 BGR_one_buff_from_caster_on_1target; //!!! CUSTOM, <Fill description for variable>
809        //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
810        uint32 BGR_one_buff_on_target;          //!!! CUSTOM, these are related to creating a item through a spell
811        //caster can have only 1 Aura per spell group, ex pal auras
812        uint32 BGR_one_buff_from_caster_on_self;//!!! CUSTOM, these are related to creating a item through a spell
813//      uint32 buffIndexType;                   //!!! CUSTOM, <Fill description for variable>
814        uint32 c_is_flags;                      //!!! CUSTOM, store spell checks in a static way : isdamageind,ishealing
815//      uint32 buffType;                        //!!! CUSTOM, these are related to creating a item through a spell
816        uint32 RankNumber;                      //!!! CUSTOM, this protects players from having >1 rank of a spell
817        uint32 NameHash;                        //!!! CUSTOM, related to custom spells, summon spell quest related spells
818        uint32 talent_tree;                     //!!! CUSTOM,
819        uint32 in_front_status;                 //!!! CUSTOM,
820        uint32 EffectSpellGroupRelation_high[3];     //!!! this is not contained in client dbc but server must have it
821        uint32 ThreatForSpell;
822        float  ThreatForSpellCoef;
823        uint32 ProcOnNameHash[3];
824        uint32 spell_coef_flags;                //!!! CUSTOM, store flags for spell coefficient calculations
825
826        float  base_range_or_radius_sqr;        //!!! CUSTOM, needed for aoe spells most of the time
827        // love me or hate me, all "In a cone in front of the caster" spells don't necessarily mean "in front"
828        float  cone_width;
829        //Spell Coefficient
830        float  casttime_coef;                   //!!! CUSTOM, faster spell bonus calculation
831        float  fixed_dddhcoef;                  //!!! CUSTOM, fixed DD-DH coefficient for some spells
832        float  fixed_hotdotcoef;                //!!! CUSTOM, fixed HOT-DOT coefficient for some spells
833        float  Dspell_coef_override;            //!!! CUSTOM, overrides any spell coefficient calculation and use this value in DD&DH
834        float  OTspell_coef_override;           //!!! CUSTOM, overrides any spell coefficient calculation and use this value in HOT&DOT
835        int    ai_target_type;
836
837        bool   self_cast_only;
838        bool   apply_on_shapeshift_change;
839        bool   always_apply;
840        bool   is_melee_spell;                  //!!! CUSTOM,
841        bool   is_ranged_spell;                 //!!! CUSTOM,
842        bool   spell_can_crit;                  //!!! CUSTOM,
843        bool   noproc;
844
845        uint32 SchoolMask;                      // Custom
846/*
847//3.0.1 client column namings
848m_id
849m_category
850m_castUI
851m_dispelType
852m_mechanic
853m_attributes
854m_attributesEx
855m_attributesExB
856m_attributesExC
857m_attributesExD
858m_attributesExE
859m_attributesExF
860m_shapeshiftMask
861m_shapeshiftExclude
862m_targets
863m_targetCreatureType
864m_requiresSpellFocus
865m_facingCasterFlags
866m_casterAuraState
867m_targetAuraState
868m_excludeCasterAuraState
869m_excludeTargetAuraState
870m_castingTimeIndex
871m_recoveryTime
872m_categoryRecoveryTime
873m_interruptFlags
874m_auraInterruptFlags
875m_channelInterruptFlags
876m_procTypeMask
877m_procChance
878m_procCharges
879m_maxLevel
880m_baseLevel
881m_spellLevel
882m_durationIndex
883m_powerType
884m_manaCost
885m_manaCostPerLevel
886m_manaPerSecond
887m_manaPerSecondPerLevel
888m_rangeIndex
889m_speed
890m_modalNextSpell
891m_cumulativeAura
892m_totem
893m_reagent
894m_reagentCount
895m_equippedItemClass
896m_equippedItemSubclass
897m_equippedItemInvTypes
898m_effect
899m_effectDieSides
900m_effectBaseDice
901m_effectDicePerLevel
902m_effectRealPointsPerLevel
903m_effectBasePoints
904m_effectMechanic
905m_implicitTargetA
906m_implicitTargetB
907m_effectRadiusIndex
908m_effectAura
909m_effectAuraPeriod
910m_effectAmplitude
911m_effectChainTargets
912m_effectItemType
913m_effectMiscValue
914m_effectMiscValueB
915m_effectTriggerSpell
916m_effectPointsPerCombo
917m_spellVisualID
918m_spellIconID
919m_activeIconID
920m_spellPriority
921m_name_lang
922m_nameSubtext_lang
923m_description_lang
924m_auraDescription_lang
925m_manaCostPct
926m_startRecoveryCategory
927m_startRecoveryTime
928m_maxTargetLevel
929m_spellClassSet
930m_spellClassMask
931m_maxTargets
932m_defenseType
933m_preventionType
934m_stanceBarOrder
935m_effectChainAmplitude
936m_minFactionID
937m_minReputation
938m_requiredAuraVision
939m_requiredTotemCategoryID
940m_requiredAreaID
941m_schoolMask
942m_RuneCostID
943m_spellMissileID
944*/
945};
946
947struct SpellRuneCostEntry
948{
949        uint32  ID;
950        uint32  bloodRuneCost;
951        uint32  frostRuneCost;
952        uint32  unholyRuneCost;
953        uint32  runePowerGain;
954};
955
956struct ItemExtendedCostEntry
957{
958        uint32 costid;
959        uint32 honor;
960        uint32 arena;
961        uint32 item[5];
962        uint32 count[5];
963        uint32 personalrating;
964};
965
966struct TalentEntry
967{
968        uint32  TalentID;
969        uint32  TalentTree;
970        uint32  Row;
971        uint32  Col;
972        uint32  RankID[5];
973//      uint32  unk[4];
974        uint32  DependsOn;
975//      uint32  unk1[2];
976        uint32  DependsOnRank;
977//      uint32  unk2[4];
978};
979
980struct TalentTabEntry
981{
982        uint32 TalentTabID;
983//      char*  Name;
984//      uint32 unk3;
985//      uint32 unk4;
986//      uint32 unk5;
987//      uint32 unk6;
988//      uint32 unk7;
989//      uint32 unk8;
990//      uint32 unk9;
991//      uint32 unk10;
992//      uint32 unk11;
993//      uint32 unk12;
994//      uint32 unk13;
995//      uint32 unk14;
996//      uint32 unk15;
997//      uint32 unk16;
998//      uint32 unk17;
999//      uint32 unk18;
1000//      uint32 unk19;
1001//      uint32 unk20;
1002        uint32 ClassMask;
1003        uint32 PetTalentMask;
1004        uint32 TabPage;
1005//      char*  InternalName;
1006};
1007
1008struct Trainerspell
1009{
1010        uint32 Id;
1011        uint32 skilline1;
1012        uint32 skilline2;
1013        uint32 skilline3;
1014        uint32 maxlvl;
1015        uint32 charclass;
1016};
1017
1018struct SpellCastTime
1019{
1020        uint32 ID;
1021        uint32 CastTime;
1022//      uint32 unk1;
1023//      uint32 unk2;
1024};
1025
1026struct SpellRadius
1027{
1028        uint32 ID;
1029        float  Radius;
1030//      float  unk1;
1031        float  Radius2;
1032};
1033
1034struct SpellRange
1035{
1036        uint32 ID;
1037        float  minRange;
1038        float  minRange2;
1039        float  maxRange;
1040        float  maxRange2;
1041//      uint32 unks[35];
1042};
1043
1044struct SpellDuration
1045{
1046        uint32 ID;
1047        uint32 Duration1;
1048        uint32 Duration2;
1049        uint32 Duration3;
1050};
1051
1052struct RandomProps
1053{
1054        uint32 ID;
1055//      uint32 name1;
1056        uint32 spells[3];
1057//      uint32 unk1;
1058//      uint32 unk2;
1059//      uint32 name2;
1060//      uint32 RankAlt1;
1061//      uint32 RankAlt2;
1062//      uint32 RankAlt3;
1063//      uint32 RankAlt4;
1064//      uint32 RankAlt5;
1065//      uint32 RankAlt6;
1066//      uint32 RankAlt7;
1067//      uint32 RankAlt8;
1068//      uint32 RankAlt9;
1069//      uint32 RankAlt10;
1070//      uint32 RankAlt11;
1071//      uint32 RankAlt12;
1072//      uint32 RankAlt13;
1073//      uint32 RankAlt14;
1074//      uint32 RankAlt15;
1075//      uint32 RankFlags;
1076
1077};
1078
1079struct AreaGroup
1080{
1081        uint32 AreaGroupId;
1082        uint32 AreaId[7];
1083};
1084
1085struct AreaTable
1086{
1087        uint32 AreaId;
1088        uint32 mapId;
1089        uint32 ZoneId;
1090        uint32 explorationFlag;
1091        uint32 AreaFlags;
1092//      uint32 unk2;
1093//      uint32 unk3;
1094//      uint32 unk4;
1095        uint32 EXP;//not XP
1096//      uint32 unk5;
1097        uint32 level;
1098        char*  name;
1099//      uint32 nameAlt1;
1100//      uint32 nameAlt2;
1101//      uint32 nameAlt3;
1102//      uint32 nameAlt4;
1103//      uint32 nameAlt5;
1104//      uint32 nameAlt6;
1105//      uint32 nameAlt7;
1106//      uint32 nameAlt8;
1107//      uint32 nameAlt9;
1108//      uint32 nameAlt10;
1109//      uint32 nameAlt11;
1110//      uint32 nameAlt12;
1111//      uint32 nameAlt13;
1112//      uint32 nameAlt14;
1113//      uint32 nameAlt15;
1114//      uint32 nameFlags;
1115        uint32 category;
1116//      uint32 unk7;
1117//      uint32 unk8;
1118//      uint32 unk9;
1119//      uint32 unk10;
1120//      uint32 unk11;
1121//      uint32 unk12;
1122};
1123
1124struct FactionTemplateDBC
1125{
1126        uint32 ID;
1127        uint32 Faction;
1128        uint32 FactionGroup;
1129        uint32 Mask;
1130        uint32 FriendlyMask;
1131        uint32 HostileMask;
1132        uint32 EnemyFactions[4];
1133        uint32 FriendlyFactions[4];
1134};
1135
1136struct AuctionHouseDBC
1137{
1138        uint32 id;
1139        uint32 unk;
1140        uint32 fee;
1141        uint32 tax;
1142//      char*  name;
1143//      char*  nameAlt1;
1144//      char*  nameAlt2;
1145//      char*  nameAlt3;
1146//      char*  nameAlt4;
1147//      char*  nameAlt5;
1148//      char*  nameAlt6;
1149//      char*  nameAlt7;
1150//      char*  nameAlt8;
1151//      char*  nameAlt9;
1152//      char*  nameAlt10;
1153//      char*  nameAlt11;
1154//      char*  nameAlt12;
1155//      char*  nameAlt13;
1156//      char*  nameAlt14;
1157//      char*  nameAlt15;
1158//      char*  nameFlags;
1159};
1160
1161struct FactionDBC
1162{
1163        uint32 ID;
1164        int32  RepListId;
1165        uint32 RaceMask[4];
1166        uint32 ClassMask[4];
1167        int32  baseRepValue[4];
1168        uint32 repFlags[4];
1169        uint32 parentFaction;
1170        char*  Name;
1171//      uint32 poo[16];
1172//      uint32 Description;
1173//      uint32 poo2[16];
1174};
1175
1176struct DBCTaxiNode
1177{
1178        uint32 id;
1179        uint32 mapid;
1180        float  x;
1181        float  y;
1182        float  z;
1183//      uint32 name;
1184//      uint32 namealt1;
1185//      uint32 namealt2;
1186//      uint32 namealt3;
1187//      uint32 namealt4;
1188//      uint32 namealt5;
1189//      uint32 namealt6;
1190//      uint32 namealt7;
1191//      uint32 namealt8;
1192//      uint32 namealt9;
1193//      uint32 namealt10;
1194//      uint32 namealt11;
1195//      uint32 namealt12;
1196//      uint32 namealt13;
1197//      uint32 namealt14;
1198//      uint32 namealt15;
1199//      uint32 nameflags;
1200        uint32 horde_mount;
1201        uint32 alliance_mount;
1202};
1203
1204struct DBCTaxiPath
1205{
1206        uint32 id;
1207        uint32 from;
1208        uint32 to;
1209        uint32 price;
1210};
1211
1212struct DBCTaxiPathNode
1213{
1214        uint32 id;
1215        uint32 path;
1216        uint32 seq;                     // nodeIndex
1217        uint32 mapid;
1218        float  x;
1219        float  y;
1220        float  z;
1221        uint32 flags;
1222        uint32 waittime;
1223//      uint32 arivalEventID;
1224//      uint32 departureEventID;
1225};
1226
1227struct CreatureSpellDataEntry
1228{
1229        uint32 id;
1230        uint32 Spells[3];
1231        uint32 PHSpell;
1232        uint32 Cooldowns[3];
1233        uint32 PH;
1234};
1235
1236struct CharRaceEntry
1237{
1238        uint32 race_id;
1239        uint32 team_id;
1240        uint32 cinematic_id;
1241        char*  name1;
1242};
1243
1244struct CharClassEntry
1245{
1246        uint32 class_id;
1247//      uint32 unk1;
1248        uint32 power_type;
1249//      uint32 unk2;
1250        char*  name;
1251//      uint32 namealt1;
1252//      uint32 namealt2;
1253//      uint32 namealt3;
1254//      uint32 namealt4;
1255//      uint32 namealt5;
1256//      uint32 namealt6;
1257//      uint32 namealt7;
1258//      uint32 namealt8;
1259//      uint32 namealt9;
1260//      uint32 namealt10;
1261//      uint32 namealt11;
1262//      uint32 namealt12;
1263//      uint32 namealt13;
1264//      uint32 namealt14;
1265//      uint32 namealt15;
1266//      uint32 nameflags;
1267//      uint32 unk3;
1268//      uint32 unk4;
1269//      uint32 unk5;
1270};
1271
1272struct CreatureFamilyEntry
1273{
1274        uint32 ID;
1275        float  minsize;
1276        uint32 minlevel;
1277        float  maxsize;
1278        uint32 maxlevel;
1279        uint32 skilline;
1280        uint32 tameable;     //second skill line - 270 Generic
1281        uint32 petdietflags;
1282        uint32 talenttree;   // -1 = none, 0 = ferocity(410), 1 = tenacity(409), 2 = cunning(411)
1283//      uint32 unk;        // some index 0 - 63
1284        char*  name;
1285//      uint32 namealt[15];
1286//      uint32 nameflags;
1287//      uint32 iconFile;
1288};
1289
1290struct MapEntry
1291{
1292        uint32 id;
1293        char*  name_internal;
1294        uint32 map_type;
1295        uint32 is_pvp_zone;
1296        char*  real_name;
1297        uint32 linked_zone;  // common zone for instance and continent map
1298        char*  hordeIntro;   // text for PvP Zones
1299        char*  allianceIntro;// text for PvP Zones
1300        uint32 multimap_id;
1301        char*  normalReqText;// normal mode requirement text
1302        char*  heroicReqText;// heroic mode requirement text
1303        int32  parent_map;   // map_id of parent map
1304        float  start_x;      // enter x coordinate (if exist single entry)
1305        float  start_y;      // enter y coordinate (if exist single entry)
1306        //uint32 resetTimeRaid;   // REMOVED IN 3.2.0
1307        //uint32 resetTimeHeroic; // REMOVED IN 3.2.0
1308        uint32 addon;        // 0-original maps, 1-tbc addon, 2-wotlk addon
1309};
1310
1311struct ItemRandomSuffixEntry
1312{
1313        uint32 id;
1314        uint32 enchantments[3];
1315        uint32 prefixes[3];
1316};
1317
1318struct BarberShopStyleEntry
1319{
1320        uint32  id;           // 0
1321        uint32  type;         // 1 value 0 -> hair, value 2 -> facialhair
1322//      char*   name;         // 2 string hairstyle name
1323//      char*   name[15];     // 3-17 name of hair style
1324//      uint32  name_flags;   // 18
1325//      uint32  unk_name[16]; // 19-34, all empty
1326//      uint32  unk_flags;    // 35
1327//      float   unk3;         // 36 values 1 and 0,75
1328        uint32  race;         // 37 race
1329        uint32  gender;       // 38 0 male, 1 female
1330        uint32  hair_id;      // 39 Hair ID
1331};
1332
1333struct gtFloat
1334{
1335        float val;
1336};
1337
1338struct CombatRatingDBC
1339{
1340        float val;
1341};
1342
1343struct ChatChannelDBC
1344{
1345        uint32 id;
1346        uint32 flags;
1347        char * name_pattern[16];
1348};
1349
1350struct DurabilityQualityEntry
1351{
1352        uint32 id;
1353        float quality_modifier;
1354};
1355
1356struct DurabilityCostsEntry
1357{
1358        uint32 itemlevel;
1359        uint32 modifier[29];
1360};
1361
1362struct SpellShapeshiftForm
1363{
1364        uint32 id;
1365        uint32 Flags;
1366        uint32 unit_type;
1367        uint32 AttackSpeed;
1368        uint32 modelId;
1369        uint32 modelId2;
1370        uint32 spells[8];
1371};
1372
1373struct AreaTriggerEntry
1374{
1375        uint32    id;           // 0
1376        uint32    mapid;        // 1
1377        float     x;            // 2
1378        float     y;            // 3
1379        float     z;            // 4
1380        float     o;            // 5 radius?
1381        float     box_x;        // 6 extent x edge
1382        float     box_y;        // 7 extent y edge
1383        float     box_z;        // 8 extent z edge
1384        float     box_o;        // 9 extent rotation by about z axis
1385};
1386
1387/*struct VehicleEntry
1388{
1389        m_ID;
1390        m_flags;
1391        m_turnSpeed;
1392        m_pitchSpeed;
1393        m_pitchMin;
1394        m_pitchMax;
1395        m_seatID[8];
1396}
1397
1398struct VehicleSeatEntry
1399{
1400        m_ID;
1401        m_flags;
1402        m_attachmentID;
1403        m_attachmentOffsetX;
1404        m_attachmentOffsetY;
1405        m_attachmentOffsetZ;
1406        m_enterPreDelay;
1407        m_enterSpeed;
1408        m_enterGravity;
1409        m_enterMinDuration;
1410        m_enterMaxDuration;
1411        m_enterMinArcHeight;
1412        m_enterMaxArcHeight;
1413        m_enterAnimStart;
1414        m_enterAnimLoop;
1415        m_rideAnimStart;
1416        m_rideAnimLoop;
1417        m_rideUpperAnimStart;
1418        m_rideUpperAnimLoop;
1419        m_exitPreDelay;
1420        m_exitSpeed;
1421        m_exitGravity;
1422        m_exitMinDuration;
1423        m_exitMaxDuration;
1424        m_exitMinArcHeight;
1425        m_exitMaxArcHeight;
1426        m_exitAnimStart;
1427        m_exitAnimLoop;
1428        m_exitAnimEnd;
1429}
1430
1431struct WeatherEntry
1432{
1433        m_ID;
1434        m_ambienceID;
1435        m_effectType;
1436        m_effectColor[3];
1437        m_effectTexture;
1438}
1439*/
1440
1441struct ScalingStatDistributionEntry{
1442        uint32 id;
1443        int32 stat[10];
1444        uint32 statmodifier[10];
1445        uint32 maxlevel;
1446};
1447
1448struct ScalingStatValuesEntry{
1449        uint32 id;
1450        uint32 level;
1451        uint32 multiplier[16];
1452};
1453
1454#pragma pack(pop)
1455
1456ARCEMU_INLINE float GetRadius(SpellRadius *radius)
1457{
1458        return radius->Radius;
1459}
1460ARCEMU_INLINE uint32 GetCastTime(SpellCastTime *time)
1461{
1462        return time->CastTime;
1463}
1464ARCEMU_INLINE float GetMaxRange(SpellRange *range)
1465{
1466        return range->maxRange;
1467}
1468ARCEMU_INLINE float GetMinRange(SpellRange *range)
1469{
1470        return range->minRange;
1471}
1472ARCEMU_INLINE uint32 GetDuration(SpellDuration *dur)
1473{
1474        return dur->Duration1;
1475}
1476
1477#define SAFE_DBC_CODE_RETURNS        /* undefine this to make out of range/nulls return null. */
1478
1479template<class T>
1480class SERVER_DECL DBCStorage
1481{
1482        T * m_heapBlock;
1483        T * m_firstEntry;
1484
1485        T ** m_entries;
1486        uint32 m_max;
1487        uint32 m_numrows;
1488        uint32 m_stringlength;
1489        char * m_stringData;
1490
1491        uint32 rows;
1492        uint32 cols;
1493        uint32 useless_shit;
1494        uint32 header;
1495
1496public:
1497
1498    class iterator{
1499    private:
1500        T *p;
1501    public:
1502        iterator(T* ip = 0) : p(ip){ }
1503        iterator& operator++(){ ++p; return *this; }
1504        bool operator!=(const iterator &i){ return (p != i.p); }
1505        T* operator*(){ return p; }
1506    };
1507
1508    iterator begin(){ 
1509        return iterator(&m_heapBlock[0]);
1510    }
1511    iterator end(){ 
1512        return iterator(&m_heapBlock[m_numrows]); 
1513    }
1514
1515        DBCStorage()
1516        {
1517                m_heapBlock = NULL;
1518                m_entries = NULL;
1519                m_firstEntry = NULL;
1520                m_max = 0;
1521                m_numrows = 0;
1522                m_stringlength= 0;
1523                m_stringData = NULL;
1524        }
1525
1526        ~DBCStorage()
1527        {
1528                Cleanup();
1529        }
1530
1531        void Cleanup()
1532        {
1533                if(m_heapBlock)
1534                {
1535                        free(m_heapBlock);
1536                        m_heapBlock = NULL;
1537                }
1538                if(m_entries)
1539                {
1540                        free(m_entries);
1541                        m_entries = NULL;
1542                }
1543                if( m_stringData != NULL )
1544                {
1545                        free(m_stringData);
1546                        m_stringData = NULL;
1547                }
1548        }
1549
1550        bool Load(const char * filename, const char * format, bool load_indexed, bool load_strings)
1551        {
1552                uint32 i;
1553                uint32 string_length;
1554                long pos;
1555
1556                FILE * f = fopen(filename, "rb");
1557                if(f == NULL)
1558                        return false;
1559
1560                /* read the number of rows, and allocate our block on the heap */
1561                fread(&header,4,1,f);
1562                fread(&rows, 4, 1, f);
1563                fread(&cols, 4, 1, f);
1564                fread(&useless_shit, 4, 1, f);
1565                fread(&string_length, 4, 1, f);
1566                pos = ftell(f);
1567
1568                if( load_strings )
1569                {
1570                        fseek( f, 20 + ( rows * cols * 4 ), SEEK_SET );
1571                        m_stringData = (char*)malloc(string_length);
1572                        m_stringlength = string_length;
1573                        if (m_stringData)
1574                                fread( m_stringData, string_length, 1, f );
1575                }
1576
1577                fseek(f, pos, SEEK_SET);
1578
1579                m_heapBlock = (T*)malloc(rows * sizeof(T));
1580                ASSERT(m_heapBlock);
1581
1582                /* read the data for each row */
1583                for(i = 0; i < rows; ++i)
1584                {
1585                        memset(&m_heapBlock[i], 0, sizeof(T));
1586                        ReadEntry(f, &m_heapBlock[i], format, cols, filename);
1587
1588                        if(load_indexed)
1589                        {
1590                                /* all the time the first field in the dbc is our unique entry */
1591                                if(*(uint32*)&m_heapBlock[i] > m_max)
1592                                        m_max = *(uint32*)&m_heapBlock[i];
1593                        }
1594                }
1595
1596                if(load_indexed)
1597                {
1598                        m_entries = (T**)malloc(sizeof(T*) * (m_max+1));
1599                        ASSERT(m_entries);
1600
1601                        memset(m_entries, 0, (sizeof(T*) * (m_max+1)));
1602                        for(i = 0; i < rows; ++i)
1603                        {
1604                                if(m_firstEntry == NULL)
1605                                        m_firstEntry = &m_heapBlock[i];
1606
1607                                m_entries[*(uint32*)&m_heapBlock[i]] = &m_heapBlock[i];
1608                        }
1609                }
1610
1611                m_numrows = rows;
1612
1613                fclose(f);
1614                return true;
1615        }
1616
1617        void ReadEntry(FILE * f, T * dest, const char * format, uint32 cols, const char * filename)
1618        {
1619                const char * t = format;
1620                uint32 * dest_ptr = (uint32*)dest;
1621                uint32 c = 0;
1622                uint32 val;
1623                size_t len = strlen(format);
1624                if(len!= cols)
1625                        printf("!!! possible invalid format in file %s (us: %u, them: %u)\n", filename, len, cols);
1626
1627                while(*t != 0)
1628                {
1629                        if((++c) > cols)
1630                        {
1631                                ++t;
1632                                printf("!!! Read buffer overflow in DBC reading of file %s\n", filename);
1633                                continue;
1634                        }
1635
1636                        fread(&val, 4, 1, f);
1637                        if(*t == 'x')
1638                        {
1639                                ++t;
1640                                continue;               // skip!
1641                        }
1642
1643                        if(( *t == 's' ) || ( *t=='l' ))
1644                        {
1645                                char ** new_ptr = (char**)dest_ptr;
1646                                static const char * null_str = "";
1647                                char * ptr;
1648                                // if t == 'lxxxxxxxxxxxxxxxx' use localized strings in case
1649                                // the english one is empty. *t ends at most on the locale flag
1650                                for(int count = (*t == 'l') ? 16 : 0 ;
1651                                        val == 0 && count > 0 && *(t+1) == 'x'; t++, count--)
1652                                {
1653                                        fread(&val, 4, 1, f);
1654
1655                                }
1656                                if( val < m_stringlength )
1657                                        ptr = m_stringData + val;
1658                                else
1659                                        ptr = (char*)null_str;
1660
1661                                *new_ptr = ptr;
1662                                new_ptr++;
1663                                dest_ptr = (uint32*)new_ptr;
1664                        }
1665                        else
1666                        {
1667                                *dest_ptr = val;
1668                                dest_ptr++;
1669                        }
1670
1671                        ++t;
1672                }
1673        }
1674
1675        ARCEMU_INLINE uint32 GetNumRows()
1676        {
1677                return m_numrows;
1678        }
1679
1680        T * LookupEntryForced(uint32 i)
1681        {
1682#if 0
1683                if(m_entries)
1684                {
1685                        if(i > m_max || m_entries[i] == NULL)
1686                        {
1687                                printf("LookupEntryForced failed for entry %u\n", i);
1688                                return NULL;
1689                        }
1690                        else
1691                                return m_entries[i];
1692                }
1693                else
1694                {
1695                        if(i >= m_numrows)
1696                                return NULL;
1697                        else
1698                                return &m_heapBlock[i];
1699                }
1700#else
1701                if(m_entries)
1702                {
1703                        if(i > m_max || m_entries[i] == NULL)
1704                                return NULL;
1705                        else
1706                                return m_entries[i];
1707                }
1708                else
1709                {
1710                        if(i >= m_numrows)
1711                                return NULL;
1712                        else
1713                                return &m_heapBlock[i];
1714                }
1715#endif
1716        }
1717
1718        T * LookupRowForced(uint32 i)
1719        {
1720                if(i >= m_numrows)
1721                        return NULL;
1722                else
1723                        return &m_heapBlock[i];
1724        }
1725
1726        T * CreateCopy(T * obj)
1727        {
1728                T * oCopy = (T*)malloc(sizeof(T));
1729                ASSERT(oCopy);
1730                memcpy(oCopy,obj,sizeof(T));
1731                return oCopy;
1732        }
1733        void SetRow(uint32 i, T * t)
1734        {
1735                if(i < m_max && m_entries)
1736                        m_entries[i] = t;
1737        }
1738
1739        T * LookupEntry(uint32 i)
1740        {
1741                if(m_entries)
1742                {
1743                        if(i > m_max || m_entries[i] == NULL)
1744                                return m_firstEntry;
1745                        else
1746                                return m_entries[i];
1747                }
1748                else
1749                {
1750                        if(i >= m_numrows)
1751                                return &m_heapBlock[0];
1752                        else
1753                                return &m_heapBlock[i];
1754                }
1755        }
1756
1757        T * LookupRow(uint32 i)
1758        {
1759                if(i >= m_numrows)
1760                        return &m_heapBlock[0];
1761                else
1762                        return &m_heapBlock[i];
1763        }
1764
1765};
1766
1767extern SERVER_DECL DBCStorage<WorldMapOverlay> dbcWorldMapOverlayStore;
1768#ifdef ENABLE_ACHIEVEMENTS
1769extern SERVER_DECL DBCStorage<AchievementEntry> dbcAchievementStore;
1770extern SERVER_DECL DBCStorage<AchievementCriteriaEntry> dbcAchievementCriteriaStore;
1771extern SERVER_DECL DBCStorage<AchievementCategoryEntry> dbcAchievementCategoryStore;
1772#endif
1773extern SERVER_DECL DBCStorage<BattlemasterListEntry> dbcBattlemasterListStore;
1774extern SERVER_DECL DBCStorage<CharTitlesEntry> dbcCharTitlesEntry;
1775extern SERVER_DECL DBCStorage<CurrencyTypesEntry> dbcCurrencyTypesStore;
1776extern SERVER_DECL DBCStorage<BarberShopStyleEntry> dbcBarberShopStyleStore;
1777extern SERVER_DECL DBCStorage<GemPropertyEntry> dbcGemProperty;
1778extern SERVER_DECL DBCStorage<GlyphPropertyEntry> dbcGlyphProperty;
1779extern SERVER_DECL DBCStorage<GlyphSlotEntry> dbcGlyphSlot;
1780extern SERVER_DECL DBCStorage<ItemSetEntry> dbcItemSet;
1781extern SERVER_DECL DBCStorage<Lock> dbcLock;
1782extern SERVER_DECL DBCStorage<SpellEntry> dbcSpell;
1783extern SERVER_DECL DBCStorage<SpellDuration> dbcSpellDuration;
1784extern SERVER_DECL DBCStorage<SpellRange> dbcSpellRange;
1785extern SERVER_DECL DBCStorage<SpellShapeshiftForm> dbcSpellShapeshiftForm;
1786extern SERVER_DECL DBCStorage<emoteentry> dbcEmoteEntry;
1787extern SERVER_DECL DBCStorage<SpellRadius> dbcSpellRadius;
1788extern SERVER_DECL DBCStorage<SpellCastTime> dbcSpellCastTime;
1789extern SERVER_DECL DBCStorage<AreaGroup> dbcAreaGroup;
1790extern SERVER_DECL DBCStorage<AreaTable> dbcArea;
1791extern SERVER_DECL DBCStorage<FactionTemplateDBC> dbcFactionTemplate;
1792extern SERVER_DECL DBCStorage<FactionDBC> dbcFaction;
1793extern SERVER_DECL DBCStorage<EnchantEntry> dbcEnchant;
1794extern SERVER_DECL DBCStorage<RandomProps> dbcRandomProps;
1795extern SERVER_DECL DBCStorage<skilllinespell> dbcSkillLineSpell;
1796extern SERVER_DECL DBCStorage<skilllineentry> dbcSkillLine;
1797extern SERVER_DECL DBCStorage<DBCTaxiNode> dbcTaxiNode;
1798extern SERVER_DECL DBCStorage<DBCTaxiPath> dbcTaxiPath;
1799extern SERVER_DECL DBCStorage<DBCTaxiPathNode> dbcTaxiPathNode;
1800extern SERVER_DECL DBCStorage<AuctionHouseDBC> dbcAuctionHouse;
1801extern SERVER_DECL DBCStorage<TalentEntry> dbcTalent;
1802extern SERVER_DECL DBCStorage<TalentTabEntry> dbcTalentTab;
1803extern SERVER_DECL DBCStorage<CreatureSpellDataEntry> dbcCreatureSpellData;
1804extern SERVER_DECL DBCStorage<CreatureFamilyEntry> dbcCreatureFamily;
1805extern SERVER_DECL DBCStorage<CharClassEntry> dbcCharClass;
1806extern SERVER_DECL DBCStorage<CharRaceEntry> dbcCharRace;
1807extern SERVER_DECL DBCStorage<MapEntry> dbcMap;
1808extern SERVER_DECL DBCStorage<SpellRuneCostEntry> dbcSpellRuneCost;
1809extern SERVER_DECL DBCStorage<ItemExtendedCostEntry> dbcItemExtendedCost;
1810extern SERVER_DECL DBCStorage<ItemRandomSuffixEntry> dbcItemRandomSuffix;
1811extern SERVER_DECL DBCStorage<CombatRatingDBC> dbcCombatRating;
1812extern SERVER_DECL DBCStorage<ChatChannelDBC> dbcChatChannels;
1813extern SERVER_DECL DBCStorage<DurabilityCostsEntry> dbcDurabilityCosts;
1814extern SERVER_DECL DBCStorage<DurabilityQualityEntry> dbcDurabilityQuality;
1815extern SERVER_DECL DBCStorage<BankSlotPrice> dbcBankSlotPrices;
1816extern SERVER_DECL DBCStorage<BankSlotPrice> dbcStableSlotPrices; //uses same structure as Bank
1817extern SERVER_DECL DBCStorage<gtFloat> dbcBarberShopPrices;
1818extern SERVER_DECL DBCStorage<gtFloat> dbcMeleeCrit;
1819extern SERVER_DECL DBCStorage<gtFloat> dbcMeleeCritBase;
1820extern SERVER_DECL DBCStorage<gtFloat> dbcSpellCrit;
1821extern SERVER_DECL DBCStorage<gtFloat> dbcSpellCritBase;
1822extern SERVER_DECL DBCStorage<gtFloat> dbcManaRegen;
1823extern SERVER_DECL DBCStorage<gtFloat> dbcManaRegenBase;
1824extern SERVER_DECL DBCStorage<gtFloat> dbcHPRegen;
1825extern SERVER_DECL DBCStorage<gtFloat> dbcHPRegenBase;
1826extern SERVER_DECL DBCStorage<AreaTriggerEntry> dbcAreaTrigger;
1827extern SERVER_DECL DBCStorage<ScalingStatDistributionEntry> dbcScalingStatDistribution;
1828extern SERVER_DECL DBCStorage<ScalingStatValuesEntry> dbcScalingStatValues;
1829extern SERVER_DECL DBCStorage<ItemLimitCategoryEntry> dbcItemLimitCategory;
1830
1831bool LoadDBCs();
1832
1833#endif
Note: See TracBrowser for help on using the browser.