Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.awt.AWTException;
- import java.awt.Robot;
- import java.awt.event.InputEvent;
- import java.awt.event.KeyEvent;
- public class OP {
- Robot robot = new Robot();
- public static void main(String[] args) throws AWTException {
- new OP();
- }
- public OP() throws AWTException {
- ////////////////////////////////////////////////////////////////
- //// CHANGE THESE VARIABLES TO CONTROL THE PROGRAM ////
- int numPacks = 3; // SET THE NUMBER OF PACKS TO OPEN HERE
- boolean screenShot = false; // true if you want screenshots, false if not
- ////////////////////////////////////////////////////////////////
- //// Set your screen resolution to 1920x1080
- robot.setAutoDelay(40);
- robot.setAutoWaitForIdle(true);
- robot.delay(3000); // give 5 seconds to move you mouse to the game screen
- // Make sure to click on the game screen anywhere
- while (numPacks > 0) {
- type("Opening pack...\n");
- openPack(screenShot);
- numPacks = numPacks - 1;
- robot.delay(100);
- }
- robot.delay(100);
- System.exit(0);
- }
- private void openPack(boolean screenShot) {
- //set pack
- type(KeyEvent.VK_SPACE); // set pack
- //int TOP = 260;
- //int MIDDLE = 520;
- //int BOTTOM = 800; // UNTESTED
- //setPack(MIDDLE);
- robot.delay(2000);
- robot.mouseMove(1120, 260); // CARD 1 //System.exit(0);
- robot.delay(100);
- leftClick();
- robot.delay(50);
- robot.mouseMove(1420, 375); // CARD 2
- robot.delay(50);
- leftClick();
- robot.delay(50);
- robot.mouseMove(1280, 800); // CARD 3
- robot.delay(50);
- leftClick();
- robot.delay(50);
- robot.mouseMove(970, 790); // CARD 4
- robot.delay(50);
- leftClick();
- robot.delay(50);
- robot.mouseMove(810, 375); // CARD 5
- robot.delay(50);
- leftClick();
- robot.delay(50);
- robot.mouseMove(1120, 580); // DONE
- robot.delay(1200);
- if (screenShot) {
- // get the screenshot
- robot.keyPress(KeyEvent.VK_PRINTSCREEN);
- robot.delay(40);
- robot.keyRelease(KeyEvent.VK_PRINTSCREEN);
- robot.delay(40);
- }
- leftClick();
- robot.delay(100);
- }
- private void leftClick() {
- robot.mousePress(InputEvent.BUTTON1_MASK);
- robot.delay(100);
- robot.mouseRelease(InputEvent.BUTTON1_MASK);
- robot.delay(100);
- }
- private void type(int i) {
- robot.delay(40);
- robot.keyPress(i);
- robot.keyRelease(i);
- }
- private void type(String s) {
- byte[] bytes = s.getBytes();
- for (byte b : bytes) {
- int code = b;
- // keycode only handles [A-Z] (which is ASCII decimal [65-90])
- if (code > 96 && code < 123) code = code - 32;
- robot.delay(40);
- robot.keyPress(code);
- robot.keyRelease(code);
- }
- }
- //private void setPack(int PACKPOSITION)
- //{
- //robot.mouseMove(400, PACKPOSITION); // CARD 1
- // robot.delay(200);
- // robot.mousePress(InputEvent.BUTTON1_MASK);
- // robot.mouseMove(1120, 580);
- // robot.delay(200);
- // robot.mouseRelease(InputEvent.BUTTON1_MASK);
- //System.exit(0);
- // robot.delay(200);
- // }
- } // End OP
- // (c) Copyright inposition . I'm in position
Add Comment
Please, Sign In to add comment