hubeb

Maple

May 19th, 2011
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.03 KB | None | 0 0
  1. // Save as: maple.java
  2. import org.rsbot.script.ScriptManifest;
  3. import org.rsbot.script.Script;
  4. import org.rsbot.script.wrappers.RSNPC;
  5. import org.rsbot.script.wrappers.RSObject;
  6. import org.rsbot.script.wrappers.RSTile;
  7. import org.rsbot.script.wrappers.RSArea;
  8. import org.rsbot.event.listeners.PaintListener;
  9. import org.rsbot.event.events.ServerMessageEvent;
  10. import java.awt.Graphics;
  11. import java.awt.Color;
  12. import org.rsbot.script.*;
  13. import org.rsbot.script.methods.*;
  14. import org.rsbot.script.wrappers.*;
  15. import java.awt.*;
  16. import org.rsbot.event.listeners.*;
  17.  
  18.  
  19. @ScriptManifest(authors = { "HUBEB" }, keywords = { "Maple" }, name = "maple", version = 1.0, description = "Cuts Maples South-East Of Seers BAnk!")
  20. public class maple extends Script implements PaintListener, ServerMessageListener {
  21.  
  22. private int anyMaple = 1307;
  23. private int anyPick = 6739;
  24.  
  25. private RSTile[] walkingPath = {new RSTile(2748, 3467), new RSTile(2742, 3475), new RSTile(2732, 3485), new RSTile(2726, 3493)};
  26. // Maple 2 Bank
  27. private RSArea bankArea = new RSArea(new RSTile(2730, 3493), new RSTile(2721, 3557));
  28. private RSArea mineArea = new RSArea(new RSTile(2752, 3470), new RSTile(2746, 3462));
  29. int[] bankerId = {494, 495};
  30. public int startExp;
  31. public int startLevel;
  32. public int currentLevel;
  33. public int gainedLevels;
  34. public int expGained = 0;
  35. public int expHour = 0;
  36. public int exp;
  37. public int percent;
  38. private int logCount;
  39. public int woodCuttingLevel;
  40. public int antiBanSelect;
  41. public int randomSkill;
  42. public int SKILL;
  43. private String status = "";
  44. public long startTime = System.currentTimeMillis();
  45. public long timeRan;
  46. private int startTab;
  47. int nextScreenShot = 1;
  48. int SSHours = 0;
  49.  
  50. private final Color color1 = new Color(0, 0, 0);
  51. private final Color color2 = new Color(255, 255, 255);
  52. private final Color color3 = new Color(255, 255, 51);
  53.  
  54. private final BasicStroke stroke1 = new BasicStroke(1);
  55.  
  56. private final Font font1 = new Font("Arial", 1, 11);
  57.  
  58.  
  59. public boolean onStart(){
  60. startTime = System.currentTimeMillis();
  61. startLevel = skills.getRealLevel(Skills.WOODCUTTING);
  62. status = "Starting HUBEB's Maples";
  63. startExp = 0;
  64. if ( startExp == 0) {
  65. startExp = skills.getCurrentExp(Skills.WOODCUTTING);
  66. }
  67. log("Mouse Speed is: " + mouse.getSpeed());
  68. mouse.setSpeed(9);
  69. log("Starting level: " + startLevel);
  70. return true;
  71. }
  72.  
  73. public void serverMessageRecieved(ServerMessageEvent e) {
  74. String msg = e.getMessage();
  75. if (msg.contains("You get some")) {
  76. logCount++;
  77. }
  78. }
  79.  
  80. public int loop(){
  81. if(inventory.isFull()){
  82. if(bankArea.contains(getMyPlayer().getLocation())){
  83. RSNPC Banker = npcs.getNearest(bankerId);
  84. if (Banker.isOnScreen() && !bank.isOpen()) {
  85. Banker.doAction("Bank Banker");
  86. sleep(random(2000, 4000));
  87. if (bank.isOpen()) {
  88. bank.depositAll();
  89. }
  90. bank.close();
  91. antiBan();
  92. }
  93. }else{
  94. if(walking.getDestination() == null || calc.distanceTo(walking.getDestination()) < random(4, 6)){
  95. walking.walkPathMM(walkingPath);
  96. return random(1000, 1500);
  97. }
  98. antiBan();
  99. }
  100. }else{
  101. if(mineArea.contains(getMyPlayer().getLocation())){
  102. if(getMyPlayer().getAnimation() != 2846){
  103. RSObject tree = objects.getNearest(anyMaple);
  104. if(tree != null){
  105. tree.doAction("Chop");
  106. antiBan();
  107. sleep(1800, 2800);
  108. }
  109. antiBan();
  110. }
  111. }else{
  112. if(walking.getDestination() == null || calc.distanceTo(walking.getDestination()) < random(4, 6)){
  113. walking.walkPathMM(walking.reversePath(walkingPath));
  114. return random(1000, 1500);
  115. }
  116. antiBan();
  117. }
  118. }
  119. return random(100, 200);
  120. }
  121.  
  122. // HUBEBs Anti-Ban START
  123. public void antiBan() {
  124. int b = random(0, 10);
  125. switch (b) {
  126. case 1: //Mouse off Screen
  127. log("AntiBan Move Mouse Off Screen");
  128. if (random(0,4) == 3) {
  129. mouse.moveOffScreen();
  130. sleep(random(2000, 5500));
  131. }
  132. break;
  133. case 2: //Move Mouse
  134. log("AntiBan Move Mouse Randomly");
  135. if (random(0,4) == 2) {
  136. mouse.moveSlightly();
  137. sleep(300, 700);
  138. mouse.moveRandomly(40, 860);
  139. }
  140. break;
  141. case 3: //Turn Screen
  142. log("Turn Screen/Camera Randomly");
  143. if (random(0, 4) == 1) {
  144. camera.setAngle(random(100, 359));
  145. sleep(500,1500);
  146. }
  147. break;
  148. default:
  149. break;
  150. }
  151. }
  152. // HUBEBs Anti-Ban FINISH
  153.  
  154. public void onFinish(){
  155. log("Script finished");
  156. }
  157. //START: Paint All
  158. public void onRepaint(Graphics g1) {
  159. //Timer
  160. long millis = System.currentTimeMillis() - startTime;
  161. long hours = millis / (1000 * 60 * 60);
  162. millis -= hours * (1000 * 60 * 60);
  163. long minutes = millis / (1000 * 60);
  164. millis -= minutes * (1000 * 60);
  165. long seconds = millis / 1000;
  166. long minutes2 = minutes + (hours * 60);
  167. //PaintNorm
  168. currentLevel = skills.getRealLevel(Skills.WOODCUTTING);
  169. gainedLevels = currentLevel - startLevel;
  170. expGained = skills.getCurrentExp(Skills.WOODCUTTING) - startExp;
  171. percent = skills.getPercentToNextLevel(Skills.WOODCUTTING);
  172. timeRan = System.currentTimeMillis() - startTime;
  173. Graphics2D g = (Graphics2D)g1;
  174.  
  175. //paint
  176.  
  177. g.setColor(color1);
  178. g.fillRect(396, 7, 116, 111);
  179. g.setColor(color2);
  180. g.setStroke(stroke1);
  181. g.drawRect(396, 7, 116, 111);
  182. g.setFont(font1);
  183. g.drawString("Maples Cut: " + logCount, 400, 25);
  184. g.drawString("Exp Gained: " + expGained, 400, 53);
  185. g.drawString("" + percent + "% TNL", 430, 77);
  186. g.setColor(color3);
  187. g.drawString("Made By HUBEB", 411, 109);
  188. }
  189.  
  190.  
  191.  
  192.  
  193.  
  194. //END: PaintAll
  195. }
Advertisement
Add Comment
Please, Sign In to add comment