Skip to content

悬赏封印使用独立奖励识别图 - #1892

Closed
weirj2016-ai wants to merge 1 commit into
runhey:devfrom
weirj2016-ai:fix/wantedquests-reward-template
Closed

weirj2016-ai wants to merge 1 commit into
runhey:devfrom
weirj2016-ai:fix/wantedquests-reward-template

Conversation

@weirj2016-ai

@weirj2016-ai weirj2016-ai commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

改动内容

  • 为悬赏封印增加 I_UI_REWARDnew 模板,并按提供的整图和识别图设置匹配区域。
  • 悬赏封印领取成功流程改用新模板;基础奖励识别接口增加可选模板参数,未传入时仍使用公共 I_UI_REWARD。

讨论

请确认 I_UI_REWARDnew 是否应只供悬赏封印使用。当前实现保留公共 I_UI_REWARD,新图仅在悬赏封印流程中使用。

验证

  • 已通过提交差异的 git diff --check。
  • 未运行游戏内实测。

Sourcery 总结

为悬赏封印奖励领取流程接入独立识别模板,并保留通用奖励识别的默认行为。

新功能:

  • 为悬赏封印流程增加独立的奖励识别图模板。

增强:

  • 支持奖励领取接口按场景选择识别模板,未指定时继续使用通用模板。
Original summary in English

Sourcery 总结

为悬赏封印接入独立的奖励识别模板,同时保留通用奖励识别的默认行为。

新功能:

  • 为悬赏封印奖励领取流程增加独立的奖励识别模板。

增强功能:

  • 支持奖励领取接口按场景使用指定的识别模板;未指定时继续使用通用模板。
Original summary in English

Summary by Sourcery

为悬赏封印接入独立奖励识别模板,同时保留通用奖励识别的默认行为。

New Features:

  • 为悬赏封印奖励领取流程增加独立的奖励识别模板。

Enhancements:

  • 支持奖励领取接口按场景使用指定识别模板,并在未指定时继续使用通用模板。

Summary by CodeRabbit

  • 功能改进
    • 悬赏探索、悬赏箱和宝箱奖励领取流程现在可识别对应的奖励提示,并据此完成奖励确认与关闭。

@weirj2016-ai
weirj2016-ai changed the base branch from master to dev October 10, 2026 04:11

@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/WantedQuests/assets.py" line_range="135" />
<code_context>
 	# 庭院悬赏任务界面 单个任务点开后的界面 是否为现世任务标志 
 	I_WQ_TRACE_ONE_REALWORLD = RuleImage(roi_front=(850,470,180,180), roi_back=(850,470,180,180), threshold=0.8, method="Template matching", file="./tasks/WantedQuests/wq/wq_trace_one_realworld.png")
+	# 悬赏封印获得奖励
+	I_UI_REWARDNEW = RuleImage(roi_front=(523,248,239,24), roi_back=(500,225,285,70), threshold=0.7, method="Template matching", file="./tasks/WantedQuests/wq/ui_rewardnew.png")


</code_context>
<issue_to_address>
**悬赏奖励在加载图像时崩溃**

悬赏任务尝试使用新模板识别奖励时,`RuleImage.load_image` 会针对配置的模板路径调用 `fromfile`。由于该路径对应的文件不存在于仓库中,加载奖励匹配器会抛出 `FileNotFoundError`,从而中止悬赏任务的奖励处理。

请将 `tasks/WantedQuests/wq/ui_rewardnew.png` 添加到配置路径对应的仓库中,或将该规则指向现有图像。

另外还涉及 `tasks/WantedQuests/script_task.py:69` 和 `tasks/WantedQuests/explore.py:84`。
</issue_to_address>

Sourcery 评估

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

阻塞性发现:tasks/WantedQuests/assets.py:135


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/WantedQuests/assets.py" line_range="135" />
<code_context>
 	# 庭院悬赏任务界面 单个任务点开后的界面 是否为现世任务标志 
 	I_WQ_TRACE_ONE_REALWORLD = RuleImage(roi_front=(850,470,180,180), roi_back=(850,470,180,180), threshold=0.8, method="Template matching", file="./tasks/WantedQuests/wq/wq_trace_one_realworld.png")
+	# 悬赏封印获得奖励
+	I_UI_REWARDNEW = RuleImage(roi_front=(523,248,239,24), roi_back=(500,225,285,70), threshold=0.7, method="Template matching", file="./tasks/WantedQuests/wq/ui_rewardnew.png")


</code_context>
<issue_to_address>
**Wanted rewards crash on image load**

When wanted Quests tries to recognize a reward using the new template, `RuleImage.load_image` calls `fromfile` for the configured template path, which is absent from the repository, so loading the reward matcher raises `FileNotFoundError` and aborts Wanted Quests reward handling.

Add `tasks/WantedQuests/wq/ui_rewardnew.png` to the repository at the configured path, or point the rule to an existing image.

Also at `tasks/WantedQuests/script_task.py:69`, `tasks/WantedQuests/explore.py:84`.
</issue_to_address>

Sourcery assessment

Approval pending. 1 finding to address first.

Blocking findings: tasks/WantedQuests/assets.py:135


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

# 庭院悬赏任务界面 单个任务点开后的界面 是否为现世任务标志
I_WQ_TRACE_ONE_REALWORLD = RuleImage(roi_front=(850,470,180,180), roi_back=(850,470,180,180), threshold=0.8, method="Template matching", file="./tasks/WantedQuests/wq/wq_trace_one_realworld.png")
# 悬赏封印获得奖励
I_UI_REWARDNEW = RuleImage(roi_front=(523,248,239,24), roi_back=(500,225,285,70), threshold=0.7, method="Template matching", file="./tasks/WantedQuests/wq/ui_rewardnew.png")

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟠 High · 悬赏奖励在加载图像时崩溃

悬赏任务尝试使用新模板识别奖励时,RuleImage.load_image 会针对配置的模板路径调用 fromfile。由于该路径对应的文件不存在于仓库中,加载奖励匹配器会抛出 FileNotFoundError,从而中止悬赏任务的奖励处理。

请将 tasks/WantedQuests/wq/ui_rewardnew.png 添加到配置路径对应的仓库中,或将该规则指向现有图像。

另外还涉及 tasks/WantedQuests/script_task.py:69 和 tasks/WantedQuests/explore.py:84。

给 AI Agent 的提示
在 `tasks/WantedQuests/assets.py` 第 135 行:

**悬赏奖励在加载图像时崩溃**

悬赏任务尝试使用新模板识别奖励时,`RuleImage.load_image` 会针对配置的模板路径调用 `fromfile`。由于该路径对应的文件不存在于仓库中,加载奖励匹配器会抛出 `FileNotFoundError`,从而中止悬赏任务的奖励处理。

请将 `tasks/WantedQuests/wq/ui_rewardnew.png` 添加到配置路径对应的仓库中,或将该规则指向现有图像。

另外还涉及 `tasks/WantedQuests/script_task.py:69` 和 `tasks/WantedQuests/explore.py:84`。
Original comment in English

🟠 High · Wanted rewards crash on image load

When wanted Quests tries to recognize a reward using the new template, RuleImage.load_image calls fromfile for the configured template path, which is absent from the repository, so loading the reward matcher raises FileNotFoundError and aborts Wanted Quests reward handling.

Add tasks/WantedQuests/wq/ui_rewardnew.png to the repository at the configured path, or point the rule to an existing image.

Also at tasks/WantedQuests/script_task.py:69, tasks/WantedQuests/explore.py:84.

Prompt for AI agents
In `tasks/WantedQuests/assets.py` at line 135:

**Wanted rewards crash on image load**

When wanted Quests tries to recognize a reward using the new template, `RuleImage.load_image` calls `fromfile` for the configured template path, which is absent from the repository, so loading the reward matcher raises `FileNotFoundError` and aborts Wanted Quests reward handling.

Add `tasks/WantedQuests/wq/ui_rewardnew.png` to the repository at the configured path, or point the rule to an existing image.

Also at `tasks/WantedQuests/script_task.py:69`, `tasks/WantedQuests/explore.py:84`.

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(未纳入版本库)。
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(未纳入版本库)。
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.

1 participant