Add: Task dungeon

This commit is contained in:
LmeSzinc 2023-06-18 01:09:09 +08:00
parent 1f8a9383f7
commit 7e30ba8d9f
3 changed files with 31 additions and 0 deletions

View File

@ -10,6 +10,7 @@ class ManualConfig:
SCHEDULER_PRIORITY = """ SCHEDULER_PRIORITY = """
Restart Restart
> Dungeon
""" """
""" """

4
src.py
View File

@ -22,6 +22,10 @@ class StarRailCopilot(AzurLaneAutoScript):
Login(self.config, device=self.device).app_start() Login(self.config, device=self.device).app_start()
UI(self.config, device=self.device).ui_goto_main() 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__': if __name__ == '__main__':
src = StarRailCopilot('src') src = StarRailCopilot('src')

26
tasks/dungeon/dungeon.py Normal file
View File

@ -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)