handle expired stuff popup window (#2342)

This commit is contained in:
Jamis
2025-11-11 19:52:17 +08:00
committed by GitHub
parent 1bee41e827
commit 953e4ad32d
3 changed files with 25 additions and 1 deletions

View File

@@ -29,6 +29,10 @@
## ChangeLog
### 0.22
- 增加处理过期物品的弹出窗口
### 0.18
- 修复坐标监控逻辑中的bug

View File

@@ -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);

View File

@@ -2,7 +2,7 @@
"bgi_version": "0.50.0",
"manifest_version": 1,
"name": "矿产资源批发",
"version": "0.21",
"version": "0.22",
"description": "自动记录矿石刷新时间,优先选择效率最高的路线,支持按区域、种类、数量自动规划挖矿路线",
"authors": [
{