Advertisement
Luxapod

Claude GOnet

Sep 7th, 2016
285
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 3.38 KB | None | 0 0
  1. // Created by Luxapodular in Processing 3.2.1
  2. // Claude GOnet - the dirty botter
  3.  
  4. import java.awt.*;
  5. import java.awt.image.BufferedImage;
  6. import javax.imageio.ImageIO;
  7. import java.awt.MouseInfo;
  8. import java.awt.Point;
  9. import java.awt.event.InputEvent;
  10.  
  11. Robot bot;
  12. Point mouse;
  13. ArrayList<int[]>  dick;
  14.  
  15.  
  16. void setup() {
  17.  
  18.   // Create robot.
  19.   try {
  20.     bot = new Robot();
  21.   } catch (AWTException e) {
  22.     println("Error creating robot.");
  23.   }
  24.  
  25.   dick = new ArrayList<int[]>();
  26.   makeDick();
  27. }
  28.  
  29. void draw () {
  30.  
  31. }
  32.  
  33. void keyPressed() {
  34.  
  35.   println("keypressed");
  36.   if (key == 'p') {
  37.     firePattern(box);
  38.   } else if (key == 'l') {
  39.     firePattern(dick);
  40.   } else if (key == 'k') {
  41.     firePattern(face);
  42.   }
  43.  
  44. }
  45.  
  46. void fire() {  
  47.   bot.mousePress(InputEvent.BUTTON1_MASK);
  48.   myDelay(95);
  49.   bot.mouseRelease(InputEvent.BUTTON1_MASK);
  50.  
  51. }
  52.  
  53. void move(int dx, int dy) {
  54.   int distanceByStep = 5; // pixels
  55.   int steps = max(dx / distanceByStep, dy / distanceByStep);
  56.   int mx = dx / steps;
  57.   int my = dy / steps;
  58.  
  59.   for (int i = 0; i < steps; i++) {
  60.    
  61.     mouse = MouseInfo.getPointerInfo().getLocation();
  62.     int ox = mouse.x;
  63.     int oy = mouse.y;
  64.    
  65.     bot.mouseMove(ox + mx, oy + my);
  66.     myDelay(20);
  67.   }
  68. }
  69.  
  70. void myDelay(int ms) {
  71.   int start = millis();
  72.  
  73.   while (millis() - start < ms) {
  74.   }
  75. }
  76.  
  77. void firePattern(ArrayList<int[]> list) {
  78.   int dx;
  79.   int dy;
  80.  
  81.   myDelay(1000);
  82.  
  83.   for (int[] tup : list) {
  84.     dx = int(tup[0] * 1.5);
  85.     dy = int(tup[1] * 1.5);
  86.     myDelay(250);
  87.     mouse = MouseInfo.getPointerInfo().getLocation();
  88.     bot.mouseMove(mouse.x + dx, mouse.y + dy);
  89.    
  90.     println(mouse.x, mouse.y);
  91.    
  92.     myDelay(300);
  93.     fire();
  94.    
  95.   }
  96. }
  97.    
  98. void makeDick() {
  99.   // Left Nut
  100.   dick.add(new int[] {0,0});
  101.   dick.add(new int[] {-10,5});
  102.   dick.add(new int[] {-8,5});
  103.   dick.add(new int[] {-5,5});
  104.   dick.add(new int[] {-3,5});
  105.   dick.add(new int[] {-1,5});
  106.   dick.add(new int[] {3,5});
  107.   dick.add(new int[] {5,5});
  108.   dick.add(new int[] {8,5});
  109.   dick.add(new int[] {10,5});
  110.  
  111.   dick.add(new int[] {10,-5});
  112.   dick.add(new int[] {8,-5});
  113.   dick.add(new int[] {5,-5});
  114.   dick.add(new int[] {3,-5});
  115.   dick.add(new int[] {1,-5});
  116.   dick.add(new int[] {3,-5});
  117.  
  118.   // Right Nut
  119.   dick.add(new int[] {3,5});
  120.   dick.add(new int[] {5,5});
  121.   dick.add(new int[] {8,5});
  122.   dick.add(new int[] {10,5});
  123.   dick.add(new int[] {10,-5});
  124.   dick.add(new int[] {8,-5});
  125.   dick.add(new int[] {5,-5});
  126.   dick.add(new int[] {3,-5});
  127.   dick.add(new int[] {1,-5});
  128.   dick.add(new int[] {-1,-5});
  129.   dick.add(new int[] {-3,-5});
  130.   dick.add(new int[] {-5,-5});
  131.   dick.add(new int[] {-8,-5});
  132.   dick.add(new int[] {-10,-5});
  133.  
  134.   // Shaft
  135.  
  136.   dick.add(new int[] {0,-5});
  137.   dick.add(new int[] {0,-5});
  138.   dick.add(new int[] {0,-5});
  139.   dick.add(new int[] {0,-5});
  140.   dick.add(new int[] {0,-5});
  141.   dick.add(new int[] {0,-5});
  142.   dick.add(new int[] {-1,-5});
  143.   dick.add(new int[] {-3,-5});
  144.   dick.add(new int[] {-5,-5});
  145.   dick.add(new int[] {-8,-5});
  146.   dick.add(new int[] {-10,-5});
  147.   dick.add(new int[] {-8,5});
  148.   dick.add(new int[] {-5,5});
  149.   dick.add(new int[] {-3,5});
  150.   dick.add(new int[] {-1,5});
  151.   dick.add(new int[] {0,5});
  152.   dick.add(new int[] {0,5});
  153.   dick.add(new int[] {0,5});
  154.   dick.add(new int[] {0,5});
  155.   dick.add(new int[] {0,5});
  156.   dick.add(new int[] {0,5});
  157. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement