无人值守自动化: 配置预检、选队精确匹配、窗口守护、卡死重跑、计划任务, AALC 升级到 b0f4393

Browse Source
- lc_mcp/preflight.py: 启动前拦截 sinner_order 全 0、会花狂气、窗口放不进桌面 (退出码 3)
- lc_mcp/aalc_patches.py: 队伍名按编号精确匹配 (TEAMS #1 不再命中 #10); 后台守护客户区 16:9
- auto_cycle.py: AALC 卡死后停掉重跑; --mirror 打镜牢; 每轮写 cycle_*.log/.json 报告
- install_unattended.ps1: 注册会话看门狗 (每 5 分钟) 与每日一轮计划任务
- lc_ui.py: pythonw 启动时子进程改用 python 且不弹窗
- vendor/aalc: 7452fad -> b0f4393 (镜牢楼层识别、困牢奖励、排队启动修复)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
yws
2026-10-13 03:12:19 +00:00
co-authored by Claude Opus 5.5
parent 6b129ddba3
commit 2190f57abe
10 changed files with 664 additions and 60 deletions
+25 -2
View File
@@ -9,7 +9,9 @@ import json
import os import os
import sys import sys
from . import preflight
from .aalc_engine import bootstrap from .aalc_engine import bootstrap
from .aalc_patches import WindowGuard, install_exact_team_match
# 任务 -> {参数名: AALC 配置项}; 参数只在本次运行内生效 # 任务 -> {参数名: AALC 配置项}; 参数只在本次运行内生效
TASKS = { TASKS = {
@@ -20,6 +22,11 @@ TASKS = {
'mirror': {'count': 'set_mirror_count'}, 'mirror': {'count': 'set_mirror_count'},
} }
RESTORE_ENV = 'LCP_RESTORE_FILE' RESTORE_ENV = 'LCP_RESTORE_FILE'
PREFLIGHT_EXIT = 3
def log(msg):
print(msg, flush=True)
def apply_overrides(cfg, task, params, restore_path=None): def apply_overrides(cfg, task, params, restore_path=None):
@@ -61,17 +68,28 @@ def run(task, params):
bootstrap() bootstrap()
from module.automation import auto from module.automation import auto
from module.config import cfg from module.config import cfg
from module.game_and_screen import screen
from tasks.base import script_task_scheme as scheme from tasks.base import script_task_scheme as scheme
from tasks.base.retry_monitor import retry_monitor from tasks.base.retry_monitor import retry_monitor
from tasks.battle import battle from tasks.battle import battle
from utils.path_manager import path_manager from utils.path_manager import path_manager
problems = preflight.check(preflight.collect(cfg), task,
desktop=None if cfg.simulator else preflight.desktop_size())
if problems:
for p in problems:
log('[ERROR] [lc_mcp] preflight: %s' % p)
return PREFLIGHT_EXIT
install_exact_team_match(auto, log)
guard = WindowGuard(screen, cfg, log=log)
guard.start()
restore_path = os.environ.get(RESTORE_ENV) restore_path = os.environ.get(RESTORE_ENV)
originals = apply_overrides(cfg, task, params, restore_path) originals = apply_overrides(cfg, task, params, restore_path)
try: try:
if task == 'all': if task == 'all':
scheme.script_task() scheme.script_task()
return return 0
# 与 script_task() 相同的前置步骤 # 与 script_task() 相同的前置步骤
scheme.init_game() scheme.init_game()
path_manager.initialize_paths() path_manager.initialize_paths()
@@ -87,7 +105,9 @@ def run(task, params):
'enkephalin': scheme.Buy_enkephalin, 'enkephalin': scheme.Buy_enkephalin,
'mirror': scheme.Mirror_task, 'mirror': scheme.Mirror_task,
}[task]() }[task]()
return 0
finally: finally:
guard.stop()
retry_monitor.stop() retry_monitor.stop()
restore(cfg, originals, restore_path) restore(cfg, originals, restore_path)
@@ -107,7 +127,10 @@ def main(argv):
print('unknown params for %s: %s' % (task, ', '.join(sorted(unknown))), file=sys.stderr) print('unknown params for %s: %s' % (task, ', '.join(sorted(unknown))), file=sys.stderr)
return 2 return 2
print('[lc_mcp] task %s start %s' % (task, json.dumps(params)), flush=True) print('[lc_mcp] task %s start %s' % (task, json.dumps(params)), flush=True)
run(task, params) code = run(task, params)
if code:
print('[lc_mcp] task %s aborted (exit %s)' % (task, code), flush=True)
return code
print('[lc_mcp] task %s done' % task, flush=True) print('[lc_mcp] task %s done' % task, flush=True)
return 0 return 0