升级环节三个实测缺陷: 满级判定、弹窗卡死、坐标定位

Browse Source
2026-10-13 18:00 那轮升级报"前 6 个候选都不需要升级或无法读取", 逐层复盘出三个缺陷,
它们互相叠加, 单看每一个都不像问题:

1. 满级人格被误判成"长按没打开详情" (scripts/levelup.py)
   详情页判定写的是 'Level Up' not in txt, 但满级(Lv.40)时那个按钮显示的是 MAX。
   实测 Zwei 满级后长按成功, 却因画面里没有 'Level Up' 被判失败跳过。
   抽成 detail_page_open(): Level Up / Uptie / Summary+Sanity 任一即可。
   顺带统一了 cmd_progress 与 cmd_card 两处不一致的判定。

2. 满级时进度条反推等级偏低 6 级 (scripts/levelup.py)
   满级后进度条分母是"下一级"的需求, 而等级已封顶: Zwei 是 LV40/MAX、
   进度条 0/6075, 而 6075 在表里对应 Lv.35, 反推成 34。
   改为满级时以直读的 LV 为准(取最大值, 避开技能等级)。

3. Uptie 弹窗关不掉, 一直挡着后续所有输入 (scripts/levelup.py, lc_ui.py)
   Tier IV 弹窗多了 Shard::Thread Exchange 一排, Cancel 实际在 (380,675),
   而代码写死 (526,660) —— 落在 Cancel 与 Use Egoshard Crate 之间的空白,
   点下去毫无反应。弹窗是模态的, 之后每一次长按都被它吞掉, 于是六张卡全跳过。
   加 lc_ui.click_text(): 按文本找元素并点识别框**中心**。
   实测 OCR 返回的 (x,y) 是文本框左上角, 直接点常常落空(346,660 无效, 380,675 才中)。
   再加 levelup.dismiss_modal(): 每次长按前先清残留弹窗, 比事后补救可靠。

实测结果(N Corp 与 LCB Sinner 各自 33->40):
  详情页: Zwei  真实等级=40  已达目标, 跳过      (修复前报"长按未打开详情")
  详情页: N Corp 真实等级=33  升级: OK 33->40    (弹窗未关也按详情页判定)

新增测试 6 个(detail_page_open 4 个 + 满级读取 2 个), 全套 223/223 通过。
This commit is contained in:
Codex Agent
2026-10-13 18:11:29 +08:00
parent ac6264eeb3
commit 66c64c169f
3 changed files with 138 additions and 4 deletions
+29
View File
@@ -93,6 +93,35 @@ def click(x, y, times=1):
return probe('click', {'x': cx, 'y': cy, 'times': times}) return probe('click', {'x': cx, 'y': cy, 'times': times})
def find_text(needle, contains=True):
"""按文本找画面元素; 返回元素本身(含 x/y/w/h)或 None。
默认子串匹配、忽略大小写。OCR 结果里 w/h 可能缺失, 调用方要能容忍。
"""
needle = needle.lower()
for it in items():
t = it.get('text', '').lower()
if (needle in t) if contains else (needle == t):
return it
return None
def click_text(needle, contains=True):
"""按文本点击元素, 点的是识别框的**中心**。
实测坑: 直接点 OCR 返回的 (x, y) 是文本框左上角, 按下去常常落空
(2026-10-13 Uptie 弹窗的 Cancel: 文本在 (346,660), 实际可点区域中心在
(380,675), 点前者毫无反应, 弹窗一直卡着挡住后续所有输入)。
"""
it = find_text(needle, contains=contains)
if not it:
return False
w = it.get('w') or 0
h = it.get('h') or 0
click(it['x'] + w / 2.0, it['y'] + h / 2.0)
return True
def drag(from_x, from_y, to_x, to_y): def drag(from_x, from_y, to_x, to_y):
fx, fy = _to_client(from_x, from_y) fx, fy = _to_client(from_x, from_y)
tx, ty = _to_client(to_x, to_y) tx, ty = _to_client(to_x, to_y)