From 953e4ad32de3187f7184e7bf625fcda9644653f6 Mon Sep 17 00:00:00 2001 From: Jamis Date: Tue, 11 Nov 2025 19:52:17 +0800 Subject: [PATCH] handle expired stuff popup window (#2342) --- repo/js/AbundantOre/README.md | 4 ++++ repo/js/AbundantOre/main.js | 20 ++++++++++++++++++++ repo/js/AbundantOre/manifest.json | 2 +- 3 files changed, 25 insertions(+), 1 deletion(-) diff --git a/repo/js/AbundantOre/README.md b/repo/js/AbundantOre/README.md index 62d392bbe..bd88d10df 100644 --- a/repo/js/AbundantOre/README.md +++ b/repo/js/AbundantOre/README.md @@ -29,6 +29,10 @@ ## ChangeLog +### 0.22 + +- 增加处理过期物品的弹出窗口 + ### 0.18 - 修复坐标监控逻辑中的bug diff --git a/repo/js/AbundantOre/main.js b/repo/js/AbundantOre/main.js index c13b2fbec..69c0b5989 100644 --- a/repo/js/AbundantOre/main.js +++ b/repo/js/AbundantOre/main.js @@ -253,6 +253,25 @@ function get_some_tasks(hints) { return tasks.map(i => [i, statistics[i]]); } +async function close_expired_stuff_popup_window() { + const game_region = captureGameRegion(); + + const text_x = 850; + const text_y = 273; + const text_w = 225; + const text_h = 51; + const ocr_res = game_region.find(RecognitionObject.ocr(text_x, text_y, text_w, text_h)); + if (ocr_res) { + if (ocr_res.text.includes("物品过期")) { + log.info("检测到物品过期"); + click(1000, 750); + await sleep(1000); + } + } + + game_region.dispose(); +} + async function get_inventory() { const ore_image_map = { amethyst_lumps: "assets/images/amethyst_lump.png", @@ -264,6 +283,7 @@ async function get_inventory() { await genshin.returnMainUi(); keyPress("b") await sleep(1000); + await close_expired_stuff_popup_window(); click(964, 53); await sleep(500); diff --git a/repo/js/AbundantOre/manifest.json b/repo/js/AbundantOre/manifest.json index 54dd146bd..b9eb2ef9a 100644 --- a/repo/js/AbundantOre/manifest.json +++ b/repo/js/AbundantOre/manifest.json @@ -2,7 +2,7 @@ "bgi_version": "0.50.0", "manifest_version": 1, "name": "矿产资源批发", - "version": "0.21", + "version": "0.22", "description": "自动记录矿石刷新时间,优先选择效率最高的路线,支持按区域、种类、数量自动规划挖矿路线", "authors": [ {