Jump to content

[Open Source] F2P Oak Chopper


Alias
 Share

Recommended Posts

import com.epicbot.api.shared.GameType;
import com.epicbot.api.shared.entity.SceneObject;
import com.epicbot.api.shared.model.Area;
import com.epicbot.api.shared.script.LoopScript;
import com.epicbot.api.shared.script.ScriptManifest;
import com.epicbot.api.shared.util.time.Time;

@ScriptManifest(name = "Alias", gameType = GameType.OS)
public class Main extends LoopScript {

    private final static Area OAK_AREA = new Area(3172, 3422, 3159, 3411);
    private final static Area BANK_AREA = new Area(3185, 3439, 3180, 3431);

    @Override
    public boolean onStart(String... strings) {
        return true;
    }

    @Override
    protected int loop() {
        if (getAPIContext().inventory().isFull()) {
            bank();
        } else {
            chop();
        }
        return 100;
    }

    private void bank() {
        if (!BANK_AREA.contains(getAPIContext().localPlayer().getLocation())) {
            getAPIContext().walking().walkTo(BANK_AREA.getCentralTile());
        } else if (!getAPIContext().bank().isOpen()) {
            if (getAPIContext().bank().open()) {
                Time.sleep(5_000, () -> getAPIContext().bank().isOpen());
            }
        } else if (getAPIContext().bank().depositAll("Oak logs")) {
            Time.sleep(5_000, () -> getAPIContext().inventory().isEmpty());
        }
    }

    private void chop() {
        if (!OAK_AREA.contains(getAPIContext().localPlayer().getLocation())) {
            getAPIContext().walking().walkTo(OAK_AREA.getCentralTile());
        } else if (!isChopping()) {
            final SceneObject tree = getAPIContext().objects().query().nameContains("Oak").results().nearest();
            if (tree != null) {
                if (tree.interact()) {
                    Time.sleep(5_000, () -> getAPIContext().localPlayer().isAnimating());
                }
            }
        }
    }

    private boolean isChopping() {
        return getAPIContext().localPlayer().isAnimating() || getAPIContext().localPlayer().isMoving();
    }
}
Edited by Alias
  • Like 2
  • Thanks 1
Link to comment
Share on other sites

Posted (edited)
41 minutes ago, Koala said:

Does this kill Zulrah?

 

Nice release 🙂

 

Considering you don't have a Zulrah released I figured I'd help. 

 

public class RotationListener implements Runnable {

    public RotationListener(final AliasZulrah ctx) {
        this.ctx = ctx;
    }
Edited by Alias
Link to comment
Share on other sites

  • 5 months later...
Posted (edited)

Updaded version for the east Side of Varrock. Just compile and go to varrock east bank or the oak Trees and you are rdy to mine oak 😁 

AND yes this is now my first start so maybe i will share some free stuff more in the future that is also my "own" stuff and new things 

 

Edit: 100% bann rate so far, even with the new area updated, maybe because no run option but only use it if you can throw away the account.

 

//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by FernFlower decompiler)
//

import com.epicbot.api.shared.GameType;
import com.epicbot.api.shared.entity.SceneObject;
import com.epicbot.api.shared.entity.details.Locatable;
import com.epicbot.api.shared.model.Area;
import com.epicbot.api.shared.script.LoopScript;
import com.epicbot.api.shared.script.ScriptManifest;
import com.epicbot.api.shared.util.time.Time;

@ScriptManifest(
    name = "F2P Oak Chopper",
    gameType = GameType.OS
)
public class main extends LoopScript {
    public static final Area OAK_AREA = new Area(3277, 3413, 3284, 3434);
    public static final Area BANK_AREA = new Area(3253, 3419, 3254, 3419);

    public main() {
    }

    public void bank() {
        if (!BANK_AREA.contains(new Locatable[]{this.getAPIContext().localPlayer().getLocation()})) {
            this.getAPIContext().walking().walkTo(BANK_AREA.getCentralTile());
        } else if (!this.getAPIContext().bank().isOpen()) {
            if (this.getAPIContext().bank().open()) {
                Time.sleep(5000, () -> {
                    return this.getAPIContext().bank().isOpen();
                });
            }
        } else if (this.getAPIContext().bank().depositAll(new String[]{"Oak logs"})) {
            Time.sleep(5000, () -> {
                return this.getAPIContext().inventory().isEmpty();
            });
        }

    }

    public void chop() {
        if (!OAK_AREA.contains(new Locatable[]{this.getAPIContext().localPlayer().getLocation()})) {
            this.getAPIContext().walking().walkTo(OAK_AREA.getCentralTile());
        } else if (!this.isChopping()) {
            SceneObject tree = (SceneObject)this.getAPIContext().objects().query().nameContains(new String[]{"Oak"}).results().nearest();
            if (tree != null && tree.interact()) {
                Time.sleep(5000, () -> {
                    return this.getAPIContext().localPlayer().isAnimating();
                });
            }
        }

    }

    public boolean isChopping() {
        return this.getAPIContext().localPlayer().isAnimating() || this.getAPIContext().localPlayer().isMoving();
    }

    public boolean onStart(String... strings) {
        System.out.println("Starting Test");
        return true;
    }

    protected int loop() {
        if (this.getAPIContext().inventory().isFull()) {
            this.bank();
            return 200;
        } else {
            this.chop();
            return 100;
        }
    }
}
Edited by TheKevin
  • Like 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...