Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import org.dreambot.api.methods.Calculations;
- import org.dreambot.api.script.AbstractScript;
- import org.dreambot.api.script.Category;
- import org.dreambot.api.script.ScriptManifest;
- import org.dreambot.api.wrappers.interactive.GameObject;
- import sun.font.Script;
- import java.awt.geom.Area;
- @ScriptManifest(
- author = "8ishop",
- description = "Woodcutter",
- category = Category.WOODCUTTING,
- version = 0.01,
- name = "Woodcutter"
- )
- public class Main extends AbstractScript {
- private int state = -1;
- private Wood currentLog;
- private boolean drop = false;
- @Override
- public void onStart() {
- super.onStart();
- state = 0;
- currentLog = Wood.NORMAL;
- }
- @Override
- public int onLoop() {
- if (state == 0) {
- cut();
- }else if (state == 1) {
- bank();
- }else if (state == 2) {
- drop();
- }
- return Calculations.random(300, 400);
- }
- private void cut() {
- if (!getInventory().isFull()) {
- GameObject g0 = getGameObjects().closest(f -> f.getName().equals(currentLog.getTreeName()));
- if (getLocalPlayer().distance(g0) > 5) {
- getWalking().walk(g0);
- sleepUntil(() -> !getLocalPlayer().isMoving()
- || getLocalPlayer().distance(getClient().getDestination()) < 7, Calculations.random(4600, 5400));
- }else {
- if (g0.interact("Chop down")) {
- sleepUntil(() -> getInventory().contains("Logs"), Calculations.random(8000));
- }
- }
- }else {
- if (drop) {
- state = 2;
- }else {
- state = 1;
- }
- }
- }
- private void bank() {
- if (getBank().isOpen()) {
- getBank().depositAllExcept(f -> f.getName().contains("axe"));
- getBank().close();
- sleepUntil(() -> !getBank().isOpen(), Calculations.random(2000, 2800));
- state = 0;
- }else {
- if (getLocalPlayer().distance(getBank().getClosestBankLocation().getCenter()) > 5) {
- if (getWalking().walk(getBank().getClosestBankLocation().getCenter())) {
- sleepUntil(() -> !getLocalPlayer().isMoving()
- || getLocalPlayer().distance(getClient().getDestination()) < 8
- , Calculations.random(3500, 5000));
- }
- }else {
- getBank().open();
- sleepUntil(() -> getBank().isOpen(), Calculations.random(2000, 2800));
- }
- }
- }
- private void drop() {
- if (getInventory().contains(currentLog.getLogName())) {
- getInventory().dropAll(currentLog.getLogName());
- }else {
- state = 0;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement