Skip to content

Commit f0b4d85

Browse files
committed
fix(素材):移植上游 runhey 的 10-10 更新修复(runhey#1891 / runhey#1892 / runhey#1893 / 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(未纳入版本库)。
1 parent b4cef48 commit f0b4d85

10 files changed

Lines changed: 30 additions & 11 deletions

File tree

‎tasks/Component/GeneralBattle/assets.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ class GeneralBattleAssets:
116116
# 左上角的退出
117117
I_EXIT = RuleImage(profile="High", roi_front=(14,12,43,41), roi_back=(0,0,91,83), threshold=0.8, method="Template matching", file="./tasks/Component/GeneralBattle/gb/gb_exit.png")
118118
# 退出确认
119-
I_EXIT_ENSURE = RuleImage(profile="High", roi_front=(674,388,135,63), roi_back=(674,388,135,63), threshold=0.8, method="Template matching", file="./tasks/Component/GeneralBattle/gb/gb_exit_ensure.png")
119+
I_EXIT_ENSURE = RuleImage(profile="High", roi_front=(701,414,95,46), roi_back=(648,388,220,96), threshold=0.8, method="Template matching", file="./tasks/Component/GeneralBattle/gb/gb_exit_ensure.png")
120120
# 左上角好友图标
121121
I_FRIENDS = RuleImage(profile="High", roi_front=(89,14,36,36), roi_back=(89,14,36,36), threshold=0.8, method="Template matching", file="./tasks/Component/GeneralBattle/gb/gb_friends.png")
122122
# 结算时的统计图标
1.42 KB
Loading

‎tasks/Component/GeneralBattle/gb/image.json‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,8 @@
102102
{
103103
"itemName": "exit_ensure",
104104
"imageName": "gb_exit_ensure.png",
105-
"roiFront": "674,388,135,63",
106-
"roiBack": "674,388,135,63",
105+
"roiFront": "701,414,95,46",
106+
"roiBack": "648,388,220,96",
107107
"method": "Template matching",
108108
"threshold": 0.8,
109109
"profile": "High",

‎tasks/Component/GeneralInvite/general_invite.py‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -660,6 +660,7 @@ def check_and_invite(self, default_invite: bool=True) -> bool:
660660
if self.appear(self.I_I_DEFAULT):
661661
break
662662
if self.appear_then_click(self.I_I_NO_DEFAULT, interval=1):
663+
sleep(0.8) # 取自 runhey#1886:点击后等 UI 状态刷新,避免误判
663664
continue
664665
# 点击确认
665666
while 1:
-2.49 KB
Loading

‎tasks/WantedQuests/assets.py‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,8 @@ class WantedQuestsAssets:
133133
I_WQ_TRACE_ONE_REALWORLD = RuleImage(profile="High", 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")
134134
# 探索界面,左侧任务列表右上角右下角标志
135135
I_WQ_LIST_TOP_BOTTOM_CHECK = RuleImage(profile="High", roi_front=(120,125,25,425), roi_back=(120,125,25,425), threshold=0.8, method="Template matching", file="./tasks/WantedQuests/wq/wq_list_top_bottom_check.png")
136+
# 悬赏封印获得奖励(取自 runhey#1892:悬赏的奖励弹窗与通用 I_UI_REWARD 不同型)
137+
I_UI_REWARDNEW = RuleImage(profile="High", 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")
136138

137139

138140
# Ocr Rule Assets

‎tasks/WantedQuests/script_task.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,11 +62,11 @@ def run(self):
6262
break
6363
if self.appear(self.I_WQ_BOX):
6464
logger.info("get reward")
65-
self.ui_get_reward(self.I_WQ_BOX)
65+
self.ui_get_reward(self.I_WQ_BOX, reward_image=self.I_UI_REWARDNEW)
6666
continue
6767
if self.appear(self.I_E_REWARD_BOX_BIG):
6868
logger.info("get treasure")
69-
self.ui_get_reward(self.I_E_REWARD_BOX_BIG)
69+
self.ui_get_reward(self.I_E_REWARD_BOX_BIG, reward_image=self.I_UI_REWARDNEW)
7070
continue
7171
current, found, total, self.O_WQ_TEXT_ALL.area = self.find_wq(
7272
self.device.image,

‎tasks/WantedQuests/wq/image.json‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,5 +168,15 @@
168168
"method": "Template matching",
169169
"threshold": 0.8,
170170
"description": "探索界面,左侧任务列表右上角右下角标志"
171+
},
172+
{
173+
"itemName": "ui_rewardnew",
174+
"imageName": "ui_rewardnew.png",
175+
"profile": "High",
176+
"roiFront": "523,248,239,24",
177+
"roiBack": "500,225,285,70",
178+
"method": "Template matching",
179+
"threshold": 0.7,
180+
"description": "悬赏封印获得奖励(取自 runhey#1892)"
171181
}
172182
]
11.6 KB
Loading

‎tasks/base_task.py‎

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -697,39 +697,45 @@ def custom_next_run(self, task: str, custom_time: Time = None, time_delta: float
697697
# ---------------------------------------------------------------------------------------------------------------
698698
#
699699
# ---------------------------------------------------------------------------------------------------------------
700-
def ui_reward_appear_click(self, screenshot=False) -> bool:
700+
def ui_reward_appear_click(self, screenshot=False, reward_image=None) -> bool:
701701
"""
702702
如果出现 ‘获得奖励’ 就点击
703+
:param reward_image: 自定义的'获得奖励'识别图,默认使用通用 I_UI_REWARD
703704
:return:
704705
"""
705706
if screenshot:
706707
self.screenshot()
707-
return self.appear_then_click(self.I_UI_REWARD, action=self.C_UI_REWARD, interval=0.4, threshold=0.6)
708+
if reward_image is None:
709+
reward_image = self.I_UI_REWARD
710+
return self.appear_then_click(reward_image, action=self.C_UI_REWARD, interval=0.4, threshold=0.6)
708711

709-
def ui_get_reward(self, click_image: RuleImage | RuleOcr | RuleClick, click_interval: float = 1):
712+
def ui_get_reward(self, click_image: RuleImage | RuleOcr | RuleClick, click_interval: float = 1, reward_image=None):
710713
"""
711714
传进来一个点击图片 或是 一个ocr, 会点击这个图片,然后等待‘获得奖励’,
712715
最后当获得奖励消失后 退出
713716
:param click_interval:
714717
:param click_image:
718+
:param reward_image: 自定义的'获得奖励'识别图,默认使用通用 I_UI_REWARD
715719
:return:
716720
"""
721+
if reward_image is None:
722+
reward_image = self.I_UI_REWARD
717723
_timer = Timer(10)
718724
_timer.start()
719725
while 1:
720726
self.screenshot()
721727

722-
if self.ui_reward_appear_click():
728+
if self.ui_reward_appear_click(reward_image=reward_image):
723729
sleep(0.5)
724730
while 1:
725731
self.screenshot()
726732
# 等待动画结束
727-
if not self.appear(self.I_UI_REWARD, threshold=0.6):
733+
if not self.appear(reward_image, threshold=0.6):
728734
logger.info('Get reward success')
729735
break
730736

731737
# 一直点击
732-
if self.ui_reward_appear_click():
738+
if self.ui_reward_appear_click(reward_image=reward_image):
733739
continue
734740
break
735741
if _timer.reached():

0 commit comments

Comments
 (0)