367 files, from working commit b1a079a. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
60 lines
3.9 KiB
Python
60 lines
3.9 KiB
Python
#!/usr/bin/env python3
|
|
"""Native full-health potion rejection/unlock fixture on disposable4509.
|
|
|
|
No HP changes. One GM-prepared118 is used twice through original input and
|
|
removed in finally if still present. Original baseline must have no118.
|
|
Review real error/lock screenshots, not just serialization or request counters.
|
|
"""
|
|
import json,os
|
|
from client_session import Session
|
|
from native_engine_character_test import Controller,ROOT,local_listeners
|
|
from native_test_guard import require_local_turtle_ports,require_authenticated_turtle_realm,require_native_gameplay_policy
|
|
from native_world_trace import WorldTrace
|
|
from local_tortoise import db
|
|
import client_ui as ui
|
|
|
|
def main():
|
|
os.umask(0o077);require_local_turtle_ports(local_listeners())
|
|
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'))
|
|
def inspect():
|
|
p=c.rpc('inspect-engine-pipe')
|
|
if p['error'] or p['closed']:raise RuntimeError('Native pipe lost; preserve fixture')
|
|
return p
|
|
def potion(p):return next((i for i in p['inventory']['rows'] if i['entry']==118),None)
|
|
if potion(inspect()) or db('SELECT health FROM tw_char.characters WHERE guid=4509;')!='2609':raise RuntimeError('Require restored full-health baseline and no existing118')
|
|
report={'pid':c.pid,'external_gateway_running':False,'health_modified':False,'cleanup_pending':False,'ui_review_required':True,'rejections':[]}
|
|
path=ROOT/'runtime/native-item-rejection.json'
|
|
if path.exists():raise RuntimeError('Previous evidence preserved; do not overwrite')
|
|
added=False
|
|
with Session(c.pid) as s,WorldTrace(c) as trace:
|
|
c.wait(lambda:s.state()=='world',15);s.focus();old=ui.KEY_DELAY;ui.KEY_DELAY=.03
|
|
try:
|
|
s.macro('/run GWErrProbe=CreateFrame("Frame");GWErrProbe:RegisterEvent("UI_ERROR_MESSAGE");GWErrProbe:SetScript("OnEvent",function(_,_,a,b)print("GW UI error",a,b)end)')
|
|
ui.key(s.d,'F1');added=True;report['cleanup_pending']=True;s.macro('/s .additem 118 1')
|
|
c.wait(lambda:potion(inspect()),6);s.macro('/s .save')
|
|
c.wait(lambda:db('SELECT ci.slot FROM tw_char.character_inventory ci JOIN tw_char.item_instance ii ON ii.guid=ci.item WHERE ci.guid=4509 AND ii.itemEntry=118;')=='25',6)
|
|
for attempt in range(2):
|
|
before=inspect()['cast_result']['count'];s.macro('/use 0 3')
|
|
def rejected():
|
|
p=inspect();r=p['cast_result']
|
|
return p if r['count']>before and r['spell']==439 and r['status']==2 and r['reason']==1 else None
|
|
p=c.wait(rejected,6)
|
|
if not potion(p) or potion(p)['count']!=1:raise RuntimeError('Rejected item unexpectedly consumed')
|
|
report['rejections'].append({k:p[k] for k in ('cast_result','item_request')})
|
|
s.macro('/run local i=C_Container.GetContainerItemInfo(0,3);print("GW rejected lock",i and i.isLocked,i and i.stackCount);print("GW rejected HP",UnitHealth("player"))')
|
|
s.shot(ROOT/f'runtime/native-item-rejection-{attempt+1}.png')
|
|
except Exception as error:report['error']=str(error);raise
|
|
finally:
|
|
try:
|
|
if added:
|
|
p=inspect();c.wait(lambda:s.state()=='world',15)
|
|
if potion(p):
|
|
if potion(p)['count']!=1:raise RuntimeError('Unexpected potion fixture count; no blind cleanup')
|
|
ui.key(s.d,'F1');s.macro('/s .additem 118 -1');c.wait(lambda:not potion(inspect()),6)
|
|
s.macro('/s .save');report['cleanup_pending']=False
|
|
finally:
|
|
ui.KEY_DELAY=old;report['trace']=trace.report();path.write_text(json.dumps(report,indent=2)+'\n')
|
|
print('Native rejection evidence requires review:',path)
|
|
if __name__=='__main__':main()
|