• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!

wc3objectdataextractor

Level 26
Joined
Feb 2, 2006
Messages
1,692
Hi,
there are many object data fields you cannot access with JASS since they are simply missing for no reason. For example, umki,usei,urq,urqa,ures,useu,utra,uupt,upgr,ucam,uhab,uabi for units and ista,igol etc. For some fields like gold and lumber costs there exist workarounds but require you to create the objects.
I need those fields to generate a HTML website from inside my map with the latest data.
Hence, I started writing a small tool called "wc3objectdataextractor" which converts extracted object data fields into a single JASS file.

You call it like:
Code:
./wc3objectdataextractor -vFp -c ~/privaterepos/wowr-website/objectdata -f umki,usei,ureq,urqa,ures,useu,utra,uupt,upgr,ucam,uhab,uabi,glmb,gglb -l 500 -i ~/privaterepos/wowr-website/ma
p/wowr.w3x/war3map.w3u -i ~/privaterepos/wowr-website/map/wowr.w3x/war3map.w3q -o test.j

You pass the list of field IDs, the maximum number of lines per extraction function (to avoid any operation limits in JASS), the object data files (in this case only unit and research data) and the output file path for the resulting JASS file test.j.

Currently, I compiled it on Linux only in my wc3lib project: wc3lib/src/app/wc3objectdataextractor.cpp at master · tdauth/wc3lib

There is room for many useful options and of course you will always have to run the tool after you have changed object data in your map but I don't know how else I could extract the data.

Code:
./wc3objectdataextractor -h
Usage: wc3objectdataextractor [options] [output file/directory] [input files]

Allowed options:
  -V [ --version ]                 Shows current version of 
                                   wc3objectdataextractor.
  -h [ --help ]                    Shows this text.
  -v [ --verbose ]                 Add more text output.
  -F [ --force ]                   Overwrites existing files and directories 
                                   when creating or extracting files.
  -f [ --fieldids ] arg            Field IDs. Extracts all field IDS if none is
                                   specified. Comma-separated values: umki,ucam
  -t [ --fieldtypes ] arg          The types of the fields in the same order as
                                   the field IDs. If no types are passed but 
                                   meta data from SLK files is read, the types 
                                   will be autodetected. Pass them as 
                                   comma-separated values. These are all 
                                   supported types: int, real, unreal, bool, 
                                   intList, stringList, unitList, abilityList, 
                                   itemList, techList, heroAbilityList, 
                                   upgradeList, abilCode, defenseType, 
                                   attributeType, regenType, unitClass, 
                                   deathType, unitRace, moveType, attackType, 
                                   weaponType, pathingTexture, tilesetList, 
                                   targetList
  -d [ --objectids ] arg           Object IDs. Extracts all object IDS if none 
                                   is specified.
  -m [ --max ] arg                 Maximum number of list entries for a single 
                                   field.
  -l [ --oplimitoperations ] arg   Maximum number of operations.
  -y [ --structsize ] arg (=50000) Maximum number of struct instances.
  -p [ --private ]                 Make everything private in the vJass library
                                   which should not be accessed from outside.
  -b [ --public ]                  Make everything public in the vJass library 
                                   which can be accessed from outside.
  -i [ --input ] arg               Input object data files (.w3a, .w3u etc.).
  -c [ --inputdirectories ] arg    Input directories which are scanned 
                                   recursively for SLK, TXT and object data 
                                   files as input.
  -k [ --slkmetainput ] arg        Input SLK files which contain meta data 
                                   (UnitMetaData.slk, AbilityMetaData.slk 
                                   etc.).
  -s [ --slkinput ] arg            Input SLK files which contain data 
                                   (UnitData.slk, AbilityData.slk etc.).
  -x [ --txtinput ] arg            Input TXT files which object data strings.
  -o [ --output ] arg              Output JASS file.

I have attached the resulting output file.

Do you think this is a good way to access the missing object data fields? Is there already a similar tool?

For the standard field values it would have to read the meta data SLKs which can be specified in the future.
 

Attachments

  • test.j
    510.9 KB · Views: 1
Last edited:
Top