This is a read only copy without any forum functionality of the old Modcraft forum.
If there is anything that you would like to have removed, message me on Discord via Kaev#5208.
Big thanks to Alastor for making this copy!

Menu

Author Topic: [TOOL] WDBX Editor  (Read 15487 times)

barncastle

  • Registred Member
  • GM Isle Explorer
  • *****
  • Posts: 21
    • View Profile
[TOOL] WDBX Editor
« on: August 14, 2016, 07:24:03 pm »
A project I started initially to learn how DBC files worked that eventually turned into this and thought it was worth a share.

This editor has full support for reading and saving all release versions of DBC, DB2, WDB and ADB. This does include support for both Legion DB2 and ADB files and works with all variants (header flags) of these.

Like the other editors I've used a definition based system whereby definitions tell the editor how to interpret each file's columns - this is a lot more reliable than guessing column types but does mean the definitions must be maintained. So far, I've mapped almost all expansions with MoP being ~50% complete, WoD being ~95% complete and everything else being 99%+ (excluding column names).

Link to the source can be found here.

Features:
  • Full support of release versions of DBC, DB2, WDB and ADB (WCH3 and WCH4 are not supported as I deem them depreciated)
  • Opening and having open multiple files regardless of type and build
  • Open DBC/DB2 files from both MPQ archives and CASC directories
  • Save single (to file) and save all (to folder)
  • Standard CRUD operations as well as go to, copy row, paste row, undo and redo
  • Hide, show and sort columns
  • A relatively powerful column filter system (similar to boolean search)
  • Displaying and editing columns in hex (numeric columns only)
  • Exporting to a SQL database, SQL file, CSV file and MPQ archives
  • Importing from a SQL database and a CSV file
  • An Excel style Find and Replace
  • Shortcuts for common tasks using common shortcut key combinations
  • A help file to try and cover off some of the pitfalls and caveats of the program (needs some work)

Tools:
  • Definition editor for maintaining the definitions
  • WotLK Item Import to remove the dreaded red question mark from custom items
  • WDB5 Parser which is an attempt to automatically parse the structure of WDB5 files

Things to Note:
  • You need .Net 4.6.1 installed (download)
  • Importing gives you the option to import; new rows, changed and new rows and to override all data
  • Exporting to MPQ allows you to append to an existing archive or to create a new one
  • Currently any SQL import must have identical columns to the file's definition
  • Legion ADB files MUST have the DB2 counterpart open before as required information is stored in the DB2 file. The program will prioritise DB2 if DB2 and ADB are opened at the same time
  • The WDB5 Parser works surprisingly well thanks to the new field structure data however it does trip up on inline strings so definitions may need to be validated manually
  • Undo, redo and copy data history are lost when changing the current file
  • Everything is stored in memory so if your PC is ancient the program will crash attempting to read hundreds of files at once!

Credits go to Ladislav Zezula for the awesome StormLib and thanks to all those that contribute to the WoWDev wiki. I've also patched the definitions together for various sources across the internet, there are too many to name, but thanks to all.

Change Log:

V 1.0.1
The following things have been changed/added:

  • Added a FileSystemWatcher so that definitions are reloaded as soon as any definition file is saved meaning the application no longer needs to be restarted
  • The program now functions correctly if set as the default program for files (thanks to Skarn for this suggestion)
  • Find and Replace now uses a lookup table so is much faster
  • Specific errors have been refined and made more human
  • The program now no longer stops importing if a string is not found in the string table and instead writes "String not found" in the cell's value. This is an attempt to combat some incorrectly modified DB2 files I've come across
  • Definitions have been updated for WoD 6.2.4 which is at ~98% now
  • A fair amount of optimisation and tinkering

After some advice from Marlamin, Schlumpf and Amaroth I'm going to put the source on git in the coming week so that others can contribute and make this program better!

V 1.0.2

The following things have been changed/added:

  • WCH7 (the new Legion ADB format) is now supported for both reading and writing
  • A range of bugs and issues have been resolved
  • Have added some options to the CSV import to fix erroneous source data:
    • Option 1 (default): Increment Ids so none are duplicated
    • Option 2: Take the newest record of the duplicated Ids
  • The DataGridView has been overhauled meaning it is slightly faster, more memory efficient and now has a cache and state system implemented
  • Undo/Redo has been rebuilt and now triggers on all events properly
    • Note: Undo/Redo history is still lost on changing file
    • Deleting 25+ rows at once is a permanent action (cannot be undone), due to BindingSource + DataGridView performance limitations, and are prompted to complete this action
  • New rows now have default values based on their value type and value types are now enforced
  • Added a new option to the column filter to hide all empty columns (the eye button)
  • Added a clear row right click option which sets the row to default values
  • Added the ability to insert a row with a specific Id provided it doesn't exist (Edit Menu/Ctrl + I)
  • Added a new line shortcut to avoid having to scroll to the bottom of the grid (Edit Menu/Ctrl + N)
  • Have updated the Legion definitions after some issues with WCH7 structures

A big thanks to UncleChristiof and Skarn for ideas, bugs and usability issues!

V 1.0.3

