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

Method run

tasks/Exploration/script_task.py:21–75  ·  view source on GitHub ↗

执行 :return:

(self)

Source from the content-addressed store, hash-verified

19 medal_grid: ImageGrid = None
20
21 def run(self):
22 """
23 执行
24 :return:
25 """
26 # 探索的 config
27 explorationConfig = self.config.exploration
28
29 # 切换御魂
30 if explorationConfig.switch_soul_config.enable:
31 self.ui_get_current_page()
32 self.ui_goto(page_shikigami_records)
33 self.run_switch_soul(explorationConfig.switch_soul_config.switch_group_team)
34
35 if explorationConfig.switch_soul_config.enable_switch_by_name:
36 self.ui_get_current_page()
37 self.ui_goto(page_shikigami_records)
38 self.run_switch_soul_by_name(explorationConfig.switch_soul_config.group_name,
39 explorationConfig.switch_soul_config.team_name)
40
41 # 开启加成
42 con = self.config.exploration.exploration_config
43 if con.buff_gold_50_click or con.buff_gold_100_click:
44 self.ui_get_current_page()
45 self.ui_goto(page_main)
46 self.open_buff()
47 if con.buff_gold_50_click:
48 self.gold_50()
49 if con.buff_gold_100_click:
50 self.gold_100()
51 self.close_buff()
52
53 self.ui_get_current_page()
54 # 探索页面
55 self.ui_goto(page_exploration)
56
57 # ************************* 跳转至对应指定章节并进入 *******************
58 # 默认全部解锁, 当前处于第二十八章
59 # 查找指定的章节:
60 if not self.open_expect_level():
61 logger.critical(f'Not find {explorationConfig.exploration_config.exploration_level} or'
62 f' Enter {explorationConfig.exploration_config.exploration_level} failed!')
63 raise RequestHumanTakeover
64
65 # 只探索7次
66 if explorationConfig.exploration_config.attack_number == AttackNumber.SEVEN:
67 count = 0
68 while count < 7:
69 if self.wait_until_appear(self.I_E_EXPLORATION_CLICK, wait_time=1):
70 self.click(self.I_E_EXPLORATION_CLICK)
71 count += 1
72 # 进入战斗环节
73 self.battle_process()
74 if self.appear_then_click(self.I_EXPLORATION_TITLE):
75 self.open_expect_level()
76
77 # 查找指定的章节:
78 def open_expect_level(self):

Callers 1

script_task.pyFile · 0.45

Calls 13

open_expect_levelMethod · 0.95
battle_processMethod · 0.95
ui_get_current_pageMethod · 0.80
ui_gotoMethod · 0.80
run_switch_soulMethod · 0.80
open_buffMethod · 0.80
gold_50Method · 0.80
gold_100Method · 0.80
close_buffMethod · 0.80
wait_until_appearMethod · 0.80
appear_then_clickMethod · 0.80

Tested by

no test coverage detected