Skip to content

Commit 621689b

Browse files
committed
1. 优化相关OCR结果,使其符合预期
2. 优化任务流程,增加任务列表滑动,使其存在两个未完成协作任务时,其他任务能正常执行完成 3. 优化探索任务流程,使其不再强制需求固定式神上阵 4. 增加根据任务式神名称跳过功能(酒吞) 5. 优化任务选择,在秘闻能够提供3个及以上的进度时,优先选择秘闻 6. 修复coorperation_only模式下,任务全部完成时,卡死的BUG
1 parent 8ab3983 commit 621689b

File tree

9 files changed

+276
-78
lines changed

9 files changed

+276
-78
lines changed

dev_tools/assets_extract.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -408,7 +408,11 @@ def __init__(self):
408408
self.task_paths = [x for x in self.task_paths if 'Component' not in x]
409409
self.task_paths.extend([str(x) for x in (self.task_path / 'Component').iterdir() if x.is_dir()])
410410

411-
process_map(self.work, self.task_paths, max_workers=1)
411+
# process_map(self.work, self.task_paths, max_workers=1)
412+
for task_path in self.task_paths:
413+
me = AssetsExtractor(task_path)
414+
me.extract()
415+
412416

413417
@staticmethod
414418
def work(task_path: str):

tasks/WantedQuests/assets.py

+11
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,10 @@ class WantedQuestsAssets:
5252
O_WQ_INFO_3 = RuleOcr(roi=(612,376,305,44), area=(612,376,305,44), mode="Single", method="Default", keyword="", name="wq_info_3")
5353
# Ocr-description
5454
O_WQ_INFO_4 = RuleOcr(roi=(613,446,315,44), area=(613,446,315,44), mode="Single", method="Default", keyword="", name="wq_info_4")
55+
# 怪物名称,如酒吞,阎魔等
56+
O_WQ_MONSTER_TYPE = RuleOcr(roi=(165,215,45,175), area=(165,215,45,175), mode="Full", method="Default", keyword="", name="wq_monster_type")
57+
#
58+
O_WQ_TEXT_ALL = RuleOcr(roi=(20,140,110,390), area=(20,140,110,390), mode="Full", method="Default", keyword="", name="wq_text_all")
5559

5660

