Add CAshMiner, CPlanker and CThiever scripts

This commit is contained in:
2021-10-27 10:18:20 +02:00
parent 06333b3364
commit 1122205220
20 changed files with 541 additions and 0 deletions

View File

@ -0,0 +1,19 @@
package io.reisub.dreambot.cashminer;
import io.reisub.dreambot.cashminer.tasks.Drop;
import io.reisub.dreambot.cashminer.tasks.Mine;
import io.reisub.dreambot.util.CTaskScript;
import io.reisub.dreambot.util.Constants;
import org.dreambot.api.script.Category;
import org.dreambot.api.script.ScriptManifest;
@ScriptManifest(category = Category.MINING, name = "CAshMiner", author = Constants.AUTHOR, version = 1.0)
public class CAshMiner extends CTaskScript {
@Override
public void onStart() {
addNodes(
new Mine(),
new Drop()
);
}
}

View File

@ -0,0 +1,21 @@
package io.reisub.dreambot.cashminer.tasks;
import io.reisub.dreambot.util.CInventory;
import org.dreambot.api.methods.Calculations;
import org.dreambot.api.methods.container.impl.Inventory;
import org.dreambot.api.script.TaskNode;
public class Drop extends TaskNode {
@Override
public boolean accept() {
return Inventory.isFull();
}
@Override
public int execute() {
Inventory.setDropPattern(CInventory.verticalSnakeDropPattern);
Inventory.dropAll("Soda ash");
return Calculations.random(250, 400);
}
}

View File

@ -0,0 +1,53 @@
package io.reisub.dreambot.cashminer.tasks;
import io.reisub.dreambot.util.Constants;
import io.reisub.dreambot.util.Util;
import org.dreambot.api.methods.Calculations;
import org.dreambot.api.methods.container.impl.Inventory;
import org.dreambot.api.methods.filter.Filter;
import org.dreambot.api.methods.interactive.GameObjects;
import org.dreambot.api.methods.map.Area;
import org.dreambot.api.methods.map.Tile;
import org.dreambot.api.methods.walking.impl.Walking;
import org.dreambot.api.script.TaskNode;
import org.dreambot.api.wrappers.interactive.GameObject;
public class Mine extends TaskNode {
private final Area AREA = new Area(
new Tile(3787, 3767, 0),
new Tile(3787, 3775, 0),
new Tile(3803, 3775, 0),
new Tile(3802, 3765, 0));
@Override
public boolean accept() {
GameObject pile = GameObjects.closest(gameObject -> AREA.contains(gameObject) && gameObject.getName().equals("Ash pile"));
if (pile != null && pile.distance() < 3) {
return !Inventory.isFull()
&& Util.playerIsIdle(1200);
} else {
return !Inventory.isFull()
&& Util.playerIsIdle();
}
}
@Override
public int execute() {
GameObject pile = GameObjects.closest(gameObject -> AREA.contains(gameObject) && gameObject.getName().equals("Ash pile"));
if (pile == null) return Calculations.random(250, 400);
if (!pile.isOnScreen()) {
if (Walking.shouldWalk(Calculations.random(4, 6))) {
Walking.walk(pile);
}
Util.sleepUntilMoving();
return Calculations.random(250, 400);
}
pile.interactForceLeft(Constants.MINE);
Util.sleepUntilMovingAndAnimating();
return Calculations.random(250, 400);
}
}