Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import org.dreambot.api.methods.Calculations;
- import org.dreambot.api.methods.interactive.GameObjects;
- import org.dreambot.api.methods.map.Area;
- import org.dreambot.api.script.AbstractScript;
- import org.dreambot.api.script.ScriptManifest;
- import org.dreambot.api.script.Category;
- import org.dreambot.api.wrappers.interactive.GameObject;
- import org.dreambot.api.wrappers.interactive.Player;
- @ScriptManifest(author = "themcpker", name = "woodcutter", version = 1.0, description = "chops only the dankest trees", category = Category.THIEVING)
- public class main extends AbstractScript {
- public Area trees = new Area(3104, 3224, 3120, 3210);
- public Area bank = new Area(3092, 3240, 3093, 3245);
- private enum State {
- BANK, CHOP, WALK, ERROR
- }
- public void onStart() {
- log("script started ");
- }
- public void onExit() {
- log("script has stopped thanks for using");
- }
- public State getState() {
- if (getInventory().isFull() == true) {
- log("inventory is full going to bank");
- return State.BANK;
- } else {
- return State.CHOP;
- }
- }
- @Override
- public int onLoop() {
- switch (getState()) {
- case WALK:
- log("walk to trees");
- getWalking().walk(trees.getRandomTile());
- sleep(Calculations.random(6000, 10000));
- break;
- case CHOP:
- if (!trees.contains(getLocalPlayer())) {
- getWalking().walk(trees.getRandomTile());
- sleep(5000, 8000);
- } else if (!getLocalPlayer().isAnimating()) {
- GameObject tree = getGameObjects().closest("Tree");
- tree.interact("Chop down");
- sleep(Calculations.random(2000, 5000));
- }
- break;
- case BANK:
- getWalking().walk(bank.getRandomTile());
- sleep(Calculations.random(6000, 10000));
- break;
- case ERROR:
- log("Script ran into error");
- break;
- default:
- break;
- }
- return Calculations.random(500, 600);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement