diff --git a/alas.py b/alas.py index 8998a341a..fb6c42b09 100644 --- a/alas.py +++ b/alas.py @@ -605,15 +605,17 @@ class AzurLaneAutoScript: failed = deep_get(self.failure_record, keys=task, default=0) failed = 0 if success else failed + 1 deep_set(self.failure_record, keys=task, value=failed) - if failed >= 3 or (self.config.Error_StrictRestart and failed >= 1 and task in RESTART_SENSITIVE_TASKS): + should_restrict = (self.config.Error_RestrictRestart and task in RESTART_SENSITIVE_TASKS + and (task == 'OpsiCrossMonth' or self.config.logger_used)) + if failed >= 3 or (failed >= 1 and should_restrict): logger.critical(f"Task `{task}` failed {failed} or more times.") logger.critical("Possible reason #1: You haven't used it correctly. " "Please read the help text of the options.") logger.critical("Possible reason #2: There is a problem with this task. " "Please contact developers or try to fix it yourself.") - if self.config.Error_StrictRestart and task in RESTART_SENSITIVE_TASKS: + if should_restrict: logger.critical("Possible reason #3: This is a restart sensitive task. " - "Please take over the game manually or turn off 'StrictRestart' option.") + "Please take over the game manually or turn off 'RestrictRestart' option.") logger.critical('Request human takeover') handle_notify( diff --git a/config/template.json b/config/template.json index 5e810f89a..e90aef120 100644 --- a/config/template.json +++ b/config/template.json @@ -85,7 +85,7 @@ "Error": { "HandleError": true, "SaveError": true, - "StrictRestart": false, + "RestrictRestart": false, "OnePushConfig": "provider: null", "ScreenshotLength": 1 }, diff --git a/module/config/argument/args.json b/module/config/argument/args.json index 5b41113f0..9232c25d3 100644 --- a/module/config/argument/args.json +++ b/module/config/argument/args.json @@ -402,7 +402,7 @@ "type": "checkbox", "value": true }, - "StrictRestart": { + "RestrictRestart": { "type": "checkbox", "value": false }, diff --git a/module/config/argument/argument.yaml b/module/config/argument/argument.yaml index 3ecffb4b9..701c788a5 100644 --- a/module/config/argument/argument.yaml +++ b/module/config/argument/argument.yaml @@ -84,7 +84,7 @@ EmulatorInfo: Error: HandleError: true SaveError: true - StrictRestart: false + RestrictRestart: false OnePushConfig: type: textarea mode: yaml diff --git a/module/config/config_generated.py b/module/config/config_generated.py index 6d8fc6628..913d2463b 100644 --- a/module/config/config_generated.py +++ b/module/config/config_generated.py @@ -34,7 +34,7 @@ class GeneratedConfig: # Group `Error` Error_HandleError = True Error_SaveError = True - Error_StrictRestart = False + Error_RestrictRestart = False Error_OnePushConfig = 'provider: null' Error_ScreenshotLength = 1 diff --git a/module/config/config_updater.py b/module/config/config_updater.py index e1f15d6f6..b30723cb5 100644 --- a/module/config/config_updater.py +++ b/module/config/config_updater.py @@ -608,7 +608,9 @@ class ConfigUpdater: # ('Coalition.Coalition.Mode', 'Coalition.Coalition.Mode', coalition_to_frostfall), # 2025.06.26 # ('Coalition.Coalition.Mode', 'Coalition.Coalition.Mode', coalition_to_little_academy), + # 2026.08.16 ('OpsiShop.OpsiShop.DisableBeforeDate', 'OpsiShop.OpsiShop.DisableBeforeResetDays', date_to_reset_days), + ('Alas.Error.StrictRestart', 'Alas.Error.RestrictRestart'), ] # redirection += [ diff --git a/module/config/i18n/en-US.json b/module/config/i18n/en-US.json index c0f416ab5..8c6695bfb 100644 --- a/module/config/i18n/en-US.json +++ b/module/config/i18n/en-US.json @@ -516,8 +516,8 @@ "name": "Record Exception", "help": "Records exception and log into directory for review or sharing" }, - "StrictRestart": { - "name": "Strict Restart", + "RestrictRestart": { + "name": "Restrict Restart", "help": "Stop Alas instead of restarting the game when running a sensitive task with an error.\nSensitive tasks include OpsiObscure, OpsiAbyssal and OpsiCrossMonth." }, "OnePushConfig": { diff --git a/module/config/i18n/ja-JP.json b/module/config/i18n/ja-JP.json index c212e89bf..7eae04420 100644 --- a/module/config/i18n/ja-JP.json +++ b/module/config/i18n/ja-JP.json @@ -516,9 +516,9 @@ "name": "Error.SaveError.name", "help": "Error.SaveError.help" }, - "StrictRestart": { - "name": "Error.StrictRestart.name", - "help": "Error.StrictRestart.help" + "RestrictRestart": { + "name": "Error.RestrictRestart.name", + "help": "Error.RestrictRestart.help" }, "OnePushConfig": { "name": "Error.OnePushConfig.name", diff --git a/module/config/i18n/zh-CN.json b/module/config/i18n/zh-CN.json index 58111bd87..2ba409a27 100644 --- a/module/config/i18n/zh-CN.json +++ b/module/config/i18n/zh-CN.json @@ -516,7 +516,7 @@ "name": "出错时,保存 Log 和截图", "help": "" }, - "StrictRestart": { + "RestrictRestart": { "name": "敏感任务出错时禁止重启", "help": "运行敏感任务出错时停止Alas,而不是重启游戏\n敏感任务包含隐秘海域、深渊海域、跨月每日" }, diff --git a/module/config/i18n/zh-TW.json b/module/config/i18n/zh-TW.json index fb6ac7e8f..819d0fc9c 100644 --- a/module/config/i18n/zh-TW.json +++ b/module/config/i18n/zh-TW.json @@ -516,7 +516,7 @@ "name": "出錯時,保存 Log 和截圖", "help": "" }, - "StrictRestart": { + "RestrictRestart": { "name": "敏感任務出錯時禁止重啟", "help": "運行敏感任務出錯時停止Alas,而不是重啟遊戲\n敏感任務包含隱秘海域、深淵海域、跨月每日" }, diff --git a/module/os/operation_siren.py b/module/os/operation_siren.py index fbfcc2ed3..9c44bf6f9 100644 --- a/module/os/operation_siren.py +++ b/module/os/operation_siren.py @@ -31,7 +31,11 @@ class OperationSiren( """ Operation Siren main class that combines all task modules. """ - pass + + def __init__(self, *args, **kwargs): + super().__init__(*args, **kwargs) + # Whether a coordinate logger was used in the current task run + self.config.logger_used = False if __name__ == '__main__': diff --git a/module/os_handler/storage.py b/module/os_handler/storage.py index 16caa5314..ad5874825 100644 --- a/module/os_handler/storage.py +++ b/module/os_handler/storage.py @@ -126,6 +126,7 @@ class StorageHandler(GlobeOperation, ZoneManager): if len(items): self._storage_item_use(items[0]) + self.config.logger_used = True continue else: logger.info('All loggers in storage have been used')