The following things have been changed/added:

The following things have been changed/added:
  • WCH8 (the new Legion ADB format) is now supported for both reading and writing
  • Save As (F12) has been added meaning Save doesn't prompt for file location
  • SQL exprt now works with all "sql_mode"s
  • SQL import now automatically fixes NULL values
  • Datagrid context menu has been added to all cells as well row headers
  • Supports opening multiple selected files at once
  • Supports drag and drop files to open (based on Windows permissions)
  • Added JSON as an export type
  • Added version check based on Github releases

The application now runs as a single instance when launched in GUI mode. This means any files opened thereafter are sent to the running instance instead of opening the application multiple times. In certain situations this is not ideal, so a button has been added to the Load Definition screen which will open a new instance of the application for all files waiting to be loaded.

A range of command line arguments have been added (this is still early stages). This is the beginning of providing an interface so tasks can be automated/invoked via batch scripts and external programs.
Commands currently include (see the help file for more information):
  • Console Mode which opens the software in a console session
  • Extract which will extract all DBC/DB2 files from a MPQ archive or CASC directory based on a filter string
  • Export which exports a specific file to CSV, JSON or SQL
  • SQL dump which dumps a file's data directly into a MySQL database table

Thanks to Luzifix for helping with development



X-Post to other site: http://www.model-changing.net/files/file/82-wdbx-editor/
« Last Edit: September 10, 2016, 02:13:42 pm by Admin »

Uthil

  • Registred Member
  • Model Change Addict
  • *****
  • Posts: 283
    • View Profile
Re: [TOOL] WDBX Editor
« Reply #1 on: August 14, 2016, 07:51:30 pm »
Great tool, going to test and see differences from the old classic MyDBC. Keep it up.
« Last Edit: January 01, 1970, 01:00:00 am by Admin »
Like my project and you like to support me, you can do it here!

Marlamin

  • Registred Member
  • GM Isle Explorer
  • *****
  • Posts: 23
    • View Profile
Re: [TOOL] WDBX Editor
« Reply #2 on: August 16, 2016, 12:34:15 pm »
I hope you consider open sourcing this. Too many amazing tools like this one have been abandoned and eventually lost to format changes.
« Last Edit: January 01, 1970, 01:00:00 am by Admin »

barncastle

  • Registred Member
  • GM Isle Explorer
  • *****
  • Posts: 21
    • View Profile
Re: [TOOL] WDBX Editor
« Reply #3 on: August 16, 2016, 08:10:27 pm »
Quote from: "Marlamin"
I hope you consider open sourcing this. Too many amazing tools like this one have been abandoned and eventually lost to format changes.

Thanks for the compliment! My long term goal is to release the source although this will be after I've finished tinkering and provided it turns out to be a worthwhile tool (haven't had much too much feedback yet) as it needs a bit of refactoring.

That being said; if you do use it and notice any issues, sticking points or missing features let me know!
« Last Edit: January 01, 1970, 01:00:00 am by Admin »

schlumpf

  • Administrator
  • Creator of Worlds
  • *****
  • Posts: 2967
    • View Profile
Re: [TOOL] WDBX Editor
« Reply #4 on: August 16, 2016, 08:22:05 pm »
Quote from: "barncastle"
Thanks for the compliment! My long term goal is to release the source although this will be after I've finished tinkering and provided it turns out to be a worthwhile tool (haven't had much too much feedback yet) as it needs a bit of refactoring.

Just on a side note: There rarely, if ever, was anything coming out of refactoring and making code nice before releasing it. In my experience, pushing earlier is better. Even if people don't fork it or anything, there might still be those reading the code, giving helpful comments and such.
« Last Edit: January 01, 1970, 01:00:00 am by Admin »

Amaroth

  • Contributors
  • Creator of Worlds
  • *****
  • Posts: 1219
    • View Profile
    • Amaroth's Tools
Re: [TOOL] WDBX Editor
« Reply #5 on: August 16, 2016, 09:13:49 pm »
^^^ this.
« Last Edit: January 01, 1970, 01:00:00 am by Admin »
English YT tutorial channel. Check it out if you preffer videos over walls of text.:
https://www.youtube.com/AmarothEng

Want to support me for my releases and/or tutorials? You can send donation via Paypal to:
jantoms@seznam.cz

Luzifix

  • Contributors
  • Polygonshifter
  • *****
  • Posts: 71
    • View Profile
Re: [TOOL] WDBX Editor
« Reply #6 on: August 22, 2016, 04:38:41 pm »
Really good job
« Last Edit: January 01, 1970, 01:00:00 am by Admin »

Nupper

  • Registred Member
  • Creator of Worlds
  • *****
  • Posts: 339
    • View Profile
Re: [TOOL] WDBX Editor
« Reply #7 on: August 23, 2016, 10:04:01 pm »
Code: [Select]
F:GamesWoW DC DevelopmentDataPatch-7.MPQDBFilesClientCreatureDisplayInfo.dbc : Failed to enable constraints. One or more rows contain values violating non-null, unique, or foreign-key constraints.
F:GamesWoW DC DevelopmentDataPatch-7.MPQDBFilesClientMap.dbc : Failed to enable constraints. One or more rows contain values violating non-null, unique, or foreign-key constraints.
« Last Edit: January 01, 1970, 01:00:00 am by Admin »

