Optimize bank opening

This commit is contained in:
Yuri Moens 2021-10-27 10:43:34 +02:00
parent 1122205220
commit 8623509eb4
Signed by: ymo
GPG Key ID: F6D51D6FE15BE924

View File

@ -5,8 +5,10 @@ import org.dreambot.api.methods.Calculations;
import org.dreambot.api.methods.MethodProvider; import org.dreambot.api.methods.MethodProvider;
import org.dreambot.api.methods.container.impl.Inventory; import org.dreambot.api.methods.container.impl.Inventory;
import org.dreambot.api.methods.container.impl.bank.Bank; import org.dreambot.api.methods.container.impl.bank.Bank;
import org.dreambot.api.methods.interactive.GameObjects;
import org.dreambot.api.methods.interactive.NPCs; import org.dreambot.api.methods.interactive.NPCs;
import org.dreambot.api.script.TaskNode; import org.dreambot.api.script.TaskNode;
import org.dreambot.api.wrappers.interactive.GameObject;
public class OpenBank extends TaskNode { public class OpenBank extends TaskNode {
@Override @Override
@ -18,7 +20,10 @@ public class OpenBank extends TaskNode {
@Override @Override
public int execute() { public int execute() {
Bank.openClosest(); GameObject bank = GameObjects.closest("Bank chest");
if (bank == null) return Calculations.random(250, 400);
bank.interactForceLeft("Use");
if (!Util.sleepUntilMoving()) return Calculations.random(250, 400); if (!Util.sleepUntilMoving()) return Calculations.random(250, 400);
MethodProvider.sleepUntil(Bank::isOpen, Calculations.random(4000, 4500)); MethodProvider.sleepUntil(Bank::isOpen, Calculations.random(4000, 4500));