diff --git a/alas.py b/alas.py index 2fa8eab88..98f376d5b 100644 --- a/alas.py +++ b/alas.py @@ -891,7 +891,7 @@ class AzurLaneAutoScript(AzurLaneAutoScript): ) self.scheduler_watcher = watcher - if self.is_azur and self.config.full_config.Hook_HookGeneral_Enable: + if self.is_azur and self.config.full_config.Hook_HookGeneral_Enable and self.config.full_config.Hook_HookGeneral_RestartEveryTime: logger.info("Hook enabled, do restart") self.restart() diff --git a/config/template.json b/config/template.json index f28fb0a2f..4a57f0a48 100644 --- a/config/template.json +++ b/config/template.json @@ -104,6 +104,8 @@ "Hook": { "HookGeneral": { "Enable": false, + "RestartEveryTime": true, + "UpdateEveryTime": true, "PushEveryTime": true, "Architecture": "auto", "InjectMethod": "local_patch", diff --git a/module/config/argument/args.json b/module/config/argument/args.json index 7821e7481..f5d7687f1 100644 --- a/module/config/argument/args.json +++ b/module/config/argument/args.json @@ -490,6 +490,14 @@ "type": "checkbox", "value": false }, + "RestartEveryTime": { + "type": "checkbox", + "value": true + }, + "UpdateEveryTime": { + "type": "checkbox", + "value": true + }, "PushEveryTime": { "type": "checkbox", "value": true diff --git a/module/config/argument/argument.yaml b/module/config/argument/argument.yaml index a73203cde..24a549752 100644 --- a/module/config/argument/argument.yaml +++ b/module/config/argument/argument.yaml @@ -778,6 +778,8 @@ GameManager: HookGeneral: Enable: false + RestartEveryTime: true + UpdateEveryTime: true PushEveryTime: true Architecture: value: auto diff --git a/module/config/config_generated.py b/module/config/config_generated.py index ee1a5764f..302393b36 100644 --- a/module/config/config_generated.py +++ b/module/config/config_generated.py @@ -465,6 +465,8 @@ class GeneratedConfig: # Group `HookGeneral` HookGeneral_Enable = False + HookGeneral_RestartEveryTime = True + HookGeneral_UpdateEveryTime = True HookGeneral_PushEveryTime = True HookGeneral_Architecture = 'auto' # auto, x86, x86_64, arm64-v8a, armeabi-v7a HookGeneral_InjectMethod = 'local_patch' # local_patch, global_patch, outer_inject diff --git a/module/config/full_config_generated.py b/module/config/full_config_generated.py index 6dddc9383..4814c6bb8 100644 --- a/module/config/full_config_generated.py +++ b/module/config/full_config_generated.py @@ -75,6 +75,8 @@ class FullGeneratedConfig: # Task `Hook` Hook_HookGeneral_Enable = None + Hook_HookGeneral_RestartEveryTime = None + Hook_HookGeneral_UpdateEveryTime = None Hook_HookGeneral_PushEveryTime = None Hook_HookGeneral_Architecture = None Hook_HookGeneral_InjectMethod = None diff --git a/module/config/i18n/en-US.json b/module/config/i18n/en-US.json index 800ef0844..f6d895491 100644 --- a/module/config/i18n/en-US.json +++ b/module/config/i18n/en-US.json @@ -2689,6 +2689,14 @@ "name": "HookGeneral.Enable.name", "help": "HookGeneral.Enable.help" }, + "RestartEveryTime": { + "name": "HookGeneral.RestartEveryTime.name", + "help": "HookGeneral.RestartEveryTime.help" + }, + "UpdateEveryTime": { + "name": "HookGeneral.UpdateEveryTime.name", + "help": "HookGeneral.UpdateEveryTime.help" + }, "PushEveryTime": { "name": "HookGeneral.PushEveryTime.name", "help": "HookGeneral.PushEveryTime.help" diff --git a/module/config/i18n/ja-JP.json b/module/config/i18n/ja-JP.json index b48e455ed..25a39171e 100644 --- a/module/config/i18n/ja-JP.json +++ b/module/config/i18n/ja-JP.json @@ -2689,6 +2689,14 @@ "name": "HookGeneral.Enable.name", "help": "HookGeneral.Enable.help" }, + "RestartEveryTime": { + "name": "HookGeneral.RestartEveryTime.name", + "help": "HookGeneral.RestartEveryTime.help" + }, + "UpdateEveryTime": { + "name": "HookGeneral.UpdateEveryTime.name", + "help": "HookGeneral.UpdateEveryTime.help" + }, "PushEveryTime": { "name": "HookGeneral.PushEveryTime.name", "help": "HookGeneral.PushEveryTime.help" diff --git a/module/config/i18n/zh-CN.json b/module/config/i18n/zh-CN.json index 667b8e156..c8e3e3374 100644 --- a/module/config/i18n/zh-CN.json +++ b/module/config/i18n/zh-CN.json @@ -2689,6 +2689,14 @@ "name": "总开关", "help": "" }, + "RestartEveryTime": { + "name": "每次启动重启游戏", + "help": "" + }, + "UpdateEveryTime": { + "name": "自动更新", + "help": "" + }, "PushEveryTime": { "name": "每次重新推送资源", "help": "视情况开关,一般更新时推送" diff --git a/module/config/i18n/zh-TW.json b/module/config/i18n/zh-TW.json index 38b562b7e..5d29ffffa 100644 --- a/module/config/i18n/zh-TW.json +++ b/module/config/i18n/zh-TW.json @@ -2689,6 +2689,14 @@ "name": "HookGeneral.Enable.name", "help": "HookGeneral.Enable.help" }, + "RestartEveryTime": { + "name": "HookGeneral.RestartEveryTime.name", + "help": "HookGeneral.RestartEveryTime.help" + }, + "UpdateEveryTime": { + "name": "HookGeneral.UpdateEveryTime.name", + "help": "HookGeneral.UpdateEveryTime.help" + }, "PushEveryTime": { "name": "HookGeneral.PushEveryTime.name", "help": "HookGeneral.PushEveryTime.help" diff --git a/module/luahook/crack.py b/module/luahook/crack.py index 24e4cac58..127c09b75 100644 --- a/module/luahook/crack.py +++ b/module/luahook/crack.py @@ -441,6 +441,9 @@ class CrackResource: if self.update_server is None: logger.info("No update server, skip update check, use local resource") return + if not self.config.full_config.Hook_HookGeneral_UpdateEveryTime: + logger.info("Update skip, use local resource") + return with open(self.version_file, "r") as f: local_version = json.load(f)