From 7e30ba8d9fce25f31a84e0a20c59931fa91a115c Mon Sep 17 00:00:00 2001 From: LmeSzinc <37934724+LmeSzinc@users.noreply.github.com> Date: Sun, 18 Jun 2023 01:09:09 +0800 Subject: [PATCH] Add: Task dungeon --- module/config/config_manual.py | 1 + src.py | 4 ++++ tasks/dungeon/dungeon.py | 26 ++++++++++++++++++++++++++ 3 files changed, 31 insertions(+) create mode 100644 tasks/dungeon/dungeon.py diff --git a/module/config/config_manual.py b/module/config/config_manual.py index 753d05fdb..edc61bc67 100644 --- a/module/config/config_manual.py +++ b/module/config/config_manual.py @@ -10,6 +10,7 @@ class ManualConfig: SCHEDULER_PRIORITY = """ Restart + > Dungeon """ """ diff --git a/src.py b/src.py index af1ebf9d7..72e91f655 100644 --- a/src.py +++ b/src.py @@ -22,6 +22,10 @@ class StarRailCopilot(AzurLaneAutoScript): Login(self.config, device=self.device).app_start() UI(self.config, device=self.device).ui_goto_main() + def dungeon(self): + from tasks.dungeon.dungeon import Dungeon + Dungeon(config=self.config, device=self.device).run() + if __name__ == '__main__': src = StarRailCopilot('src') diff --git a/tasks/dungeon/dungeon.py b/tasks/dungeon/dungeon.py new file mode 100644 index 000000000..2ff84eb92 --- /dev/null +++ b/tasks/dungeon/dungeon.py @@ -0,0 +1,26 @@ +from module.logger import logger +from tasks.combat.combat import Combat +from tasks.dungeon.keywords import DungeonList +from tasks.dungeon.ui import DungeonUI + + +class Dungeon(DungeonUI, Combat): + def run(self, dungeon: DungeonList = None, team: int = None): + if dungeon is None: + dungeon = DungeonList.find(self.config.Dungeon_Name) + if team is None: + team = self.config.Dungeon_Team + + # Run + if not self.dungeon_goto(dungeon): + logger.error('Please check you dungeon settings') + self.config.Scheduler_Enable = False + self.config.task_stop() + + self.combat(team) + + # Scheduler + # Recover 1 trailbaze power each 6 minutes + cover = max(60 - self.state.TrailblazePower, 0) * 6 + logger.info(f'Currently has {self.state.TrailblazePower} Need {cover} minutes to reach 60') + self.config.task_delay(minute=cover)