Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 02/19/2022 in all areas

  1. This bot will mine Tin & Copper in Rimmington then navigate to Falador smelter, create bronze bars, bank. Start script with empty inventory and desired pickaxe in equipment slot, only start the script in either Rimmington or Falador East Bank. import com.epicbot.api.shared.APIContext; import com.epicbot.api.shared.GameType; import com.epicbot.api.shared.entity.SceneObject; import com.epicbot.api.shared.entity.WidgetGroup; import com.epicbot.api.shared.model.Area; import com.epicbot.api.shared.model.Tile; 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.Time; import com.epicbot.api.shared.webwalking.model.RSBank; import javax.imageio.ImageIO; import java.awt.*; import java.awt.image.BufferedImage; import java.io.IOException; import java.net.HttpURLConnection; import java.net.URL; @ScriptManifest(name = "Private Miner & Smither", gameType = GameType.OS) public class main extends LoopScript { private Area BANK_AREA = new Area(new Tile(3008, 3359, 0), new Tile(3019, 3352, 0)); private Area TIN_AREA = new Area(new Tile(2983, 3238, 0), new Tile(2987, 3234, 0)); private Area COPPER_AREA = new Area(new Tile(2975, 3248, 0), new Tile(2980, 3244, 0)); private Area FURNACE_AREA = new Area(new Tile(2969, 3371, 0), new Tile(2978, 3367, 0)); private long startTime; private int counter = 0; @Override public boolean onStart(String... strings) { startTime = System.currentTimeMillis(); return true; } @Override protected int loop() { WidgetGroup LevelUpInterface = getAPIContext().widgets().get(233); if (LevelUpInterface.isVisible()) { levelup(); } else { if (getAPIContext().inventory().getCount("Uncut sapphire", "Uncut emerald", "Uncut ruby", "Uncut diamond", "Clue geode (beginner)") > 0) { drop(); } else if (getAPIContext().inventory().getCount("Bronze bar") == 14) { bank(); } else if (FURNACE_AREA.contains(getAPIContext().localPlayer().getLocation())) { smelt(); } else if (getAPIContext().inventory().getCount("Tin ore") == 14 && (getAPIContext().inventory().getCount("Copper ore") == 14)) { smelt(); } else if (getAPIContext().inventory().getCount("Tin ore") != 14) { mine_tin(); } else if (getAPIContext().inventory().getCount("Copper ore") != 14) { mine_copper(); } } return 100; } private boolean isActioning() { return getAPIContext().localPlayer().isAnimating() || getAPIContext().localPlayer().isMoving(); } private void bank() { if (!BANK_AREA.contains(getAPIContext().localPlayer().getLocation())) { getAPIContext().webWalking().walkTo(RSBank.FALADOR_EAST.getTile()); } else { if (BANK_AREA.contains(getAPIContext().localPlayer().getLocation())) { if (!getAPIContext().bank().isOpen()) { getAPIContext().bank().open(); Time.sleep(1_000, () -> getAPIContext().bank().isOpen()); }else if (getAPIContext().bank().isOpen()) { getAPIContext().bank().depositInventory(); counter = counter + 14; Time.sleep(1_000, () -> !getAPIContext().bank().isOpen()); } } } } private void mine_tin() { final SceneObject Rocks = getAPIContext().objects().query().id(11361, 11360).results().nearest(); if (!TIN_AREA.contains(getAPIContext().localPlayer().getLocation())) { getAPIContext().webWalking().walkTo(TIN_AREA.getCentralTile()); } else if (!isActioning()) { if (Rocks != null) { Rocks.interact("Mine"); Time.sleep(2_000, () -> getAPIContext().localPlayer().isAnimating()); } } } private void mine_copper() { final SceneObject Rocks = getAPIContext().objects().query().id(11161, 10943).results().nearest(); if (!COPPER_AREA.contains(getAPIContext().localPlayer().getLocation())) { getAPIContext().webWalking().walkTo(COPPER_AREA.getCentralTile()); } else if (!isActioning()) { if (Rocks != null) { Rocks.interact("Mine"); Time.sleep(2_000, () -> getAPIContext().localPlayer().isAnimating()); } } } private void smelt() { final SceneObject FURNACE = getAPIContext().objects().query().nameContains("Furnace").results().nearest(); WidgetGroup SmeltInterface = getAPIContext().widgets().get(270); if (!FURNACE_AREA.contains(getAPIContext().localPlayer().getLocation())) { getAPIContext().webWalking().walkTo(FURNACE_AREA.getCentralTile()); } else if (isActioning()) { Time.sleep(2_000, () -> !getAPIContext().localPlayer().isAnimating()); Time.sleep(2_000, () -> getAPIContext().localPlayer().isAnimating() && getAPIContext().inventory().getCount("Bronze bar") != 14); } else if (SmeltInterface.isVisible()) { getAPIContext().keyboard().sendKey(49); Time.sleep(2_000, () -> getAPIContext().localPlayer().isAnimating()); } else if (FURNACE != null) { FURNACE.interact("Smelt"); Time.sleep(1000,2000); } } private void levelup() { WidgetGroup LevelUpInterface = getAPIContext().widgets().get(233); Time.sleep(500, 1000); if (LevelUpInterface.isVisible()) { getAPIContext().keyboard().sendKey(32); } } private void drop() { if (getAPIContext().inventory().getCount("Uncut sapphire") > 0) { getAPIContext().inventory().dropAll("Uncut sapphire"); }else if (getAPIContext().inventory().getCount("Uncut emerald") > 0) { getAPIContext().inventory().dropAll("Uncut emerald"); }else if (getAPIContext().inventory().getCount("Uncut ruby") > 0) { getAPIContext().inventory().dropAll("Uncut ruby"); }else if (getAPIContext().inventory().getCount("Uncut diamond") > 0) { getAPIContext().inventory().dropAll("Uncut diamond"); }else if (getAPIContext().inventory().getCount("Clue geode (beginner)") > 0) { getAPIContext().inventory().dropAll("Clue geode (beginner)"); Time.sleep(500,1000); } } //define image to display on screen private BufferedImage image = downloadImage("https://i.imgur.com/6rfxOOp.jpg"); @Override protected void onPaint(Graphics2D g, APIContext ctx){ PaintFrame pf = new PaintFrame(); g.drawImage(image, 0, getAPIContext().game().getViewportHeight() - -5, null); pf.addLine("Private Miner/Smither",""); pf.addLine("",""); pf.addLine("Runtime: ", Time.getFormattedRuntime(startTime)); pf.addLine("",""); pf.addLine("Mining Level: ", getAPIContext().skills().mining().getCurrentLevel()); pf.addLine("",""); pf.addLine("Smithing Level: ", getAPIContext().skills().smithing().getCurrentLevel()); pf.addLine("",""); pf.addLine("Bronze Bars: ", counter); pf.addLine("",""); pf.addLine("",""); pf.addLine("",""); pf.addLine("",""); pf.draw(g, 195, 339, ctx); } //download the image to display on screen public BufferedImage downloadImage(String url) { try { HttpURLConnection conn; conn = (HttpURLConnection)(new URL(url.replaceAll(" ", "%20")).openConnection()); conn.setInstanceFollowRedirects(false); conn.setRequestProperty("User-Agent", "Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.2.8) Gecko/20100722 Firefox/3.6.8"); conn.setRequestProperty("Accept", "ttext/html,application/xhtml+xml,application/xml;q=0.9,/;q=0.8"); conn.setRequestProperty("Accept-Language", "en-us,en;q=0.5"); conn.setRequestProperty("Accept-Encoding", "gzip, deflate"); conn.setRequestProperty("Accept-Charset", "ISO-8859-1,utf-8;q=0.7,*;q=0.7"); conn.setRequestProperty("Keep-Alive", "300"); conn.setRequestProperty("Connection", "keep-alive"); conn.setRequestMethod("GET"); return ImageIO.read(conn.getInputStream()); } catch(IOException e1) { return null; } } }
    1 point
×
×
  • Create New...