Files

29 lines
1.7 KiB
Python

"""#84: WMOAreaTable rows of the Turtle outdoor street groups get FORCE_OUTDOORS 0x4 (native 70334 convention:
Blizzard Undercity WMOID 1150 has 0x4 on 805/861 rows, streets stay interior groups). Input: the 307 groups content
4371a22a made EXTERIOR (pins of wmofog-1186-20261128)."""
import json, struct, glob, os, sys, collections
sys.path.insert(0, '/mnt/Games/@project/wt-master-merge/ops/claude_recipe_parity')
import dbd
P = '/mnt/Games/@project/gateway/runtime/continuation-20261113/claude-lane/content/wmofog-1186-20261128/pins'
d = json.load(open('/mnt/Games/@project/gateway/runtime/continuation-20261110/map-wdt/indoor-wmoid-rows-mapsZ48J.private.json'))
rootmap = {r['path'].lower().replace('\\', '/'): r for r in d['roots']}
want = set(); groups = []
for pj in glob.glob(P + '/*/pin.json'):
p = json.load(open(pj)); name = p['table']
if not name[-8:-4].startswith('_'): continue
b = open(os.path.dirname(pj) + '/before.bin', 'rb').read(); o = 0
while o + 8 <= len(b):
n = struct.unpack_from('<I', b, o + 4)[0]
if b[o:o + 4][::-1] == b'MOGP': gid = struct.unpack_from('<I', b, o + 8 + 0x38)[0]; break
o += 8 + n
r = rootmap[name[:-8] + '.wmo']; want.add((r['new'], gid)); groups.append(p['fdid'])
t = dbd.table('WMOAreaTable', 'in/WMOAreaTable.db2'); out = []; seen = collections.Counter()
for row in t['rows'].values():
k = (row['WMOID'], row['WMOGroupID'])
if k in want:
seen[k] += 1
if not row['Flags'] & 4: out.append(dict(ID=row['ID'], Flags=row['Flags'] | 4))
missing = sorted(want - set(seen))
json.dump(out, open('setrows.json', 'w'), indent=1)
print('groups', len(groups), 'keys', len(want), 'rows', sum(seen.values()), 'set', len(out), 'missing', len(missing), missing[:5])