367 files, from working commit b1a079a. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
107 lines
6.9 KiB
Python
107 lines
6.9 KiB
Python
#!/usr/bin/env python3
|
|
"""Bounded original melee -> dead-target interaction -> real loot-window test.
|
|
|
|
Requires a prepared ordinary local Praxiscopy near passive Plainstriders. No
|
|
grants, GM commands, database writes, injected responses or automatic retries.
|
|
An opened window is not item-pickup/persistence acceptance. Keep that separate.
|
|
"""
|
|
import argparse
|
|
import json
|
|
from pathlib import Path
|
|
|
|
import client_ui as ui
|
|
from client_session import Session
|
|
from local_tortoise import db
|
|
from native_engine_character_test import Controller, ROOT, local_listeners
|
|
from native_talent_apply_test import persisted
|
|
from native_test_guard import (require_authenticated_turtle_realm,
|
|
require_local_turtle_ports, require_native_gameplay_policy, require_solo_test_character)
|
|
from native_world_trace import WorldTrace
|
|
|
|
|
|
def main():
|
|
parser=argparse.ArgumentParser(description=__doc__)
|
|
parser.add_argument('--evidence',type=Path,required=True)
|
|
parser.add_argument('--capture-corpse',action='store_true',help='Retain the real scene for original world-pointer interaction; no loot success claim')
|
|
parser.add_argument('--autoloot',action='store_true',help='Original auto-loot setting; verify real pickup and inventory deltas')
|
|
args=parser.parse_args();out=args.evidence.resolve()
|
|
if not out.is_relative_to(ROOT/'runtime') or out.exists():parser.error('Require new runtime evidence')
|
|
require_local_turtle_ports(local_listeners())
|
|
require_solo_test_character(4518,db('SELECT guid FROM tw_char.characters WHERE online<>0 ORDER BY guid;'))
|
|
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'))
|
|
pipe=c.rpc('inspect-engine-pipe')
|
|
actors={a['legacy_guid'] for a in pipe['entities']['actors'] if a['entry']==2955 and a['sent'] and a['kind']==3}
|
|
if not actors:raise RuntimeError('Prepared passive fixture absent; no input')
|
|
r=dict(pid=c.pid,character=4518,entry=2955,external_gateway_running=False,
|
|
before_inventory=pipe['inventory'],loot_window_verified=False,item_pickup_verified=False)
|
|
trace=WorldTrace(c);bound=False;approach=False;autoloot=False;old=ui.KEY_DELAY
|
|
try:
|
|
with trace:
|
|
with Session(c.pid) as s:
|
|
s.wait_world(5);ui.KEY_DELAY=.02
|
|
try:
|
|
s.macro('/run GWLF=GetBindingAction("F");SetBinding("F","INTERACTTARGET")');bound=True
|
|
# autoInteract is verified in the actual70334 console
|
|
# catalog. Let the original engine approach its target;
|
|
# don't estimate a roaming actor's position or replace its
|
|
# protected UnitPosition values with guessed coordinates.
|
|
s.macro('/run GWAI=GetCVar("autoInteract");SetCVar("autoInteract","1")');approach=True
|
|
if args.autoloot:
|
|
s.macro('/run GWAL=GetCVar("autoLootDefault");SetCVar("autoLootDefault","1")');autoloot=True
|
|
s.macro('/targetexact Plainstrider');anchor=trace.bookmark()
|
|
s.macro('/startattack')
|
|
r['attack_request']=trace.wait(2,0x3e011e,4,after_index=anchor)
|
|
def dead():
|
|
rows=trace.report().get('source_unit_fields',{}).get('rows',[])
|
|
return next((v for v in reversed(rows) if v.get('legacy_guid')in actors and
|
|
v.get('field')==22 and v.get('value')==0 and v.get('world_trace_index',-1)>anchor),None)
|
|
ui.key(s.d,'f')
|
|
r['source_death']=c.wait(dead,10)
|
|
if args.capture_corpse:
|
|
s.shot(out.with_suffix('.png'))
|
|
r['corpse_scene_captured']=True
|
|
# Do not spend the source corpse's lifetime taking shots,
|
|
# reloading Lua or typing probes before the real interaction.
|
|
if not args.capture_corpse:
|
|
# Source selection clear is a distinct UI issue. Use
|
|
# the original last-target command to reselect the
|
|
# genuine body; never create a loot request ourselves.
|
|
s.macro('/targetlasttarget')
|
|
anchor=trace.bookmark();ui.key(s.d,'f')
|
|
r['loot_request']=trace.wait(2,0x3e00cc,4,after_index=anchor)
|
|
r['loot_response']=trace.wait(3,0x4700bf,4,after_index=anchor)
|
|
if args.autoloot:
|
|
r['pickup_request']=trace.wait(2,0x3e00ce,4,after_index=anchor)
|
|
r['source_slot_removed']=trace.wait(1,0x162,4,after_index=anchor)
|
|
r['server_pickup_verified']=True
|
|
s.macro('/run GatewayDiagnosticsSaved.lootAcceptance={guid=UnitGUID("target"),dead=UnitIsDead("target"),count=GetNumLootItems(),visible=LootFrame and LootFrame:IsShown()}')
|
|
s.shot(out.with_suffix('.png'))
|
|
# Restore before /reload discards unsaved Lua globals.
|
|
s.macro('/run SetBinding("F",GWLF);GWLF=nil');bound=False
|
|
s.macro('/run SetCVar("autoInteract",GWAI);GWAI=nil');approach=False
|
|
if autoloot:s.macro('/run SetCVar("autoLootDefault",GWAL);GWAL=nil');autoloot=False
|
|
r['client']=persisted(s).get('lootAcceptance')
|
|
r['loot_window_verified']=bool(r['client'] and r['client'].get('visible'))
|
|
finally:
|
|
s.macro('/stopattack')
|
|
if bound:s.macro('/run SetBinding("F",GWLF);GWLF=nil');bound=False
|
|
if approach:s.macro('/run SetCVar("autoInteract",GWAI);GWAI=nil');approach=False
|
|
if autoloot:s.macro('/run SetCVar("autoLootDefault",GWAL);GWAL=nil');autoloot=False
|
|
except Exception as error:
|
|
r['failure']=str(error)
|
|
finally:
|
|
ui.KEY_DELAY=old;r.update(trace.report());p=c.rpc('inspect-engine-pipe')
|
|
r.update(pipe_error=p['error'],pipe_closed=p['closed'],after_inventory=p['inventory'])
|
|
r['inventory_object_create_observed']=p['inventory']['creates']>r['before_inventory']['creates'] and p['inventory']['items']>r['before_inventory']['items']
|
|
r['binding_restoration_pending']=bound
|
|
r['approach_cvar_restoration_pending']=approach
|
|
r['autoloot_cvar_restoration_pending']=autoloot
|
|
out.write_text(json.dumps(r,indent=2)+'\n');out.chmod(0o600)
|
|
print(json.dumps({k:r.get(k)for k in ('loot_window_verified','source_death','loot_request','loot_response','failure','pipe_error','lost_metadata_rows')}))
|
|
return 0 if r['loot_window_verified'] or r.get('corpse_scene_captured') or (r.get('server_pickup_verified') and r['inventory_object_create_observed']) else 2
|
|
|
|
|
|
if __name__=='__main__':raise SystemExit(main())
|