From 9286227444139bc75899d4b1a6601b52b66d3ea8 Mon Sep 17 00:00:00 2001 From: Sthkm3 Date: Wed, 25 Feb 2026 14:46:02 +0800 Subject: [PATCH] v1.0.1-2 Refactor screen capture and color detection logic for product selling. --- src/run.js | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/src/run.js b/src/run.js index 8c3fdd4..724a0ad 100644 --- a/src/run.js +++ b/src/run.js @@ -59,7 +59,6 @@ toast(isPaused ? "已暫停" : "已啟動"); }); // 主循環 while (true) { - var img = captureScreen(); var pkg = currentPackage(); // 判斷應用 @@ -68,17 +67,21 @@ while (true) { sleep(1000); continue; } + + var img = captureScreen(); // 販賣商品 if (config.sellProduct && !isPaused) { - if ( - !images.detectsColor(img, "#B38282", 40, 1265) && - !images.detectsColor(img, "#DCAB82", 40, 1265) - ) { - let x = random(30, 90); - let y = random(1200, 1240); - click(x, y); - sleep(200); + let l = ( + !images.detectsColor(img, "#B38282", 35, 1267) && + !images.detectsColor(img, "#DCAB82", 35, 1267) + ) + let r = ( + !images.detectsColor(img, "#B38282", 45, 1267) && + !images.detectsColor(img, "#DCAB82", 45, 1267) + ) + if (l || r) { + click(60, 1222); } } @@ -86,7 +89,6 @@ while (true) { if (config.upgradeFacility && !isPaused) { if (!images.detectsColor(img, "#F7E5AE", 57, 1096)) { click(31, 1044); - sleep(200); } }