DBC: Difference between revisions

From wowdev
Jump to navigation Jump to search
No edit summary
 
(14 intermediate revisions by 2 users not shown)
Line 1: Line 1:
The DBC (DataBaseClient) files are clientside databases containing data about Items, NPC's, Enviroment, World etc.
DBC (DataBaseClient) files are clientside databases containing data about items, NPCs, environment, world and a lot more.


=Header=
=Table content structures=
This page describes the structure of DBC files. For a list of existing DBC files and their contents see the categories [[:Category:DBC|DBC]], [[:Category:DBC_Vanilla|Vanilla]], [[:Category:DBC_BC|Burning Crusade]], [[:Category:DBC_WotLK|Wrath of the Lich King]], [[:Category:DBC_Cataclysm|Cataclysm]] and [[:Category:DBC_MoP|Mists of Pandaria]]. If you add documentation for a file, please add the correct categories (also the build number) as well.


  '''Column Field Type Notes'''
=Structure=
  --------------------------------------------------------------------------------------------------------
  struct dbc_header
1 Signature String (4-bytes) string, always 'WDBC'  
  {
2 Records Integer (4-bytes) number of records in the file
  uint32_t magic; // always 'WDBC'
  3 Fields Integer (4-bytes) number of fields per record
  uint32_t record_count; // records per file
  4 Record Size Integer (4-bytes) Fields*FieldSize (FieldSize is usually 4, but not always)  
  uint32_t field_count; // fields per record
  5 String Block Size Integer Size of the string block
  uint32_t record_size; // sum (sizeof (field_type_i)) | 0 <= i < field_count. field_type_i is NOT defined in the files.
  uint32_t string_block_size;
};
template<typename record_type>
  struct dbc_file
  {
  dbc_header header;
  // static_assert (header.record_size == sizeof (record_type));
  record_type records[header.record_count];
  char string_block[header.string_block_size];
  };


=String Block=  
==String Block==
DBC records can contain strings. Strings are not stored in record but in an additional string block. A record contains an offset into that block. Strings are zero terminated (c strings) and might be zero length. A zero length string then only contains one byte being zero.


Unlike the cache files, string data is stored in a block after the records. String data in records contain an offset to the string, starting from the string block. For example: If the address of the string block was 500, and the string value was 50, the address of the string would be at 550. The string block starts with a null character, and all strings are null-terminated.
Thus, if
using {{Template:Type|stringref}} = uint32_t;
struct example_record
{
  uint32_t id;
  {{Template:Type|stringref}} name;
};
printing the id and name of record i can be done by
// dbc_file<example_record> file;
printf ("record %u: %u, %s\n", file.records[i].id, file.string_block[file.records[i].name]);
or when going by offsets only:
// const char* file;
uint32_t record_count = *(uint32_t*) (file + 1 * sizeof (uint32_t));
uint32_t record_size = *(uint32_t*) (file + 3 * sizeof (uint32_t));
const char* records = file + 5 * sizeof (uint32_t) /* header */;
const char* string_block = records + record_size * record_count;
printf ("record %u: %u, %s\n", *(uint32_t*)(records + i * record_size /* id */), string_block + *(uint32_t*)(records + i * record_size + sizeof (uint32_t) /* name */));


=Notes=
=Localization=
DBC records can contain localized strings. Localized strings are a set of one string block offset per locale plus a bitmask up to Cataclysm. Beginning with Cataclysm, there only is one field containing only one string offset, thus disallowing providing multiple locales in one file.


When encountering a string field in a dbc file, it usually consists of an english name field as well as 7 additional fields for different localizations. Following the 8 String* fields is a bitmask field. I'm not exactly sure what the bitmask field is used for yet, see Localization.  
The number and order of locale fields can be found at [[Localization]]. The record description might either mark a number of columns per localized field (e.g. 1-16) or treat all the fields as one column.
'''Locale Field offset Notes'''
---------------------------------------
enXX 0 GB and US
krKR 1 Korean
frFR 2 French
deDE 3 German
zhCN 4 Chinese
zhTW 5 Taiwanese
???? 6 Unknown
???? 7 Unknown


2.1.1 changes the additional fields to 15.
[[Category:Format]]
 
=List of DBC Files=
 
