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

Method run

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

Source from the content-addressed store, hash-verified

19class ScriptTask(GeneralBattle, GeneralInvite, GeneralBuff, GeneralRoom, GameUi, SwitchSoul, FallenSunAssets):
20
21 def run(self) -> bool:
22 # 御魂切换方式一
23 if self.config.fallen_sun.switch_soul.enable:
24 self.ui_get_current_page()
25 self.ui_goto(page_shikigami_records)
26 self.run_switch_soul(self.config.fallen_sun.switch_soul.switch_group_team)
27
28 # 御魂切换方式二
29 if self.config.fallen_sun.switch_soul.enable_switch_by_name:
30 self.ui_get_current_page()
31 self.ui_goto(page_shikigami_records)
32 self.run_switch_soul_by_name(self.config.fallen_sun.switch_soul.group_name,
33 self.config.fallen_sun.switch_soul.team_name)
34
35 limit_count = self.config.fallen_sun.fallen_sun_config.limit_count
36 limit_time = self.config.fallen_sun.fallen_sun_config.limit_time
37 self.current_count = 0
38 self.limit_count: int = limit_count
39 self.limit_time: timedelta = timedelta(hours=limit_time.hour, minutes=limit_time.minute, seconds=limit_time.second)
40
41 self.ui_get_current_page()
42 self.ui_goto(page_main)
43 config: FallenSun = self.config.fallen_sun
44
45 success = True
46 match config.fallen_sun_config.user_status:
47 case UserStatus.LEADER: success = self.run_leader()
48 case UserStatus.MEMBER: success = self.run_member()
49 case UserStatus.ALONE: self.run_alone()
50 case UserStatus.WILD: self.run_wild()
51 case _: logger.error('Unknown user status')
52
53 # 下一次运行时间
54 if success:
55 self.set_next_run('FallenSun', finish=True, success=True)
56 else:
57 self.set_next_run('FallenSun', finish=False, success=False)
58
59 raise TaskEnd
60
61
62

Callers

nothing calls this directly

Calls 9

run_leaderMethod · 0.95
run_memberMethod · 0.95
run_aloneMethod · 0.95
run_wildMethod · 0.95
ui_get_current_pageMethod · 0.80
ui_gotoMethod · 0.80
run_switch_soulMethod · 0.80
set_next_runMethod · 0.80

Tested by

no test coverage detected