Database Handler - thethiny/NRS-Asset-Manager GitHub Wiki

Database Handler

Parses UE3 property-based database exports and outputs them as JSON.

Handled Types

MK11

mk11unlockdata, mk11kollectioniteminfo, mk11itemdatabase

IJ2

dcf2assetdefinitions, dcf2gearrarity, dcf2dialogconfigdata, dcf2billboardconfigdata, dcf2storydata, dcf2storydatashowbuild, capasset, capitempresetsasset, capmaterialasset, colorpaletteasset, dcf2cappresets, dcf2capinfotable, dcf2materialpalettetable

How It Works

  1. Reads the export's raw data blob from the Midway buffer
  2. Iterates UProperty.parse_once() until None sentinel or EOF
  3. Collects all properties into a Python dict
  4. Serializes to JSON
class DatabaseHandler(ClassHandler):
    def parse(self):
        data = {}
        while self.mm.tell() < self.mm.size():
            result = UProperty.parse_once(self.mm, self.name_table, True)
            if result is None:
                break
            data.update(result)
        return data
    
    def save(self, data, export, asset_name, save_dir, *args):
        with open(save_path + ".json", "w+") as f:
            json.dump(data, f, indent=4)

Property Types

See UE3 Property Types for the full list of supported property types and their serialization formats.

Output Example

{
    "mItems": [
        {
            "mItemHash": "8ffb2610f67ec35b...",
            "mAssetGroup": 42
        }
    ],
    "mVisualRarityTable": [
        {
            "mItemHash": "...",
            "mVisualRarity": 1020005
        }
    ]
}