===A===
:[[AnimationData.dbc]]
:[[AreaPOI.dbc]]
:[[AreaTable.dbc]]
:[[AreaTrigger.dbc]]
:[[AttackAnimKits.dbc]]
:[[AttackAnimTypes.dbc]]
:[[AuctionHouse.dbc]]
===B===
:[[BankBagSlotPrices.dbc]]
:[[BattlemasterList.dbc]]
===C===
:[[CameraShakes.dbc]]
:[[Cfg_Categories.dbc]]
:[[Cfg_Configs.dbc]]
:[[CharacterCreateCameras.dbc]] - removed
:[[CharacterFacialHairStyles.dbc]]
:[[CharBaseInfo.dbc]]
:[[CharHairGeosets.dbc]]
:[[CharHairTextures.dbc]]
:[[CharSections.dbc]]
:[[CharStartOutfit.dbc]]
:[[CharTitles.dbc]]
:[[CharVariations.dbc]]
:[[ChatChannels.dbc]]
:[[ChatProfanity.dbc]]
:[[ChrClasses.dbc]]
:[[ChrRaces.dbc]]
:[[CinematicCamera.dbc]]
:[[CinematicSequences.dbc]]
:[[CreatureDisplayInfo.dbc]]
:[[CreatureDisplayInfoExtra.dbc]]
:[[CreatureFamily.dbc]]
:[[CreatureModelData.dbc]]
:[[CreatureSoundData.dbc]]
:[[CreatureSpellData.dbc]]
:[[CreatureType.dbc]]
 
===D===
:[[DeathThudLookups.dbc]]
:[[DurabilityCosts.dbc]]
:[[DurabilityQuality.dbc]]
===E===
:[[Emotes.dbc]]
:[[EmotesText.dbc]]
:[[EmotesTextData.dbc]]
:[[EmotesTextSound.dbc]]
:[[EnvironmentalDamage.dbc]]
:[[Exhaustion.dbc]]
===F===
:[[Faction.dbc]]
:[[FactionGroup.dbc]]
:[[FactionTemplate.dbc]]
:[[FootprintTextures.dbc]]
:[[FootstepTerrainLookup.dbc]]
===G===
:[[GameObjectArtKit.dbc]]
:[[GameObjectDisplayInfo.dbc]]
:[[GameTables.dbc]]
:[[GameTips.dbc]]
:[[GemProperties.dbc]]
:[[GMSurveyCurrentSurvey.dbc]]
:[[GMSurveyQuestions.dbc]]
:[[GMSurveySurveys.dbc]]
:[[GMTicketCategory.dbc]]
:[[GroundEffectDoodad.dbc]]
:[[GroundEffectTexture.dbc]]
:[[GtChanceToMeleeCrit.dbc]]
:[[GtChanceToMeleeCritBase.dbc]]
:[[GtChanceToSpellCrit.dbc]]
:[[GtChanceToSpellCritBase.dbc]]
:[[GtCombatRatings.dbc]]
:[[GtOCTRegenHP.dbc]]
:[[GtOCTRegenMP.dbc]]
:[[GtRegenHPPerSpt.dbc]]
:[[GtRegenMPPerSpt.dbc]]
===H===
:[[HelmetGeosetVisData.dbc]]
===I===
:[[ItemBagFamily.dbc]]
:[[ItemClass.dbc]]
:[[ItemDisenchantLoot.dbc]]
:[[ItemDisplayInfo.dbc]]
:[[ItemExtendedCost.dbc]]
:[[ItemGroupSounds.dbc]]
:[[ItemPetFood.dbc]]
:[[ItemRandomProperties.dbc]]
:[[ItemRandomSuffix.dbc]]
:[[ItemSet.dbc]]
:[[ItemSubClass.dbc]]
:[[ItemSubClassMask.dbc]]
:[[ItemVisualEffects.dbc]]
:[[ItemVisuals.dbc]]
===L===
:[[Languages.dbc]]
:[[LanguageWords.dbc]]
:[[LFGDungeons.dbc]]
:[[Light.dbc]]
:[[LightFloatBand.dbc]]
:[[LightIntBand.dbc]] - cant restore this one :|
:[[LightParams.dbc]]
:[[LightSkybox.dbc]]
:[[LiquidType.dbc]]
:[[LoadingScreenTaxiSplines.dbc]]
:[[LoadingScreens.dbc]]
:[[Lock.dbc]]
:[[LockType.dbc]]
 
