Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.awt.AWTException;
- import java.awt.MouseInfo;
- import java.awt.Robot;
- import java.awt.Toolkit;
- import java.awt.event.InputEvent;
- import java.awt.event.KeyEvent;
- import java.awt.event.MouseEvent;
- import java.util.Arrays;
- import java.util.Random;
- public class A {
- private static Robot bot;
- private static int[][] clickList = new int[][]{
- {691, 308, 100}, //tutorial
- {1176, 843, 100}, //play tutorial
- {934, 202, 5500},
- {1266, 942},
- {1229, 764},
- {948, 930},
- {942, 202},
- {724, 471},
- {970, 205},
- {730, 477},
- {958, 203, 100},
- {955, 203},
- {955, 203},
- {226, 1002},
- {961, 208, 3500},
- {1157, 923},
- {1130, 753},
- {1077, 940},
- {632, 572},
- {225, 996},
- {954, 212, 3500},
- {951, 209},
- //{955, 209},
- {732, 470},
- {804, 372},
- {1057, 942},
- {789, 570},
- {221, 1003},
- {940, 1001, 4500}};
- private static Times[] timeList = new Times[]{
- Times.CLICKTHROUGH,//Tutorial
- Times.CLICKTHROUGH,//play tutorial
- Times.TURN,//wait for turn to start, then click dialogue
- Times.CLICKTHROUGH,//no need to wait before first card action - clicking ranger
- Times.CARD,//should wait a sec before saccing
- Times.CARD,//wait before rat
- Times.CLICKTHROUGH,//click dialogue
- Times.CLICKTHROUGH, //click dialogue provided enough pause for play rat
- Times.CARD,//dialogue after summon should wait a sec
- Times.CLICKTHROUGH, //click on rat
- Times.CLICKTHROUGH,//click on dialogue
- Times.CLICKTHROUGH,//click on dialogue
- Times.CLICKTHROUGH,//click on dialogue
- Times.CLICKTHROUGH,//click on end turn button
- Times.TURN, //wait for short turn by tootsie to click dialogue
- Times.CLICKTHROUGH, //click sacranger
- Times.CARD, //wait for sac
- Times.CARD,//select ranger
- Times.CARD, //play ranger
- Times.CARD, //end turn
- Times.TURN, //wait for short tootsie turn
- Times.CLICKTHROUGH, //dialogue select
- Times.CLICKTHROUGH, //rat click
- Times.CARD, //rat move
- Times.CARD, //wolf click
- Times.CARD, //wolf play
- Times.CARD, //end turn
- Times.TURN //end game
- };
- public enum Times{
- CLICKTHROUGH(100), SHORTTURN(3000), TURN(6000), CARD(1000);
- private int time = 0;
- private Times(int time){
- this.time = time;
- }
- public int getTime(){
- return time;
- }
- }
- public static void main(String[] args) throws AWTException, InterruptedException{
- System.out.println(timeList.length +" " + clickList.length);
- bot = new Robot();
- Random r = new Random();
- int i = -1;
- Thread.sleep(7000);
- while(true){
- i++;
- if(i==clickList.length){
- i = 0;
- System.out.println("Objective completed");
- Thread.sleep(r.nextInt(5000));
- click(1288, 367);
- }
- //if(i>12)Thread.sleep(3000);
- Thread.sleep((int) (timeList[i].getTime() * ((r.nextFloat()/2)+1)));
- Toolkit.getDefaultToolkit().beep();
- /*if(clickList[i].length == 3){
- Thread.sleep(clickList[i][2]);
- //((Runnable) Toolkit.getDefaultToolkit().getDesktopProperty("win.sound.start")).run();;
- }else{
- Thread.sleep(1000);
- //Toolkit.getDefaultToolkit().beep();
- }*/
- //Thread.sleep(r.nextInt(100));
- if(MouseInfo.getPointerInfo().getLocation().x < 10) break;
- System.out.println("Click number " + i + " at coords " + clickList[i][0] + ", " + clickList[i][1] + " after delay " + timeList[i].name());
- click(clickList[i][0], clickList[i][1]);
- }
- /*while(true){
- Thread.sleep(5000);
- if(true){
- Toolkit.getDefaultToolkit().beep();
- //int offset = r.nextInt(11) - 5;
- System.out.println("{" + (MouseInfo.getPointerInfo().getLocation().x) + ", " + (MouseInfo.getPointerInfo().getLocation().y) + "}" +", ");
- Thread.sleep(5000);
- }
- }*/
- }
- private static boolean mouseDown = false;
- public void mousePressed(MouseEvent e) {
- if (e.getButton() == MouseEvent.BUTTON1) {
- mouseDown = true;
- }
- }
- public void mouseReleased(MouseEvent e) {
- if (e.getButton() == MouseEvent.BUTTON1) {
- mouseDown = false;
- }
- }
- public static void click(int x, int y){
- int mask = InputEvent.BUTTON1_DOWN_MASK;
- bot.mouseMove(x, y);
- bot.mousePress(mask);
- bot.mouseRelease(mask);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement