From 1da50832ee8da69f370c043514a7cd3a36cbefe2 Mon Sep 17 00:00:00 2001 From: W1NDes Date: Fri, 11 Jul 2025 00:11:35 +0800 Subject: [PATCH] =?UTF-8?q?Add(voucher):=20=E6=94=AF=E6=8C=81=E8=87=AA?= =?UTF-8?q?=E5=8A=A8=E8=B4=AD=E4=B9=B0=E6=88=98=E5=BD=B9=E4=BF=A1=E6=81=AF?= =?UTF-8?q?=E8=AE=B0=E5=BD=95=E4=BB=AA=E4=BB=A5=E5=8F=8A=E9=9A=90=E7=A7=98?= =?UTF-8?q?=E6=B5=B7=E5=9F=9F=E4=BF=A1=E6=81=AF=E8=AE=B0=E5=BD=95=E4=BB=AA?= =?UTF-8?q?=E5=8A=9F=E8=83=BD(HiddenZoneDataLogger)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/template.json | 1 + module/campaign/os_run.py | 7 +++++++ module/config/argument/args.json | 8 +++++-- 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/os/operation_siren.py | 6 ++++++ module/shop/base.py | 6 +++--- module/shop/clerk.py | 31 ++++++++++++++++++++++++++++ module/shop/shop_voucher.py | 26 +++++++++++++++++++++++ 13 files changed, 98 insertions(+), 5 deletions(-) diff --git a/config/template.json b/config/template.json index 76e618c63..0eb54e702 100644 --- a/config/template.json +++ b/config/template.json @@ -1930,6 +1930,7 @@ "ServerUpdate": "00:00" }, "OpsiShop": { + "BuySpecialRadar": false, "PresetFilter": "max_benefit_meta", "CustomFilter": "LoggerAbyssalT6 > LoggerAbyssalT5 > LoggerObscure > LoggerAbyssalT4 > ActionPoint > PurpleCoins\n> GearDesignPlanT3 > PlateRandomT4 > DevelopmentMaterialT3 > GearDesignPlanT2 > GearPart\n> OrdnanceTestingReportT3 > OrdnanceTestingReportT2 > DevelopmentMaterialT2 > OrdnanceTestingReportT1\n> METARedBook > CrystallizedHeatResistantSteel > NanoceramicAlloy > NeuroplasticProstheticArm > SupercavitationGenerator" }, diff --git a/module/campaign/os_run.py b/module/campaign/os_run.py index 023e98d43..8be489e07 100644 --- a/module/campaign/os_run.py +++ b/module/campaign/os_run.py @@ -5,6 +5,7 @@ from module.os.map_operation import OSMapOperation from module.os.operation_siren import OperationSiren from module.os_handler.action_point import ActionPointLimit +from module.oilkeep.oilkeep import Oilkeep class OSCampaignRun(OSMapOperation): campaign: OperationSiren @@ -29,6 +30,12 @@ class OSCampaignRun(OSMapOperation): self.config.opsi_task_delay(ap_limit=True) def opsi_shop(self): + if self.config.OpsiShop_BuySpecialRadar: + if Oilkeep(self.config, self.device).update_oil() > 6000: + self.load_campaign() + self.campaign.os_voucher_buy_loggerUnlock() + else: + logger.warning('oil < 6000, skip buying loggerUnlock') try: self.load_campaign() self.campaign.os_shop() diff --git a/module/config/argument/args.json b/module/config/argument/args.json index 47206050e..8d46899b1 100644 --- a/module/config/argument/args.json +++ b/module/config/argument/args.json @@ -3552,12 +3552,12 @@ ], "option_bold": [ "event_20230525_cn", - "event_20250520_cn" + "event_20250424_cn" ], "cn": "event_20230525_cn", "en": "event_20230525_cn", "jp": "event_20230525_cn", - "tw": "event_20250520_cn" + "tw": "event_20250424_cn" }, "Mode": { "type": "select", @@ -9792,6 +9792,10 @@ } }, "OpsiShop": { + "BuySpecialRadar": { + "type": "checkbox", + "value": false + }, "PresetFilter": { "type": "select", "value": "max_benefit_meta", diff --git a/module/config/argument/argument.yaml b/module/config/argument/argument.yaml index 5dcef7841..0c820bebb 100644 --- a/module/config/argument/argument.yaml +++ b/module/config/argument/argument.yaml @@ -802,6 +802,7 @@ OpsiExplore: ForceRun: false LastZone: 0 OpsiShop: + BuySpecialRadar: false PresetFilter: value: max_benefit_meta option: diff --git a/module/config/config_generated.py b/module/config/config_generated.py index 3023965eb..76ebd706f 100644 --- a/module/config/config_generated.py +++ b/module/config/config_generated.py @@ -496,6 +496,7 @@ class GeneratedConfig: OpsiExplore_LastZone = 0 # Group `OpsiShop` + OpsiShop_BuySpecialRadar = False OpsiShop_PresetFilter = 'max_benefit_meta' # max_benefit, max_benefit_meta, no_meta, all, custom OpsiShop_CustomFilter = 'LoggerAbyssalT6 > LoggerAbyssalT5 > LoggerObscure > LoggerAbyssalT4 > ActionPoint > PurpleCoins\n> GearDesignPlanT3 > PlateRandomT4 > DevelopmentMaterialT3 > GearDesignPlanT2 > GearPart\n> OrdnanceTestingReportT3 > OrdnanceTestingReportT2 > DevelopmentMaterialT2 > OrdnanceTestingReportT1\n> METARedBook > CrystallizedHeatResistantSteel > NanoceramicAlloy > NeuroplasticProstheticArm > SupercavitationGenerator' diff --git a/module/config/i18n/en-US.json b/module/config/i18n/en-US.json index fb723bda3..b174fe1ff 100644 --- a/module/config/i18n/en-US.json +++ b/module/config/i18n/en-US.json @@ -2755,6 +2755,10 @@ "name": "OpSi Shop Settings", "help": "Completes OpSi daily activities\nThe following must be satisfied:\n- OpSi story and practice battles must be complete\n- Task OpSi Explore enabled or consuming 5000 oil for special radar in OpSi voucher shop\nAvailable only in the next month after clearing OpSi story, i.e., after the port shop becomes a new version of the shop" }, + "BuySpecialRadar": { + "name": "Buy Special Radar", + "help": "Automatically purchase the Operation Siren Data Logger (5k oil item)" + }, "PresetFilter": { "name": "OpSi Shop Filter", "help": "Generally does not need to be modified. Use \"High value items and META material\"` if Voucher Coins spilled or \"Without META materials\" if you are newcomer.\nHigh value items include ActionPoint, Logger and T4 or higher items; META materials include METABook and META enhance materials.", diff --git a/module/config/i18n/ja-JP.json b/module/config/i18n/ja-JP.json index 42be45e1c..c1cb99cab 100644 --- a/module/config/i18n/ja-JP.json +++ b/module/config/i18n/ja-JP.json @@ -2755,6 +2755,10 @@ "name": "OpsiShop._info.name", "help": "OpsiShop._info.help" }, + "BuySpecialRadar": { + "name": "戦闘情報記録器購入", + "help": "戦闘情報記録器(5000油道具)自動購入" + }, "PresetFilter": { "name": "OpsiShop.PresetFilter.name", "help": "OpsiShop.PresetFilter.help", diff --git a/module/config/i18n/zh-CN.json b/module/config/i18n/zh-CN.json index 55d03c9af..5885f0662 100644 --- a/module/config/i18n/zh-CN.json +++ b/module/config/i18n/zh-CN.json @@ -2755,6 +2755,10 @@ "name": "大世界商店", "help": "使用此功能前必须满足以下条件:\n- 通关大世界主线并完成模拟战+塞壬试验场\n- 启用大世界开荒任务或使用战役信息记录仪(5000油道具)\n- 通关大世界主线后的下一个月,即港口商店变为新版商店后才可使用" }, + "BuySpecialRadar": { + "name": "购买战役信息记录仪", + "help": "自动购买战役信息记录仪(5000油道具)" + }, "PresetFilter": { "name": "港口商店过滤器", "help": "一般默认即可,白票溢出建议选 \"高价值物品与META材料\",萌新建议选 \"不购买META材料\",这会买除了META材料以外的所有东西。\n高价值物品为行动力、坐标和金或者更高级別的商品;META材料为META通用战术教材和4种强化材料。", diff --git a/module/config/i18n/zh-TW.json b/module/config/i18n/zh-TW.json index 1b3ab30c1..2c1229ab4 100644 --- a/module/config/i18n/zh-TW.json +++ b/module/config/i18n/zh-TW.json @@ -2755,6 +2755,10 @@ "name": "大世界商店", "help": "使用此功能前必須滿足以下條件:\n- 通關大世界主線任務+模擬戰\n- 開啟大世界開荒任務或使用戰役信息記錄儀(5000油道具)\n- 通關大世界主線後的下個月,也就是港口商店變成新版商店後才可使用" }, + "BuySpecialRadar": { + "name": "購買戰役信息記錄儀", + "help": "自動購買戰役信息記錄儀(5000油道具)" + }, "PresetFilter": { "name": "港口商店過濾器", "help": "一般用預設即可,白票溢出建議選 \"高價值物品與META材料\",新手建議選 \"不購買META材料\",這會買除了META材料以外的所有東西。\n高價值物品為行動點、坐標和金或者更高級別的物品;META材料為META通用戰術教材和4種強化材料。", diff --git a/module/os/operation_siren.py b/module/os/operation_siren.py index c9ff0110f..435654bf4 100644 --- a/module/os/operation_siren.py +++ b/module/os/operation_siren.py @@ -262,6 +262,12 @@ class OperationSiren(OSMap): self.config.task_delay(target=next_reset) self.config.task_stop() + def os_voucher_buy_loggerUnlock(self): + logger.hr('OS voucher buy loggerUnlock', level=1) + self._os_voucher_enter() + VoucherShop(self.config, self.device).run_loggerUnlock() + self._os_voucher_exit() + def _os_shop_delay(self, not_empty) -> datetime: """ Calculate the delay of OpsiShop. diff --git a/module/shop/base.py b/module/shop/base.py index 10f20628b..268bd42a1 100644 --- a/module/shop/base.py +++ b/module/shop/base.py @@ -16,7 +16,7 @@ FILTER_REGEX = re.compile( '^(array|book|box|bulin|cat' '|chip|coin|cube|drill|food' '|plate|retrofit|pr|dr|specializedcore' - '|logger|tuning' + '|logger|tuning|hiddenzonedatalogger' '|hecombatplan|fragment' '|albacore|bataan|bearn|bluegill|carabiniere|casablanca|contedicavour|dukeofyork' '|echo|eldridge|gangut|glorious|grenville|hibiki|hunter|icarus' @@ -208,7 +208,7 @@ class ShopBase(UI): return False - def shop_get_items(self, skip_first_screenshot=True): + def shop_get_items(self, skip_first_screenshot=True,cost=True): """ Args: skip_first_screenshot (bool): @@ -248,7 +248,7 @@ class ShopBase(UI): self.device.image, name=True, amount=False, - cost=True, + cost=cost, price=True, tag=False ) diff --git a/module/shop/clerk.py b/module/shop/clerk.py index cb8718994..aeb144eb8 100644 --- a/module/shop/clerk.py +++ b/module/shop/clerk.py @@ -344,3 +344,34 @@ class ShopClerk(ShopBase, Retirement): logger.warning('Too many items to buy, stopped') return True + + def shop_buy_loggerUnlock(self): + """ + Returns: + bool: If success, and able to continue. + """ + for _ in range(12): + logger.hr('Shop buy loggerUnlock', level=2) + # Get first for innate delay to ocr + # shop currency for accurate parse + items = self.shop_get_items(cost=False) + self.shop_currency() + if self._currency <= 0: + logger.warning(f'Current funds: {self._currency}, stopped') + return False + + if items is None: + logger.info('Shop buy finished') + return True + + for item in items: + if item.price == 5000: + logger.warning(f'Found loggerUnlock, buy it') + self.shop_buy_execute(item) + return True + else: + continue + + + logger.warning('no loggerUnlock to buy, stopped') + return True diff --git a/module/shop/shop_voucher.py b/module/shop/shop_voucher.py index 1cdb2b27f..0fd16acbf 100644 --- a/module/shop/shop_voucher.py +++ b/module/shop/shop_voucher.py @@ -209,6 +209,32 @@ class VoucherShop(ShopClerk, ShopStatus): del_cached_property(self, 'shop_voucher_items') continue + def run_loggerUnlock(self): + """ + Run Voucher Shop + """ + # Base case; exit run if filter empty + if not self.shop_filter: + return + + # When called, expected to be in + # correct Voucher Shop interface + logger.hr('Voucher Shop', level=1) + self.wait_until_voucher_appear() + + # Execute buy operations + VOUCHER_SHOP_SCROLL.set_top(main=self) + while 1: + self.shop_buy_loggerUnlock() + if VOUCHER_SHOP_SCROLL.at_bottom(main=self): + logger.info('Voucher Shop reach bottom, stop') + break + else: + VOUCHER_SHOP_SCROLL.next_page(main=self) + del_cached_property(self, 'shop_grid') + del_cached_property(self, 'shop_voucher_items') + continue + def run_once(self): """ Run Voucher Shop to purchase