From f4cd7a70fff5c6dcbee660fc4ef8ac51dad8d02e Mon Sep 17 00:00:00 2001 From: 0O0o0oOoO00 <11174151+0O0o0oOoO00@users.noreply.github.com> Date: Sun, 21 Sep 2025 20:22:26 +0800 Subject: [PATCH] add: flexible coin consumption settings --- config/template.json | 2 +- module/config/argument/args.json | 4 ++-- module/config/argument/argument.yaml | 2 +- module/config/config_generated.py | 2 +- module/config/i18n/zh-CN.json | 2 +- module/shop/shop_general.py | 20 ++++++++++++++++++++ 6 files changed, 26 insertions(+), 6 deletions(-) diff --git a/config/template.json b/config/template.json index ed7c42e83..d5faf91ed 100644 --- a/config/template.json +++ b/config/template.json @@ -2173,7 +2173,7 @@ "UseGems": false, "Refresh": false, "BuySkinBox": false, - "ConsumeCoins": false, + "ConsumeCoins": 550000, "Filter": "BookRedT3 > BookYellowT3 > BookBlueT3 > BookRedT2\n> Cube\n> FoodT6 > FoodT5" }, "Storage": { diff --git a/module/config/argument/args.json b/module/config/argument/args.json index e6703b8e9..aacd75c3e 100644 --- a/module/config/argument/args.json +++ b/module/config/argument/args.json @@ -15045,8 +15045,8 @@ "value": false }, "ConsumeCoins": { - "type": "checkbox", - "value": false + "type": "input", + "value": 550000 }, "Filter": { "type": "textarea", diff --git a/module/config/argument/argument.yaml b/module/config/argument/argument.yaml index 6482bd8c9..7d2cbe73a 100644 --- a/module/config/argument/argument.yaml +++ b/module/config/argument/argument.yaml @@ -468,7 +468,7 @@ GeneralShop: UseGems: false Refresh: false BuySkinBox: false - ConsumeCoins: false + ConsumeCoins: 550000 Filter: |- BookRedT3 > BookYellowT3 > BookBlueT3 > BookRedT2 > Cube diff --git a/module/config/config_generated.py b/module/config/config_generated.py index 428e254bb..c7641b608 100644 --- a/module/config/config_generated.py +++ b/module/config/config_generated.py @@ -267,7 +267,7 @@ class GeneratedConfig: GeneralShop_UseGems = False GeneralShop_Refresh = False GeneralShop_BuySkinBox = False - GeneralShop_ConsumeCoins = False + GeneralShop_ConsumeCoins = 550000 GeneralShop_Filter = 'BookRedT3 > BookYellowT3 > BookBlueT3 > BookRedT2\n> Cube\n> FoodT6 > FoodT5' # Group `GuildShop` diff --git a/module/config/i18n/zh-CN.json b/module/config/i18n/zh-CN.json index 6f01f58e3..dad829ab9 100644 --- a/module/config/i18n/zh-CN.json +++ b/module/config/i18n/zh-CN.json @@ -1731,7 +1731,7 @@ }, "ConsumeCoins": { "name": "消耗溢出物资", - "help": "物资超过550000时购买所有消耗物资的物品" + "help": "设置为0则不启用,默认为550000" }, "Filter": { "name": "商店过滤器", diff --git a/module/shop/shop_general.py b/module/shop/shop_general.py index d3d9d83ea..9a32e9dce 100644 --- a/module/shop/shop_general.py +++ b/module/shop/shop_general.py @@ -155,6 +155,26 @@ class GeneralShop(ShopClerk, ShopUI, ShopStatus): break +class GeneralShop(GeneralShop): + def shop_check_custom_item(self, item): + if isinstance(self.config.GeneralShop_ConsumeCoins, bool): + self.config.GeneralShop_ConsumeCoins = 550000 + + if self.config.GeneralShop_ConsumeCoins and self._currency >= self.config.GeneralShop_ConsumeCoins: + if item.cost == 'Coins': + return True + + if self.config.GeneralShop_BuySkinBox: + if (not item.is_known_item()) and item.amount == 1 and item.cost == 'Coins' and item.price == 7000: + # check a custom item that cannot be template matched as color + # and design constantly changes i.e. equip skin box + logger.info(f'Item {item} is considered to be an equip skin box') + if self._currency >= item.price: + return True + + return False + + class GeneralShop_250814(GeneralShop): # New UI in 2025-08-14 @cached_property