From 42b2ad5a4be3ce55614ffaf853df578da367f378 Mon Sep 17 00:00:00 2001 From: mrbesen Date: Sat, 11 Mar 2017 16:56:00 +0100 Subject: [PATCH] changed the way of should_work; Added reset, when the button is not detected; Added Info, when the button is detected. --- src/mrbesen/cr/auto/clicker/Clicker.java | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/src/mrbesen/cr/auto/clicker/Clicker.java b/src/mrbesen/cr/auto/clicker/Clicker.java index 7d0af10..6c56c4a 100644 --- a/src/mrbesen/cr/auto/clicker/Clicker.java +++ b/src/mrbesen/cr/auto/clicker/Clicker.java @@ -76,8 +76,6 @@ public class Clicker implements Runnable{ sleep(500); clickL(rob, battle);//smash the start button sleep(1000); - if(!should_run) - break; clickL(rob, battle);//press start again (if there is an alert poping up) //battle is starting up sleep(9000);//wait for the battle to start (loading screen) @@ -93,8 +91,13 @@ public class Clicker implements Runnable{ if(((System.currentTimeMillis() - start) / 1000) > 20) {//game is older then 20 seconds if(checkOK(end, rob)) okcount ++; - if(okcount > 5) + else + okcount = 0;//reste the counter + if(okcount > 5) { + Main.get().ui.info("OK-button detected!"); + System.out.println("OK-Button-detected!"); break; + } } //try to play out a card @@ -116,6 +119,8 @@ public class Clicker implements Runnable{ long startwait = System.currentTimeMillis();//record needed time if(checkOK(end, rob))//check okcount ++;//ok button detected + else + okcount = 0;//reset sleep((int) (3000 - (System.currentTimeMillis() - startwait)));//sleep the rest of 3 seconds, that was not gone for checking waittime = (int) (waittime - (System.currentTimeMillis() - startwait));//calculate waittime that is left } @@ -125,14 +130,9 @@ public class Clicker implements Runnable{ } skipbattle = false; inbattle = false; + clickL(rob, end);//ok button Main.get().ui.info("Battle ended."); - - if(!should_run) - break; - clickL(rob, end);//ok knopf - if(!should_run) - break; - sleep(10000);//10 sec-lade screen + sleep(10000);//10 sec-loading screen } } catch (AWTException e) { e.printStackTrace(); @@ -209,6 +209,8 @@ public class Clicker implements Runnable{ } private void clickL(Robot b, Point a) { + if(!should_run) + return; Point old = getMouse(); b.mouseMove(a.x, a.y); sleep(50);