Advertisement
Guest User

Sus's Logger 0.3 Source

a guest
Jan 14th, 2019
178
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 3.40 KB | None | 0 0
  1. package core;
  2.  
  3. import java.awt.Color;
  4. import java.awt.Font;
  5. import java.awt.Graphics2D;
  6.  
  7. import org.osbot.rs07.api.map.constants.Banks;
  8. import org.osbot.rs07.api.map.Area;
  9. import org.osbot.rs07.api.model.RS2Object;
  10. import org.osbot.rs07.api.ui.Skill;
  11. import org.osbot.rs07.script.Script;
  12. import org.osbot.rs07.script.ScriptManifest;
  13. import org.osbot.rs07.utility.ConditionalSleep;
  14.  
  15. @ScriptManifest(author = "Suss", info = "Cuts trees & banks the logs at Grand Exchange.", name = "Sus's Logger", version = 0.3, logo = "https://i.ibb.co/xgbRfTv/rsz-logger.png")
  16.  
  17. public class Main extends Script {
  18.  
  19.  public Area grandExchange = new Area(3142, 3468, 3187, 3515);
  20.  public int treeCount = 0;
  21.  public int woodcuttingXP = 0;
  22.  public int treeCountHour = 0;
  23.  public int woodcuttingXPHR = 0;
  24.  public long totalElapsed = 0;
  25.  public long totalElapsedFixed = 0;
  26.  public long totalLogsBanked = 0;
  27.  public String botStatus;
  28.  
  29.  @Override
  30.  public void onStart() {
  31.   log("Sus's Logger Started");
  32.   getExperienceTracker().start(Skill.WOODCUTTING);
  33.  }
  34.  
  35.  public void statTracker() {
  36.   // XP
  37.   woodcuttingXP = getExperienceTracker().getGainedXP(Skill.WOODCUTTING);
  38.   woodcuttingXPHR = getExperienceTracker().getGainedXPPerHour(Skill.WOODCUTTING);
  39.  
  40.   // Total Logs
  41.   treeCount = woodcuttingXP / 25;
  42.   treeCountHour = woodcuttingXPHR / 25;
  43.  
  44.   // Timings
  45.   totalElapsed = getExperienceTracker().getElapsed(Skill.WOODCUTTING);
  46.   totalElapsedFixed = totalElapsed / 1000;
  47.  }
  48.  
  49.  public void botStatus() {
  50.   if (getInventory().isFull() && myPlayer().isMoving()) {
  51.    botStatus = "Walking to GE";
  52.   } else if (myPlayer().isAnimating() && !getInventory().isFull()) {
  53.    botStatus = "Chopping Tree";
  54.   } else if (myPlayer().isMoving() || !myPlayer().isMoving() && !getInventory().isFull()) {
  55.    botStatus = "Locating Tree";
  56.   }
  57.  }
  58.  
  59.  @Override
  60.  public int onLoop() throws InterruptedException {
  61.   RS2Object regTree = getObjects().closest(grandExchange, "Tree");
  62.   if (grandExchange.contains(myPlayer())) {
  63.    if (getInventory().contains("Logs") && getInventory().isFull()) {
  64.     getWalking().webWalk(Banks.GRAND_EXCHANGE);
  65.     bank.open();
  66.     bank.depositAll("Logs");
  67.     bank.close();
  68.    } else if (regTree != null && !myPlayer().isAnimating()) {
  69.  
  70.     if (regTree.interact("Chop down")) {
  71.      new ConditionalSleep(5000, 750) {
  72.       @Override
  73.       public boolean condition() throws InterruptedException {
  74.        return myPlayer().isAnimating();
  75.       }
  76.      }.sleep();
  77.     }
  78.    }
  79.   } else {
  80.       getWalking().webWalk(grandExchange);
  81.   }
  82.  
  83.   // Updates GUI
  84.   statTracker();
  85.   botStatus();
  86.  
  87.   return random(750, 1500);
  88.  }
  89.  
  90.  @Override
  91.  public void onExit() {
  92.   log("========================================");
  93.   log("Thank you for chopping with Sus Tree Chooper!");
  94.   log("========================================");
  95.  }
  96.  
  97.  @Override
  98.  public void onPaint(Graphics2D title) {
  99.  
  100.   title.setFont(new Font("arial", Font.ITALIC, 12));
  101.   title.setColor(Color.PINK);
  102.  
  103.   title.drawString("Sus's Tree Cutter", 30, 40);
  104.   title.drawString("Total Logs Cut: " + treeCount, 30, 60);
  105.   title.drawString("Logs Per Hour:  " + treeCountHour, 30, 80);
  106.   title.drawString("Total XP Gained: " + woodcuttingXP, 30, 100);
  107.   title.drawString("XP Per Hour: " + woodcuttingXPHR, 30, 120);
  108.  
  109.   title.drawString("Total Time Ran:  " + totalElapsedFixed + " Seconds", 30, 150);
  110.   title.drawString("Bot Status:  " + botStatus, 30, 170);
  111.  }
  112. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement