Files
WoW-Hybrid-gateway/ops/item_model_mat_res.py
praxisandClaude Fable 5.2 8a24c445b0 Content pipeline and operator tools
367 files, from working commit b1a079a.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-19 01:32:48 +02:00

57 lines
2.5 KiB
Python

#!/usr/bin/env python3
"""Add ItemDisplayInfoModelMatRes rows for packaged hotfix ItemDisplayInfo rows.
REA (70334): native ItemDisplayInfoModelMatRes (FDI 4050937, table hash
0x14320f31, parent ItemDisplayInfoID) carries item model and cape textures:
11,094 rows, TextureType 2 for 11,074, ModelIndex 0/1. A hotfix display that
only sets ItemDisplayInfo.ModelMaterialResourcesID renders textured at
character select but white in world. Local run 68: adding one row per nonzero
ModelMaterialResourcesID slot rendered converted cloaks textured in world.
Hotfix wire: four int32 fields in metadata order (MaterialResourcesID,
TextureType, ModelIndex, ItemDisplayInfoID parent). Existing rows of this
table are replaced so the step is idempotent; the package push identity is
recomputed.
"""
import argparse,hashlib,json,struct,sys
from pathlib import Path
sys.path.insert(0,str(Path(__file__).resolve().parent))
from item_sparse_compat import package_payloads,package_pages
TABLE='ItemDisplayInfoModelMatRes'
TABLE_HASH='0x14320f31'
OBJECT_SKIN=2
POLICY='octo-catalogue-modelmatres-v1'
def add_model_mat_res(package,first_id):
rows=[r for r in package['rows'] if r['table_name']!=TABLE]
next_id=first_id;added=0
for display in [r for r in rows if r['table_name']=='ItemDisplayInfo']:
wire=bytes.fromhex(display['wire_hex'])
for slot,material in enumerate(struct.unpack_from('<2i',wire,48)):
if not material:continue
record=struct.pack('<iiii',material,OBJECT_SKIN,slot,display['id'])
rows.append(dict(id=next_id,policy=POLICY,sha256=hashlib.sha256(record).hexdigest(),
source_display_id=display.get('source_display_id'),table_hash=TABLE_HASH,
table_name=TABLE,wire_hex=record.hex()))
next_id+=1;added+=1
package['rows']=rows
package['push_id']=package_payloads(rows)[0]
if 'pushes' in package:package['pushes']=package_pages(rows)
return added
def main():
p=argparse.ArgumentParser(description=__doc__.splitlines()[0])
p.add_argument('package',type=Path)
p.add_argument('--first-id',type=int,required=True,help='first row ID, above every native ItemDisplayInfoModelMatRes ID')
a=p.parse_args()
package=json.loads(a.package.read_text())
added=add_model_mat_res(package,a.first_id)
a.package.write_text(json.dumps(package))
print(f'{TABLE} rows {added}; package rows {len(package["rows"])}')
if __name__=='__main__':main()