45 lines
3.6 KiB
Python
45 lines
3.6 KiB
Python
"""#34 GO display models on 2ad1af97: 91 Octo GameObject displays (63 M2 + 28 WMO, build_m2.py + build_wmo.py) (HE banners/tents, Thalassian Mailbox 33182, BE scrying
|
|
orbs 29624, ...) -> converted models + GameObjectDisplayInfo rows (build_m2.py, go-models.json). Previously: NE transport ship (owner 2026-11-24), on content f5213778. Turtle display 7087 (Transportship_NE.wmo: Moonspray 176244,
|
|
Auberdine-Stormwind 181646, Windrunner 176250) had no client row. The 70334 client carries Blizzard's NE ship as
|
|
transportship_ne_stationary.wmo (FDID 116324 + group 116325; the moving 116322 is not shipped): native art, no import.
|
|
GameObjectDisplayInfo 7087 -> FileDataID 116324, GeoBox 0 like native 3015."""
|
|
import json, hashlib, struct, sys
|
|
from pathlib import Path
|
|
H = Path(__file__).resolve().parent; sys.path.insert(0, str(H))
|
|
import frozen_store as fs
|
|
md5 = lambda b: hashlib.md5(b).hexdigest(); sha = lambda b: hashlib.sha256(b).hexdigest()
|
|
I = H / 'inputs'
|
|
TABLES = [(1266277, 'dbfilesclient/gameobjectdisplayinfo.db2', I / 'after/GameObjectDisplayInfo.db2'), (764428, 'world/model.blob', I / 'after/model.blob')]
|
|
# Catalogue-wide (m2_sequence_hash.py): every imported M2 whose 0x24 table has no empty slot -> native hash (hilt 8810038 incl. gold texture)
|
|
TABLES += [(int(f), f'model/m2_sequence_hash_{f}.m2', H / p) for f, p in json.load(open(I / 'hashfix.json')).items()]
|
|
NEW = [(a['file_data_id'], a['kind'], a['path'], Path(a['file'])) for f in ('go-models.json', 'go-wmo.json') for a in json.load(open(H / f))['art']]
|
|
WHY = '#34 + M2 sequence hash (ERROR #109) + Hilt of Radiance gold pommel: 91 spawned GameObject displays without client row/model (63 M2 + 28 WMO) -> converted Octo models + GameObjectDisplayInfo rows'
|
|
store = fs.Store(); root = store.root; lay = store.layout; assert lay['root_md5'] == fs.ROOT
|
|
patched = bytearray(root); pins = []
|
|
want = {fid: [] for fid, _, _ in TABLES}
|
|
for g in lay['groups']:
|
|
f = 0
|
|
for i, (d,) in enumerate(struct.iter_unpack('<I', memoryview(root)[g['ids_offset']:g['ckeys_offset']])):
|
|
f += d
|
|
if f in want: want[f].append((g, g['ckeys_offset'] + i * 16))
|
|
f += 1
|
|
for fid, name, out in TABLES:
|
|
en = [(g, at) for g, at in want[fid] if g['locale'] & 2 and not g.get('flags1')]; assert len(en) == 1, (fid, len(en))
|
|
g, at = en[0]; ck = root[at:at + 16].hex(); old = store.read(ck)[2]
|
|
new = out.read_bytes(); patched[at:at + 16] = bytes.fromhex(md5(new))
|
|
d = H / 'pins' / str(fid); d.mkdir(parents=True, exist_ok=True)
|
|
(d / 'before.bin').write_bytes(old); (d / 'after.bin').write_bytes(new)
|
|
pin = dict(fdid=fid, table=name, parent_root=fs.ROOT, selected_group={}, original_decoded=dict(file='before.bin', md5=ck, sha256=sha(old)),
|
|
encrypted_original=False, after_decoded=dict(file='after.bin', md5=md5(new), sha256=sha(new)), reason=WHY)
|
|
(d / 'pin.json').write_text(json.dumps(pin, indent=1) + '\n')
|
|
pins.append(dict(file=str(d / 'pin.json'), sha256=sha((d / 'pin.json').read_bytes()), type='wdc_enus'))
|
|
assets = []
|
|
for fid, kind, path, src in NEW:
|
|
raw = src.read_bytes()
|
|
assets.append(dict(file_data_id=fid, path=path, sha256=sha(raw), ckey=md5(raw), kind=kind, file=str(src)))
|
|
art = H / 'pins' / 'new-textures.json'; raw = (json.dumps(dict(type='art', parent_root=fs.ROOT, assets=assets), indent=1) + '\n').encode(); art.write_bytes(raw)
|
|
if assets: pins.append(dict(file=str(art), sha256=sha(raw), type='art'))
|
|
(H / 'components.json').write_text(json.dumps(pins, indent=2) + '\n')
|
|
(H / 'selected-root.json').write_text(json.dumps(dict(parent_build=fs.BUILD, parent_root=fs.ROOT, decoded_root_sha256=sha(bytes(patched)), parent_root_sha256=sha(root)), indent=2) + '\n')
|
|
print('pins', len(pins))
|