From c2365aa92c813f636d86c69b93cf37ebb09ce0ce Mon Sep 17 00:00:00 2001 From: positnuec <93694981+positnuec@users.noreply.github.com> Date: Thu, 25 Dec 2025 19:03:24 +0800 Subject: [PATCH] Feat: Purchase Quantity Control for Skin Boxes --- config/template.json | 3 ++- module/config/argument/args.json | 13 +++++++++++-- module/config/argument/argument.yaml | 5 ++++- module/config/config_generated.py | 3 ++- module/config/i18n/en-US.json | 9 ++++++++- module/config/i18n/ja-JP.json | 9 ++++++++- module/config/i18n/zh-CN.json | 11 +++++++++-- module/config/i18n/zh-TW.json | 9 ++++++++- module/shop/shop_general.py | 5 ++++- 9 files changed, 56 insertions(+), 11 deletions(-) diff --git a/config/template.json b/config/template.json index ea54fdb74..21720d3a0 100644 --- a/config/template.json +++ b/config/template.json @@ -1743,7 +1743,8 @@ "GeneralShop": { "UseGems": false, "Refresh": false, - "BuySkinBox": false, + "BuySkinBox": "disabled", + "BuySkinBoxAmount": 0, "ConsumeCoins": false, "Filter": "BookRedT3 > BookYellowT3 > BookBlueT3 > BookRedT2\n> Cube\n> FoodT6 > FoodT5" }, diff --git a/module/config/argument/args.json b/module/config/argument/args.json index b50607cf5..a0142b045 100644 --- a/module/config/argument/args.json +++ b/module/config/argument/args.json @@ -9475,8 +9475,17 @@ "value": false }, "BuySkinBox": { - "type": "checkbox", - "value": false + "type": "select", + "value": "disabled", + "option": [ + "disabled", + "unlimited", + "specified" + ] + }, + "BuySkinBoxAmount": { + "type": "input", + "value": 0 }, "ConsumeCoins": { "type": "checkbox", diff --git a/module/config/argument/argument.yaml b/module/config/argument/argument.yaml index bc888e4ed..81e9ca139 100644 --- a/module/config/argument/argument.yaml +++ b/module/config/argument/argument.yaml @@ -763,7 +763,10 @@ Island15: GeneralShop: UseGems: false Refresh: false - BuySkinBox: false + BuySkinBox: + value: disabled + option: [ disabled, unlimited, specified ] + BuySkinBoxAmount: 0 ConsumeCoins: false Filter: |- BookRedT3 > BookYellowT3 > BookBlueT3 > BookRedT2 diff --git a/module/config/config_generated.py b/module/config/config_generated.py index e6929f032..a7421d7fe 100644 --- a/module/config/config_generated.py +++ b/module/config/config_generated.py @@ -403,7 +403,8 @@ class GeneratedConfig: # Group `GeneralShop` GeneralShop_UseGems = False GeneralShop_Refresh = False - GeneralShop_BuySkinBox = False + GeneralShop_BuySkinBox = 'disabled' # disabled, unlimited, specified + GeneralShop_BuySkinBoxAmount = 0 GeneralShop_ConsumeCoins = False GeneralShop_Filter = 'BookRedT3 > BookYellowT3 > BookBlueT3 > BookRedT2\n> Cube\n> FoodT6 > FoodT5' diff --git a/module/config/i18n/en-US.json b/module/config/i18n/en-US.json index 08aa4578b..540ef4fea 100644 --- a/module/config/i18n/en-US.json +++ b/module/config/i18n/en-US.json @@ -2981,7 +2981,14 @@ }, "BuySkinBox": { "name": "Buy Equip Skin Boxes", - "help": "In order to reduce maintenance costs, the skin box selectors in the filter will not be updated with the game, but Alas will consider any unknown items with a quantity of 1 and consume 7000 coins as skin boxes and buy them." + "help": "In order to reduce maintenance costs, the skin box selectors in the filter will not be updated with the game, but Alas will consider any unknown items with a quantity of 1 and consume 7000 coins as skin boxes and buy them.", + "disabled": "Do Not Purchase", + "unlimited": "Unlimited Purchases", + "specified": "Purchase Specified Quantity" + }, + "BuySkinBoxAmount": { + "name": "Purchase X Skin Boxes", + "help": "Takes effect when \"Purchase Specified Quantity\" is selected." }, "ConsumeCoins": { "name": "Consume Spilled Coins", diff --git a/module/config/i18n/ja-JP.json b/module/config/i18n/ja-JP.json index 2f735661e..2c663d7c5 100644 --- a/module/config/i18n/ja-JP.json +++ b/module/config/i18n/ja-JP.json @@ -2981,7 +2981,14 @@ }, "BuySkinBox": { "name": "GeneralShop.BuySkinBox.name", - "help": "GeneralShop.BuySkinBox.help" + "help": "GeneralShop.BuySkinBox.help", + "disabled": "disabled", + "unlimited": "unlimited", + "specified": "specified" + }, + "BuySkinBoxAmount": { + "name": "GeneralShop.BuySkinBoxAmount.name", + "help": "GeneralShop.BuySkinBoxAmount.help" }, "ConsumeCoins": { "name": "GeneralShop.ConsumeCoins.name", diff --git a/module/config/i18n/zh-CN.json b/module/config/i18n/zh-CN.json index 8a849088c..508781008 100644 --- a/module/config/i18n/zh-CN.json +++ b/module/config/i18n/zh-CN.json @@ -2980,8 +2980,15 @@ "help": "刷新需要消耗50钻石" }, "BuySkinBox": { - "name": "买外观装备箱", - "help": "为降低维护成本,过滤器中的外观箱选择器不会随游戏更新,但Alas会将任何未知的,数量为1的,消耗7000物资的物品视为外观箱,并购买" + "name": "买装备外观箱", + "help": "为降低维护成本,过滤器中的外观箱选择器不会随游戏更新,但Alas会将任何未知的,数量为1的,消耗7000物资的物品视为外观箱,并购买", + "disabled": "不购买", + "unlimited": "无限制购买", + "specified": "购买指定数量" + }, + "BuySkinBoxAmount": { + "name": "购买 X 个外观箱", + "help": "在选择“购买指定数量”时生效" }, "ConsumeCoins": { "name": "消耗溢出物资", diff --git a/module/config/i18n/zh-TW.json b/module/config/i18n/zh-TW.json index 0bed18560..9de40e80a 100644 --- a/module/config/i18n/zh-TW.json +++ b/module/config/i18n/zh-TW.json @@ -2981,7 +2981,14 @@ }, "BuySkinBox": { "name": "買外觀裝備箱", - "help": "為降低維護成本,過濾器中的外觀箱選擇器不會隨遊戲更新,但Alas會將任何未知的,數量為1的,消耗7000物資的物品視為外觀箱,併購買" + "help": "為降低維護成本,過濾器中的外觀箱選擇器不會隨遊戲更新,但Alas會將任何未知的,數量為1的,消耗7000物資的物品視為外觀箱,併購買", + "disabled": "不購買", + "unlimited": "無限制購買", + "specified": "購買指定數量" + }, + "BuySkinBoxAmount": { + "name": "購買 X 個外觀箱", + "help": "在選擇「購買指定數量」時生效" }, "ConsumeCoins": { "name": "消耗溢出物資", diff --git a/module/shop/shop_general.py b/module/shop/shop_general.py index 48dff114b..898369680 100644 --- a/module/shop/shop_general.py +++ b/module/shop/shop_general.py @@ -125,12 +125,15 @@ class GeneralShop_250814(ShopClerk, ShopUI, ShopStatus): if item.cost == 'Coins': return True - if self.config.GeneralShop_BuySkinBox: + mode = self.config.GeneralShop_BuySkinBox + if (mode == 'unlimited' or (mode == 'specified' and self.config.GeneralShop_BuySkinBoxAmount > 0)): 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: + if mode == 'specified': + self.config.GeneralShop_BuySkinBoxAmount -= 1 return True return False