自动化实战踩坑全记录 + 20 份运行日志归档
把 2026-10-05 无人值守养号过程中挖出的 14 个坑整理成 PITFALLS.md, 并按"离奇程度"排序。其中 6 个是 AALC 自身的缺陷或脆弱点。 最有价值的几条: - 人格详情页是"长按"打开的, 单击只能选中(移动端移植 UI 的反直觉设计)。 - 按名字选队会子串误匹配: "TEAMS #1" 是 "TEAMS #10" 的子串, 本机 40 个预设下极易命中空队伍, 且日志仍报"成功找到队伍 # 1"(假阳性), 症状是 0/5 刷屏 306 次、空转 27 分钟。 - 位置法选队会随列表滚动漂移, 落到 TEAMS #2; 固定偏移量补丁无效(已还原), 因为复位滑动的终点本身在漂移。 - 最终解法: 用游戏内 Team Code 把队伍复制进多个预设, 让落点不再有意义。 此后 10 轮 daily 全部 6/6 选队、0 卡死、0 错误。 - 同步到三阶会解锁并自动播放人格剧情, 导致脚本误报同步失败。 - 等级数字 OCR 两处都不可靠(网格小字与详情页艺术字), 改用 EXP 进度条反推。 - 主界面上按返回键会进入剧情 Drive; 拖拽滚动预设列表时起点必须在列表内。 logs/full/ 为 20 份原始日志的 gzip 归档(9.8MB -> 0.7MB), logs/summary.md 给出逐份指标对比与关键转折点, logs/*.txt 为四次关键事件的精简片段。 战果: 10 轮完整 daily, 升级 5 个人格(最高 Lv.04->36), 同步解锁技能3, 账号 037->041, 狂气 2896->3476 一分未花。
This commit is contained in:
+118
-3
@@ -8,6 +8,7 @@
|
|||||||
避免无人监督地长时间空转。每轮输出结构化报告供上层核对。
|
避免无人监督地长时间空转。每轮输出结构化报告供上层核对。
|
||||||
"""
|
"""
|
||||||
import json
|
import json
|
||||||
|
import os
|
||||||
import subprocess
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
import time
|
import time
|
||||||
@@ -16,8 +17,10 @@ PY = r'D:\lc-mcp\vendor\aalc\.venv\Scripts\python.exe'
|
|||||||
HERE = r'D:\lc-mcp\scripts'
|
HERE = r'D:\lc-mcp\scripts'
|
||||||
PROBE = HERE + r'\mcp_probe.py'
|
PROBE = HERE + r'\mcp_probe.py'
|
||||||
LEVELUP = HERE + r'\levelup.py'
|
LEVELUP = HERE + r'\levelup.py'
|
||||||
|
LUNACY_BASELINE = os.path.expanduser(r'~\lc_mcp\lunacy_baseline.txt')
|
||||||
|
|
||||||
# 导航
|
# 导航
|
||||||
|
BACK = (85, 75) # 只在 Sinners 内部退层用, 主界面上按它会进剧情
|
||||||
BTN_SINNERS = (1130, 805) # 主界面底部 Sinners
|
BTN_SINNERS = (1130, 805) # 主界面底部 Sinners
|
||||||
TAB_ALL_IDENTITIES = (1472, 245) # TEAMS 页 -> All Identities
|
TAB_ALL_IDENTITIES = (1472, 245) # TEAMS 页 -> All Identities
|
||||||
|
|
||||||
@@ -81,6 +84,50 @@ def goto_identities():
|
|||||||
return 'IDENTITIES' in txt and 'Facades' in txt
|
return 'IDENTITIES' in txt and 'Facades' in txt
|
||||||
|
|
||||||
|
|
||||||
|
def on_teams_screen(txt):
|
||||||
|
return ('SIN COST' in txt) or ('All Idensities' in txt) or ('All E.6.0' in txt)
|
||||||
|
|
||||||
|
|
||||||
|
def on_grid(txt):
|
||||||
|
return 'IDENTITIES' in txt and 'Facades' in txt
|
||||||
|
|
||||||
|
|
||||||
|
def ensure_team1():
|
||||||
|
"""进 TEAMS 界面, 把预设列表滚到顶并选中 TEAMS #1。
|
||||||
|
|
||||||
|
实测坑: 这个账号有 40 个队伍预设, 而 AALC 的选队搜索只朝列表下方扫
|
||||||
|
(dy 为负), 列表一旦停在底部就永远找不到 TEAMS #1, 日志表现为
|
||||||
|
"找不到队伍 # 1" 然后整轮空转。所以每轮开跑前先把列表拉回顶部。
|
||||||
|
"""
|
||||||
|
for _ in range(5):
|
||||||
|
items = probe('get_state').get('items', [])
|
||||||
|
txt = ' | '.join(i.get('text', '') for i in items)
|
||||||
|
if on_teams_screen(txt):
|
||||||
|
break
|
||||||
|
if on_grid(txt):
|
||||||
|
click(*BACK) # 网格 -> TEAMS, 仍在 Sinners 内, 安全
|
||||||
|
time.sleep(3)
|
||||||
|
continue
|
||||||
|
click(*BTN_SINNERS)
|
||||||
|
time.sleep(3.5)
|
||||||
|
|
||||||
|
for _ in range(10):
|
||||||
|
items = probe('get_state').get('items', [])
|
||||||
|
cand = [i for i in items
|
||||||
|
if i.get('text', '').strip().replace(' ', '') in
|
||||||
|
('TEAMS#1', 'TFAMS#1') and i.get('x', 999) < 320]
|
||||||
|
if cand:
|
||||||
|
top = min(cand, key=lambda i: i.get('y', 0))
|
||||||
|
click(top['x'], top['y'])
|
||||||
|
time.sleep(2.5)
|
||||||
|
return True
|
||||||
|
# 向下拖拽 = 列表内容下移 = 露出更靠前的预设
|
||||||
|
probe('drag', {'from_x': 190, 'from_y': 400,
|
||||||
|
'to_x': 190, 'to_y': 700})
|
||||||
|
time.sleep(2)
|
||||||
|
return False
|
||||||
|
|
||||||
|
|
||||||
def run_daily():
|
def run_daily():
|
||||||
log('起 daily(经验本x3 + 纽本x3)')
|
log('起 daily(经验本x3 + 纽本x3)')
|
||||||
r = probe('run_task', {'task': 'daily'})
|
r = probe('run_task', {'task': 'daily'})
|
||||||
@@ -108,26 +155,94 @@ def report_grid():
|
|||||||
return out.strip()
|
return out.strip()
|
||||||
|
|
||||||
|
|
||||||
|
def read_lunacy():
|
||||||
|
"""从主界面读狂气余额(LUNACY 标签右下方的数字)。读不到返回 None。"""
|
||||||
|
items = probe('get_state').get('items', [])
|
||||||
|
lab = None
|
||||||
|
for it in items:
|
||||||
|
if 'LUNACY' in it.get('text', '').upper():
|
||||||
|
lab = it
|
||||||
|
break
|
||||||
|
if not lab:
|
||||||
|
return None
|
||||||
|
best = None
|
||||||
|
for it in items:
|
||||||
|
t = it.get('text', '').strip()
|
||||||
|
if t.isdigit() and len(t) >= 3:
|
||||||
|
dy = it.get('y', 0) - lab.get('y', 0)
|
||||||
|
dx = abs(it.get('x', 0) - lab.get('x', 0))
|
||||||
|
if 0 < dy < 70 and dx < 130:
|
||||||
|
best = int(t)
|
||||||
|
return best
|
||||||
|
|
||||||
|
|
||||||
|
def lunacy_guard():
|
||||||
|
"""狂气只许不降。用户明确要求狂气只能用于抽卡。
|
||||||
|
|
||||||
|
返回 (ok, 说明)。首次运行写入基线。
|
||||||
|
"""
|
||||||
|
cur = read_lunacy()
|
||||||
|
if cur is None:
|
||||||
|
return True, '读不到狂气余额, 跳过校验'
|
||||||
|
base = None
|
||||||
|
if os.path.exists(LUNACY_BASELINE):
|
||||||
|
try:
|
||||||
|
base = int(open(LUNACY_BASELINE, encoding='utf-8').read().strip())
|
||||||
|
except ValueError:
|
||||||
|
base = None
|
||||||
|
if base is None:
|
||||||
|
with open(LUNACY_BASELINE, 'w', encoding='utf-8') as f:
|
||||||
|
f.write(str(cur))
|
||||||
|
return True, '记录狂气基线 %d' % cur
|
||||||
|
if cur < base:
|
||||||
|
return False, '狂气从 %d 降到 %d —— 已消耗, 立即停止' % (base, cur)
|
||||||
|
if cur > base:
|
||||||
|
with open(LUNACY_BASELINE, 'w', encoding='utf-8') as f:
|
||||||
|
f.write(str(cur))
|
||||||
|
return True, '狂气 %d -> %d (增加, 更新基线)' % (base, cur)
|
||||||
|
return True, '狂气 %d 未变' % cur
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
t_start = time.time()
|
t_start = time.time()
|
||||||
log('=== 一轮开始 ===')
|
log('=== 一轮开始 ===')
|
||||||
|
|
||||||
|
ok, info = lunacy_guard()
|
||||||
|
log('狂气校验: %s (%s)' % ('OK' if ok else 'FAIL', info))
|
||||||
|
if not ok:
|
||||||
|
log('=== 中止: 狂气被消耗, 按用户要求不得使用 ===')
|
||||||
|
return 1
|
||||||
|
|
||||||
|
# 先把预设列表拉回顶部并选中 TEAMS #1——否则 AALC 会"找不到队伍 # 1"
|
||||||
|
if ensure_team1():
|
||||||
|
log('已选中 TEAMS #1')
|
||||||
|
else:
|
||||||
|
log('[warn] 未能确认选中 TEAMS #1, 继续尝试')
|
||||||
|
|
||||||
ok, info = run_daily()
|
ok, info = run_daily()
|
||||||
log('刷材料: %s (%s)' % ('OK' if ok else 'FAIL', info))
|
log('刷材料: %s (%s)' % ('OK' if ok else 'FAIL', info))
|
||||||
if not ok:
|
if not ok:
|
||||||
log('=== 本轮失败: 刷材料未成功 ===')
|
log('=== 本轮失败: 刷材料未成功 ===')
|
||||||
return 1
|
return 1
|
||||||
|
|
||||||
# daily 结束后应回到主界面
|
# daily 结束后正在主界面, 这里才是能读到 LUNACY 的时机
|
||||||
time.sleep(8)
|
time.sleep(8)
|
||||||
|
ok, info = lunacy_guard()
|
||||||
|
log('狂气校验(刷后): %s (%s)' % ('OK' if ok else 'FAIL', info))
|
||||||
|
if not ok:
|
||||||
|
log('=== 中止: 狂气被消耗, 按用户要求不得使用 ===')
|
||||||
|
return 1
|
||||||
|
|
||||||
if not goto_identities():
|
if not goto_identities():
|
||||||
log('无法进入 Identities 网格, 放弃本轮')
|
log('无法进入 Identities 网格, 放弃本轮')
|
||||||
return 1
|
return 1
|
||||||
log('已进入 Identities 网格')
|
log('已进入 Identities 网格')
|
||||||
log('升级前:\n' + report_grid())
|
log('升级前:\n' + report_grid())
|
||||||
|
|
||||||
log('对队内最低者升级 + 同步')
|
log('对队内低于 Lv.34 的人格升级 + 同步')
|
||||||
out = run([PY, '-X', 'utf8', LEVELUP, 'weakest', '--uptie'])
|
# 用 progress 而非 weakest: 网格 OCR 会把 LV14 读成 Lv.1,
|
||||||
|
# progress 会逐个打开详情页以真实等级判断目标。
|
||||||
|
out = run([PY, '-X', 'utf8', LEVELUP, 'progress', '34', '--uptie'])
|
||||||
for line in out.strip().splitlines():
|
for line in out.strip().splitlines():
|
||||||
log(' ' + line)
|
log(' ' + line)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user