diff --git a/config/template.json b/config/template.json index bd93fe74d..7dae1bcc3 100644 --- a/config/template.json +++ b/config/template.json @@ -1285,7 +1285,8 @@ "Mode": "seamlessly", "RetainTalentedGold": true, "RetainTalentedPurple": true, - "EnhanceIndex": 1 + "EnhanceIndex": 1, + "MaxFeedLevel": 5 }, "Storage": { "Storage": {} diff --git a/module/config/argument/args.json b/module/config/argument/args.json index be92a41ca..c2f357b33 100644 --- a/module/config/argument/args.json +++ b/module/config/argument/args.json @@ -7035,6 +7035,10 @@ "EnhanceIndex": { "type": "input", "value": 1 + }, + "MaxFeedLevel": { + "type": "input", + "value": 5 } }, "Storage": { diff --git a/module/config/argument/argument.yaml b/module/config/argument/argument.yaml index 9b4889491..c898e3528 100644 --- a/module/config/argument/argument.yaml +++ b/module/config/argument/argument.yaml @@ -427,6 +427,7 @@ MeowfficerTrain: RetainTalentedGold: true RetainTalentedPurple: true EnhanceIndex: 1 + MaxFeedLevel: 5 GuildLogistics: Enable: true SelectNewMission: false diff --git a/module/config/config_generated.py b/module/config/config_generated.py index 2200caec3..f5e2ec226 100644 --- a/module/config/config_generated.py +++ b/module/config/config_generated.py @@ -229,6 +229,7 @@ class GeneratedConfig: MeowfficerTrain_RetainTalentedGold = True MeowfficerTrain_RetainTalentedPurple = True MeowfficerTrain_EnhanceIndex = 1 + MeowfficerTrain_MaxFeedLevel = 5 # Group `GuildLogistics` GuildLogistics_Enable = True diff --git a/module/config/i18n/en-US.json b/module/config/i18n/en-US.json index 20596037a..31cc14958 100644 --- a/module/config/i18n/en-US.json +++ b/module/config/i18n/en-US.json @@ -1503,6 +1503,10 @@ "EnhanceIndex": { "name": "Enhance Index", "help": "Index of target meowfficer to enhance. Limited in 1 ~ 12; indices are in ascending order from left to right of the 4 x 3 grid." + }, + "MaxFeedLevel": { + "name": "Do not use meowfficer larger than level X as enhancing materials", + "help": "The X value is limited to 1 to 30" } }, "GuildLogistics": { diff --git a/module/config/i18n/ja-JP.json b/module/config/i18n/ja-JP.json index 07710af2e..f44e45207 100644 --- a/module/config/i18n/ja-JP.json +++ b/module/config/i18n/ja-JP.json @@ -1503,6 +1503,10 @@ "EnhanceIndex": { "name": "MeowfficerTrain.EnhanceIndex.name", "help": "MeowfficerTrain.EnhanceIndex.help" + }, + "MaxFeedLevel": { + "name": "レベル X 以上の猫を強化材料にしない", + "help": "X 値は1~30に制限します" } }, "GuildLogistics": { diff --git a/module/config/i18n/zh-CN.json b/module/config/i18n/zh-CN.json index f66da16a1..02445b35e 100644 --- a/module/config/i18n/zh-CN.json +++ b/module/config/i18n/zh-CN.json @@ -1503,6 +1503,10 @@ "EnhanceIndex": { "name": "用无特殊天赋的猫给第 X 只猫强化", "help": "猫仓库的第 X 只猫,限制在 1 ~ 12,顺序从左上到右下" + }, + "MaxFeedLevel": { + "name": "不使用大于 X 级的猫作为强化材料", + "help": "X 值限制在 1 ~ 30" } }, "GuildLogistics": { diff --git a/module/config/i18n/zh-TW.json b/module/config/i18n/zh-TW.json index a8ceb69a6..e6b5cfb4c 100644 --- a/module/config/i18n/zh-TW.json +++ b/module/config/i18n/zh-TW.json @@ -1503,6 +1503,10 @@ "EnhanceIndex": { "name": "用無特殊天賦的貓給第 X 隻貓強化", "help": "貓倉庫的第 X 隻貓,限制在 1 ~ 12,順序從左上到右下" + }, + "MaxFeedLevel": { + "name": "不使用大於 X 級的貓作為強化材料", + "help": "X 值限制在 1 ~ 30" } }, "GuildLogistics": { diff --git a/module/meowfficer/enhance.py b/module/meowfficer/enhance.py index ef4551f06..3855ab1b7 100644 --- a/module/meowfficer/enhance.py +++ b/module/meowfficer/enhance.py @@ -14,6 +14,9 @@ MEOWFFICER_SELECT_GRID = ButtonGrid( MEOWFFICER_FEED_GRID = ButtonGrid( origin=(783, 189), delta=(130, 148), button_shape=(46, 46), grid_shape=(4, 3), name='MEOWFFICER_FEED_GRID') +MEOWFICER_FEED_LEVEL_GRID = ButtonGrid( + origin=(738, 211), delta=(130, 148), button_shape=(20, 22), grid_shape=(4, 3), + name='MEOWFFICER_FEED_LEVEL_GRID') MEOWFFICER_FEED = DigitCounter(OCR_MEOWFFICER_FEED, letter=(131, 121, 123), threshold=64) @@ -85,7 +88,26 @@ class MeowfficerEnhance(MeowfficerBase): list(Button) """ clickable = [] - for index, button in enumerate(MEOWFFICER_FEED_GRID.buttons): + + # Reset invalid value of MeowfficerTrain_MaxFeedLevel + # it can work without this code, just for rigor + reset_max_feed_level = -1 + if self.config.MeowfficerTrain_MaxFeedLevel < 1: + reset_max_feed_level = 1 + elif self.config.MeowfficerTrain_MaxFeedLevel > 30: + reset_max_feed_level = 30 + + if -1 != reset_max_feed_level: + logger.warning(f"Condition '1 <= MeowfficerTrain_MaxFeedLevel <= 30' needs to be satisfied, " + f'now MeowfficerTrain_MaxFeedLevel is {self.config.MeowfficerTrain_MaxFeedLevel}, ' + f'reset to {reset_max_feed_level}') + self.config.MeowfficerTrain_MaxFeedLevel = reset_max_feed_level + + # Get all the cat levels ready for enhance + feed_level_list = Digit(MEOWFICER_FEED_LEVEL_GRID.buttons, letter=(49, 48, 49), + name='FEED_MEOWFFICER_LEVEL').ocr(self.device.image) + + for index, (button, level) in enumerate(zip(MEOWFFICER_FEED_GRID.buttons, feed_level_list)): # Exit if 11th button; no need to validate as not # possible to click beyond this point if index >= 10: @@ -100,6 +122,11 @@ class MeowfficerEnhance(MeowfficerBase): if self.image_color_count(button, color=(95, 229, 108), threshold=221, count=150): continue + # Continue onto next If the target Meowfficer's level + # is greater than the maximum feed level set + if level > self.config.MeowfficerTrain_MaxFeedLevel: + continue + # Neither base case, so presume # button is clickable clickable.append(button)