Files

36 lines
2.8 KiB
Python

"""#36 (2026-11-28): Turtle creator + shop skins/faces mapped onto DK/DH-only ChrCustomizationChoice rows render as the
default for every Turtle class (Grimtotem skin 21 -> 1066 Req 103 = DK only). The client draws only choices whose Req
the player meets (LOCAL A/B: Req 12/10/quest/region locks all render the default), so ops/appearance_catalogue/
class_gate_reqs.py sets all 112 emitted class-gated choices to Req 141, and single_name_creation_ui.
rebase_hide_creator_choices removes out-of-range skins + the 59 shop-only choices from the creator allow-list (8209459)."""
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()
TABLES = [(3450554, 'ChrCustomizationChoice', H / 'out/ChrCustomizationChoice.db2'), (8209459, 'interface/addons/blizzard_charactercreate/camelot/blizzard_charactercreate.lua', H / 'out/blizzard_charactercreate.lua')]
WHY = '#36: shop/creator skins+faces render for all Turtle classes (class-gated DK/DH Reqs -> 141); shop-only choices + out-of-range skins hidden from the creator list'
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, src 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]
assert old == (H / 'in' / src.name).read_bytes(), 'input differs from parent store'
new = src.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))