Add pickup nest task
This commit is contained in:
parent
f6d2593f8a
commit
76b25c5b04
@ -20,6 +20,7 @@ public class CPlanker extends CTaskScript {
|
|||||||
getUI().setCustomLines(1);
|
getUI().setCustomLines(1);
|
||||||
|
|
||||||
addNodes(
|
addNodes(
|
||||||
|
new PickupNest(),
|
||||||
new Chop(),
|
new Chop(),
|
||||||
new BuyPlanks(),
|
new BuyPlanks(),
|
||||||
new Teleport(),
|
new Teleport(),
|
||||||
|
@ -0,0 +1,31 @@
|
|||||||
|
package io.reisub.dreambot.cplanker.tasks;
|
||||||
|
|
||||||
|
import org.dreambot.api.methods.Calculations;
|
||||||
|
import org.dreambot.api.methods.MethodProvider;
|
||||||
|
import org.dreambot.api.methods.container.impl.Inventory;
|
||||||
|
import org.dreambot.api.methods.filter.Filter;
|
||||||
|
import org.dreambot.api.methods.item.GroundItems;
|
||||||
|
import org.dreambot.api.script.TaskNode;
|
||||||
|
import org.dreambot.api.wrappers.items.GroundItem;
|
||||||
|
|
||||||
|
public class PickupNest extends TaskNode {
|
||||||
|
@Override
|
||||||
|
public boolean accept() {
|
||||||
|
GroundItem nest = GroundItems.closest(groundItem -> groundItem.getName().contains("nest"));
|
||||||
|
return nest != null
|
||||||
|
&& !Inventory.isFull();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int execute() {
|
||||||
|
int count = Inventory.fullSlotCount();
|
||||||
|
|
||||||
|
GroundItem nest = GroundItems.closest(groundItem -> groundItem.getName().contains("nest"));
|
||||||
|
if (nest == null) return Calculations.random(250, 400);
|
||||||
|
|
||||||
|
nest.interact();
|
||||||
|
MethodProvider.sleepUntil(() -> Inventory.fullSlotCount() > count, Calculations.random(4000, 4500));
|
||||||
|
|
||||||
|
return Calculations.random(250, 400);
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user