Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.awt.Graphics2D;
- import java.util.concurrent.TimeUnit;
- import org.osbot.rs07.api.map.Area;
- import org.osbot.rs07.api.map.Position;
- import org.osbot.rs07.api.model.Entity;
- import org.osbot.rs07.api.ui.Message;
- import org.osbot.rs07.api.ui.Message.MessageType;
- import org.osbot.rs07.api.ui.Skill;
- import org.osbot.rs07.script.Script;
- import org.osbot.rs07.script.ScriptManifest;
- @ScriptManifest(author = "You", info = "My first script", name = "cutter", version = 0, logo = "")
- public class Yews extends Script {
- private long timeBegan;
- private long timeRan;
- private int beginningXP;
- private int currentXp;
- private int xpGained;
- private int currentLevel;
- private int beginningLevel;
- private int levelsGained;
- private int logsCut = 0;
- /** YOUR VARIABLES */
- private static final Area BANK_AREA = new Area(3092, 3245, 3094, 3242);
- Area TREE_AREA = new Area(3056,3269,3051,3274);
- @Override
- public void onMessage(Message c) {
- if (c.getType() == MessageType.GAME) {
- String m = c.getMessage();
- try {
- if (m.contains("You get some yew logs.")) {
- logsCut++;
- }
- } catch (Exception exception) {
- exception.printStackTrace();
- }
- }
- }
- @Override
- public void onStart() {
- beginningLevel = skills.getStatic(Skill.WOODCUTTING);
- timeBegan = System.currentTimeMillis();
- beginningXP = skills.getExperience(Skill.WOODCUTTING);
- log("Let's get started!");
- log("gl with the ban this anti ban sucks ass");
- }
- private enum State {
- CUT, BANKING, BANKING_REAL, WAIT, WALK_TO_TREE
- };
- private State getState() {
- Entity tree = objects.closest("Yew");
- if(BANK_AREA.contains(myPlayer()) && !inventory.isFull() && !TREE_AREA.contains(myPlayer()))
- return State.WALK_TO_TREE;
- if (inventory.isFull() && !BANK_AREA.contains(myPlayer()))
- return State.BANKING;
- if (inventory.isFull() && BANK_AREA.contains(myPlayer()))
- return State.BANKING_REAL;
- if (tree != null && tree.isVisible() && !inventory.isFull() && !myPlayer().isAnimating()
- && !myPlayer().isMoving())
- return State.CUT;
- return State.WAIT;
- }
- @Override
- public int onLoop() throws InterruptedException {
- switch (getState()) {
- case CUT:
- Entity Tree = objects.closest("Yew");
- if (Tree != null && Tree.isVisible()) {
- Tree.interact("Chop down");
- return(random(600, 1200));
- }
- break;
- case WALK_TO_TREE:
- getWalking().webWalk(TREE_AREA);
- break;
- case BANKING:
- getWalking().webWalk(BANK_AREA);
- break;
- case BANKING_REAL:
- if (bank.isOpen()) {
- getBank().bank.depositAllExcept("Rune Axe");
- } else {
- getBank().open();
- }
- case WAIT:
- sleep(random(1000, 2000));
- break;
- }
- return random(3000, 4000);
- }
- @Override
- public void onExit() {
- log("Thanks for running my Wood Cutter!");
- }
- @Override
- public void onPaint(Graphics2D g) {
- g.drawString("Logs cut: " + logsCut , 288, 62);
- levelsGained = currentLevel - beginningLevel;
- g.drawString("Levels gained " + levelsGained, 266, 327);
- currentLevel = skills.getStatic(Skill.WOODCUTTING);
- g.drawString("Starting Level " + beginningLevel, 255,273);
- g.drawString("Current Level " + currentLevel, 492,309);
- currentXp = skills.getExperience(Skill.WOODCUTTING);
- xpGained = currentXp - beginningXP;
- g.drawString("XP gained " + xpGained, 60, 302);
- timeRan = System.currentTimeMillis() - this.timeBegan;
- g.drawString(ft(timeRan), 53, 66);
- }
- private String ft(long duration)
- {
- String res = "";
- long days = TimeUnit.MILLISECONDS.toDays(duration);
- long hours = TimeUnit.MILLISECONDS.toHours(duration)
- - TimeUnit.DAYS.toHours(TimeUnit.MILLISECONDS.toDays(duration));
- long minutes = TimeUnit.MILLISECONDS.toMinutes(duration)
- - TimeUnit.HOURS.toMinutes(TimeUnit.MILLISECONDS
- .toHours(duration));
- long seconds = TimeUnit.MILLISECONDS.toSeconds(duration)
- - TimeUnit.MINUTES.toSeconds(TimeUnit.MILLISECONDS
- .toMinutes(duration));
- if (days == 0) {
- res = (hours + ":" + minutes + ":" + seconds);
- } else {
- res = (days + ":" + hours + ":" + minutes + ":" + seconds);
- }
- return res;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement