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

Method run

tasks/KekkaiUtilize/script_task.py:24–59  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

22class ScriptTask(GameUi, ReplaceShikigami, KekkaiUtilizeAssets):
23
24 def run(self):
25 con = self.config.kekkai_utilize.utilize_config
26 self.ui_get_current_page()
27 self.ui_goto(page_guild)
28 # 收体力或者资金
29 # 进入寮主页会有一个动画,等一等
30 time.sleep(1)
31 self.check_guild_ap_or_assets(ap_enable=con.guild_ap_enable, assets_enable=con.guild_assets_enable)
32 # 进入寮结界
33 self.goto_realm()
34 # 顺带收体力盒子或者是经验盒子
35 time.sleep(1)
36 self.check_box_ap_or_exp(con.box_ap_enable, con.box_exp_enable, con.box_exp_waste)
37
38 # 收菜看看
39 self.check_utilize_harvest()
40 self.realm_goto_grown()
41 # 无论收不收到菜,都会进入看看至少看一眼时间还剩多少
42 self.screenshot()
43 if not self.appear(self.I_UTILIZE_ADD):
44 remaining_time = self.O_UTILIZE_RES_TIME.ocr(self.device.image)
45 if not isinstance(remaining_time, timedelta):
46 logger.warning('Ocr remaining time error')
47 logger.info(f'Utilize remaining time: {remaining_time}')
48 # 执行失败,推出下一次执行为失败的时间间隔
49 logger.info('Utilize failed, exit')
50 self.back_guild()
51 next_time = datetime.now() + remaining_time
52 self.set_next_run(task='KekkaiUtilize', success=False, finish=True, target=next_time)
53 raise TaskEnd
54 if not self.grown_goto_utilize():
55 logger.info('Utilize failed, exit')
56 self.run_utilize(con.select_friend_list, con.shikigami_class, con.shikigami_order)
57 self.back_guild()
58 self.set_next_run(task='KekkaiUtilize', success=True, finish=True)
59 raise TaskEnd
60
61
62

Callers 1

script_task.pyFile · 0.45

Calls 15

goto_realmMethod · 0.95
check_box_ap_or_expMethod · 0.95
check_utilize_harvestMethod · 0.95
realm_goto_grownMethod · 0.95
back_guildMethod · 0.95
grown_goto_utilizeMethod · 0.95
run_utilizeMethod · 0.95
ui_get_current_pageMethod · 0.80
ui_gotoMethod · 0.80
sleepMethod · 0.80
appearMethod · 0.80

Tested by

no test coverage detected