From d92d6f249fcbccf4e94b2a2589369498e04ee8a3 Mon Sep 17 00:00:00 2001 From: Gitea Date: Sat, 11 Jun 2022 10:04:55 +0300 Subject: [PATCH] Improved reliability --- src/xyz/unbewohnte/albionFisher/fisher.java | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/xyz/unbewohnte/albionFisher/fisher.java b/src/xyz/unbewohnte/albionFisher/fisher.java index b56be8f..647a980 100644 --- a/src/xyz/unbewohnte/albionFisher/fisher.java +++ b/src/xyz/unbewohnte/albionFisher/fisher.java @@ -25,7 +25,6 @@ import java.awt.image.BufferedImage; import javax.swing.ImageIcon; - public class fisher { static RGB BOBBER_COLOR = new RGB(255, 180, 31); @@ -225,16 +224,19 @@ public class fisher { Point bobberCoords = imgutils.getPixelCoordinates(screenshot, BOBBER_COLOR); if (bobberCoords.x != -1 && bobberCoords.y != -1) { // found one ! - System.out.println(String.format("found bobber: %d %d", bobberCoords.x, bobberCoords.y)); if (initialBobberPosition.x == -1 && initialBobberPosition.y == -1) { // it's the first time initialBobberPosition = bobberCoords; continue; } - // play the game + if (bobberCoords.x < initialBobberPosition.x) { + // hold bot.mousePress(InputEvent.BUTTON1_DOWN_MASK); - bot.delay(1400); + } + + if (bobberCoords.x > initialBobberPosition.x) { + // release bot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK); } } @@ -245,7 +247,7 @@ public class fisher { break; } - Thread.sleep(25); + Thread.sleep(5); } } } catch (Exception e) {