diff --git a/alas.py b/alas.py index e659457cc..e850071e9 100644 --- a/alas.py +++ b/alas.py @@ -16,6 +16,8 @@ from module.notify import handle_notify from module.gg_handler.gg_handler import GGHandler g_current_task: str = "" +g_config: AzurLaneConfig = None + class AzurLaneAutoScript: stop_event: threading.Event = None @@ -545,6 +547,10 @@ class AzurLaneAutoScript: exit(1) def loop(self): + global g_config + if g_config is not None: + g_config = self.config + self.gg_check() logger.set_file_logger(self.config_name) logger.info(f'Start scheduler loop: {self.config_name}') diff --git a/module/retire/dock.py b/module/retire/dock.py index 3ee4308e0..76a53e9cc 100644 --- a/module/retire/dock.py +++ b/module/retire/dock.py @@ -393,7 +393,23 @@ class DockNew(UI): continue -class Dock(DockOld if globals().get("g_current_task", "") == "GemsFarming" else DockNew): +def redirect_inherit_to_old() -> bool: + current_task = globals().get("g_current_task", "") + current_config = globals().get("g_config", None) + + if current_task == "GemsFarming": + return True + elif current_task.find("Main") != -1: + return True + elif current_task.find("Event") != -1: + return True + else: + return False + + return False + + +class Dock(DockOld if redirect_inherit_to_old() else DockNew): def __init__(self, *args, **kwargs): if isinstance(self, DockOld): logger.info("use DockOld")