Skip to content

fix: 修复组队邀请默认勾选框点击后UI状态识别问题 (#1881) - #1886

Merged
runhey merged 3 commits into
runhey:masterfrom
allesgutefy:fix/invite-default-checkbox-timing
Oct 10, 2026
Merged

runhey merged 3 commits into
runhey:masterfrom
allesgutefy:fix/invite-default-checkbox-timing

Conversation

@allesgutefy

@allesgutefy allesgutefy commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

Issue 概要

组队战斗中,点击"默认邀请"勾选框后,OAS无法识别"已勾选"状态,导致无限循环等待、最终触发GameStuckError。

问题根因

tasks/Component/GeneralInvite/general_invite.py 第543-547行的循环逻辑:点击后立即截图,UI来不及刷新。

修复方案

点击后增加0.8秒延时,等待UI状态更新。

复现步骤(已验证)

  1. 组队战斗,第一场结束后出现"默认邀请"弹窗
  2. OAS点击勾选框后立即截图
  3. 识别不到"已勾选"状态,重复点击
  4. 60秒后超时

修复后验证

已在本地验证,0.8秒延时可正常识别"已勾选"状态并退出循环。

Fixes #1881

Sourcery 摘要

错误修复:

  • 允许 UI 状态在识别前刷新,防止重复点击默认邀请复选框。
Original summary in English

Sourcery 摘要

Bug 修复:

  • 修复默认邀请复选框点击后 UI 状态未及时识别,避免重复点击并导致组队邀请流程超时。
Original summary in English

Sourcery 摘要

错误修复:

  • 允许 UI 状态在检查前刷新,以防止重复点击默认邀请复选框以及团队邀请超时。
Original summary in English

Summary by Sourcery

Bug Fixes:

  • Prevent repeated default-invite checkbox clicks and team invitation timeouts by allowing the UI state to refresh before it is checked.

Summary by CodeRabbit

  • 问题修复
    • 点击“非默认邀请”后,等待时间由 1 秒延长至 3 秒,再继续后续流程。

修复组队邀请时,点击'默认邀请'勾选框后,UI来不及刷新导致无法识别'已勾选'状态,从而无法break循环、重复点击的问题。

根因:点击 I_I_NO_DEFAULT 后立即截图判断 I_I_DEFAULT,但游戏UI渲染需要时间,导致循环无法退出。

修复:在点击后增加0.8秒延时,确保UI状态更新后再继续判断。

Fixes runhey#1881

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

你好——我发现了 1 个问题

面向 AI Agent 的提示
请处理本次代码审查中的评论:

## 单独评论

### 评论 1
<location path="tasks/Component/GeneralInvite/general_invite.py" line_range="546" />
<code_context>
                     if self.appear(self.I_I_DEFAULT):
                         break
                     if self.appear_then_click(self.I_I_NO_DEFAULT, interval=1):
+                        sleep(0.8)
                         continue
         # 点击确认
</code_context>
<issue_to_address>
**队长邀请弹窗卡住**

当 Bondling Fairyland 的默认邀请弹窗出现,且复选框更新所需时间超过一次循环迭代时,bondling Fairyland 的 `GeneralInvite.check_and_invite` 在点击 `I_I_NO_DEFAULT` 后会立即进入下一次循环,因此可能会看到过时的未勾选图像,再次点击它,并且无法识别 `I_I_DEFAULT`;队长任务会一直卡住,直到超时。

在点击 `I_I_NO_DEFAULT` 后,等待复选框界面完成更新,再继续循环。
</issue_to_address>

Sourcery 评估

等待批准。 请先处理 1 个发现的问题。

阻塞性发现:tasks/Component/GeneralInvite/general_invite.py:546


Sourcery 对开源项目免费——如果您喜欢我们的审查,请考虑分享 ✨
Original comment in English

Hey - I've found 1 issue

Prompt for AI Agents
Please address the comments from this code review:

## Individual Comments

### Comment 1
<location path="tasks/Component/GeneralInvite/general_invite.py" line_range="546" />
<code_context>
                     if self.appear(self.I_I_DEFAULT):
                         break
                     if self.appear_then_click(self.I_I_NO_DEFAULT, interval=1):
+                        sleep(0.8)
                         continue
         # 点击确认
</code_context>
<issue_to_address>
**Leader invite popup stalls**

When the Bondling Fairyland default-invite popup appears and the checkbox update takes longer than one loop iteration, bondling Fairyland `GeneralInvite.check_and_invite` immediately loops after clicking `I_I_NO_DEFAULT`, so it can see the stale unchecked image, click it again, and fail to recognize `I_I_DEFAULT`; the leader task stalls until timeout.

Wait for the checkbox UI to update after clicking `I_I_NO_DEFAULT` before continuing the loop.
</issue_to_address>

Sourcery assessment

Approval pending. 1 finding to address first.

Blocking findings: tasks/Component/GeneralInvite/general_invite.py:546


Sourcery is free for open source - if you like our reviews please consider sharing them ✨

Comment thread tasks/Component/GeneralInvite/general_invite.py
@coderabbitai

coderabbitai Bot commented Oct 9, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 14dcdafe-9950-48e6-8a58-23a04fbcca50

📥 Commits

Reviewing files that changed from the base of the PR and between 62340f3 and ca7a418.


📒 Files selected for processing (1)
  • tasks/Component/GeneralInvite/general_invite.py

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review.



Walkthrough

check_and_invite 点击“非默认邀请”后新增 0.8 秒暂停,然后继续检查默认邀请选项。其余邀请确认流程未变。

关联问题评估

Objective Addressed Explanation
[#1881] 默认邀请选项识别失败时,避免 check_and_invite 无限循环卡住。 ❌ 新增暂停,但未修改识别条件,也未限制循环次数。

Priority: ➖ Normal

Severity of issue fixed: Medium

Merge Risk: ⚪ Minimal · up to ca7a4

The invite flow now waits before rechecking the default option, giving the UI time to update. No actionable merge-blocking risk is apparent.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

小兔点下邀请键,
等待零点八秒间。
再看勾选是否现,
耳朵竖起盯画面。
愿下一场快开演。

Comment @coderabbitai help to get the list of available commands.

@runhey

runhey commented Oct 9, 2026

Copy link
Copy Markdown
Owner

“if self.appear_then_click(self.I_I_NO_DEFAULT, interval=1):” 你把interval=3 看看下

@runhey

runhey commented Oct 9, 2026

Copy link
Copy Markdown
Owner

sleep 不大好

lygone added a commit to lygone/OnmyojiAutoScript that referenced this pull request Oct 10, 2026
 / runhey#1886)

2026-10-10 游戏更新改了 UI 美术,上游同日开了三个素材修复 PR,本提交移植与本库相关的部分。
注意:本库与上游 runhey/master 已长期分叉(共同祖先 2025-11-15;上游多 757 个提交、本库多 1062 个),
故按文件取用,而非合并分支。

--- 取自 runhey#1891(smallwin-jq 退出战斗确认按钮)
- gb/gb_exit_ensure.png 换用其素材(135x63 -> 95x46)
- I_EXIT_ENSURE 的 roi 同步收紧:roi_front=(701,414,95,46)、roi_back=(648,388,220,96)
  (原为固定位置比对 (674,388,135,63);新框完全落在金色"确定"按钮内,并容许弹窗轻微位移)
- gb/image.json 标注元数据同步
- 该 PR 其余 5 个文件只是注释/排序等装饰性改动,未采纳
- 交叉校验:与本地独立截取的同一弹窗素材在重叠区一致性 0.9874

--- 取自 runhey#1892(weirj2016-ai 悬赏封印独立奖励识别图)
- 新增 tasks/WantedQuests/wq/ui_rewardnew.png (239x24) 与规则 I_UI_REWARDNEW (threshold 0.7)
- tasks/base_task.py:ui_get_reward() / ui_reward_appear_click() 增加 reward_image 参数,
  默认仍用通用 I_UI_REWARD,行为不变;悬赏的奖励弹窗与通用那张不同型
- tasks/WantedQuests/script_task.py:两处宝箱奖励调用改为传 reward_image=self.I_UI_REWARDNEW
  本库悬赏探索继承探索任务,其"小纸人奖励"路径仍用通用 I_UI_REWARD(已修),未改动
- 未采用上游的 I_UI_REWARDnew 别名写法(本库类直接继承 assets,用 I_UI_REWARDNEW 即可)

--- 取自 runhey#1893(m123711 换御魂确认按钮)
- tasks/Component/SwitchSoul/ss/ss_sou_switch_sure.png 换用其素材(180x61,与 roi_front 尺寸一致,无代码改动)

--- 取自 runhey#1886(allesgutefy 组队邀请默认勾选框)
- check_and_invite() 点击 I_I_NO_DEFAULT 后 sleep(0.8),避免 UI 状态未刷新导致误判

未采纳:runhey#1885(本库已有 run_task_or_default_general_battle)、runhey#1862 彼世逢魔,
以及 runhey#1872/runhey#1870/runhey#1873/runhey#1847/runhey#1822(对应任务本库未启用)。
旧素材均本地备份为同名 .bak-20261010(未纳入版本库)。

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sourcery assessment

Approved.

@runhey
runhey merged commit 3ffe7d3 into runhey:master Oct 10, 2026
1 of 2 checks passed
@runhey

runhey commented Oct 10, 2026

Copy link
Copy Markdown
Owner

又给合到master去了

@allesgutefy

Copy link
Copy Markdown
Contributor Author

PR 更新说明

已根据开发者建议和本地测试结果更新:

  1. 代码修改:将 sleep(0.8) 替换为 interval=3
  2. 新增修改:I_GI_SURE 也改为 interval=3(经本地测试验证)
  3. 素材更新:更新了 gi_i_default.png、gi_i_no_default.png、gi_gi_sure.png、gi_cancel.png 四个素材,以适配游戏10月10日UI更新后的新界面

本地测试已通过,请审核。

barnettfan pushed a commit to barnettfan/OnmyojiAutoScript that referenced this pull request Oct 11, 2026
 / runhey#1886)

2026-10-10 游戏更新改了 UI 美术,上游同日开了三个素材修复 PR,本提交移植与本库相关的部分。
注意:本库与上游 runhey/master 已长期分叉(共同祖先 2025-11-15;上游多 757 个提交、本库多 1062 个),
故按文件取用,而非合并分支。

--- 取自 runhey#1891(smallwin-jq 退出战斗确认按钮)
- gb/gb_exit_ensure.png 换用其素材(135x63 -> 95x46)
- I_EXIT_ENSURE 的 roi 同步收紧:roi_front=(701,414,95,46)、roi_back=(648,388,220,96)
  (原为固定位置比对 (674,388,135,63);新框完全落在金色"确定"按钮内,并容许弹窗轻微位移)
- gb/image.json 标注元数据同步
- 该 PR 其余 5 个文件只是注释/排序等装饰性改动,未采纳
- 交叉校验:与本地独立截取的同一弹窗素材在重叠区一致性 0.9874

--- 取自 runhey#1892(weirj2016-ai 悬赏封印独立奖励识别图)
- 新增 tasks/WantedQuests/wq/ui_rewardnew.png (239x24) 与规则 I_UI_REWARDNEW (threshold 0.7)
- tasks/base_task.py:ui_get_reward() / ui_reward_appear_click() 增加 reward_image 参数,
  默认仍用通用 I_UI_REWARD,行为不变;悬赏的奖励弹窗与通用那张不同型
- tasks/WantedQuests/script_task.py:两处宝箱奖励调用改为传 reward_image=self.I_UI_REWARDNEW
  本库悬赏探索继承探索任务,其"小纸人奖励"路径仍用通用 I_UI_REWARD(已修),未改动
- 未采用上游的 I_UI_REWARDnew 别名写法(本库类直接继承 assets,用 I_UI_REWARDNEW 即可)

--- 取自 runhey#1893(m123711 换御魂确认按钮)
- tasks/Component/SwitchSoul/ss/ss_sou_switch_sure.png 换用其素材(180x61,与 roi_front 尺寸一致,无代码改动)

--- 取自 runhey#1886(allesgutefy 组队邀请默认勾选框)
- check_and_invite() 点击 I_I_NO_DEFAULT 后 sleep(0.8),避免 UI 状态未刷新导致误判

未采纳:runhey#1885(本库已有 run_task_or_default_general_battle)、runhey#1862 彼世逢魔,
以及 runhey#1872/runhey#1870/runhey#1873/runhey#1847/runhey#1822(对应任务本库未启用)。
旧素材均本地备份为同名 .bak-20261010(未纳入版本库)。
allesgutefy added a commit to allesgutefy/OnmyojiAutoScript that referenced this pull request Oct 11, 2026
- Add I_I_NO_DEFAULT interval=3 (fix incomplete fix from PR runhey#1886)
- Add I_GI_SURE interval=3
- Update 4 GI assets for Oct 10 game UI update
- PR runhey#1886 was only merged to master, not dev, so repeat changes here

Fixes runhey#1881
lygone added a commit to lygone/OnmyojiAutoScript that referenced this pull request Oct 16, 2026
…y#1930/runhey#1931)

上游确认 runhey#1881(组队邀请默认勾选框识别问题)的根因是勾选框素材随游戏 UI 更新失效,
最终方案为「改用 GlobalGame 共用勾选框素材 + 点击间隔放宽到 3 秒」。

本次移植:
- 素材(取自 runhey/master):ui_ui_check.png 3088->2708 (41x39)、
  ui_ui_uncheck.png 945->2183 (36x35)、ui_ui_confirm.png 14637->9019(上游通用确认键,
  在本库 Hunt 弹窗截图上实测 0.9973,阈值 0.8)
- tasks/Component/GeneralInvite/general_invite.py:invite_again / check_and_invite /
  check_then_accept 三处把邀请专用的 I_I_DEFAULT / I_I_NO_DEFAULT 换成共用
  I_UI_CHECK / I_UI_UNCHECK,点击间隔 1 -> 3;并移除此前移植 runhey#1886 时加的 sleep(0.8)
  (上游最终以 interval=3 取代它)。位置兼容性已核对:邀请勾选框 roi(541,342) 与共用规则
  roi_front(564,341) 基本重合,且共用规则带搜索区,更稳。

未采纳:
- runhey#1933 的探索困28 滑动修复:本库已是"按目标等级判断上/下滑"的更好实现;
- runhey#1933 的邀请第二人 sleep(3):本库 general_invite.py 为独立重写版,无对应代码;
- runhey#1915 的删除式重构、runhey#1913 的 battle_wait 改动:本库代码已分叉,风险大于收益。
旧素材本地备份为 .bak-20261016(未纳入版本库)。
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

八岐大蛇组队:默认邀请勾选后识别不到已勾选状态,check_and_invite 死循环卡死

2 participants