Guest User

Untitled

a guest
Jan 13th, 2018
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.71 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 int numOfBeers;
  24. public long startTime = 0;
  25. public long millis = 0;
  26. public double ph;
  27. public long hours = 0;
  28. public long minutes = 0;
  29. public long seconds = 0;
  30. public long last = 0;
  31. public RSArea atBeer = new RSArea(new RSTile(2953, 3366), new RSTile(2960, 3376));
  32. RSArea atBank = new RSArea(new RSTile(2943, 3365), new RSTile(2949, 3373));
  33. /* public final RSTile[] path = {
  34. new RSTile(2944, 3370), new RSTile(2944, 3372),
  35. new RSTile(2945, 3374), new RSTile(2947, 3376),
  36. new RSTile(2949, 3377), new RSTile(2951, 3378),
  37. new RSTile(2953, 3379), new RSTile(2955, 3380),
  38. new RSTile(2955, 3377), new RSTile(2956, 3375),
  39. new RSTile(2955, 3372)
  40. };
  41. public final RSTile[] path1 = {
  42. new RSTile(2958, 3371), new RSTile(2956, 3374),
  43. new RSTile(2955, 3378), new RSTile(2954, 3380),
  44. new RSTile(2952, 3377), new RSTile(2950, 3376),
  45. new RSTile(2946, 3375), new RSTile(2944, 3373),
  46. new RSTile(2945, 3370), new RSTile(2945, 3368)
  47. };
  48. RSTilePath bankToBeer;
  49. RSTilePath beerToBank;*/
  50. RSTile beerPlace = new RSTile(2956, 3372);
  51. RSTile bankPlace = new RSTile(2945, 3368);
  52.  
  53. public void Antiban() {
  54.  
  55. int b = random(0, 10);
  56. switch (b) {
  57. case 1:
  58. if (random(0, 10) == 5) {
  59. mouse.moveSlightly();
  60. sleep(200, 300);
  61. mouse.moveRandomly(150, 350);
  62. }
  63. break;
  64. case 3:
  65. if (random(0, 24) == 6) {
  66. mouse.moveOffScreen();
  67. sleep(600, 700);
  68. }
  69. break;
  70. default:
  71. break;
  72. }
  73. }
  74.  
  75. public boolean onStart() {
  76. startTime = System.currentTimeMillis();
  77. numOfBeers = 0;
  78.  
  79. //beerToBank = walking.newTilePath(path1);
  80. //bankToBeer = walking.newTilePath(path);
  81. log("Welcome to my Beer Buyer Bot! by beharon");
  82. return true;
  83. }
  84.  
  85. public void onFinish() {
  86. log("Thank you for using my BeerBot by beharon");
  87. }
  88.  
  89. public int loop() {
  90. if (random(1, 1000) < 100) {
  91. Antiban();
  92. }
  93.  
  94. if (inventory.isFull()) {
  95. if (atBank.contains(getMyPlayer().getLocation())) {
  96. bank();
  97. } else {
  98. log("finished buying beers");
  99. walking.walkTileMM(bankPlace);
  100. sleep(4000, 5000);
  101. //beerToBank.randomize(2, 2);
  102. //beerToBank.traverse();
  103.  
  104. }
  105. } else {
  106. if (atBeer.contains(getMyPlayer().getLocation())) {
  107. buyBeer();
  108. } else {
  109. walking.walkTileMM(beerPlace);
  110. sleep(4000, 5000);
  111. }
  112. }
  113.  
  114. return random(500, 1000);
  115. }
  116.  
  117. public void buyBeer() {
  118. RSNPC Emily = npcs.getNearest(736);
  119. if (Emily != null);
  120. {
  121. Emily.interact("Talk");
  122. sleep(750, 1250);
  123. interfaces.clickContinue();
  124. sleep(500, 1250);
  125. interfaces.clickContinue();
  126. sleep(500, 1250);
  127. ;
  128. interfaces.clickContinue();
  129. sleep(750, 1250);
  130. interfaces.getComponent(232, 3).doClick();
  131. sleep(1000, 1500);
  132.  
  133.  
  134. interfaces.clickContinue();
  135. sleep(500, 1250);
  136. interfaces.clickContinue();
  137. numOfBeers++;
  138.  
  139.  
  140. }
  141. }
  142. //banks all of your inventory except your gold
  143.  
  144. private void bank() {
  145. if (bank.isOpen()) { //if banks open, banks inventory, and closes bank
  146. bank.depositAllExcept(995);
  147. sleep(1000, 2000);
  148. bank.close();
  149. } else { //if bank is closed, opens bank
  150. bank.open();
  151. sleep(1000, 1500);
  152. }
  153. }
  154. private final Color color1 = new Color(255, 255, 255);
  155. private final Color color2 = new Color(0, 0, 0);
  156. private final BasicStroke stroke1 = new BasicStroke(1);
  157. private final Font font1 = new Font("Arial", 0, 9);
  158.  
  159. public void onRepaint(Graphics g1) {
  160. millis = System.currentTimeMillis() - startTime;
  161.  
  162. hours = millis / (1000 * 60 * 60);
  163.  
  164. millis -= hours * (1000 * 60 * 60);
  165.  
  166. minutes = millis / (1000 * 60);
  167.  
  168. millis -= minutes * (1000 * 60);
  169.  
  170. seconds = millis / 1000;
  171. Graphics2D g = (Graphics2D) g1;
  172. g.setColor(color1);
  173. g.fillRect(1, 477, 517, 25);
  174. g.setColor(color2);
  175. g.setStroke(stroke1);
  176. g.drawRect(1, 477, 517, 25);
  177. g.setFont(font1);
  178. g.drawString("Beers Bought: " + numOfBeers, 8, 494);
  179. g.drawString("Run Time: " + hours + ":" + minutes + ":" + seconds, 160, 495);
  180. g.drawString("Estimated Profit: " + numOfBeers * 100, 288, 495);
  181.  
  182. ph = millis / (1000 * 60 * 60);
  183.  
  184. g.drawString("P/h: " + (numOfBeers*100*3600*1000/millis), 405, 493);
  185.  
  186.  
  187. }
  188. }
Add Comment
Please, Sign In to add comment