Files
2026-11-23 03:28:32 +02:00

23 lines
1.3 KiB
Python

import sys, struct, re, pickle, collections, json
sys.path.insert(0, '.')
import client_read as R
from recover_bindings import chunks
IDS = pickle.load(open('/tmp/claude-1000/-home-praxis-Projects/8c775e16-46f6-4cfc-9a63-844a8b79c754/scratchpad/cr/root-ids.pkl', 'rb'))
want = {(0, 1, 0), (24, 0, 0), (49, 0, 0), (16, 1, 0), (48, 0, 0)}
roots = []
for l in open('/mnt/Games/@project/listfiles/community-listfile.csv', encoding='utf-8', errors='replace'):
a, _, p = l.rstrip('\n').partition(';')
if p.endswith('.wmo') and not re.search(r'_\d{3}(_lod\d)?\.wmo$', p) and int(a) in IDS and int(a) < 8400000: roots.append((int(a), p))
hits = collections.defaultdict(list); n = 0; allt = collections.Counter()
for f, p in roots:
try: b = R.read_fdid(f)
except Exception: continue
if b[:4] != b'REVM': continue
c = dict(chunks(b)); m = c.get('MOMT', b''); n += 1
for k in range(0, len(m), 64):
t = (struct.unpack_from('<I', m, k)[0], struct.unpack_from('<I', m, k + 4)[0], struct.unpack_from('<I', m, k + 8)[0]); allt[t] += 1
if t in want and len(hits[t]) < 5: hits[t].append((f, p))
print('roots scanned', n, 'of', len(roots))
for t in sorted(want): print(t, allt[t], hits[t][:3])
json.dump({str(k): v for k, v in allt.items()}, open('native-momt-tuples.json', 'w'))