Files
WoW-Hybrid-gateway/ops/verify_npc_movement.py
praxisandClaude Fable 5.2 8a24c445b0 Content pipeline and operator tools
367 files, from working commit b1a079a.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-19 01:32:48 +02:00

71 lines
3.5 KiB
Python

#!/usr/bin/env python3
"""Observe natural Turtle NPC movement in actual WowB without moving the player.
Requires an already in-world client and complete private population/spline audit.
Waits for a real translated spline for the supplied GUID, then captures a fixed
camera sequence. Visual review is required; packet sends alone never pass this.
"""
import argparse
import datetime
import json
import os
from pathlib import Path
import subprocess
import time
ROOT = Path(__file__).resolve().parents[1]
def main():
p = argparse.ArgumentParser(description=__doc__)
p.add_argument('audit', type=Path)
p.add_argument('--guid', type=int, required=True)
p.add_argument('--deadline', type=int, default=240)
args = p.parse_args()
if not args.audit.resolve().is_relative_to(ROOT/'runtime') or not 10<=args.deadline<=600:
p.error('Private runtime audit and deadline10..600 required')
os.umask(0o077)
output = ROOT/'runtime'/('npc-motion-'+datetime.datetime.now(datetime.timezone.utc).strftime('%Y%m%dT%H%M%SZ'))
output.mkdir(mode=0o700)
started = last_report = time.monotonic()
result = dict(guid=str(args.guid), screenshot_review_required=True, visual_movement_verified=False,
scope='Real Turtle translated spline triggers actual WowB captures; no actor/player manipulation')
with args.audit.open() as stream:
stream.seek(0,2)
buffered = ''
while time.monotonic()-started<args.deadline:
buffered += stream.read()
while '\n' in buffered:
line,buffered = buffered.split('\n',1)
e = json.loads(line)
if e['event']=='capture_capped':
raise RuntimeError('Audit cap reached; cannot observe subsequent splines')
if e['event']!='monster_sent' or int(e['guid'])!=args.guid or int(e['duration'])<5000:
continue
# This specific Northshire patrol passes the saved player location.
# Do not capture when it is at the far end of the circuit.
pos = e['start']
if abs(float(pos['0'])+8928.9502)>25 or abs(float(pos['1'])+118.467)>25:
continue
result['spline'] = e
result['frames'] = []
print('Observed actual nearby patrol spline',e['id'],'duration',e['duration'],flush=True)
for frame in range(5):
path = output/('frame-'+str(frame)+'.png')
before = datetime.datetime.now(datetime.timezone.utc).isoformat()
subprocess.run(['python3',str(ROOT/'ops/client_ui.py'),'shot','--output',str(path)],check=True)
result['frames'].append(dict(file=path.name,started_utc=before,
finished_utc=datetime.datetime.now(datetime.timezone.utc).isoformat()))
time.sleep(.4)
(output/'result.json').write_text(json.dumps(result,indent=2)+'\n')
print('Actual-client evidence (visual review required):',output,flush=True)
return
if time.monotonic()-last_report>=30:
print('Waiting for natural matching patrol movement; elapsed',round(time.monotonic()-started),'seconds',flush=True)
last_report=time.monotonic()
time.sleep(.1)
(output/'result.json').write_text(json.dumps(result,indent=2)+'\n')
raise SystemExit('No matching nearby patrol in deadline; movement remains unverified')
if __name__=='__main__':
main()