More efficient cheating
This commit is contained in:
parent
6fdddd6454
commit
511cfa3a84
@ -9,14 +9,13 @@ import java.io.File;
|
||||
import java.util.Comparator;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
|
||||
import javax.imageio.ImageIO;
|
||||
|
||||
public class GarticPhoneCheats {
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
BufferedImage img = ImageIO.read(new File("cock.jpg"));
|
||||
BufferedImage img = ImageIO.read(new File("red.jpg"));
|
||||
Robot r = new Robot();
|
||||
|
||||
System.out.println("Top left");
|
||||
@ -35,6 +34,14 @@ public class GarticPhoneCheats {
|
||||
Thread.sleep(3000);
|
||||
Point bottomRightC = MouseInfo.getPointerInfo().getLocation();
|
||||
|
||||
System.out.println("Undo");
|
||||
Thread.sleep(3000);
|
||||
Point undo = MouseInfo.getPointerInfo().getLocation();
|
||||
|
||||
System.out.println("Redo");
|
||||
Thread.sleep(3000);
|
||||
Point redo = MouseInfo.getPointerInfo().getLocation();
|
||||
|
||||
int poop = 5;
|
||||
Map<Color, Point> colors = new HashMap<>();
|
||||
Rectangle colRect = new Rectangle(topLeftC.x, topLeftC.y, bottomRightC.x - topLeftC.x, bottomRightC.y - topLeftC.y);
|
||||
@ -74,10 +81,12 @@ public class GarticPhoneCheats {
|
||||
nImg.createGraphics().drawImage(img, 0, 0, nW, nH, null);
|
||||
|
||||
int scale = 10;
|
||||
int delay = 7;
|
||||
int delay = 10;
|
||||
|
||||
Color selectedColor = null;
|
||||
for(int x = 0; x < nImg.getWidth() / scale; x++) {
|
||||
Color prevColor = null;
|
||||
int len = 0;
|
||||
|
||||
for(int y = 0; y < nImg.getHeight() / scale; y++) {
|
||||
int rgb = nImg.getRGB(x * scale, y * scale);
|
||||
|
||||
@ -90,25 +99,68 @@ public class GarticPhoneCheats {
|
||||
.sorted(Comparator.comparingDouble(c -> dist(c, col)))
|
||||
.findFirst().orElse(null);
|
||||
|
||||
if(!Objects.equals(selectedColor, closest)) {
|
||||
if(closest != prevColor) {
|
||||
if(prevColor != null) {
|
||||
Thread.sleep(2 * delay);
|
||||
|
||||
selectedColor = closest;
|
||||
Point colPoint = colors.get(closest);
|
||||
Point colPoint = colors.get(prevColor);
|
||||
r.mouseMove(colPoint.x, colPoint.y);
|
||||
|
||||
r.mousePress(InputEvent.BUTTON1_DOWN_MASK);
|
||||
Thread.sleep(delay);
|
||||
r.mouseRelease(InputEvent.BUTTON1_DOWN_MASK);
|
||||
|
||||
Thread.sleep(delay);
|
||||
|
||||
r.mouseMove(pX, pY - scale * len);
|
||||
r.mousePress(InputEvent.BUTTON1_DOWN_MASK);
|
||||
Thread.sleep(delay);
|
||||
r.mouseMove(pX, pY - scale);
|
||||
r.mouseRelease(InputEvent.BUTTON1_DOWN_MASK);
|
||||
Thread.sleep(2 * delay);
|
||||
}
|
||||
|
||||
r.mouseMove(pX, pY);
|
||||
prevColor = closest;
|
||||
len = 1;
|
||||
}else {
|
||||
len++;
|
||||
}
|
||||
}
|
||||
|
||||
System.out.println(prevColor);
|
||||
Thread.sleep(2 * delay);
|
||||
|
||||
Point colPoint = colors.get(prevColor);
|
||||
r.mouseMove(colPoint.x, colPoint.y);
|
||||
|
||||
r.mousePress(InputEvent.BUTTON1_DOWN_MASK);
|
||||
Thread.sleep(delay);
|
||||
r.mouseRelease(InputEvent.BUTTON1_DOWN_MASK);
|
||||
|
||||
int pX = topLeft.x + x * scale;
|
||||
int pY = topLeft.y + nImg.getHeight() - scale;
|
||||
r.mouseMove(pX, pY - scale * len);
|
||||
r.mousePress(InputEvent.BUTTON1_DOWN_MASK);
|
||||
Thread.sleep(delay);
|
||||
r.mouseMove(pX, pY);
|
||||
r.mouseRelease(InputEvent.BUTTON1_DOWN_MASK);
|
||||
Thread.sleep(2 * delay);
|
||||
}
|
||||
|
||||
for(int i = 0; i < 100; i++) {
|
||||
r.mouseMove(undo.x, undo.y);
|
||||
r.mousePress(InputEvent.BUTTON1_DOWN_MASK);
|
||||
Thread.sleep(delay * 5);
|
||||
r.mouseRelease(InputEvent.BUTTON1_DOWN_MASK);
|
||||
Thread.sleep(delay * 5);
|
||||
}
|
||||
|
||||
for(int i = 0; i < 100; i++) {
|
||||
r.mouseMove(redo.x, redo.y);
|
||||
r.mousePress(InputEvent.BUTTON1_DOWN_MASK);
|
||||
Thread.sleep(delay * 5);
|
||||
r.mouseRelease(InputEvent.BUTTON1_DOWN_MASK);
|
||||
Thread.sleep(delay * 5);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user