From 052ce48feaf98471f0a5f4037f2e4de45abfc56e Mon Sep 17 00:00:00 2001 From: Zebartin <1500012724@pku.edu.cn> Date: Mon, 13 Mar 2023 20:09:01 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E8=BF=94=E5=9B=9E=E9=A6=96=E9=A1=B5?= =?UTF-8?q?=E5=90=8E=E7=82=B9=E4=B8=80=E4=B8=8B=E2=80=9C=E5=A4=A7=E5=8E=85?= =?UTF-8?q?=E2=80=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- NIKKE/NIKKEutils.js | 15 ++++++++++++--- "NIKKE/NIKKE\346\227\245\345\270\270.js" | 1 + 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/NIKKE/NIKKEutils.js b/NIKKE/NIKKEutils.js index cd233c9..1b79854 100644 --- a/NIKKE/NIKKEutils.js +++ b/NIKKE/NIKKEutils.js @@ -149,23 +149,32 @@ function 退出NIKKE() { function 返回首页() { const homeImage = images.read('./images/home.jpg'); + let [width, height] = getDisplaySize(); var result = null; for (let i = 0; i < 10; ++i) { result = findImageByFeature(captureScreen(), homeImage, { threshold: 0.6, - region: [0, height * 0.8] + region: [0, height * 0.8, width / 2, height * 0.2] }); if (result != null) break; sleep(300); } + result.text = '首页图标' homeImage.recycle(); sleep(1000); for (let i = 0; i < 10; ++i) { clickRect(result); sleep(4000); - if (ocrUntilFound(res => res.text.match(/(大厅|基地|物品|方舟)/), 3, 400) != null) + let hallBtn = ocrUntilFound(res => { + if (res.text.match(/(大厅|基地|物品|方舟)/) == null) + return null; + return res.find(e => e.text == '大厅'); + }, 3, 400) + if (hallBtn != null) { + clickRect(hallBtn); break; + } } log('返回首页'); } @@ -228,7 +237,7 @@ function 刷刷刷() { let img = captureScreen(); let hasBlue = images.findColor(img, '#00a1ff', { region: [ - 0, clickNext.bounds.bottom, + 0, clickNext.bounds.bottom, clickNext.bounds.right, img.height - clickNext.bounds.bottom ], threshold: 20 diff --git "a/NIKKE/NIKKE\346\227\245\345\270\270.js" "b/NIKKE/NIKKE\346\227\245\345\270\270.js" index 76a4c63..c2b0fcc 100644 --- "a/NIKKE/NIKKE\346\227\245\345\270\270.js" +++ "b/NIKKE/NIKKE\346\227\245\345\270\270.js" @@ -128,6 +128,7 @@ function 商店() { break; sleep(300); } + arenaShop.text = '竞技场商店图标'; arenaShopImage.recycle(); clickRect(arenaShop); ocrUntilFound(res => {