===M===
:[[MailTemplate.dbc]]
:[[Map.dbc]]
:[[Material.dbc]]
===N===
:[[NPCSounds.dbc]]
:[[NameGen.dbc]]
:[[NamesProfanity.dbc]]
:[[NamesReserved.dbc]]
===P===
:[[Package.dbc]]
:[[PageTextMaterial.dbc]]
:[[PaperDollItemFrame.dbc]]
:[[PetitionType.dbc]]
:[[PetLoyalty.dbc]]
:[[PetPersonality.dbc]]
===Q===
:[[QuestInfo.dbc]]
:[[QuestSort.dbc]]
===R===
:[[RandPropPoints.dbc]]
:[[Resistances.dbc]]
===S===
:[[ServerMessages.dbc]]
:[[SheatheSoundLookups.dbc]]
:[[SkillCostsData.dbc]]
:[[SkillLine.dbc]]
:[[SkillLineAbility.dbc]]
:[[SkillLineCategory.dbc]]
:[[SkillRaceClassInfo.dbc]]
:[[SkillTiers.dbc s cont.]]
:[[SoundAmbience.dbc]]
:[[SoundCharacterMacroLines.dbc]]
:[[SoundEntries.dbc]]
:[[SoundProviderPreferences.dbc]]
:[[SoundSamplePreferences.dbc]]
:[[SoundWaterType.dbc]]
:[[SpamMessages.dbc]]
:[[Spell.dbc]]
:[[SpellAuraNames.dbc]]
:[[SpellCastTimes.dbc]]
:[[SpellCategory.dbc]]
:[[SpellChainEffects.dbc]]
:[[SpellDispelType.dbc]]
:[[SpellDuration.dbc]]
:[[SpellEffectCameraShakes.dbc]]
:[[SpellEffectNames.dbc]]
:[[SpellFocusObject.dbc]]
:[[SpellIcon.dbc]]
:[[SpellItemEnchantment.dbc]]
:[[SpellItemEnchantmentCondition.dbc]]
:[[SpellMechanic.dbc]]
:[[SpellMissileMotion.dbc]]
:[[SpellRadius.dbc]]
:[[SpellRange.dbc]]
:[[SpellShapeshiftForm.dbc]]
:[[SpellVisual.dbc]]
:[[SpellVisualEffectName.dbc]]
:[[SpellVisualKit.dbc]]
:[[SpellVisualPrecastTransitions.dbc]]
:[[StableSlotPrices.dbc]]
:[[Startup Strings.dbc]]
:[[Stationery.dbc]]
:[[StringLookups.dbc]]
===T===
:[[Talent.dbc]]
:[[TalentTab.dbc]]
:[[TaxiNodes.dbc]]
:[[TaxiPath.dbc]]
:[[TaxiPathNode.dbc]]
:[[TerrainType.dbc]]
:[[TerrainTypeSounds.dbc]]
:[[TotemCategory.dbc]]
:[[TransportAnimation.dbc]]
===U===
:[[UISoundLookups.dbc]]
:[[UnitBlood.dbc]]
:[[UnitBloodLevels.dbc]]
===V===
:[[VideoHardware.dbc]]
:[[VocalUISounds.dbc]]
===W===
:[[WeaponImpactSounds.dbc]]
:[[WeaponSwingSounds2.dbc]]
:[[WMOAreaTable.dbc]]
:[[WorldMapArea.dbc]]
:[[WorldMapContinent.dbc]]
:[[WorldMapOverlay.dbc]]
:[[WorldMapTransforms.dbc]]
:[[WorldSafeLocs.dbc]]
:[[WorldStateUI.dbc]]
:[[WowError Strings.dbc]]
===Z===
:[[ZoneIntroMusicTable.dbc]]
:[[ZoneMusic.dbc]]

Latest revision as of 11:59, 23 February 2016

DBC (DataBaseClient) files are clientside databases containing data about items, NPCs, environment, world and a lot more.

Table content structures

This page describes the structure of DBC files. For a list of existing DBC files and their contents see the categories DBC, Vanilla, Burning Crusade, Wrath of the Lich King, Cataclysm and Mists of Pandaria. If you add documentation for a file, please add the correct categories (also the build number) as well.

Structure

struct dbc_header
{
  uint32_t magic; // always 'WDBC'
  uint32_t record_count; // records per file
  uint32_t field_count; // fields per record
  uint32_t record_size; // sum (sizeof (field_type_i)) | 0 <= i < field_count. field_type_i is NOT defined in the files.
  uint32_t string_block_size;
};

template<typename record_type>
struct dbc_file
{
  dbc_header header;
  // static_assert (header.record_size == sizeof (record_type));
  record_type records[header.record_count];
  char string_block[header.string_block_size];
};

String Block

DBC records can contain strings. Strings are not stored in record but in an additional string block. A record contains an offset into that block. Strings are zero terminated (c strings) and might be zero length. A zero length string then only contains one byte being zero.

Thus, if

using stringref = uint32_t;
struct example_record
{
  uint32_t id;
  stringref name;
};

printing the id and name of record i can be done by

// dbc_file<example_record> file;
printf ("record %u: %u, %s\n", file.records[i].id, file.string_block[file.records[i].name]);

or when going by offsets only:

// const char* file;
uint32_t record_count = *(uint32_t*) (file + 1 * sizeof (uint32_t));
uint32_t record_size = *(uint32_t*) (file + 3 * sizeof (uint32_t));
const char* records = file + 5 * sizeof (uint32_t) /* header */;
const char* string_block = records + record_size * record_count;
printf ("record %u: %u, %s\n", *(uint32_t*)(records + i * record_size /* id */), string_block + *(uint32_t*)(records + i * record_size + sizeof (uint32_t) /* name */));

Localization

DBC records can contain localized strings. Localized strings are a set of one string block offset per locale plus a bitmask up to Cataclysm. Beginning with Cataclysm, there only is one field containing only one string offset, thus disallowing providing multiple locales in one file.

The number and order of locale fields can be found at Localization. The record description might either mark a number of columns per localized field (e.g. 1-16) or treat all the fields as one column.