367 files, from working commit b1a079a. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
56 lines
4.2 KiB
Python
56 lines
4.2 KiB
Python
#!/usr/bin/env python3
|
|
"""One source-authored damage/update pipeline probe, NOT a melee gameplay test.
|
|
|
|
GM .damage 500 3 emits the genuine server damage event even for self
|
|
(Commands.cpp::HandleDamageCommand). Restore confirmed HP/max through normal
|
|
GM commands, with no direct SQL write, item grant, teleport or progression reset.
|
|
"""
|
|
import argparse,json
|
|
from pathlib import Path
|
|
from native_engine_character_test import ROOT,Controller,local_listeners
|
|
from native_test_guard import require_authenticated_turtle_realm,require_local_turtle_ports,require_native_gameplay_policy
|
|
from native_world_trace import WorldTrace
|
|
from native_combat_state_test import state
|
|
from client_session import Session
|
|
import client_ui as ui
|
|
|
|
def main():
|
|
p=argparse.ArgumentParser(description=__doc__);p.add_argument('--baseline-health',type=int,required=True);p.add_argument('--baseline-max',type=int,required=True);p.add_argument('--output',type=Path,required=True);a=p.parse_args();path=a.output.resolve()
|
|
if not path.is_relative_to(ROOT/'runtime') or path.exists() or not path.parent.is_dir() or not 1000<a.baseline_health<=a.baseline_max<=1000000:p.error('Require new runtime output and confirmed safely bounded health baseline')
|
|
require_local_turtle_ports(local_listeners());baseline=state()
|
|
if baseline['health']!=a.baseline_health:raise RuntimeError('Saved server baseline differs; no damage issued')
|
|
c=Controller(int((ROOT/'runtime/native-client.pid').read_text()));require_authenticated_turtle_realm(c.rpc('inspect-wire-account'));require_native_gameplay_policy(c.rpc('inspect-native-channel-policy'))
|
|
report={'pid':c.pid,'baseline':baseline,'baseline_max_health':a.baseline_max,'external_gateway_running':False,'source_command':'damage 500 3','restoration_pending':False,'actual_melee_verified':False,'ui_review_required':True}
|
|
changed=False;failure=None;old=ui.KEY_DELAY;ui.KEY_DELAY=.03
|
|
with WorldTrace(c) as trace:
|
|
try:
|
|
with Session(c.pid) as s:
|
|
if s.state()!='world':raise RuntimeError('Require existing actual world session')
|
|
ui.key(s.d,'F1');trace.wait(2,0x3f00cd,3)
|
|
# Selection request is generated by the original F1 action and
|
|
# translated through the authenticated owned-GUID binding.
|
|
changed=True;report['restoration_pending']=True;s.macro('/s .damage 500 3')
|
|
report['server_damage_event']=trace.wait(1,0x14a,5)
|
|
report['native_damage_queued']=trace.wait(3,0x4d002c,3)
|
|
s.macro('/run print("GW controlled damage",UnitHealth("player"),UnitHealthMax("player"))')
|
|
s.shot(path.with_suffix('.png'));s.macro('/s .save');report['server_after_damage']=state()
|
|
if report['server_after_damage']['health']>=a.baseline_health:raise RuntimeError('Controlled reduction not visible in authoritative saved state')
|
|
except Exception as e:failure=type(e).__name__+': '+str(e)
|
|
finally:
|
|
try:
|
|
if changed:
|
|
with Session(c.pid) as s:
|
|
if s.state()!='world':raise RuntimeError('World lost before controlled health restoration')
|
|
ui.key(s.d,'F1');s.macro(f'/s .modify hp {a.baseline_health} {a.baseline_max}');s.macro('/s .save')
|
|
report['restored_server']=c.wait(lambda:(r if (r:=state())==baseline else False),8)
|
|
report['restoration_pending']=False
|
|
s.macro('/run print("GW restored damage",UnitHealth("player"),UnitHealthMax("player"))');s.shot(path.with_name(path.stem+'-restored.png'))
|
|
except Exception as e:report['restoration_error']=type(e).__name__+': '+str(e)
|
|
ui.KEY_DELAY=old
|
|
report.update(trace.report())
|
|
if failure:report['failure']=failure
|
|
path.write_text(json.dumps(report,indent=2)+'\n');path.chmod(0o600)
|
|
print(json.dumps({k:report.get(k) for k in ('pid','server_after_damage','server_damage_event','native_damage_queued','restored_server','restoration_pending','lost_metadata_rows','observer_error','failure','restoration_error')}))
|
|
return 0 if not failure and not report['restoration_pending'] and not trace.error and not trace.lost else 2
|
|
if __name__=='__main__':raise SystemExit(main())
|