From 8a6851d24c70fc65995d8b00cfb75bc712b9b362 Mon Sep 17 00:00:00 2001 From: RedDeadDepresso <94017243+RedDeadDepresso@users.noreply.github.com> Date: Sat, 6 Jan 2024 19:29:47 +0000 Subject: [PATCH] fix: exit emulator, aas, shutdown allow tactical challenge to be completed --- module/alas.py | 43 +++++++++++++++++++++++++---------- module/config/i18n/en-US.json | 2 +- 2 files changed, 32 insertions(+), 13 deletions(-) diff --git a/module/alas.py b/module/alas.py index f706bd2..c6b7f8a 100644 --- a/module/alas.py +++ b/module/alas.py @@ -233,21 +233,40 @@ class AzurLaneAutoScript: del_cached_property(self, 'config') continue elif method == 'exit_aas': - self.config.Optimization_WhenTaskQueueEmpty = 'goto_main' - self.exit_aas() - exit(1) + if abs(task.next_run - datetime.now()) >= timedelta(minutes=2): # ensure tactical challenge is fully ran + self.config.Optimization_WhenTaskQueueEmpty = 'goto_main' + self.exit_aas() + exit(1) + release_resources() + self.device.release_during_wait() + if not self.wait_until(task.next_run): + del_cached_property(self, 'config') + continue elif method == 'exit_emulator': - self.config.Optimization_WhenTaskQueueEmpty = 'goto_main' - self.exit_emulator() - exit(1) # stops AAS from restarting emulator + if abs(task.next_run - datetime.now()) >= timedelta(minutes=2): + self.config.Optimization_WhenTaskQueueEmpty = 'goto_main' + self.exit_emulator() + exit(1) # stops AAS from restarting emulator + release_resources() + self.device.release_during_wait() + if not self.wait_until(task.next_run): + del_cached_property(self, 'config') + continue elif method == 'exit_aas_emulator': - self.config.Optimization_WhenTaskQueueEmpty = 'goto_main' - self.exit_emulator() - self.exit_aas() - exit(1) + if abs(task.next_run - datetime.now()) >= timedelta(minutes=2): + self.config.Optimization_WhenTaskQueueEmpty = 'goto_main' + self.exit_emulator() + self.exit_aas() + exit(1) + release_resources() + self.device.release_during_wait() + if not self.wait_until(task.next_run): + del_cached_property(self, 'config') + continue elif method == 'shutdown': - self.config.Optimization_WhenTaskQueueEmpty = 'goto_main' - self.shutdown() + if abs(task.next_run - datetime.now()) >= timedelta(minutes=2): + self.config.Optimization_WhenTaskQueueEmpty = 'goto_main' + self.shutdown() release_resources() self.device.release_during_wait() if not self.wait_until(task.next_run): diff --git a/module/config/i18n/en-US.json b/module/config/i18n/en-US.json index 2f8b08b..f32387b 100644 --- a/module/config/i18n/en-US.json +++ b/module/config/i18n/en-US.json @@ -221,7 +221,7 @@ }, "WhenTaskQueueEmpty": { "name": "When Task Queue is Empty", - "help": "Close Blue Archive when there are no pending tasks, can help reduce CPU.\nExit AAS, emulator and shutdown should be set while AAS is running tasks otherwise it won't start and after their execution it will be reset to Goto Main Page.\nExit AAS and emulator are only available on Windows.\nExit emulator is only possible if instance name and emulator path follow the same auto-filled values according to 'Serial' in Emulator Settings", + "help": "Close Blue Archive when there are no pending tasks, can help reduce CPU.\nExit AAS, emulator and shutdown should be set while AAS is running tasks otherwise it won't start; after their execution it will be reset to Goto Main Page.\nExit AAS and emulator are only available on Windows.\n\nExit emulator is only possible if instance name and emulator path actually follow the same auto-filled values according to 'Serial' in Emulator Settings.\nFor example, for Bluestacks 5 the instance name and Bluestacks 5 installation path must be respectively:\nNougat64\nC:/Program Files/BlueStacks_nxt/HD-Player.exe", "stay_there": "Stay There", "goto_main": "Goto Main Page", "close_game": "Close Game",