Not signed in (Sign In)

Welcome, Guest

Want to take part in these discussions? If you have an account, sign in now.

If you don't have an account, apply for one now.

Vanilla 1.1.4 is a product of Lussumo. More Information: Documentation, Community Support.

    • CommentAuthorgeoffb
    • CommentTimeJan 6th 2007
     
    Looks like there hasn't been much forum activity here lately, but I thought I'd make a post on the off chance that people are still lurking around... :)

    Long story short, I'm writing a DBC file parser. As it stands now I'm manually telling the parser which fields are strings and which are integers in a given DBC file. Basically, I create a template per DBC file which specifies the data type of each field. If it's a string, the parser knows to look in the string buffer using the offset stored in the field.

    However, creating a template for each DBC manually is a pain in the ass. :D

    Is there a better way to know that a given field in a DBC file is actually an offset in the string buffer vs an integer??

    Thanks in advance.
    •  
      CommentAuthorzeeg
    • CommentTimeJan 7th 2007
     
    There's a dbc2csv application on http://www.sourcepeek.com/ftp/ that does it, I'm not sure how, I'll see if I can get the guy to hop over here and explain.
    • CommentAuthorgeoffb
    • CommentTimeJan 7th 2007
     
    That would be awesome, Zeeg. :)
    • CommentAuthorMaggi
    • CommentTimeJan 11th 2007
     
    hm, maybe it works this way:

    read the whole dbc file with all fields as integer type

    read the stringblock

    look if the values of a column in all rows point to a index/offset in the stringblock

    if thats true you can asume this is a string column

    but then you may have still problems to examine wether a column is integer or float type
    • CommentAuthorgeoffb
    • CommentTimeJan 16th 2007
     
    Thanks for the suggestion Maggi. I implemented it and it seems to work very well so far.

    I guess I'll tackle the float problem when I run into it. So far, I've been safe assuming that they're all integers.
    • CommentAuthorMaggi
    • CommentTimeJan 17th 2007
     
    floats you have in Spell.dbc and some related dbcs
    another problem I see: there are some empty columns only containing zeros in some dbcs and the stringblock has always an empty string at offset 0, so it will be interpreted as string column, what might be wrong when this column is filled with data later

    all in all this auto detect method is good to just explore the dbcs, but later if you want to work with this data I would suppose to use mapping files!

    PS: if you show your dbc in a kind of listview or table (don't know if you use WinApp or Web) you may build some kind of context menu where you can change the datatype of a column between Integer and Float or String...
    •  
      CommentAuthorzeeg
    • CommentTimeJan 17th 2007
     
    You can check the value of the # to see if its a float, basically you can do like if int(num) == float(num) you're ok, depending on the language of course
    • CommentAuthorMaggi
    • CommentTimeJan 17th 2007
     
    oh, I didn't know that, but if it works fantastic :)
    • CommentAuthorgeoffb
    • CommentTimeJan 18th 2007 edited
     
    Posted By: Maggianother problem I see: there are some empty columns only containing zeros in some dbcs and the stringblock has always an empty string at offset 0, so it will be interpreted as string column, what might be wrong when this column is filled with data later


    I got around that pretty easily. I simply read the string block buffer into an array starting with the 2 character since the first is always null. Then if my code looks for an array member index of 0 it won't exist and therefore not be treated as a string.

    For the curious, I'm writing all of this in PHP. It's for a website I'm developing which is similar to Thottbot or Allakhazam. (Online item, spell, quest, etc database)

    If you're interested you can check out the very, very, very alpha version at: http://wowmonkey.net
    • CommentAuthorMaggi
    • CommentTimeJan 19th 2007
     
    hm, sorry if I missunderstood you, but there are some string columns where some indexs are 0, because it's an empty string, for example in Faction.dbc the description column

    then this column is not recognized as a string column, or is it?
    • CommentAuthorgeoffb
    • CommentTimeJan 19th 2007
     
    Posted By: Maggihm, sorry if I missunderstood you, but there are some string columns where some indexs are 0, because it's an empty string, for example in Faction.dbc the description column

    then this column is not recognized as a string column, or is it?


    Yeah, I guess I misunderstood what you were getting at there. That definitely sounds like a problem, though.

    Maybe I need to set a threshold for the number of rows that must have a valid string block entry in a given column before it's considered a string column. That still seems pretty hacky though. Plus, if there was every a column which was a string yet they were all blank, it would throw that off too. (Or if there happened to be a very small number of strings thus under the threshold)

    Blah.

    Anyway, there has to be a way to parse this data without using mapping files. I can't imagine that Blizzard would do things that way...
    • CommentAuthorMaggi
    • CommentTimeJan 19th 2007
     
    maybe at blizz it's some kind of hardcoded, they know which column contains which data and the datatype (string, float,integer...).

    you may do it the following way:

    if all values of a column that are not 0 point into string block, then this has to be a string column

    and when a row contains only 0 you can handle it as integer
    • CommentAuthormrbean429
    • CommentTimeJan 20th 2007 edited
     
    Sorry I'm coming in late.. I haven't found the spell.dbc file so I can extract the data. I pulled up WinMQ and still couldn't find the spell.dbc.

    If somebody wouldn't mind letting me in on this little secret.

    Thanks

    A noob us
    • CommentAuthorguur3k
    • CommentTimeJan 20th 2007
     
    Posted By: mrbean429 If somebody wouldn't mind letting me in on this little secret.


    The most up-to-date Spell.dbc is found in the patch-enUS-2.MPQ for us in the Western hemisphere.
    • CommentAuthormrbean429
    • CommentTimeJan 20th 2007
     
    Thank You guur3k!
    • CommentAuthormrbean429
    • CommentTimeJan 20th 2007 edited
     
    geoffb,

    If you wouldn't mind posting your PHP.. I have had a bugger of a time with what you did.

    Thanks

    Joshua
    • CommentAuthorgeoffb
    • CommentTimeJan 20th 2007
     
    Posted By: mrbean429geoffb,

    If you wouldn't mind posting your PHP.. I have had a bugger of a time with what you did.

    Thanks

    Joshua


    Sure, I can post my PHP classes. I was thinking of adding them to the wiki at some point anyway.

    I need to do a bit of cleanup on them first, but I should have them up in the next couple days.