diff --git a/bin/dumpworldnames.py b/bin/dumpworldnames.py new file mode 100755 index 0000000..fe69560 --- /dev/null +++ b/bin/dumpworldnames.py @@ -0,0 +1,26 @@ +#!/usr/bin/env python3 + +import json +from unitypack.asset import Asset + +INPUT = 'CustomAssetBundle-1dca92eecee4742d985b799d8226666d' +OUTPUT = 'worldnames.json' +WORLDNAMEINDEX = 8 +TABLENAME = "m_pWorldNameData" + +def main(tabledata): + worldnames = tabledata.objects[WORLDNAMEINDEX].read() + + out = {} + out[TABLENAME] = {} + table = worldnames[TABLENAME] + for i, data in enumerate(table): + out[TABLENAME][i] = data + + with open(OUTPUT, 'w') as f: + json.dump(out, f, indent=4) + + +with open(INPUT, 'rb') as f: + tabledata = Asset.from_file(f) + main(tabledata)