barncastle

  • Registred Member
  • GM Isle Explorer
  • *****
  • Posts: 21
    • View Profile
Re: [TOOL] WDBX Editor
« Reply #8 on: August 24, 2016, 12:09:53 pm »
Quote from: "Nupper"
Code: [Select]
F:GamesWoW DC DevelopmentDataPatch-7.MPQDBFilesClientCreatureDisplayInfo.dbc : Failed to enable constraints. One or more rows contain values violating non-null, unique, or foreign-key constraints.
F:GamesWoW DC DevelopmentDataPatch-7.MPQDBFilesClientMap.dbc : Failed to enable constraints. One or more rows contain values violating non-null, unique, or foreign-key constraints.

Either you have duplicate Ids in your DBC files or the definition has the Id field in the wrong position. Without more info I can't pinpoint this exactly however I'd suggest starting with the definitions; since these are DBC files the Id column should always be the first field.
« Last Edit: January 01, 1970, 01:00:00 am by Admin »

Alastor

  • Contributors
  • Creator of Worlds
  • *****
  • Posts: 1105
    • View Profile
Re: [TOOL] WDBX Editor
« Reply #9 on: August 24, 2016, 10:38:06 pm »
just little add

i hope you didnt used unsigned variables for columns its rare but i rofled hard when i find out various DBC editors faling only because Spell.dbc is using negative values too :D ( for example energy type -2 is your HPs if i remember correctly )
« Last Edit: January 01, 1970, 01:00:00 am by Admin »
No matter how fast light travels it finds the darkness has always got there first and is waiting for it
Star Citizen Referral Code : STAR-XNFS-HVL9

Nupper

  • Registred Member
  • Creator of Worlds
  • *****
  • Posts: 339
    • View Profile
Re: [TOOL] WDBX Editor
« Reply #10 on: August 31, 2016, 07:43:48 am »
Known Database Issue
SQL Error (1364): Field "M_lang_enGB" Doesn't have a default value
Its like that with all with no Default value
« Last Edit: January 01, 1970, 01:00:00 am by Admin »

barncastle

  • Registred Member
  • GM Isle Explorer
  • *****
  • Posts: 21
    • View Profile
Re: [TOOL] WDBX Editor
« Reply #11 on: August 31, 2016, 03:03:09 pm »
Quote from: "Nupper"
Known Database Issue
SQL Error (1364): Field "M_lang_enGB" Doesn't have a default value
Its like that with all with no Default value

Thanks for reporting this, it sounds like you've got your MySQL server in STRICT which enforces these kinds of policies. I'll update the program when I get a chance to default strings to a non-null character.
« Last Edit: January 01, 1970, 01:00:00 am by Admin »

Nupper

  • Registred Member
  • Creator of Worlds
  • *****
  • Posts: 339
    • View Profile
Re: [TOOL] WDBX Editor
« Reply #12 on: August 31, 2016, 06:19:47 pm »
Quote from: "barncastle"
Quote from: "Nupper"
Known Database Issue
SQL Error (1364): Field "M_lang_enGB" Doesn't have a default value
Its like that with all with no Default value

Thanks for reporting this, it sounds like you've got your MySQL server in STRICT which enforces these kinds of policies. I'll update the program when I get a chance to default strings to a non-null character.
How would i disable the strict for Non-Null Characters in mysql
« Last Edit: January 01, 1970, 01:00:00 am by Admin »

barncastle

  • Registred Member
  • GM Isle Explorer
  • *****
  • Posts: 21
    • View Profile
Re: [TOOL] WDBX Editor
« Reply #13 on: August 31, 2016, 10:30:16 pm »
Quote from: "Nupper"
How would i disable the strict for Non-Null Characters in mysql

If you run
Code: [Select]
select @@sql_mode; it will tell you what mode your engine is running in. Apparently STRICT_TRANS_TABLES is the default now so I'd suggest just updating any text columns to have a default of an empty string literal.

I don't know how many fields you need to alter but the below will generate the SQL needed to bulk update them all for you, obviously replace <table_name> with your table's name.
Code: [Select]
SELECT GROUP_CONCAT(CONCAT('ALTER TABLE ','<table_name>',' ALTER COLUMN `',COLUMN_NAME,'`  SET DEFAULT '''';') SEPARATOR ' ') FROM INFORMATION_SCHEMA.COLUMNS WHERE table_name = '<table_name>' AND DATA_TYPE = 'text';

I've pushed a fix for this to the git repo, I'd be grateful if you had a chance to test it works.
« Last Edit: January 01, 1970, 01:00:00 am by Admin »

Nupper

  • Registred Member
  • Creator of Worlds
  • *****
  • Posts: 339
    • View Profile
Re: [TOOL] WDBX Editor
« Reply #14 on: September 05, 2016, 07:52:30 pm »
is there a compiled update...my visual studieo is to old for it i think.
« Last Edit: January 01, 1970, 01:00:00 am by Admin »