Jump to content
  • We are looking for staff for the Wiki area!
    If interested please
    click here and select "Documentation Team"

  • DBC File Structure


    antz

    Introduction

    A client database or DBC file is a simple binary format for a database table.

    Each record in the file is one row of the table. Field values may consist of a limited range of data types, and do not include field separation characters
    - except for character-based string fields.

    DBC files nearly always use file extension DBC (or dbc) and DB2 (or db2) and have been named DataBaseClient files ever since their discovery in the DataBaseClient folder in the client files. The true extension meaning has not yet been revealed by Blizzard.

    Technical details

    Each file consists of a header, the table data, and if necessary a string block.

    Header

    00h: char[4] Signature always 'WDBC'
    04h: int32 Records number of records in the file
    08h: int32 Fields number of fields per record
    0Ch: int32 Record Size Fields*FieldSize (FieldSize is usually 4, but not always)
    10h: int32 String Block Size Size of the string block

    Table Data

    Each record has a constant length. Usually all the values are 32bit integers. String data is stored in a block after the records. String data in records contain an offset to the string, relative to the start of the string block.

    When encountering string data, it usually consists of an English name field, followed by 7 additional fields for different localizations.

    String Block

    A continuous block of zero-terminated strings. Offsets into the String Block are relative to the start of the block.

    A more detailed breakdown follows:

    DBC file layout

    The DBC file layout is fairly simple, below is a hex display of the file AuctionHouse.dbc
      Col Col Col Col Col Col Col Col Col Col Col Col Col Col Col Col Col Col Col Col Col Col Col Col  
    File Offset 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 14 15 16 17 ASCII DISPLAY

    00000000 57 44 42 43 07 00 00 00 0d 00 00 00 34 00 00 00 aa 00 00 00 01 00 00 00 WDBC........4...a.......
    00000018 01 00 00 00 05 00 00 00 05 00 00 00 01 00 00 00 00 00 00 00 00 00 00 00 ........................
    00000030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 7e 00 3f 00 ....................~.?.
    00000048 02 00 00 00 03 00 00 00 05 00 00 00 05 00 00 00 19 00 00 00 00 00 00 00 ........................
    00000060 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ........................
    00000078 7e 00 3f 00 03 00 00 00 04 00 00 00 05 00 00 00 05 00 00 00 30 00 00 00 ~.?.................O...
    00000090 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ........................
    000000a8 00 00 00 00 7e 00 3f 00 04 00 00 00 05 00 00 00 05 00 00 00 05 00 00 00 ....~.?.................
    000000c0 48 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 H.......................
    000000d8 00 00 00 00 00 00 00 00 7e 00 3f 00 05 00 00 00 06 00 00 00 05 00 00 00 ........~.?.............
    000000f0 05 00 00 00 60 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ....'...................
    00000108 00 00 00 00 00 00 00 00 00 00 00 00 7e 00 3f 00 06 00 00 00 02 00 00 00 ............~.?.........
    00000120 05 00 00 00 05 00 00 00 7d 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ........}...............
    00000138 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 7e 00 3f 00 07 00 00 00 ................~.?.....
    00000150 71 01 00 00 19 00 00 00 0f 00 00 00 91 00 00 00 00 00 00 00 00 00 00 00 q...........'...........
    00000168 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 7e 00 3f 00 ......./............~/?.
    00000180 00 53 74 6f 72 6d 77 69 6e 64 20 41 75 63 74 69 6f 6e 20 48 6f 75 73 65 .Stormwind Auction House
    00000198 00 41 6c 6c 69 61 6e 63 65 20 41 75 63 74 69 6f 6e 20 48 6f 75 73 65 00 .Alliance Auction House.
    000001b0 44 61 72 6e 61 73 73 75 73 20 41 75 63 74 69 6f 6e 20 48 6f 75 73 65 00 Darnassus Auction House.
    000001c8 55 6e 64 65 72 63 69 74 79 20 41 75 63 74 69 6f 6e 20 48 6f 75 73 65 00 Undercity Auction House.
    000001e0 54 68 75 6e 64 65 72 20 42 6c 75 66 66 20 20 41 75 63 74 69 6f 6e 20 48 Thunder Bluff Auction H
    000001f8 6f 75 73 65 00 48 6f 72 64 65 20 41 75 63 74 69 6f 6e 20 48 6f 75 73 65 ouse.Horde Auction House
    00000210 00 42 6c 61 63 6b 77 61 74 65 72 20 41 75 63 74 69 6f 6e 20 48 6f 75 73 .Blackwater Auction Hous
    00000228 65 00   e.
    Header Block

    The first section is the header block which is 20 bytes long

      Col Col Col Col Col Col Col Col Col Col Col Col Col Col Col Col Col Col Col Col Col Col Col Col  
    File Offset 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 14 15 16 17 ASCII DISPLAY

    00000000 57 44 42 43 07 00 00 00 0d 00 00 00 34 00 00 00 aa 00 00 00   WDBC........4...a...


    57 44 42 43 is the filetype is text. Normally "WDBC" or "WDB2"

    07 00 00 00 is the number of rows, the byte order is reversed, so this would be 00 00 00 07 = 7 Rows of data.

    0d 00 00 00 is the number of fields, again byte order reversed, so 00 00 00 0d = 13 rows of data

    34 00 00 00 is the length of the row 00 00 00 34 = 52 bytes long

    aa 00 00 00 is the length of the string block

    The start of the string block can be calculated one of two ways:

    • The length of the file - the size of the string block
    • The length of the header + (number of rows * length of the row)

    Using the latter approach, we can calculate the start of the string block as follows:

    The length of the header + (number of rows * length of the row) i.e. 20 + (7 * 52) = 384 (or 180 in hex).

    This gives us the start offset for the string block 00000180h

    Data Block

    The Second section is the data block, from the values obtained above from the header we know there are 7 records and 13 fields. Each field is typically 4 bytes long.

    Here is the first record:

      Col Col Col Col Col Col Col Col Col Col Col Col Col Col Col Col Col Col Col Col Col Col Col Col  
    File Offset 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 14 15 16 17 ASCII DISPLAY

    00000000   01 00 00 00                     ....
    00000018 01 00 00 00 05 00 00 00 05 00 00 00 01 00 00 00 00 00 00 00 00 00 00 00 ........................
    00000030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 7e 00 3f 00 ....................~.?.


    All the byte groups are in reverse order as before

    01 00 00 00 is 00 00 00 01 = 1,

    01 00 00 00 is 00 00 00 01 = 1,

    05 00 00 00 is 00 00 00 05 = 5,

    05 00 00 00 is 00 00 00 05 = 5,

    01 00 00 00 is 00 00 00 01 = 1, is the string offset for the text

    00 00 00 00 is 00 00 00 00 = 0, same for localised languages

    00 00 00 00 is 00 00 00 00 = 0, same for localised languages

    00 00 00 00 is 00 00 00 00 = 0, same for localised languages

    00 00 00 00 is 00 00 00 00 = 0, same for localised languages

    00 00 00 00 is 00 00 00 00 = 0, same for localised languages

    00 00 00 00 is 00 00 00 00 = 0, same for localised languages

    00 00 00 00 is 00 00 00 00 = 0, same for localised languages

    7e 00 3f 00 is 00 3f 00 7e = 4128894

    If you check out the Wiki page for AuctionHouse.dbc you will see that we have the fields:

    AuctionHouse ID = 1
    Faction ID =1
    Auction Fee = 5
    Deposit Tax = 5
    Name = 1
    Name1 = 0
    Name2 = 0
    Name3 = 0
    Name4 = 0
    Name5 = 0
    Name6 = 0
    Name7 = 0
    Text Checksum = 4128894

     

    String Block

    The string block is a chunk of text strings, separated by nulls.

    Now previously we had calculated the start offset for the string block as 00000180h

      Col Col Col Col Col Col Col Col Col Col Col Col Col Col Col Col Col Col Col Col Col Col Col Col  
    File Offset   01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 14 15 16 17 ASCII DISPLAY

    00000180 00 53 74 6f 72 6d 77 69 6e 64 20 41 75 63 74 69 6f 6e 20 48 6f 75 73 65  Stormwind Auction House
    00000198 00 41 6c 6c 69 61 6e 63 65 20 41 75 63 74 69 6f 6e 20 48 6f 75 73 65 00 .Alliance Auction House.
    000001b0 44 61 72 6e 61 73 73 75 73 20 41 75 63 74 69 6f 6e 20 48 6f 75 73 65 00 Darnassus Auction House.
    000001c8 55 6e 64 65 72 63 69 74 79 20 41 75 63 74 69 6f 6e 20 48 6f 75 73 65 00 Undercity Auction House.
    000001e0 54 68 75 6e 64 65 72 20 42 6c 75 66 66 20 20 41 75 63 74 69 6f 6e 20 48 Thunder Bluff Auction H
    000001f8 6f 75 73 65 00 48 6f 72 64 65 20 41 75 63 74 69 6f 6e 20 48 6f 75 73 65 ouse.Horde Auction House
    00000210 00 42 6c 61 63 6b 77 61 74 65 72 20 41 75 63 74 69 6f 6e 20 48 6f 75 73 .Blackwater Auction Hous
    00000228 65 00   e.


    As we saw above, the Value for Name was 1, add this is the base gives 181h, then read all characters until a null. This is the start character of "Stormwind Auction House" (there is a null after "House").

    Looking at all the records, the string offsets are:

    01h = 1 - "Stormwind Auction House"
    19h = 25 - "Alliance Auction House"
    30h = 48 - "Darnassus Auction House"
    48h = 72 - "Undercity Auction House"
    60h = 96 - "Thunder Bluff Auction House"
    7dh = 125 - "Horde Auction House"
    91h = 145 - "Blackwater Auction House"

    Edited by antz


    User Feedback

    Recommended Comments

    There are no comments to display.



    Create an account or sign in to comment

    You need to be a member in order to leave a comment

    Create an account

    Sign up for a new account in our community. It's easy!

    Register a new account

    Sign in

    Already have an account? Sign in here.

    Sign In Now

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. Privacy Policy Terms of Use