I made simple script for making rings in Edgevile.
import com.epicbot.api.shared.APIContext;
import com.epicbot.api.shared.GameType;
import com.epicbot.api.shared.entity.LocatableEntity;
import com.epicbot.api.shared.entity.SceneObject;
import com.epicbot.api.shared.entity.WidgetChild;
import com.epicbot.api.shared.script.LoopScript;
import com.epicbot.api.shared.script.ScriptManifest;
import com.epicbot.api.shared.util.paint.frame.PaintFrame;
import com.epicbot.api.shared.util.time.SleepTimer;
import com.epicbot.api.shared.util.time.Time;
import javax.swing.*;
import java.awt.*;
import java.util.ArrayList;
import java.util.Arrays;
@ScriptManifest(name = "Gold coocker", gameType = GameType.OS)
public class GoldCoocker extends LoopScript {
int furnaceId = 16469;
int bankBoothId = 10355;
int goldBarId = 2357;
int goldRingId = 1635;
private int stallCount;
private long startTime;
private Jewellery selectedItem;
@Override
protected int loop() {
APIContext ctx = getAPIContext();
if (!ctx.client().isLoggedIn()) {
return 600;
}
if (selectedItem == null) {
return 600;
}
if (!ctx.widgets().get(149, 0).isVisible()) {
ctx.widgets().get(164, 54).click();
return 200;
}
if (ctx.walking().getRunEnergy() > 40 && !ctx.walking().isRunEnabled()) {
ctx.walking().setRun(true);
return 200;
}
if (selectedItem.inventoryFull(ctx)) {
SceneObject furnace = ctx.objects().query().id(furnaceId).results().nearest();
if (ctx.calculations().distanceBetween(furnace, ctx.localPlayer().getLocation()) > 1) {
if (!ctx.localPlayer().isMoving()) {
ctx.walking().walkTo(furnace);
}
return 650;
}
if (ctx.localPlayer().getAnimation() == 899) {
stallCount = 0;
return 1000;
} else {
stallCount += 1;
}
if (stallCount > 5) {
stallCount = 0;
WidgetChild wgt = ctx.widgets().get(446, selectedItem.smeltId);
if (!wgt.isVisible()) {
furnace.interact("Smelt");
return 200 + Time.getHumanReaction();
}
wgt.click();
}
return 200;
} else {
LocatableEntity bank = ctx.objects().query().id(bankBoothId).results().nearest();
if (ctx.calculations().distanceBetween(bank, ctx.localPlayer().getLocation()) > 1) {
if (!ctx.localPlayer().isMoving()) {
ctx.walking().walkTo(bank);
}
return 650;
} else {
if (!ctx.bank().isOpen()) {
ctx.bank().open();
return Time.getHumanReaction() + 200;
}
this.selectedItem.depositItems(ctx);
this.selectedItem.withdrawItems(ctx);
if (ctx.bank().isOpen()) {
ctx.bank().close();
return Time.getHumanReaction() + 200;
}
}
}
return 0;
}
@Override
protected void onPaint(Graphics2D g, APIContext ctx) {
PaintFrame frame = new PaintFrame(getManifest().name());
frame.addLine("Runtime", Time.getFormattedRuntime(startTime));
frame.draw(g, 0, 170, ctx);
}
@Override
public boolean onStart(String... strings) {
stallCount = 0;
startTime = Time.getRuntime(0);
settingsView();
return true;
}
public void settingsView() {
JFrame frame = new JFrame();
JComboBox<Jewellery> box = new JComboBox<>(new Jewellery[]{
new Jewellery("Gold ring", 1635, 8, new Item[]{new Item(2357, 27)}),
new Jewellery("Sapphire ring", 1637, 9, new Item[]{new Item(2357, 13), new Item(1607, 13)}),
new Jewellery("Emerald ring", 1639, 10, new Item[]{new Item(2357, 13), new Item(1605, 13)}),
new Jewellery("Ruby ring", 1641, 11, new Item[]{new Item(2357, 13), new Item(1603, 13)}),
new Jewellery("Diamond ring", 1643, 12, new Item[]{new Item(2357, 13), new Item(1601, 13)}),
new Jewellery("Dragonstone ring", 1645, 13, new Item[]{new Item(2357, 13), new Item(1615, 13)}),
});
JButton btn = new JButton("Start");
btn.addActionListener(actionEvent -> {
selectedItem = (Jewellery) box.getSelectedItem();
frame.dispose();
startTime = Time.getRuntime(0);
});
box.setBounds(100, 50, 160, 40);
btn.setBounds(130, 100, 100, 40);
frame.add(box);
frame.add(btn);
frame.setSize(200, 270);
frame.setLayout(null);
frame.setVisible(true);
}
private class Jewellery {
int id, smeltId;
String name;
ArrayList<Item> combination;
public Jewellery(String name, int id, int smeltId, Item[] com) {
this.name = name;
this.id = id;
this.smeltId = smeltId;
this.combination = new ArrayList<>(Arrays.asList(com));
}
public void depositItems(APIContext ctx) {
if (ctx.inventory().getCount(id) > 0) {
ctx.bank().depositAll(id);
Time.sleep(new SleepTimer(100, 2000) {
@Override
public boolean isDone() {
return ctx.inventory().getCount(id) == 0;
}
});
}
}
public void withdrawItems(APIContext ctx) {
for (Item i : combination) {
if (i.amount == ctx.inventory().getCount(i.id)) {
continue;
}
int amountLeft = ctx.bank().getCount(i.id);
if (i.amount >= 27) {
ctx.bank().withdrawAll(i.id);
} else {
ctx.bank().withdraw(i.amount, i.id);
}
Time.sleep(new SleepTimer(100, 2000) {
@Override
public boolean isDone() {
return ctx.inventory().getCount(i.id) == i.amount || ctx.inventory().getCount(i.id) == amountLeft;
}
});
}
}
@Override
public String toString() {
return name;
}
public boolean inventoryFull(APIContext ctx) {
for (Item i : combination) {
if (ctx.inventory().getCount(i.id) <= 0) {
return false;
}
}
return true;
}
}
private class Item {
int id, amount;
public Item(int id, int amount) {
this.id = id;
this.amount = amount;
}
}
}
Any feedback are welcome :)