Advertisement
Guest User

Untitled

a guest
Jul 26th, 2017
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.06 KB | None | 0 0
  1. import com.rsbuddy.event.listeners.PaintListener;
  2. import com.rsbuddy.script.ActiveScript;
  3. import com.rsbuddy.script.Manifest;
  4. import com.rsbuddy.script.methods.Camera;
  5. import com.rsbuddy.script.methods.Game;
  6. import com.rsbuddy.script.methods.Mouse;
  7. import com.rsbuddy.script.methods.Objects;
  8. import com.rsbuddy.script.methods.Skills;
  9. import com.rsbuddy.script.util.Random;
  10. import com.rsbuddy.script.wrappers.GameObject;
  11.  
  12. import java.awt.*;
  13. import java.awt.Color;
  14. import java.awt.Font;
  15. import java.awt.Graphics;
  16. import java.awt.Graphics2D;
  17.  
  18. @Manifest(authors = {"b0xb0x"}, keywords = {"Agility", "Low wall"}, name = "Low Wall Climber", version = 1.1, description = "Start at either low wall in Brimhaven Agility Arena.")
  19. public class LowWallClimber extends ActiveScript implements PaintListener {
  20.  
  21. private static final int lowWallID = 3565;
  22.  
  23. private long startTime;
  24. private long runTime;
  25.  
  26. int wallAttempted = -1;
  27. int wallSucceeded = 0;
  28. int wallFailed = 0;
  29. int startExp;
  30. int currentLevel;
  31. int currentExp;
  32. int startLevel;
  33. int expGained;
  34. int expPerHr;
  35. int levelsGained;
  36. int wallToLvl;
  37. int expToLvl;
  38. int wallPerHr;
  39. int seconds;
  40. int minutes;
  41. int hours;
  42.  
  43. public boolean onStart() {
  44. log("Starting script!");
  45. Mouse.setSpeed(Random.nextInt(6, 8));
  46. startTime = System.currentTimeMillis();
  47. startExp = Skills.getCurrentExp(Skills.AGILITY);
  48. startLevel = Skills.getCurrentLevel(Skills.AGILITY);
  49. return true;
  50. }
  51.  
  52. public int loop() {
  53. hopWall();
  54. antiBan();
  55. return Random.nextInt(4500, 4700);
  56. }
  57.  
  58. public void onFinish() {
  59. int seconds = (int) (runTime / 1000);
  60. int minutes = 0;
  61. int hours = 0;
  62. if (seconds >= 60) {
  63. minutes = seconds / 60;
  64. seconds -= minutes * 60;
  65. }
  66. if (minutes >= 60) {
  67. hours = minutes / 60;
  68. minutes -= hours * 60;
  69. }
  70. log("Thanks for using Low Wall Climber!");
  71. log("-----------------------------------------------");
  72. log("Ran for " + hours + ":" + minutes + ":" + seconds + ".");
  73. log("Gained " + expGained + " agility experience.");
  74. log("Gained " + levelsGained + " levels.");
  75. log("Climbed " + wallSucceeded + " walls.");
  76. }
  77.  
  78. private boolean hopWall() {
  79. GameObject lowWall = Objects.getNearest(3565);
  80. if (lowWall != null) {
  81. lowWall.interact("Climb-over");
  82. Mouse.moveSlightly();
  83. wallAttempted++;
  84. }
  85. return true;
  86. }
  87.  
  88. private boolean antiBan() {
  89. final int random = Random.nextInt(1,20);
  90. if (random == 1)
  91. Camera.setCompassAngle(Random.nextInt(56, 65));
  92. if (random == 2)
  93. Camera.setCompassAngle(Random.nextInt(189, 265));
  94. if (random == 5)
  95. Camera.setCompassAngle(Random.nextInt(93, 167));
  96. if (random == 6)
  97. Camera.setCompassAngle(Random.nextInt(13, 46));
  98. if (random == 7)
  99. Camera.setCompassAngle(Random.nextInt(253, 267));
  100. if (random == 8)
  101. Camera.setCompassAngle(Random.nextInt(132, 256));
  102. return true;
  103. }
  104.  
  105. public void onRepaint(Graphics g1) {
  106. if (Game.isLoggedIn()) {
  107. runTime = System.currentTimeMillis() - startTime;
  108. expToLvl = Skills.getExpToNextLevel(Skills.AGILITY);
  109. currentLevel = Skills.getCurrentLevel(Skills.AGILITY);
  110. currentExp = Skills.getCurrentExp(Skills.AGILITY);
  111. expGained = currentExp - startExp;
  112. expPerHr = (int) (expGained * 3600000.0D / runTime);
  113. levelsGained = currentLevel - startLevel;
  114. wallSucceeded = expGained / 8;
  115. wallFailed = wallAttempted - wallSucceeded;
  116. wallToLvl = expToLvl / 8;
  117. wallPerHr = (int) (wallSucceeded * 3600000.0D / runTime);
  118. int seconds = (int) (runTime / 1000);
  119. int minutes = 0;
  120. int hours = 0;
  121. if (seconds >= 60) {
  122. minutes = seconds / 60;
  123. seconds -= minutes * 60;
  124. }
  125. if (minutes >= 60) {
  126. hours = minutes / 60;
  127. minutes -= hours * 60;
  128. }
  129. Graphics2D g = (Graphics2D) g1;
  130. g.setColor(new Color(0, 100, 100, 150));
  131. g.fillRoundRect(549, 207, 186, 256, 16, 16);
  132. g.setColor(new Color(255, 255, 255));
  133. g.setFont(new Font("GEORGE", Font.BOLD, 22));
  134. g.drawString("Low Wall Climber", 555, 237);
  135. g.setFont(new Font("Palatino Linotype", Font.PLAIN, 13));
  136. g.drawString("Script by b0xb0x" , 565, 253);
  137. g.drawString("Time elapsed: " + hours + ":" + minutes + ":" + seconds, 565, 272);
  138. g.drawString("Current level: " + currentLevel, 565, 286);
  139. g.drawString("Levels gained: " + levelsGained, 565, 300);
  140. g.drawString("Exp gained: " + expGained, 565, 322);
  141. g.drawString("Exp/hr: " + expPerHr, 565, 336);
  142. g.drawString("Exp to level: " + expToLvl, 565, 350);
  143. g.drawString("Walls climbed: " + wallSucceeded, 565, 372);
  144. g.drawString("Walls attemped: " + wallAttempted, 565, 386);
  145. g.drawString("Walls failed: " + wallFailed, 565, 400);
  146. g.drawString("Walls to lvl: " + wallToLvl, 565, 414);
  147. g.drawString("Walls/hr: " + wallPerHr, 565, 428);
  148. g.setColor(new Color(125, 0, 0));
  149. g.fill3DRect(585, 438, 100, 11, true);
  150. g.setColor(new Color(0, 125, 0));
  151. g.fill3DRect(585, 438, Skills.getPercentToNextLevel(Skills.AGILITY), 11, true);
  152. g.setColor(new Color(255, 255, 255));
  153. g.drawString(Skills.getPercentToNextLevel(Skills.AGILITY) + "% to " + (Skills.getCurrentLevel(Skills.AGILITY) + 1), 605, 448);
  154. g.setColor(new Color(255, 255, 255));
  155. g.setFont(new Font("Palatino Linotype", Font.PLAIN, 10));
  156. g.drawString("V 1.1", 700, 460);
  157.  
  158. g.setColor(new Color(0, 250, 50));
  159. g.drawLine((Mouse.getLocation().x - 8), (Mouse.getLocation().y), (Mouse.getLocation().x + 8), (Mouse.getLocation().y));
  160. g.drawLine((Mouse.getLocation().x - 7), (Mouse.getLocation().y + 1), (Mouse.getLocation().x + 7), (Mouse.getLocation().y + 1));
  161. g.drawLine((Mouse.getLocation().x - 7), (Mouse.getLocation().y - 1), (Mouse.getLocation().x + 7), (Mouse.getLocation().y - 1));
  162. g.drawLine((Mouse.getLocation().x), (Mouse.getLocation().y - 8), (Mouse.getLocation().x), (Mouse.getLocation().y + 8));
  163. g.drawLine((Mouse.getLocation().x + 1), (Mouse.getLocation().y - 7), (Mouse.getLocation().x + 1), (Mouse.getLocation().y + 7));
  164. g.drawLine((Mouse.getLocation().x - 1), (Mouse.getLocation().y - 7), (Mouse.getLocation().x - 1), (Mouse.getLocation().y + 7));
  165. }
  166. }
  167. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement