mirror of
https://github.com/LmeSzinc/StarRailCopilot.git
synced 2024-11-27 02:27:12 +00:00
76 lines
3.2 KiB
Python
76 lines
3.2 KiB
Python
from module.logger import logger
|
|
from tasks.battle_pass.keywords import KEYWORDS_BATTLE_PASS_QUEST
|
|
from tasks.daily.keywords import KEYWORDS_DAILY_QUEST
|
|
from tasks.rogue.entry.entry import RogueEntry
|
|
from tasks.rogue.exception import RogueReachedWeeklyPointLimit, RogueTeamNotPrepared
|
|
from tasks.rogue.route.loader import RouteLoader
|
|
|
|
|
|
class Rogue(RouteLoader, RogueEntry):
|
|
def rogue_once(self):
|
|
"""
|
|
Do a complete rogue run.
|
|
|
|
Pages:
|
|
in: Any
|
|
out: page_rogue, is_page_rogue_main()
|
|
"""
|
|
try:
|
|
self.rogue_world_enter()
|
|
except RogueTeamNotPrepared:
|
|
logger.error(f'Please prepare your team in {self.config.RogueWorld_World} '
|
|
f'and start rogue task at team preparation page')
|
|
self.rogue_world_exit()
|
|
return False
|
|
except RogueReachedWeeklyPointLimit:
|
|
logger.hr('Reached rogue weekly point limit')
|
|
return False
|
|
|
|
self.rogue_run()
|
|
self.rogue_reward_claim()
|
|
# runs when one rogue run finishes (do not handle whether the last rogue run finished or failed due to one who use this feature has less chance of failure -- would be better if check boss battle result instead of rogue result, but this version also works), and decreases rogue farming count by 1
|
|
if self.config.RogueWorld_WeeklyFarming and self.config.RogueWorld_WeeklyFarmingCount > 0:
|
|
self.config.RogueWorld_WeeklyFarmingCount -= 1
|
|
logger.attr("WeeklyFarmingCount",
|
|
self.config.RogueWorld_WeeklyFarmingCount)
|
|
return True
|
|
|
|
def run(self):
|
|
self.config.update_battle_pass_quests()
|
|
self.config.update_daily_quests()
|
|
if self.config.stored.DungeonDouble.is_expired():
|
|
self.config.task_call('Dungeon')
|
|
self.config.task_stop()
|
|
|
|
while 1:
|
|
# Run
|
|
success = self.rogue_once()
|
|
|
|
# Scheduler
|
|
with self.config.multi_set():
|
|
# Task switched
|
|
if self.config.task_switched():
|
|
self.config.task_stop()
|
|
# Archived daily quest
|
|
if success:
|
|
quests = self.config.stored.DailyQuest.load_quests()
|
|
if KEYWORDS_DAILY_QUEST.Complete_Simulated_Universe_1_times in quests:
|
|
logger.info('Achieve daily quest Complete_Simulated_Universe_1_times')
|
|
self.config.task_call('DailyQuest')
|
|
self.config.task_stop()
|
|
quests = self.config.stored.BattlePassWeeklyQuest.load_quests()
|
|
if KEYWORDS_BATTLE_PASS_QUEST.Complete_Simulated_Universe_1_times in quests:
|
|
logger.info('Achieve battle pass quest Complete_Simulated_Universe_1_times')
|
|
self.config.task_call('BattlePass')
|
|
self.config.task_stop()
|
|
# End
|
|
if not success:
|
|
self.config.task_delay(server_update=True)
|
|
break
|
|
|
|
|
|
if __name__ == '__main__':
|
|
self = Rogue('src', task='Rogue')
|
|
self.device.screenshot()
|
|
self.rogue_once()
|