按 docs/feedback/2026-10-13/TEST_PLAN.md 在 Windows 实机上跑完到第 4 步,
结果与交付物在 docs/feedback/2026-10-13/results/。
通过: 第1步(记录配置)/第2步(坐标缩放)/第3步(预检真实拦截一次后放行)
第4步 daily 成功(选队 6/6 全走补丁覆盖的 :188 名字查找, 0/5卡死=0, ERROR=0)
镜牢成功(59 分钟 exit=0), 第5步窗口守护真实触发, 第7步看门狗触发成功
被环境挡住: 子模块 AALC 7452fad -> b0f4393 (GitHub 不通, 6 个镜像全挂)
修掉 3 个测试中实测到的缺陷:
1. 卡死检测认不出"界面误判"型卡死 (lc_mcp/tasks.py)
原判据只有内容相关的 empty_team 一条。实测 AALC 把镜牢入口误认成经验本界面,
对着误匹配模板连点 18 分钟, 日志一直在涨所以计数法抓不到, 外层只能干等 45 分钟超时。
加一条与内容无关的判据: 里程碑(开始执行/结束执行)多久没前进。
实测 1193 秒无进展被识别, 外层 11 分钟即自愈(原来 45 分钟)。
新增 tests/test_stall_no_progress.py 5 个用例。
2. 看门狗间隔 5 分钟过长 (计划任务 + scripts/install_unattended.ps1)
用户断开 RDP 后最长 4 分钟黑屏, AALC 在此期间爆出 134 个错误。
改为 1 分钟(Windows 计划任务下限, PT30S 会被拒)。
3. 升级判定假阴性 (scripts/levelup.py)
实测 Zwei 从 Lv.33 升到 Lv.40(MAX)、券也确实扣了, 但脚本报 FAIL:
"Confirm 后 Power-up 窗口仍在"。旧代码在弹窗残留时直接返回失败,
根本没走到读详情页那步 —— 而详情页的等级才是事实来源。
改为: 先关残留弹窗, 再用详情页的等级/经验条下结论。
新增 test_popup_still_open_but_level_rose_is_still_success。
测试全套 207/207 通过(原 201 + 新增 6)。
未完成: 第6步注册计划任务(等第4步确认), 子模块升级(需可访问 GitHub 的网络)。
另记: AALC 上游 tasks/daily/get_prize.py:44 的 from config import cfg 是错的,
只影响 to_get_reward 路径, daily/镜牢不经过; 建议升级子模块后复核。
另记: README 的 unittest discover -s tests 在 Python 3.13+Windows 上不成立,
需 -s tests -t tests。
75 lines
3.9 KiB
PowerShell
75 lines
3.9 KiB
PowerShell
# 注册无人值守用的两个计划任务 (在跑游戏的那个账号下, 普通 PowerShell 即可):
|
|
# LcMCPKeepDisplay 每 5 分钟跑 keep_display.ps1: 会话掉到 Disc 时重挂 console, 防止截图全黑
|
|
# LcMCPDailyCycle 每天定时跑 auto_cycle.py: 刷材料 -> 镜牢 -> 升级/同步, 报告写到 ~\lc_mcp\cycles
|
|
#
|
|
# 用法:
|
|
# powershell -ExecutionPolicy Bypass -File scripts\install_unattended.ps1
|
|
# 可选: -At 05:30 每日运行时间。游戏每日重置为 06:00 (KST), 即北京时间 05:00
|
|
# -Mirror 1 每轮镜牢局数, 0 = 不打镜牢
|
|
# -Target 34 把队内人格升到的等级
|
|
# -Python <路径> 默认 vendor\aalc\.venv\Scripts\pythonw.exe (无窗口, 不抢游戏焦点)
|
|
# -NoWatchdog 只装每日任务
|
|
# -Uninstall
|
|
#
|
|
# 前提: LcMCPServer 已用 install_logon_task.ps1 装好并在运行。
|
|
# 先手动跑一轮确认无误再装: python scripts\auto_cycle.py --mirror 1
|
|
param(
|
|
[string]$At = "05:30",
|
|
[int]$Mirror = 1,
|
|
[int]$Target = 34,
|
|
[string]$Python = "",
|
|
[switch]$NoWatchdog,
|
|
[switch]$Uninstall
|
|
)
|
|
$ErrorActionPreference = "Stop"
|
|
$Repo = Split-Path -Parent $PSScriptRoot
|
|
$Watchdog = "LcMCPKeepDisplay"
|
|
$Daily = "LcMCPDailyCycle"
|
|
|
|
if ($Uninstall) {
|
|
foreach ($name in @($Watchdog, $Daily)) {
|
|
Unregister-ScheduledTask -TaskName $name -Confirm:$false -ErrorAction SilentlyContinue
|
|
Write-Output "removed $name"
|
|
}
|
|
exit 0
|
|
}
|
|
|
|
if (-not $Python) { $Python = Join-Path $Repo "vendor\aalc\.venv\Scripts\pythonw.exe" }
|
|
if (-not (Test-Path $Python)) {
|
|
throw "找不到 Python: $Python`n先在 vendor\aalc 里执行 uv sync, 或用 -Python 指定"
|
|
}
|
|
if (-not (Get-ScheduledTask -TaskName "LcMCPServer" -ErrorAction SilentlyContinue)) {
|
|
Write-Warning "没有找到 LcMCPServer 计划任务, 每日任务需要它: 先运行 scripts\install_logon_task.ps1"
|
|
}
|
|
|
|
$user = "$env:USERDOMAIN\$env:USERNAME"
|
|
# Limited: keep_display.ps1 自己用 RunAs 静默提权跑 tscon (需要 ConsentPromptBehaviorAdmin=0)
|
|
$principal = New-ScheduledTaskPrincipal -UserId $user -LogonType Interactive -RunLevel Limited
|
|
|
|
if (-not $NoWatchdog) {
|
|
$ps = "$env:SystemRoot\System32\WindowsPowerShell\v1.0\powershell.exe"
|
|
$script = Join-Path $PSScriptRoot "keep_display.ps1"
|
|
$action = New-ScheduledTaskAction -Execute $ps -WorkingDirectory $Repo `
|
|
-Argument "-NoProfile -NonInteractive -WindowStyle Hidden -ExecutionPolicy Bypass -File `"$script`""
|
|
$trigger = New-ScheduledTaskTrigger -Once -At (Get-Date).AddMinutes(1) `
|
|
-RepetitionInterval (New-TimeSpan -Minutes 1) -RepetitionDuration (New-TimeSpan -Days 3650)
|
|
$settings = New-ScheduledTaskSettingsSet -AllowStartIfOnBatteries -DontStopIfGoingOnBatteries `
|
|
-ExecutionTimeLimit (New-TimeSpan -Minutes 3) -MultipleInstances IgnoreNew
|
|
Register-ScheduledTask -TaskName $Watchdog -Action $action -Trigger $trigger -Principal $principal `
|
|
-Settings $settings -Force | Out-Null
|
|
Write-Output "registered $Watchdog (every 5 min) -> $script"
|
|
}
|
|
|
|
$cycle = Join-Path $PSScriptRoot "auto_cycle.py"
|
|
$action = New-ScheduledTaskAction -Execute $Python -WorkingDirectory $Repo `
|
|
-Argument "-X utf8 `"$cycle`" --mirror $Mirror --target $Target"
|
|
$trigger = New-ScheduledTaskTrigger -Daily -At $At
|
|
# 一轮 daily 约 20 分钟, 每局镜牢约 40 分钟; 超过上限由计划任务强杀
|
|
$limit = New-TimeSpan -Minutes (60 + 75 * [Math]::Max($Mirror, 0))
|
|
$settings = New-ScheduledTaskSettingsSet -AllowStartIfOnBatteries -DontStopIfGoingOnBatteries `
|
|
-StartWhenAvailable -ExecutionTimeLimit $limit -MultipleInstances IgnoreNew
|
|
Register-ScheduledTask -TaskName $Daily -Action $action -Trigger $trigger -Principal $principal `
|
|
-Settings $settings -Force | Out-Null
|
|
Write-Output "registered $Daily (daily at $At, mirror=$Mirror, target=Lv.$Target, limit=$limit)"
|
|
Write-Output "reports -> $env:USERPROFILE\lc_mcp\cycles\cycle_*.json"
|