5761
# Image Rule Assets
@@ -166,6 +170,8 @@ class WantedQuestsAssets:
166170
I_WQ_TRACE_ONE_CHECK_OPENED = RuleImage(roi_front=(510,175,210,60), roi_back=(510,175,210,60), threshold=0.8, method="Template matching", file="./tasks/WantedQuests/wq/wq_trace_one_check_opened.png")
167171
# 庭院悬赏任务界面 单个任务点开后的界面 是否为现世任务标志
168172
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")
173+
# 探索界面,左侧任务列表右上角右下角标志
174+
I_WQ_LIST_TOP_BOTTOM_CHECK = RuleImage(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")
169175

170176

171177
# Image Rule Assets
@@ -177,3 +183,8 @@ class WantedQuestsAssets:
177183
I_WQ_NIAN = RuleImage(roi_front=(19,176,100,100), roi_back=(0,153,166,273), threshold=0.8, method="Template matching", file="./tasks/WantedQuests/wq/wq_wq_nian.png")
178184

179185

186+
# Swipe Rule Assets
187+
# 手指向上滑动
188+
S_WQ_LIST_UP = RuleSwipe(roi_front=(60,250,2,4), roi_back=(65,200,2,4), mode="default", name="wq_list_up")
189+
190+

tasks/WantedQuests/config.py

+2
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,8 @@ class WantedQuestsConfig(BaseModel):
9292
battle_priority: str = Field(default='挑战 > 秘闻 > 探索', description='battle_priority_help')
9393
# 只完成协作任务
9494
cooperation_only: bool = Field(default=False, description="cooperation_only_help")
95+
# 忽略任务的任务目标名称(“酒吞童子”等),多个用逗号“,,"分隔
96+
unwanted_boss_names: str = Field(default='酒吞童子,阎魔', description='unwanted_boss_name_help')
9597

9698

9799
class WantedQuests(ConfigBase):

tasks/WantedQuests/explore.py

+15-11
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ def explore(self, goto: RuleImage, num: int):
4343
if explore_only_boss:
4444
raise ExploreWantedBoss
4545
break
46+
logger.info("点击探索")
4647
self.ui_click(self.I_E_EXPLORATION_CLICK, stop=self.I_E_SETTINGS_BUTTON)
4748
continue
4849
# 探索大世界
@@ -59,16 +60,16 @@ def explore(self, goto: RuleImage, num: int):
5960
continue
6061
# 探索里面
6162
elif scene == Scene.MAIN:
62-
if not explore_init:
63-
count=0
64-
while count<5:
65-
if self.appear(self.I_E_AUTO_ROTATE_ON):
66-
break
67-
if self.appear(self.I_E_AUTO_ROTATE_OFF, interval=1.5):
68-
self.click(self.I_E_AUTO_ROTATE_OFF)
69-
count+=1
70-
explore_init = True
71-
continue
63+
# if not explore_init:
64+
# count = 0
65+
# while count < 5:
66+
# if self.appear(self.I_E_AUTO_ROTATE_ON):
67+
# break
68+
# if self.appear(self.I_E_AUTO_ROTATE_OFF, interval=1.5):
69+
# self.click(self.I_E_AUTO_ROTATE_OFF)
70+
# count += 1
71+
# explore_init = True
72+
# continue
7273
# 小纸人
7374
if self.appear(self.I_BATTLE_REWARD):
7475
if self.ui_get_reward(self.I_BATTLE_REWARD):
@@ -84,6 +85,7 @@ def explore(self, goto: RuleImage, num: int):
8485
if self.appear(self.TEMPLATE_GIF) and self.fire(self.TEMPLATE_GIF):
8586
explore_only_boss = False
8687
logger.info(f'Fight, minions cnt {self.minions_cnt}')
88+
continue
8789
# 向后拉,寻找怪
8890
if search_fail_cnt >= 4:
8991
search_fail_cnt = 0
@@ -95,6 +97,8 @@ def explore(self, goto: RuleImage, num: int):
9597
continue
9698
else:
9799
search_fail_cnt += 1
100+
elif scene==Scene.BATTLE_PREPARE:
101+
self.ui_click_until_disappear(self.I_PREPARE_HIGHLIGHT, interval=0.5)
98102
elif scene == Scene.UNKNOWN:
99103
continue
100104

@@ -107,4 +111,4 @@ def explore(self, goto: RuleImage, num: int):
107111
config = Config('oas1')
108112
device = Device(config)
109113
t = WQExplore(config, device)
110-
t.explore(goto=WantedQuestsAssets.I_GOTO_1, num=2)
114+
t.explore(goto=WantedQuestsAssets.I_GOTO_1, num=2)

tasks/WantedQuests/ocr.json

+18
Original file line numberDiff line numberDiff line change
@@ -142,5 +142,23 @@
142142
"method": "Default",
143143
"keyword": "",
144144
"description": "Ocr-description"
145+
},
146+
{
147+
"itemName": "wq_monster_type",
148+
"roiFront": "165,215,45,175",
149+
"roiBack": "165,215,45,175",
150+
"mode": "Full",
151+
"method": "Default",
152+
"keyword": "",
153+
"description": "怪物名称,如酒吞,阎魔等"
154+
},
155+
{
156+
"itemName": "wq_text_all",
157+
"roiFront": "20,140,110,390",
158+
"roiBack": "20,140,110,390",
159+
"mode": "Full",
160+
"method": "Default",
161+
"keyword": "",
162+
"description": ""
145163
}
146164
]

0 commit comments

Comments
 (0)