Guest User

Untitled

a guest
Jan 13th, 2018
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.08 KB | None | 0 0
  1.  
  2. import java.awt.BasicStroke;
  3. import java.awt.Color;
  4. import java.awt.Font;
  5. import java.awt.Graphics;
  6. import java.awt.Graphics2D;
  7. import java.util.logging.Level;
  8. import java.util.logging.Logger;
  9.  
  10. import org.rsbot.event.listeners.PaintListener;
  11. import org.rsbot.script.Script;
  12. import org.rsbot.script.ScriptManifest;
  13.  
  14. import org.rsbot.script.wrappers.RSTile;
  15.  
  16. import org.rsbot.script.wrappers.RSArea;
  17. import org.rsbot.script.wrappers.RSNPC;
  18. import org.rsbot.script.wrappers.RSTilePath;
  19.  
  20. @ScriptManifest(name = "myfirstScript", authors = "beharon", keywords = "Moneymaking", version = 2.7, description = "Buys Beers")
  21. public class myfirstScript extends Script implements PaintListener {
  22.  
  23. public long startTime = 0;
  24. public long millis = 0;
  25. public long hours = 0;
  26. public long minutes = 0;
  27. public long seconds = 0;
  28. public long last = 0;
  29. public RSArea atBeer = new RSArea(new RSTile(2953, 3366), new RSTile(2960, 3376));
  30. RSArea atBank = new RSArea(new RSTile(2943, 3365), new RSTile(2949, 3373));
  31. public final RSTile[] path = {
  32. new RSTile(2956, 3371), new RSTile(2956, 3374),
  33. new RSTile(2955, 3377), new RSTile(2955, 3380),
  34. new RSTile(2952, 3378), new RSTile(2950, 3376),
  35. new RSTile(2947, 3375), new RSTile(2944, 3374),
  36. new RSTile(2945, 3372), new RSTile(2944, 3370)
  37. };
  38. RSTilePath bankToBeer;
  39.  
  40. public void Antiban() {
  41.  
  42. int b = random(0, 10);
  43. switch (b) {
  44. case 1:
  45. if (random(0, 10) == 5) {
  46. mouse.moveSlightly();
  47. sleep(200, 300);
  48. mouse.moveRandomly(150, 350);
  49. }
  50. break;
  51. case 2:
  52. if (random(0, 13) == 2) {
  53. camera.setAngle(random(30, 70));
  54. sleep(400, 500);
  55.  
  56. }
  57. break;
  58. case 3:
  59. if (random(0, 24) == 6) {
  60. mouse.moveOffScreen();
  61. sleep(600, 700);
  62. }
  63. break;
  64. case 5:
  65. if (random(0, 30) == 4) {
  66. camera.setPitch(random(10, 99));
  67. sleep(800, 900);
  68. }
  69. break;
  70. default:
  71. break;
  72. }
  73. }
  74.  
  75. public boolean onStart() {
  76. startTime = System.currentTimeMillis();
  77.  
  78. log("Welcome");
  79. bankToBeer = walking.newTilePath(path);
  80. return true;
  81. }
  82.  
  83. public void onFinish() {
  84. log("Thank you for using my BeerBot by beharon");
  85. }
  86.  
  87. public int loop() {
  88. // if (random(1, 1000) < 100) {
  89. // Antiban();
  90. //}
  91.  
  92. if (inventory.isFull()) {
  93. if (atBank.contains(getMyPlayer().getLocation())) {
  94. bank();
  95. } else {
  96. bankToBeer.traverse();
  97.  
  98. }
  99. } else {
  100. if (atBeer.contains(getMyPlayer().getLocation())) {
  101. buyBeer();
  102. } else {
  103. bankToBeer.reverse();
  104. bankToBeer.traverse();
  105. bankToBeer.reverse();
  106.  
  107.  
  108. }
  109. }
  110.  
  111. return random(500, 1000);
  112. }
  113.  
  114. public boolean buyBeer() {
  115. RSNPC Emily = npcs.getNearest(736);
  116. if (Emily != null);
  117. {
  118. Emily.interact("Talk");
  119. sleep(1500, 2000);
  120. interfaces.clickContinue();
  121. sleep(500, 1000);
  122. interfaces.clickContinue();
  123. sleep(500, 1000);
  124. interfaces.clickContinue();
  125. sleep(500, 1000);
  126. interfaces.getComponent(232, 3).doClick();
  127. sleep(1000, 1500);
  128.  
  129.  
  130. interfaces.clickContinue();
  131. sleep(500, 1000);
  132.  
  133. return true;
  134.  
  135. }
  136. }
  137.  
  138. private void bank() {
  139. if (bank.isOpen()) {
  140. bank.depositAllExcept(995);
  141. sleep(1000, 2000);
  142. bank.close();
  143. } else {
  144. bank.open();
  145. sleep(1000, 1500);
  146. }
  147. }
  148. private final Color color1 = new Color(255, 255, 255);
  149. private final Color color2 = new Color(0, 0, 0);
  150. private final BasicStroke stroke1 = new BasicStroke(1);
  151. private final Font font1 = new Font("Arial", 0, 9);
  152. private final Font font2 = new Font("Arial", 0, 20);
  153.  
  154. public void onRepaint(Graphics g1) {
  155. millis = System.currentTimeMillis() - startTime;
  156.  
  157. hours = millis / (1000 * 60 * 60);
  158.  
  159. millis -= hours * (1000 * 60 * 60);
  160.  
  161. minutes = millis / (1000 * 60);
  162.  
  163. millis -= minutes * (1000 * 60);
  164.  
  165. seconds = millis / 1000;
  166. Graphics2D g = (Graphics2D) g1;
  167. g.setColor(color1);
  168. // g.fillRect(3, 339, 515, 138);
  169. g.setColor(color2);
  170. g.setStroke(stroke1);
  171. // g.drawRect(3, 339, 515, 138);
  172. g.setFont(font1);
  173. g.drawString("Time Running" + hours + ":" + minutes + ":" + seconds, 28, 368);
  174. g.setFont(font2);
  175. g.drawString("Beers Bought", 28, 399);
  176. }
  177. }
Add Comment
Please, Sign In to add comment