人格升级自动化: 长按入口、选队定位缺陷与一轮驱动脚本

Browse Source
把人格升级/同步这条只存在于 GUI 的链路自动化, 并定位到一个静默选错队伍的配置陷阱。

关键发现:
- 人格详情页是"长按"打开的, 单击只会选中/取消选中。lc-mcp 无 long-press 工具,
  但 drag 起终点相同即长按, 实测稳定可复现。
- select_team_by_order: true 按坐标位置点队伍, 列表位移几十像素就会点到隔壁;
  实测导致 AALC 选中空队伍 TEAMS #2 并空转 26 分钟。改回按名字查找后连续 4 次全中。
  该开关当初是为绕过"编队名匹配失败"而加, 但那个问题的真因是 sinner_order 全 0,
  修好之后名字匹配本可用——为症状加的开关在根因修好后反而成了新故障源。

新增 scripts/levelup.py (长按->详情->升级->同步) 与 scripts/auto_cycle.py
(刷材料->升级->同步->前后对比, 刻意只做一轮以便逐轮核对)。

实测: Rosespanner Workshop Fixer Lv.04->Lv.36 (HP 87->173) 并同步至三阶,
解锁 Skill 3 与新被动; N Corp. Mittelhammer Lv.14->Lv.26。
This commit is contained in:
Codex Agent
2026-10-05 14:37:34 +08:00
parent 3547d9c43f
commit aebedbcec8
3 changed files with 615 additions and 0 deletions
+145
View File
@@ -0,0 +1,145 @@
# -*- coding: utf-8 -*-
"""一轮自动推进: 刷材料 -> 升级最弱人格 -> 同步 -> 报告。
用法: python auto_cycle.py [--rounds N]
退出码: 0 正常完成一轮 / 1 失败
设计: 只做"一轮",不做无限循环——由外层(goal 轮次)负责重复与判断,
避免无人监督地长时间空转。每轮输出结构化报告供上层核对。
"""
import json
import subprocess
import sys
import time
PY = r'D:\lc-mcp\vendor\aalc\.venv\Scripts\python.exe'
HERE = r'D:\lc-mcp\scripts'
PROBE = HERE + r'\mcp_probe.py'
LEVELUP = HERE + r'\levelup.py'
# 导航
BTN_SINNERS = (1130, 805) # 主界面底部 Sinners
TAB_ALL_IDENTITIES = (1472, 245) # TEAMS 页 -> All Identities
# daily 轮询上限
DAILY_TIMEOUT_S = 45 * 60
def run(cmd):
r = subprocess.run(cmd, capture_output=True, text=True,
encoding='utf-8', errors='replace')
return (r.stdout or '') + (r.stderr or '')
def probe(tool, args=None):
cmd = [PY, '-X', 'utf8', PROBE, tool]
if args is not None:
cmd.append(json.dumps(args, ensure_ascii=False))
out = run(cmd)
for line in reversed(out.strip().splitlines()):
line = line.strip()
if line.startswith('{'):
try:
return json.loads(line)
except json.JSONDecodeError:
continue
return {}
def click(x, y):
return probe('click', {'x': int(x), 'y': int(y), 'times': 1})
def log(msg):
print('[%s] %s' % (time.strftime('%H:%M:%S'), msg), flush=True)
def goto_identities():
"""从任意位置尽力走到 罪人 -> Identities 网格。
只点 Sinners 按钮, 绝不点左上返回键——主界面上的返回键会进入剧情(Drive),
实测会掉进过场动画, 需要额外恢复。
"""
for attempt in range(5):
items = probe('get_state').get('items', [])
txt = ' | '.join(i.get('text', '') for i in items)
if 'IDENTITIES' in txt and 'Facades' in txt:
return True
if 'TEAMS #1' in txt or 'SIN COST' in txt or 'All Idensities' in txt:
click(*TAB_ALL_IDENTITIES)
time.sleep(3)
continue
if 'LUXCAVATION' in txt.upper() or 'MIRROR' in txt.upper():
# 在副本/关卡菜单里, 先回主界面
probe('keypress', {'key': 'esc'})
time.sleep(2)
continue
click(*BTN_SINNERS)
time.sleep(3.5)
items = probe('get_state').get('items', [])
txt = ' | '.join(i.get('text', '') for i in items)
return 'IDENTITIES' in txt and 'Facades' in txt
def run_daily():
log('起 daily(经验本x3 + 纽本x3)')
r = probe('run_task', {'task': 'daily'})
if not r.get('ok'):
return False, 'run_task 失败: %s' % r
log('daily 已启动, 开始轮询')
t0 = time.time()
while time.time() - t0 < DAILY_TIMEOUT_S:
time.sleep(60)
st = probe('task_status', {'lines': 1})
s = st.get('state')
if s != 'running':
el = int(time.time() - t0)
log('daily 结束: state=%s elapsed=%ds exit=%s'
% (s, el, st.get('exit_code')))
return s == 'succeeded', 'state=%s elapsed=%ds' % (s, el)
if int(time.time() - t0) % 600 < 60:
log(' ...running %ds' % int(time.time() - t0))
probe('stop_task')
return False, '超时 %ds' % DAILY_TIMEOUT_S
def report_grid():
out = run([PY, '-X', 'utf8', LEVELUP, 'list'])
return out.strip()
def main():
t_start = time.time()
log('=== 一轮开始 ===')
ok, info = run_daily()
log('刷材料: %s (%s)' % ('OK' if ok else 'FAIL', info))
if not ok:
log('=== 本轮失败: 刷材料未成功 ===')
return 1
# daily 结束后应回到主界面
time.sleep(8)
if not goto_identities():
log('无法进入 Identities 网格, 放弃本轮')
return 1
log('已进入 Identities 网格')
log('升级前:\n' + report_grid())
log('对队内最低者升级 + 同步')
out = run([PY, '-X', 'utf8', LEVELUP, 'weakest', '--uptie'])
for line in out.strip().splitlines():
log(' ' + line)
time.sleep(5)
if not goto_identities():
log('升级后无法回到网格')
return 1
log('升级后:\n' + report_grid())
log('=== 一轮结束, 耗时 %ds ===' % int(time.time() - t_start))
return 0
if __name__ == '__main__':
raise SystemExit(main())