From 613ef9f22c7a072936a69039dd5b14e05d1b6d71 Mon Sep 17 00:00:00 2001 From: W1NDes Date: Sat, 9 Aug 2025 16:16:21 +0800 Subject: [PATCH] =?UTF-8?q?Fix(7Dtask:=20=E5=B0=86=E5=A4=84=E7=90=86?= =?UTF-8?q?=E9=80=80=E5=BD=B9=E4=BB=BB=E5=8A=A1=E6=94=B9=E4=B8=BA=E5=8F=AF?= =?UTF-8?q?=E9=80=89=E9=A1=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/template.json | 1 + module/config/argument/args.json | 4 ++++ module/config/argument/argument.yaml | 1 + module/config/config_generated.py | 1 + module/config/i18n/en-US.json | 4 ++++ module/config/i18n/ja-JP.json | 4 ++++ module/config/i18n/zh-CN.json | 4 ++++ module/config/i18n/zh-TW.json | 4 ++++ module/smallevent/samllevent.py | 35 ++++++++++++++++------------ 9 files changed, 43 insertions(+), 15 deletions(-) diff --git a/config/template.json b/config/template.json index 20ad8368b..953789247 100644 --- a/config/template.json +++ b/config/template.json @@ -1863,6 +1863,7 @@ "Smallevent": { "SevenDayTask": true, "UpdateInfoImmediately": false, + "autoRetire": false, "OcrModel": "volc" }, "Storage": { diff --git a/module/config/argument/args.json b/module/config/argument/args.json index 2c72dbaec..b70681902 100644 --- a/module/config/argument/args.json +++ b/module/config/argument/args.json @@ -9164,6 +9164,10 @@ "type": "checkbox", "value": false }, + "autoRetire": { + "type": "checkbox", + "value": false + }, "OcrModel": { "type": "select", "value": "volc", diff --git a/module/config/argument/argument.yaml b/module/config/argument/argument.yaml index 38ae662e0..c919db7a0 100644 --- a/module/config/argument/argument.yaml +++ b/module/config/argument/argument.yaml @@ -732,6 +732,7 @@ Minigame: Smallevent: SevenDayTask: true UpdateInfoImmediately: false + autoRetire: false OcrModel: value: volc option: [ baidu, volc ] diff --git a/module/config/config_generated.py b/module/config/config_generated.py index bedc63ffa..15a86da75 100644 --- a/module/config/config_generated.py +++ b/module/config/config_generated.py @@ -447,6 +447,7 @@ class GeneratedConfig: # Group `Smallevent` Smallevent_SevenDayTask = True Smallevent_UpdateInfoImmediately = False + Smallevent_autoRetire = False Smallevent_OcrModel = 'volc' # baidu, volc # Group `Oilkeep` diff --git a/module/config/i18n/en-US.json b/module/config/i18n/en-US.json index 3ddf07340..d4813b624 100644 --- a/module/config/i18n/en-US.json +++ b/module/config/i18n/en-US.json @@ -2507,6 +2507,10 @@ "name": "Smallevent.UpdateInfoImmediately.name", "help": "Smallevent.UpdateInfoImmediately.help" }, + "autoRetire": { + "name": "Smallevent.autoRetire.name", + "help": "Smallevent.autoRetire.help" + }, "OcrModel": { "name": "Smallevent.OcrModel.name", "help": "Smallevent.OcrModel.help", diff --git a/module/config/i18n/ja-JP.json b/module/config/i18n/ja-JP.json index 0240b335f..80f3ef21a 100644 --- a/module/config/i18n/ja-JP.json +++ b/module/config/i18n/ja-JP.json @@ -2507,6 +2507,10 @@ "name": "Smallevent.UpdateInfoImmediately.name", "help": "Smallevent.UpdateInfoImmediately.help" }, + "autoRetire": { + "name": "Smallevent.autoRetire.name", + "help": "Smallevent.autoRetire.help" + }, "OcrModel": { "name": "Smallevent.OcrModel.name", "help": "Smallevent.OcrModel.help", diff --git a/module/config/i18n/zh-CN.json b/module/config/i18n/zh-CN.json index 4219e8c3c..b5b75e27a 100644 --- a/module/config/i18n/zh-CN.json +++ b/module/config/i18n/zh-CN.json @@ -2507,6 +2507,10 @@ "name": "立即更新任务进度", "help": "开启后,会立即更新任务进度(多消耗一次api调用),否则会等到第二天更新" }, + "autoRetire": { + "name": "自动完成退役任务", + "help": "开启后,会自动一键退役舰船以完成7日小任务" + }, "OcrModel": { "name": "OCR模型", "help": "选择OCR模型,火山OCR和百度OCR", diff --git a/module/config/i18n/zh-TW.json b/module/config/i18n/zh-TW.json index 09e22a760..c63407716 100644 --- a/module/config/i18n/zh-TW.json +++ b/module/config/i18n/zh-TW.json @@ -2507,6 +2507,10 @@ "name": "Smallevent.UpdateInfoImmediately.name", "help": "Smallevent.UpdateInfoImmediately.help" }, + "autoRetire": { + "name": "Smallevent.autoRetire.name", + "help": "Smallevent.autoRetire.help" + }, "OcrModel": { "name": "Smallevent.OcrModel.name", "help": "Smallevent.OcrModel.help", diff --git a/module/smallevent/samllevent.py b/module/smallevent/samllevent.py index 1bf0cc4a8..f18dfc34d 100644 --- a/module/smallevent/samllevent.py +++ b/module/smallevent/samllevent.py @@ -183,22 +183,27 @@ class SmallEvent(UI): return True if "舰船退役" in text: logger.info(f'resolve the task: 舰船退役') - from module.retire.retirement import Retirement - from module.ui.page import page_retire - self.ui_ensure(destination=page_retire) - retire = Retirement(self.config) - retire._unable_to_enhance = True - retire.device.screenshot() - total = retire.retire_ships_one_click() - if not total: - logger.warning( - 'No ship retired, trying to reset dock filter and disable favourite, then retire again') - retire.dock_favourite_set(False, wait_loading=False) - retire.dock_filter_set() + if self.config.Smallevent_autoRetire == True: + logger.info("resolve the 7Dtask with auto retire") + from module.retire.retirement import Retirement + from module.ui.page import page_retire + self.ui_ensure(destination=page_retire) + retire = Retirement(self.config) + retire._unable_to_enhance = True + retire.device.screenshot() total = retire.retire_ships_one_click() - if not total: - logger.critical('No ship retired') - return True + if not total: + logger.warning( + 'No ship retired, trying to reset dock filter and disable favourite, then retire again') + retire.dock_favourite_set(False, wait_loading=False) + retire.dock_filter_set() + total = retire.retire_ships_one_click() + if not total: + logger.critical('No ship retired') + return True + else: + logger.info("skip the retire task") + return False return False