Guest User

Untitled

a guest
Aug 17th, 2018
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.54 KB | None | 0 0
  1. import org.rsbot.script.Script;
  2. import org.rsbot.script.ScriptManifest;
  3. import org.rsbot.script.wrappers.RSObject;
  4. import org.rsbot.event.listeners.PaintListener;
  5. import org.rsbot.script.wrappers.RSTile;
  6. import org.rsbot.script.wrappers.RSItem;
  7. import org.rsbot.script.util.Filter;
  8. import java.awt.*;
  9. import javax.imageio.ImageIO;
  10. import java.io.IOException;
  11. import java.net.URL;
  12. import org.rsbot.event.events.ServerMessageEvent;
  13.  
  14. @ScriptManifest(authors = { "YoshiFue27" }, keywords = { "Willow Chopper Cutter" }, name = "Willow Cutter", version = 1.0, description = "Cuts Willows. CAUTION: WILL DROP ANY HATCHET" +
  15. "IN YOUR INVENTORY THAT IS NOT BRONZE, IRON, STEEL, OR RUNE. IF YOU DO NOT HAVE ANY OF THESE TYPES OF HATCHETS, PLEASE WIELD THEM.")
  16. public class YFPowerCutter extends Script implements PaintListener {
  17. private int willowID[] = {5551, 5552, 5553};
  18. private int hatchetsID[] = {1359, 1351, 1353, 1349,};
  19. private String status = "Loading...";
  20. public long startTime = System.currentTimeMillis();
  21. private int logsChopped = 0;
  22. public boolean onStart() {
  23. mouse.setSpeed(random(8, 11));
  24. log("Welcome to YoshiFue's Willow Cutter!");
  25. return true;
  26. }
  27.  
  28. public int loop(){
  29. if(inventory.isFull()){
  30. status = "Dropping logs!";
  31. inventory.dropAllExcept(hatchetsID);
  32.  
  33. }else{
  34. if(getMyPlayer().getAnimation() != 867){
  35. RSObject tree = objects.getNearest(willowID);
  36. if(tree != null){
  37. status = "Chopping";
  38. tree.doAction("Chop");
  39. sleep(2000, 2500);
  40. }
  41. }
  42. }
  43. return random(100, 200);
  44. }
  45.  
  46. public void onFinish() {
  47.  
  48. log("Thank you for using YoshiFue's Willow Cutter v1.2. Goodbye.");
  49.  
  50. }
  51.  
  52.  
  53.  
  54.  
  55. public void onRepaint(Graphics g1) {
  56.  
  57.  
  58. Graphics2D g = (Graphics2D)g1;
  59. long millis = System.currentTimeMillis() - startTime;
  60. long hours = millis / (1000 * 60 * 60);
  61. millis -= hours * (1000 * 60 * 60);
  62. long minutes = millis / (1000 * 60);
  63. millis -= minutes * (1000 * 60);
  64. long seconds = millis / 1000;
  65.  
  66.  
  67.  
  68. g.setColor(color1);
  69. g.fillRoundRect(9, 347, 485, 110, 16, 16);
  70. g.setFont(font1);
  71. g.setColor(color2);
  72. g.drawString("Welcome to YoshiFue's Auto Willow Cutter v1.2!", 15, 363);
  73. g.drawString("Status: " + status, 16, 399);
  74. g.drawString("Running Time: " + hours + ":" + minutes + ":" + seconds, 16, 425);
  75. }
  76. private final Color color1 = new Color(0, 0, 204);
  77. private final Color color2 = new Color(0, 0, 0);
  78.  
  79. private final Font font1 = new Font("Arial Black", 0, 16);
  80.  
  81. }
Add Comment
Please, Sign In to add comment