Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import Utils.Timer;
- import org.osbot.rs07.api.model.Entity;
- import org.osbot.rs07.script.Script;
- import org.osbot.rs07.script.ScriptManifest;
- import javax.imageio.ImageIO;
- import java.awt.*;
- import java.awt.image.BufferedImage;
- import java.io.IOException;
- @ScriptManifest(author = "DarkBinded", info = "DarkBinded's Progressive Woodcutter", name = "Progressive WoodCutter", version = 0.1, logo = "")
- public class WoodCutting extends Script {
- private long timeBegan, timeRan;
- BufferedImage background;
- @Override
- public void onStart() {
- log("Thank you for choosing DarkBinded's Progressive Woodcutter!");
- timeBegan = System.currentTimeMillis();
- try{
- background = ImageIO.read(WoodCutting.class.getResourceAsStream("/woodcutting/woodcutter.png"));
- } catch(IOException e){
- log(e);
- }
- }
- @Override
- public void onExit() {
- log("Thank you for using DarkBinded's Progressive Woodcutter!");
- }
- @Override
- public int onLoop() {
- if(!myPlayer().isAnimating()){
- if(getInventory().isFull()){
- getInventory().dropAllExcept("Bronze axe");
- }
- else{
- Entity tree = getObjects().closest("Oak");
- if(tree != null){
- tree.interact("Chop down");
- }
- }
- }
- return 3000; //The amount of time in milliseconds before the loop starts over
- }
- @Override
- public void onPaint(Graphics2D g) {
- timeRan = System.currentTimeMillis() - timeBegan;
- g.setColor(Color.black);
- Point mP = getMouse().getPosition();
- g.drawLine(mP.x - 5, mP.y + 5, mP.x + 5, mP.y - 5);
- g.drawLine(mP.x + 5, mP.y + 5, mP.x - 5, mP.y - 5);
- g.drawString("Time Ran: " + timeFormatDHMS(timeRan), 30, 400);
- if(background != null) {
- g.drawImage(background, null, 0, 0);
- }
- }
- public String timeFormatDHMS(long time) {
- int sec = (int) (time / 1000), d = sec / 86400, h = sec / 3600 % 24, m = sec / 60 % 60, s = sec % 60;
- return (d < 10 ? "0" + d : d) + ":" + (h < 10 ? "0" + h : h) + ":"
- + (m < 10 ? "0" + m : m) + ":" + (s < 10 ? "0" + s : s);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement