Advertisement
Guest User

Untitled

a guest
Mar 25th, 2017
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.19 KB | None | 0 0
  1. package PlayBot;
  2.  
  3. import java.awt.Dimension;
  4. import java.awt.Robot;
  5. import java.awt.Toolkit;
  6. import java.awt.event.InputEvent;
  7. import java.awt.event.KeyEvent;
  8. import java.io.BufferedReader;
  9. import java.io.InputStreamReader;
  10.  
  11.  
  12. public class playBot {
  13.  
  14. public static void main(String... args) throws Exception {
  15. //heading
  16. Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
  17. Robot robot = new Robot();
  18. robot.mouseMove((screenSize.width/2) , (screenSize.height/2));
  19. String line;
  20. String pidInfo ="";
  21. int leftOrRight = 0;
  22. int waitOrNo = 0;
  23. int leagueOpen = 0;
  24. Thread.sleep(5000);
  25.  
  26. //process league
  27. Process p =Runtime.getRuntime().exec(System.getenv("windir") +"\\system32\\"+"tasklist.exe");
  28. BufferedReader input = new BufferedReader(new InputStreamReader(p.getInputStream()));
  29. while ((line = input.readLine()) != null) {
  30. pidInfo+=line;
  31. }
  32. input.close();
  33. if(pidInfo.contains("League of Legends.exe"))
  34. {
  35. leagueOpen = 1;
  36. } else {
  37. leagueOpen = 0;
  38. }
  39.  
  40. //start loop
  41. while (leagueOpen == 1) {
  42. //move to middle of lane
  43. robot.mouseMove(((screenSize.width/2)+95) , ((screenSize.height/2)+95));
  44. int mouseRep = 0;
  45. while (mouseRep != 4) {
  46. robot.mousePress(InputEvent.BUTTON3_MASK);
  47. robot.mouseRelease(InputEvent.BUTTON3_MASK);
  48. Thread.sleep(800);
  49. mouseRep=mouseRep+1;
  50. }
  51. if (waitOrNo == 0) {
  52. Thread.sleep(10000); //let move to location
  53. waitOrNo++;
  54. } else {
  55. Thread.sleep(1000);
  56. }
  57.  
  58. //start attacking nearby targets
  59. robot.keyPress(KeyEvent.VK_A);
  60. robot.mousePress(InputEvent.BUTTON1_MASK);
  61. robot.keyRelease(KeyEvent.VK_A);
  62. robot.mouseRelease(InputEvent.BUTTON1_MASK);
  63. Thread.sleep(5000); //let attack for 5 seconds
  64. //move left or right
  65. if (leftOrRight == 0) {
  66. robot.mouseMove(((screenSize.width/2)+93) , ((screenSize.height/2)+95));
  67. robot.mousePress(InputEvent.BUTTON3_MASK);
  68. robot.mouseRelease(InputEvent.BUTTON3_MASK);
  69. leftOrRight = 1;
  70. } else {
  71. robot.mouseMove(((screenSize.width/2)+98) , ((screenSize.height/2)+95));
  72. robot.mousePress(InputEvent.BUTTON3_MASK);
  73. robot.mouseRelease(InputEvent.BUTTON3_MASK);
  74. leftOrRight = 0;
  75. }
  76. //start attacking nearby targets
  77. robot.keyPress(KeyEvent.VK_A);
  78. robot.mousePress(InputEvent.BUTTON1_MASK);
  79. robot.keyRelease(KeyEvent.VK_A);
  80. robot.mouseRelease(InputEvent.BUTTON1_MASK);
  81. Thread.sleep(5000); //let attack for 5 seconds
  82. //move left or right
  83. if (leftOrRight == 0) {
  84. robot.mouseMove(((screenSize.width/2)+93) , ((screenSize.height/2)+96));
  85. robot.mousePress(InputEvent.BUTTON3_MASK);
  86. robot.mouseRelease(InputEvent.BUTTON3_MASK);
  87. leftOrRight = 1;
  88. } else {
  89. robot.mouseMove(((screenSize.width/2)+98) , ((screenSize.height/2)+96));
  90. robot.mousePress(InputEvent.BUTTON3_MASK);
  91. robot.mouseRelease(InputEvent.BUTTON3_MASK);
  92. leftOrRight = 0;
  93. }
  94. String line1;
  95. String pidInfo1 ="";
  96. Process g =Runtime.getRuntime().exec(System.getenv("windir") +"\\system32\\"+"tasklist.exe");
  97. BufferedReader inpus = new BufferedReader(new InputStreamReader(g.getInputStream()));
  98. while ((line1 = inpus.readLine()) != null) {
  99. pidInfo1+=line1;
  100. }
  101. input.close();
  102. if(pidInfo1.contains("League of Legends.exe"))
  103. {
  104. leagueOpen = 1;
  105. } else {
  106. leagueOpen = 0;
  107. }
  108. }
  109. }
  110. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement