Guest User

Untitled

a guest
Dec 11th, 2017
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.56 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.Inventory;
  7. import com.rsbuddy.script.methods.Objects;
  8. import com.rsbuddy.script.methods.Players;
  9. import com.rsbuddy.script.methods.Walking;
  10. import com.rsbuddy.script.util.Random;
  11. import com.rsbuddy.script.util.Timer;
  12. import com.rsbuddy.script.wrappers.GameObject;
  13.  
  14. import java.awt.*;
  15. import java.awt.event.MouseEvent;
  16. import java.awt.event.MouseListener;
  17. import java.awt.event.MouseMotionListener;
  18.  
  19. @Manifest(name = "TutorialChampion", version = 0.01, authors = "iCyrus")
  20. public class TutorialChampion extends ActiveScript implements PaintListener, MessageListener, MouseListener, MouseMotionListener {
  21.  
  22. private static final int TREE_ID = 1278;
  23.  
  24. private int random(int min, int max) {
  25. return Random.nextInt(min, (max + 1));
  26. }
  27.  
  28. public boolean onStart() {
  29. return true;
  30. }
  31.  
  32. public int loop() {
  33. log("Through loop");
  34. if (!Inventory.isFull()) {
  35. GameObject tree = Objects.getNearest(TREE_ID);
  36. if (tree != null) {
  37. if (!tree.isOnScreen()) {
  38. Walking.findPath(tree.getLocation()).traverse();
  39. return random(800, 1000);
  40. } else {
  41. tree.interact("Chop down Tree");
  42. sleep(600, 800);
  43. Timer t = new Timer(random(800, 1000));
  44. while (t.isRunning() && tree != null && Objects.getTopAt(tree.getLocation()).getId() == TREE_ID) {
  45. if (Players.getLocal().getAnimation() != -1 || Players.getLocal().isMoving()) {
  46. t.reset();
  47. }
  48. sleep(30);
  49. }
  50. }
  51. }
  52. }
  53. return 0;
  54. }
  55.  
  56. public void messageReceived(MessageEvent e) {
  57. String s = e.getMessage();
  58. }
  59.  
  60. public void onRepaint(Graphics g1) {
  61. }
  62.  
  63. public void mouseClicked(MouseEvent e) {
  64. int x = e.getX();
  65. int y = e.getY();
  66. }
  67.  
  68. public void mousePressed(MouseEvent e) {
  69. }
  70.  
  71. public void mouseReleased(MouseEvent e) {
  72. }
  73.  
  74. public void mouseEntered(MouseEvent e) {
  75. }
  76.  
  77. public void mouseExited(MouseEvent e) {
  78. }
  79.  
  80. public void mouseDragged(MouseEvent e) {
  81. }
  82.  
  83. public void mouseMoved(MouseEvent e) {
  84. }
  85. }
Add Comment
Please, Sign In to add comment