Advertisement
Guest User

Untitled

a guest
Feb 20th, 2020
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.33 KB | None | 0 0
  1.  
  2.  
  3. import Utils.Timer;
  4. import org.osbot.rs07.api.model.Entity;
  5. import org.osbot.rs07.script.Script;
  6.  
  7. import org.osbot.rs07.script.ScriptManifest;
  8.  
  9. import javax.imageio.ImageIO;
  10. import java.awt.*;
  11. import java.awt.image.BufferedImage;
  12. import java.io.IOException;
  13.  
  14.  
  15. @ScriptManifest(author = "DarkBinded", info = "DarkBinded's Progressive Woodcutter", name = "Progressive WoodCutter", version = 0.1, logo = "")
  16.  
  17. public class WoodCutting extends Script {
  18.  
  19. private long timeBegan, timeRan;
  20. BufferedImage background;
  21.  
  22. @Override
  23.  
  24.  
  25.  
  26.  
  27.  
  28. public void onStart() {
  29. log("Thank you for choosing DarkBinded's Progressive Woodcutter!");
  30. timeBegan = System.currentTimeMillis();
  31. try{
  32.  
  33. background = ImageIO.read(WoodCutting.class.getResourceAsStream("/woodcutting/woodcutter.png"));
  34. } catch(IOException e){
  35.  
  36. log(e);
  37. }
  38. }
  39.  
  40.  
  41.  
  42. @Override
  43.  
  44. public void onExit() {
  45. log("Thank you for using DarkBinded's Progressive Woodcutter!");
  46. }
  47.  
  48. @Override
  49.  
  50. public int onLoop() {
  51. if(!myPlayer().isAnimating()){
  52. if(getInventory().isFull()){
  53. getInventory().dropAllExcept("Bronze axe");
  54. }
  55. else{
  56. Entity tree = getObjects().closest("Oak");
  57. if(tree != null){
  58. tree.interact("Chop down");
  59. }
  60. }
  61. }
  62.  
  63.  
  64. return 3000; //The amount of time in milliseconds before the loop starts over
  65.  
  66. }
  67.  
  68. @Override
  69.  
  70. public void onPaint(Graphics2D g) {
  71. timeRan = System.currentTimeMillis() - timeBegan;
  72. g.setColor(Color.black);
  73.  
  74. Point mP = getMouse().getPosition();
  75.  
  76. g.drawLine(mP.x - 5, mP.y + 5, mP.x + 5, mP.y - 5);
  77. g.drawLine(mP.x + 5, mP.y + 5, mP.x - 5, mP.y - 5);
  78.  
  79. g.drawString("Time Ran: " + timeFormatDHMS(timeRan), 30, 400);
  80.  
  81. if(background != null) {
  82.  
  83. g.drawImage(background, null, 0, 0);
  84. }
  85. }
  86. public String timeFormatDHMS(long time) {
  87. int sec = (int) (time / 1000), d = sec / 86400, h = sec / 3600 % 24, m = sec / 60 % 60, s = sec % 60;
  88. return (d < 10 ? "0" + d : d) + ":" + (h < 10 ? "0" + h : h) + ":"
  89. + (m < 10 ? "0" + m : m) + ":" + (s < 10 ? "0" + s : s);
  90. }
  91. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement