Guest User

Untitled

a guest
Jan 21st, 2018
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.59 KB | None | 0 0
  1. import java.awt.*;
  2.  
  3. import com.rsbuddy.event.events.MessageEvent;
  4. import com.rsbuddy.event.listeners.MessageListener;
  5. import com.rsbuddy.event.listeners.PaintListener;
  6. import com.rsbuddy.script.ActiveScript;
  7. import com.rsbuddy.script.Manifest;
  8. import com.rsbuddy.script.methods.Bank;
  9. import com.rsbuddy.script.methods.Camera;
  10. import com.rsbuddy.script.methods.Environment;
  11. import com.rsbuddy.script.methods.Inventory;
  12. import com.rsbuddy.script.methods.Mouse;
  13. import com.rsbuddy.script.util.Random;
  14. import com.rsbuddy.script.util.Timer;
  15. import com.rsbuddy.script.wrappers.Item;
  16.  
  17. @Manifest(authors={"Remi"}, name="RCrusher", keywords={"Money, Making, chocolate, bar, remi"}, version=1, description="Start by any bank or chest.")
  18. public class RCrusher extends ActiveScript implements PaintListener, MessageListener {
  19.  
  20. private int crushed; //how many inventories you've crushed, after each inv, should add +1
  21. private Timer t; //for paint/ is runtime
  22. private long startTime;
  23. private long seconds = 0, minutes = 0, hours = 0;
  24. long runTime = System.currentTimeMillis() - startTime;
  25. private static String status = "Unknown";
  26. final Font comicPlain10 = new Font("Comic Sans MS", Font.PLAIN, 10);
  27. final Color black = new Color(0, 0, 0);
  28.  
  29. private void idle() { //antiban
  30. if (Random.nextInt(0, 500) == 0) {
  31. Mouse.setSpeed(10);
  32. int rand2 = Random.nextInt(1, 3);
  33. for (int i = 0; i < rand2; i++) {
  34. Mouse.move(Random.nextInt(100, 700), Random.nextInt(100, 500));
  35. sleep(Random.nextInt(200, 700));
  36. }
  37. Mouse.move(Random.nextInt(0, 800), 647, 50, 100);
  38. sleep(Random.nextInt(100, 1500));
  39. Mouse.move(Random.nextInt(75, 400), Random.nextInt(75, 400), 30);
  40. Mouse.setSpeed(Random.nextInt(3, 5));
  41. }
  42. if (Random.nextInt(0, 500) == 0) {
  43. Mouse.setSpeed(10);
  44. Point curPos = Mouse.getLocation();
  45. Mouse.move(Random.nextInt(0, 750), Random.nextInt(0, 500), 20);
  46. sleep(Random.nextInt(100, 300));
  47. Mouse.move(curPos, 20, 20);
  48. Mouse.setSpeed(Random.nextInt(3, 5));
  49. }
  50. if (Random.nextInt(0, 500) == 0) {
  51. int angle = Camera.getCompassAngle();
  52. int rand = Random.nextInt(0, 40);
  53. if (Random.nextInt(0, 2) == 0) {
  54. angle += rand;
  55. } else {
  56. angle -= rand;
  57. }
  58. if (angle < 0) {
  59. angle += 359;
  60. }
  61. if (angle > 359) {
  62. angle -= 359;
  63. }
  64. Camera.setCompassAngle(angle);
  65. }
  66. if (Random.nextInt(0, 500) == 0) {
  67. if (Random.nextInt(0, 4) == 0) {
  68. Camera.setPitch(Random.nextInt(50, 80));
  69. } else {
  70. Camera.setPitch(true);
  71. }
  72. }
  73. }
  74.  
  75. @Override
  76. public int loop() {
  77. if (Inventory.isFull() && Inventory.contains(1973) && Inventory.contains(233)) { //if your inventory is full, has a chocolate bar and mortar, then it'll do //everything under it until the } part
  78. status = "Crushing"; //for the paint.
  79. Item item1 = Inventory.getItem(233); //this is like Mortar
  80. Item item2 = Inventory.getItem(1973); //and this is a chocolate bar
  81. Inventory.useItem(item1, item2); //uses mortar on chocolate bar
  82. sleep(500, 1000); //waits for the interface to pop-up
  83. Mouse.click(257, 423, true); //clicks 'Make-All'
  84. sleep(17000); //waits until the current inventory is done, 1000 = 1 second
  85. } else //ends the above method, then starts the next one
  86. if (Inventory.contains(1975) && !Inventory.contains(1973)) {
  87. bank();
  88. } else
  89. if (Bank.getCount(1975) == 0 && Inventory.getCount(1975) == 0) { //checks if the inventory and bank dont have any chocolate bars left
  90. log("No Chocolate Bars found, stopping script.");
  91. stop(); //stops script
  92. }
  93. return 500;
  94. }
  95.  
  96. private void bank() { //obvious enough
  97. //insert banking function here
  98. }
  99.  
  100. public void messageReceived(MessageEvent me) {
  101. String s = me.getMessage();
  102. if (s.contains("grind the")) {
  103. // what will the script do if it reads this from ingame?
  104. }
  105. }
  106. @Override
  107. public boolean onStart() {
  108. idle(); //antiban
  109. Mouse.setSpeed(1);
  110. t = new Timer(0); //for paint
  111. return true;
  112. }
  113.  
  114. @Override
  115. public void onFinish() {
  116. Environment.saveScreenshot(true);
  117. }
  118.  
  119.  
  120. public void onRepaint(Graphics g1) {
  121. Graphics2D g = (Graphics2D)g1;
  122. seconds = runTime / 1000;
  123. if (seconds >= 60) {
  124. minutes = seconds / 60;
  125. seconds -= (minutes * 60);
  126. }
  127. if (minutes >= 60) {
  128. hours = minutes / 60;
  129. minutes -= (hours * 60);
  130. // add your paint here ↓
  131. g.drawstring("crushed: " +crushed, 30, 30);
  132. }
  133. }
Add Comment
Please, Sign In to add comment