367 files, from working commit b1a079a. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
63 lines
4.5 KiB
Python
63 lines
4.5 KiB
Python
#!/usr/bin/env python3
|
|
"""Actual native sharpening cast cancel, unlock and successful retry fixture.
|
|
|
|
Disposable4509, genuine12404/spell16138, actual equipped sword25/slot15.
|
|
No HP/position changes. GM only prepares/removes one stone and saves. A successful
|
|
retry refreshes the real temporary enchant; it is left to expire normally.
|
|
"""
|
|
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 recovery record')
|
|
return p
|
|
def stone(p):return next((i for i in p['inventory']['rows'] if i['entry']==12404),None)
|
|
if stone(inspect()) or db('SELECT ii.itemEntry FROM tw_char.character_inventory ci JOIN tw_char.item_instance ii ON ii.guid=ci.item WHERE ci.guid=4509 AND ci.slot=15;')!='25':raise RuntimeError('Require no existing stone and real equipped sword')
|
|
path=ROOT/'runtime/native-item-cancel.json'
|
|
if path.exists():raise RuntimeError('Previous evidence preserved')
|
|
report={'pid':c.pid,'external_gateway_running':False,'ui_review_required':True,'cleanup_pending':False,'hp_or_position_changed':False}
|
|
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 GWCancelProbe=CreateFrame("Frame");GWCancelProbe:RegisterUnitEvent("UNIT_SPELLCAST_INTERRUPTED","player");GWCancelProbe:SetScript("OnEvent",function(_,e,u,g,i)print("GW cancel",e,u,g,i)end)')
|
|
ui.key(s.d,'F1');added=True;report['cleanup_pending']=True;s.macro('/s .additem 12404 1')
|
|
c.wait(lambda:stone(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=12404;')=='25',6)
|
|
before=inspect()['cast_result']['count'];s.macro('/use 0 3');s.macro('/use 16');s.macro('/stopcasting')
|
|
def canceled():
|
|
p=inspect();r=p['cast_result'];return p if r['count']>before and r['spell']==16138 and r['status']==2 and r['reason']==35 else None
|
|
p=c.wait(canceled,6)
|
|
if not stone(p) or stone(p)['count']!=1:raise RuntimeError('Canceled item was unexpectedly consumed')
|
|
report['canceled']={k:p[k] for k in ('cast_result','item_request')}
|
|
s.macro('/run local i=C_Container.GetContainerItemInfo(0,3);print("GW cancel lock",i and i.isLocked,i and i.stackCount);print("GW cancel idle",UnitCastingInfo("player"),PlayerCastingBarFrame:IsShown())')
|
|
s.shot(ROOT/'runtime/native-item-canceled.png')
|
|
before=p['cast_result']['count'];s.macro('/use 0 3');s.macro('/use 16')
|
|
def completed():
|
|
p=inspect();r=p['cast_result'];return p if r['count']>before and r['spell']==16138 and r['status']==0 and not stone(p) else None
|
|
p=c.wait(completed,8);report['retry']={k:p[k] for k in ('cast_result','item_request','inventory')}
|
|
s.macro('/run print("GW retry enchant",GetWeaponEnchantInfo());print("GW retry damage",UnitDamage("player"))');s.shot(ROOT/'runtime/native-item-cancel-retry.png')
|
|
except Exception as error:report['error']=str(error);raise
|
|
finally:
|
|
try:
|
|
if added:
|
|
p=inspect();c.wait(lambda:s.state()=='world',15)
|
|
if stone(p):
|
|
if stone(p)['count']!=1:raise RuntimeError('Unexpected stone count; no blind cleanup')
|
|
ui.key(s.d,'F1');s.macro('/s .additem 12404 -1');c.wait(lambda:not stone(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('Actual cancel/retry evidence requires review:',path)
|
|
if __name__=='__main__':main()
|