Guest User

Untitled

a guest
Dec 11th, 2017
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.47 KB | None | 0 0
  1. import com.rsbuddy.event.events.MessageEvent;
  2. import com.rsbuddy.event.listeners.MessageListener;
  3. import com.rsbuddy.event.listeners.PaintListener;
  4. import com.rsbuddy.script.ActiveScript;
  5. import com.rsbuddy.script.Manifest;
  6. import com.rsbuddy.script.methods.*;
  7. import com.rsbuddy.script.util.Random;
  8. import com.rsbuddy.script.util.Timer;
  9. import com.rsbuddy.script.wrappers.GameObject;
  10. import com.rsbuddy.script.wrappers.Tile;
  11.  
  12. import java.awt.*;
  13. import java.awt.event.MouseEvent;
  14. import java.awt.event.MouseListener;
  15. import java.awt.event.MouseMotionListener;
  16.  
  17. @Manifest(name = "TutorialChampion", version = 0.01, authors = "iCyrus")
  18. public class TutorialChampion extends ActiveScript implements PaintListener, MessageListener, MouseListener, MouseMotionListener {
  19.  
  20. private static final int TREE_ID = 1278;
  21.  
  22. private static final int[] HATCHET_IDS = {
  23. 1359
  24. };
  25.  
  26. private static final Tile BANK_TILE = new Tile(3181, 3444);
  27.  
  28. private int random(int min, int max) {
  29. return Random.nextInt(min, (max + 1));
  30. }
  31.  
  32. public boolean onStart() {
  33. return true;
  34. }
  35.  
  36. public int loop() {
  37. if (!Inventory.isFull()) {
  38. GameObject tree = Objects.getNearest(TREE_ID);
  39. if (tree != null) {
  40. if (!tree.isOnScreen()) {
  41. Walking.findPath(tree.getLocation()).traverse();
  42. return random(800, 1000);
  43. } else {
  44. tree.interact("Chop down Tree");
  45. Timer t = new Timer(random(800, 1000));
  46. while (t.isRunning() && tree != null && Objects.getTopAt(tree.getLocation()).getId() == TREE_ID) {
  47. if (Players.getLocal().getAnimation() != -1 || Players.getLocal().isMoving()) {
  48. t.reset();
  49. }
  50. sleep(30);
  51. }
  52. }
  53. }
  54. } else {
  55. GameObject bankBooth = Objects.getTopAt(BANK_TILE);
  56. if (bankBooth != null) {
  57. if (!bankBooth.isOnScreen()) {
  58. Walking.findPath(bankBooth.getLocation()).traverse();
  59. return random(800, 1000);
  60. } else if (!Bank.isOpen()) {
  61. Bank.open();
  62. sleep(600, 800);
  63. while (Players.getLocal().isMoving() && !Bank.isOpen()) {
  64. sleep(30);
  65. }
  66. return 30;
  67. } else {
  68. Bank.depositAllExcept(HATCHET_IDS);
  69. return random(600, 800);
  70. }
  71. } else {
  72. //Bankbooth is null, so we need to get to the Tile that it should be on
  73. Walking.findPath(BANK_TILE).traverse();
  74. return random(600, 800);
  75. }
  76. }
  77. return 0;
  78. }
  79.  
  80. public void messageReceived(MessageEvent e) {
  81. String s = e.getMessage();
  82. }
  83.  
  84. public void onRepaint(Graphics g1) {
  85. }
  86.  
  87. public void mouseClicked(MouseEvent e) {
  88. int x = e.getX();
  89. int y = e.getY();
  90. }
  91.  
  92. public void mousePressed(MouseEvent e) {
  93. }
  94.  
  95. public void mouseReleased(MouseEvent e) {
  96. }
  97.  
  98. public void mouseEntered(MouseEvent e) {
  99. }
  100.  
  101. public void mouseExited(MouseEvent e) {
  102. }
  103.  
  104. public void mouseDragged(MouseEvent e) {
  105. }
  106.  
  107. public void mouseMoved(MouseEvent e) {
  108. }
  109. }
Add Comment
Please, Sign In to add comment