Files

40 lines
2.9 KiB
Python

"""Octo Black Drake model (owner queue 6, 2026-11-23), on content a12f7dce.
drakemount.m2 (FDID 234564, all drake mounts) becomes Octo's model: Source256 converted with
m2_equipment_convert --creature, wrapped by inputs/build_model.py (\$FD1 roar t=1466 on anim 94; Octo Jump 38
aliases its wing-flap swim). Its four views replace the native skin FDIDs. Seven Octo drake textures that differ
from the client (saddle, black 3, twilight skins) are imported on their own FDIDs."""
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()
TEX = dict([(234565,'drakemount_saddle'),(234571,'drakeskinblack3'),(234587,'drakeskintwilightgreen_01'),(234590,'drakeskintwilightpurple_01'),
(234593,'drakeskintwilightred_01'),(234594,'drakeskintwilightred_02'),(234595,'drakeskintwilightred_03')])
TABLES = [(234564,'creature/drakemount/drakemount.m2',None,H/'inputs'/'drakemount.m2')]
TABLES += [(f,f'creature/drakemount/skin{k}',None,H/'inputs'/f'octo-drakemount-0{k}.skin') for k,f in enumerate([474429,4059003,4059005,4059006])]
TABLES += [(f,f'creature/drakemount/{n}.blp',None,H/'inputs'/'tex'/f'{n}.blp') for f,n in TEX.items()]
WHY = 'Octo Black Drake model + differing Octo drake textures (owner queue 6)'
store = fs.Store(); root = store.root; lay = store.layout; assert lay['root_md5'] == fs.ROOT
patched = bytearray(root); pins = []
for fid, name, src, out in TABLES:
cells = []
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 == fid: cells.append((g, g['ckeys_offset'] + i * 16))
f += 1
en = [(g, at) for g, at in cells 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'))
(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))