26 lines
1.6 KiB
Python
26 lines
1.6 KiB
Python
import json, re, glob, collections, os
|
|
G = '/mnt/Games/@project/gateway'
|
|
modern = {}
|
|
for l in open(G + '/runtime/continuation-20261113/codex/Windows-parity-20261117/windows-codec-closure-r3/forever/src/server/game/Server/Protocol/Opcodes.h', errors='replace'):
|
|
m = re.match(r'\s*((?:CMSG|SMSG|MSG)_\w+)\s*=\s*(0x[0-9A-Fa-f]+)', l)
|
|
if m: modern.setdefault(int(m.group(2), 16), m.group(1))
|
|
legacy = {}
|
|
for l in open('/mnt/Games/@project/servers/tortoise-wow-be0706/src/game/Protocol/Opcodes.cpp', errors='replace'):
|
|
m = re.search(r'/\*(0x[0-9A-Fa-f]+)\*/\s*StoreOpcode\((\w+)', l)
|
|
if m: legacy[int(m.group(1), 16)] = m.group(2)
|
|
dirs = glob.glob('/mnt/Games/OctoWoW-Windows-Client/_classic_beta_/Diagnostics/2026*') + glob.glob(G + '/runtime/continuation-20261113/claude-lane/diagnostics-archive-20261122/2026*')
|
|
res = {}
|
|
for stream, names in (('client_dropped', modern), ('packets_unhandled', legacy), ('packets_error', legacy)):
|
|
c = collections.Counter(); sessions = collections.defaultdict(set)
|
|
for d in dirs:
|
|
p = os.path.join(d, stream + '.jsonl')
|
|
if not os.path.exists(p): continue
|
|
for l in open(p):
|
|
try: r = json.loads(l)
|
|
except Exception: continue
|
|
if 'opcode' in r: c[r['opcode']] += r.get('count', 1); sessions[r['opcode']].add(os.path.basename(d))
|
|
res[stream] = [(hex(o), names.get(o, '?'), n, len(sessions[o])) for o, n in c.most_common()]
|
|
print('==', stream, len(dirs), 'sessions,', len(c), 'opcodes')
|
|
for row in res[stream][:45]: print(' ', row)
|
|
json.dump(res, open('drops.json', 'w'), indent=1)
|