Add hover functionality
This commit is contained in:
parent
aaee43be4c
commit
25844dad61
@ -2,11 +2,15 @@ package io.reisub.dreambot.csmelter.tasks;
|
||||
|
||||
import io.reisub.dreambot.csmelter.CSmelter;
|
||||
import io.reisub.dreambot.csmelter.Ingredient;
|
||||
import io.reisub.dreambot.util.Util;
|
||||
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.container.impl.bank.Bank;
|
||||
import org.dreambot.api.methods.widget.Widgets;
|
||||
import org.dreambot.api.script.TaskNode;
|
||||
import org.dreambot.api.wrappers.items.Item;
|
||||
import org.dreambot.api.wrappers.widgets.WidgetChild;
|
||||
|
||||
public class DoBank extends TaskNode {
|
||||
@Override
|
||||
@ -17,6 +21,18 @@ public class DoBank extends TaskNode {
|
||||
@Override
|
||||
public int execute() {
|
||||
if (Inventory.contains(CSmelter.smeltingOption.getEndProduct())) {
|
||||
if (Util.getHoverEntry("deposit") == null) {
|
||||
if (Inventory.contains(item -> item.getName().endsWith("mould"))) {
|
||||
Item item = Inventory.get(CSmelter.smeltingOption.getEndProduct());
|
||||
Util.addHoverEntry("deposit", item.getDestination().getBoundingBox());
|
||||
} else {
|
||||
WidgetChild depositAll = Widgets.getChildWidget(12, 42);
|
||||
if (depositAll != null && depositAll.isVisible()) {
|
||||
Util.addHoverEntry("deposit", depositAll.getRectangle());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Bank.depositAllExcept(item -> item.getName().endsWith("mould"));
|
||||
if (!MethodProvider.sleepUntil(() -> Inventory.isEmpty() || Inventory.onlyContains(item -> item.getName().endsWith("mould")), Calculations.random(2000, 2500))) return Calculations.random(250, 400);
|
||||
}
|
||||
@ -46,6 +62,8 @@ public class DoBank extends TaskNode {
|
||||
}
|
||||
}
|
||||
|
||||
Util.hover("minimapToFurnace");
|
||||
|
||||
MethodProvider.sleepUntil(() -> Inventory.containsAll(names), Calculations.random(2000, 2500));
|
||||
|
||||
return Calculations.random(250, 400);
|
||||
|
@ -32,9 +32,12 @@ public class OpenBank extends TaskNode {
|
||||
}
|
||||
}
|
||||
|
||||
Util.addHoverEntry("bank", bank);
|
||||
|
||||
bank.interactForceLeft("Bank");
|
||||
if (!Util.sleepUntilMoving()) return Calculations.random(250, 400);
|
||||
|
||||
Util.hover("deposit");
|
||||
MethodProvider.sleepUntil(Bank::isOpen, Calculations.random(10000, 11000));
|
||||
|
||||
return Calculations.random(250, 400);
|
||||
|
@ -21,7 +21,7 @@ public class Smelt extends TaskNode {
|
||||
@Override
|
||||
public boolean accept() {
|
||||
return Inventory.containsAll(CSmelter.smeltingOption.getIngredientsNames())
|
||||
&& Util.playerIsIdle(1000);
|
||||
&& Util.playerIsIdle(1400);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -30,6 +30,7 @@ public class Smelt extends TaskNode {
|
||||
if (furnace == null) return Calculations.random(250, 400);
|
||||
|
||||
if (Bank.isOpen()) {
|
||||
Util.addHoverEntry("minimapToFurnace", furnace.getTile(), true);
|
||||
Walking.walk(furnace);
|
||||
MethodProvider.sleep(300, 600);
|
||||
}
|
||||
@ -39,6 +40,7 @@ public class Smelt extends TaskNode {
|
||||
if (!Util.sleepUntilMoving()) return Calculations.random(250, 400);
|
||||
}
|
||||
|
||||
Util.hover("smeltWidget");
|
||||
MethodProvider.sleepWhile(() -> furnace.distance() > Calculations.random(2, 4), Calculations.random(10000, 11000));
|
||||
|
||||
if (CSmelter.smeltingOption.getMould().equals("")) {
|
||||
@ -61,11 +63,14 @@ public class Smelt extends TaskNode {
|
||||
}, Calculations.random(3000, 3500))) return Calculations.random(250, 400);
|
||||
|
||||
WidgetChild w = Widgets.getChildWidget(446, CSmelter.smeltingOption.getHotkey());
|
||||
Util.addHoverEntry("smeltWidget", w.getRectangle());
|
||||
w.interact();
|
||||
|
||||
Util.sleepUntilAnimating();
|
||||
}
|
||||
|
||||
Util.hover("bank");
|
||||
|
||||
return Calculations.random(250, 400);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user