Files

25 lines
1.6 KiB
Python

"""Catalogue rule (2026-11-23): every ItemDisplayInfo model texture slot needs an ItemDisplayInfoModelMatRes row.
70334 draws item model textures (weapons, shoulders, helms, capes) from ItemDisplayInfoModelMatRes
{MaterialResourcesID, TextureType 2, ModelIndex, ItemDisplayInfoID}; IDI.ModelMaterialResourcesID alone renders
white. Native rows mirror IDI (13,143 slots agree). Emit a row for each IDI slot with a material and no row."""
import json, subprocess, sys, collections
from pathlib import Path
H = Path(__file__).resolve().parent
TOOL = ['dotnet', '/mnt/Games/@project/wt-merge/ops/db2-bake-20261122/tool/bin/Debug/net10.0/Db2Bake.dll']
DEFS = '/mnt/Games/@project/tools/WoWDBDefs/definitions'
def dump(t):
out = subprocess.run(TOOL + ['dump', str(H / 'inputs/before'), DEFS, t], capture_output=True, text=True, check=True).stdout
for l in out.splitlines():
x = l.split('\t'); yield dict(a.split('=', 1) for a in x[1:])
have = collections.defaultdict(dict); nid = 0
for r in dump('ItemDisplayInfoModelMatRes'):
have[int(r['ItemDisplayInfoID'])][int(r['ModelIndex'])] = int(r['MaterialResourcesID']); nid = max(nid, int(r['ID']))
rows = []
for r in dump('ItemDisplayInfo'):
d = int(r['ID']); mmr = [int(x) for x in r['ModelMaterialResourcesID'].split(',')]
for i, m in enumerate(mmr):
if m and i not in have[d]:
nid += 1; rows.append(dict(ID=nid, MaterialResourcesID=m, TextureType=2, ModelIndex=i, ItemDisplayInfoID=d))
json.dump(rows, open(H / 'inputs/modelmat-rows.json', 'w'), indent=0)
print('rows', len(rows), 'displays', len({r['ItemDisplayInfoID'] for r in rows}))