From e45fd05341de6300b7d8a35e868b21d7c12342d3 Mon Sep 17 00:00:00 2001 From: LmeSzinc <37934724+LmeSzinc@users.noreply.github.com> Date: Sat, 28 Mar 2026 18:12:31 +0800 Subject: [PATCH] Add: Add Students with Level >= X Only --- config/template.json | 3 ++- module/config/argument/args.json | 4 ++++ module/config/argument/argument.yaml | 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/tactical/tactical_class.py | 23 +++++++++++++++-------- 8 files changed, 38 insertions(+), 9 deletions(-) diff --git a/config/template.json b/config/template.json index 7ec2175f7..41b2a2628 100644 --- a/config/template.json +++ b/config/template.json @@ -1253,7 +1253,8 @@ }, "AddNewStudent": { "Enable": false, - "Favorite": true + "Favorite": true, + "MinLevel": 50 }, "Storage": { "Storage": {} diff --git a/module/config/argument/args.json b/module/config/argument/args.json index 531741908..40f6f579a 100644 --- a/module/config/argument/args.json +++ b/module/config/argument/args.json @@ -6685,6 +6685,10 @@ "Favorite": { "type": "checkbox", "value": true + }, + "MinLevel": { + "type": "input", + "value": 50 } }, "Storage": { diff --git a/module/config/argument/argument.yaml b/module/config/argument/argument.yaml index 77fc24e65..d27cdf4c4 100644 --- a/module/config/argument/argument.yaml +++ b/module/config/argument/argument.yaml @@ -362,6 +362,7 @@ ControlExpOverflow: AddNewStudent: Enable: false Favorite: true + MinLevel: 50 Research: UseCube: value: only_05_hour diff --git a/module/config/i18n/en-US.json b/module/config/i18n/en-US.json index 51352e6ad..d9cfe5d8e 100644 --- a/module/config/i18n/en-US.json +++ b/module/config/i18n/en-US.json @@ -1417,6 +1417,10 @@ "Favorite": { "name": "Use Favorite Filter", "help": "During student selection apply the favorite filter\nThereby, giving priority to certain ship girls\nApply the favorite status to a ship girl in-game" + }, + "MinLevel": { + "name": "Add Students with Level >= X Only", + "help": "" } }, "Research": { diff --git a/module/config/i18n/ja-JP.json b/module/config/i18n/ja-JP.json index b4daf33c2..686a40d84 100644 --- a/module/config/i18n/ja-JP.json +++ b/module/config/i18n/ja-JP.json @@ -1417,6 +1417,10 @@ "Favorite": { "name": "好ましい選択", "help": "" + }, + "MinLevel": { + "name": "レベルがX以上のキャラクターのみを追加してください。", + "help": "" } }, "Research": { diff --git a/module/config/i18n/zh-CN.json b/module/config/i18n/zh-CN.json index a4de36172..91f022671 100644 --- a/module/config/i18n/zh-CN.json +++ b/module/config/i18n/zh-CN.json @@ -1417,6 +1417,10 @@ "Favorite": { "name": "优先选择常用", "help": "" + }, + "MinLevel": { + "name": "仅添加等级 >= X 的角色", + "help": "" } }, "Research": { diff --git a/module/config/i18n/zh-TW.json b/module/config/i18n/zh-TW.json index 69294ecab..edee19175 100644 --- a/module/config/i18n/zh-TW.json +++ b/module/config/i18n/zh-TW.json @@ -1417,6 +1417,10 @@ "Favorite": { "name": "優先選擇常用", "help": "" + }, + "MinLevel": { + "name": "僅新增等級 >= X 的角色", + "help": "" } }, "Research": { diff --git a/module/tactical/tactical_class.py b/module/tactical/tactical_class.py index 3c2e9f022..b8c9f5b9d 100644 --- a/module/tactical/tactical_class.py +++ b/module/tactical/tactical_class.py @@ -643,27 +643,34 @@ class RewardTacticalClass(Dock): # Wait until they turn into # [120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120] level_ocr = LevelOcr(CARD_LEVEL_GRIDS.buttons, name='DOCK_LEVEL_OCR', threshold=64) - timeout = Timer(1, count=1).start() - while 1: + list_level = [] + for _ in self.loop(timeout=1): list_level = level_ocr.ocr(self.device.image) first_ship = next((i for i, x in enumerate(list_level) if x > 0), len(list_level)) first_empty = next((i for i, x in enumerate(list_level) if x == 0), len(list_level)) - if timeout.reached(): - logger.warning('Wait ship cards timeout') - break if first_empty >= first_ship: break - self.device.screenshot() + else: + logger.warning('Wait ship cards timeout') + + try: + min_level = int(self.config.AddNewStudent_MinLevel) + if min_level < 1: + min_level = 1 + except (ValueError, TypeError) as e: + logger.warning(f'Invalid AddNewStudent_MinLevel: {self.config.AddNewStudent_MinLevel}, {e}') + min_level = 1 + logger.attr('AddNewStudent_MinLevel', min_level) should_select_button = None for button, level in list(zip(CARD_GRIDS.buttons, list_level))[self.dock_select_index:]: # Select ship LV > 1 only - if level > 1: + if level >= min_level: should_select_button = button break if should_select_button is None: - logger.info('No ships with level > 1 in dock') + logger.info(f'No ships with level >= {min_level} in dock') return False # select a ship