Add pickup nest task

This commit is contained in:
Yuri Moens 2021-10-27 11:04:04 +02:00
parent f6d2593f8a
commit 76b25c5b04
Signed by: ymo
GPG Key ID: F6D51D6FE15BE924
2 changed files with 32 additions and 0 deletions

View File

@ -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(),

View File

@ -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);
}
}