feat(server): 新增 /api/expedition/auto_check 挂机专用端点,优化浴室维修为全部修理#443
Open
syokounya wants to merge 8 commits intoOpenWSGR:mainfrom
Open
feat(server): 新增 /api/expedition/auto_check 挂机专用端点,优化浴室维修为全部修理#443syokounya wants to merge 8 commits intoOpenWSGR:mainfrom
syokounya wants to merge 8 commits intoOpenWSGR:mainfrom
Conversation
dc581a8 to
905d68d
Compare
- 不受 _require_idle 限制,专供 Scheduler 定时远征检查调用 - 顺带领取任务奖励(collect_rewards) - 根据 ctx.active_fight_tasks 智能判断是否执行浴室维修,避免战斗中占用舰队
ddadec6 to
c7ec46f
Compare
for more information, see https://pre-commit.ci
…GR#445) * fix(fleet): support ship-type selector and alias-safe search - add ship_type to FleetRuleRequest and slot selector - normalize search_name for first search and in-compare matching - filter choose-ship hits by OCR-detected ship type * chore(release): bump version to 2.1.9.post7 * fix(fleet): address copilot review on ship_type validation - validate and normalize ship_type in FleetRuleRequest - update change_fleet selector docs to include ship_type - include ship_type constraint in choose-ship final failure diagnostics * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
- 不受 _require_idle 限制,专供 Scheduler 定时远征检查调用 - 顺带领取任务奖励(collect_rewards) - 根据 ctx.active_fight_tasks 智能判断是否执行浴室维修,避免战斗中占用舰队
- 将 CHAPTER_NAV_MAX_ATTEMPTS 从 12 提升到 20,避免远距离切换超时 - navigate_to_chapter 改为批量点击策略: - 当距离 > 2 章时,一次性连续点击最多 4 章,然后统一等待 1.0s - 让动画完全结束后再 OCR 验证,大幅减少过渡态抖动导致的轮空 - 近距离(≤2 章)保持单步点击,确保精度 - 更新 .gitignore 忽略 .tmp/
for more information, see https://pre-commit.ci
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
背景与问题
当前 GUI 的自动远征定时检查仅能通过
/api/expedition/check收取远征,无法顺带领取任务奖励和执行浴室维修。用户长时间挂机时仍需手动操作,体验不佳。此外,现有的
/api/expedition/check、/api/reward/collect、/api/repair/bath均受_require_idle()限制,只要后端有战斗任务在运行,这些接口就会返回409 任务执行中,无法操作。这导致挂机期间即使只是"收菜",也会被战斗任务阻塞。另一个问题是原有的
repair_in_bath实现是点击"选择修理" overlay 中的第一个舰船逐个修理,效率低且容易在 overlay 关闭检测上超时失败。解决方案
1. 新增挂机专用端点
/api/expedition/auto_check在
server/routes/ops.py中新增POST /api/expedition/auto_check:_require_idle()限制:专供 Scheduler 的定时远征检查调用,确保挂机"收菜"不会被战斗任务拦截。collect_expedition(ctx)— 收取已完成远征collect_rewards(ctx)— 领取任务奖励ctx.active_fight_tasks,若大于 0 则跳过维修并记录原因;否则执行维修results数据,方便前端展示日志。2. 浴室维修改为点击"全部修理"
在
ui/bath_page/signatures.py中新增:CLICK_REPAIR_ALL(0.8625, 0.1639) — 全部修理按钮坐标REPAIR_ALL_BUTTON_COLOR((28, 128, 226), 30.0) — 蓝色按钮颜色CLOSE_OVERLAY_BUTTON_COLOR((197, 199, 194), 30.0) — 关闭按钮灰色颜色在
ui/bath_page/page.py中新增click_repair_all()方法:close_choose_repair_overlay()关闭浮层在
ops/repair.py中:repair_in_bath改调page.click_repair_all()goto_page(ctx, PageName.MAIN),确保流程结束后回到主界面,避免后续导航出错3. 战斗任务感知
利用已有的
ctx.active_fight_tasks计数器(由TaskScheduler._run_task维护),在自动检查浴室维修前进行判断,避免战斗中占用舰队导致战斗中断或被迫使用快修。影响范围
autowsgr/server/routes/ops.py— 新增expedition_auto_check端点autowsgr/ui/bath_page/signatures.py— 新增全部修理相关常量autowsgr/ui/bath_page/page.py— 新增click_repair_all()方法autowsgr/ops/repair.py— 改调全部修理并返回主界面配套前端改动
前端 PR 见:
yltx/AutoWSGR-GUI对应分支feat/gui-expedition-repair