MCPcopy Create free account
hub / github.com/runhey/OnmyojiAutoScript / run

Method run

tasks/RyouToppa/script_task.py:23–92  ·  view source on GitHub ↗

执行 :return:

(self)

Source from the content-addressed store, hash-verified

21 medal_grid: ImageGrid = None
22
23 def run(self):
24 """
25 执行
26 :return:
27 """
28 ryou_config = self.config.ryou_toppa
29 self.medal_grid = ImageGrid([RealmRaidAssets.I_MEDAL_5, RealmRaidAssets.I_MEDAL_4, RealmRaidAssets.I_MEDAL_3,
30 RealmRaidAssets.I_MEDAL_2, RealmRaidAssets.I_MEDAL_1, RealmRaidAssets.I_MEDAL_0])
31
32 if ryou_config.switch_soul_config.enable:
33 self.ui_get_current_page()
34 self.ui_goto(page_shikigami_records)
35 self.run_switch_soul(ryou_config.switch_soul_config.switch_group_team)
36
37 if ryou_config.switch_soul_config.enable_switch_by_name:
38 self.ui_get_current_page()
39 self.ui_goto(page_shikigami_records)
40 self.run_switch_soul_by_name(ryou_config.switch_soul_config.group_name, ryou_config.switch_soul_config.team_name)
41
42 self.ui_get_current_page()
43 self.ui_goto(page_kekkai_toppa)
44 ryou_toppa_start_flag = True
45 ryou_toppa_success_penetration = False
46 # 点击突破
47 while 1:
48 self.screenshot()
49 if self.appear_then_click(RealmRaidAssets.I_REALM_RAID, interval=1):
50 logger.info(f'Click {RealmRaidAssets.I_REALM_RAID.name}')
51 continue
52 if self.appear(self.I_REAL_RAID_REFRESH, threshold=0.8):
53 if self.appear_then_click(self.I_RYOU_TOPPA, interval=1):
54 logger.info(f'Click {self.I_RYOU_TOPPA.name}')
55 continue
56 # 攻破阴阳寮,说明寮突已开,则退出
57 elif self.appear(self.I_SUCCESS_PENETRATION, threshold=0.8):
58 ryou_toppa_start_flag = True
59 ryou_toppa_success_penetration = True
60 break
61 # 出现选择寮突说明寮突未开
62 elif self.appear(self.I_SELECT_RYOU_BUTTON, threshold=0.8):
63 ryou_toppa_start_flag = False
64 break
65 # 出现寮奖励, 说明寮突已开
66 elif self.appear(self.I_RYOU_REWARD, threshold=0.8) or self.appear(self.I_RYOU_REWARD_90, threshold=0.8):
67 ryou_toppa_start_flag = True
68 break
69
70 # 寮突未开 并且有权限, 开开寮突
71 if not ryou_toppa_start_flag and ryou_config.raid_config.ryou_access == 'yes':
72 # 开寮突
73 self.start_ryou_toppa()
74
75 # 100% 攻破, 第二天再执行
76 if ryou_toppa_success_penetration:
77 self.set_next_run(task='RyouToppa', finish=True, success=True)
78 raise TaskEnd
79
80 # 开始突破

Callers 1

script_task.pyFile · 0.45

Calls 11

start_ryou_toppaMethod · 0.95
execute_roundMethod · 0.95
ImageGridClass · 0.90
ui_get_current_pageMethod · 0.80
ui_gotoMethod · 0.80
run_switch_soulMethod · 0.80
appear_then_clickMethod · 0.80
appearMethod · 0.80
set_next_runMethod · 0.80
screenshotMethod · 0.45

Tested by

no test coverage detected