LeetyPoo Posted October 11 Share Posted October 11 Hello everyone. I am releasing all of the custom scripts that I've made. They are probably not super great but they worked for me just messing around. Might be able to find some useful stuff I suppose. I am a java game developer and just took these on for fun. I don't really play anymore though so I thought I'd release it all for everyone else to hopefully get some use out of. If you want a custom script feel free to message me. I don't mind helping out where I can. This is just a basic script for mining at the mining guild. import com.epicbot.api.shared.APIContext; import com.epicbot.api.shared.GameType; import com.epicbot.api.shared.entity.GameEntity; import com.epicbot.api.shared.entity.GroundItem; import com.epicbot.api.shared.entity.NPC; import com.epicbot.api.shared.entity.WidgetChild; import com.epicbot.api.shared.methods.IInventoryAPI; import com.epicbot.api.shared.model.Skill; 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.Random; import com.epicbot.api.shared.util.paint.frame.PaintFrame; import com.epicbot.api.shared.methods.*; import com.epicbot.api.shared.util.time.Time; import com.epicbot.api.shared.util.time.Timer; import java.awt.*; @ScriptManifest(name = "ELeetMiningGuild", gameType = GameType.OS) public class ELeetMiner extends LoopScript { @Override public boolean onStart(String... strings) { return true; } private final Timer runTimer = new Timer(0); private int oresDropped = 0; private String status = "Starting"; private boolean scriptBanksOres = true; private int oreIndex = 0; private int profitGenerated = 0; private double experienceGained, startExperience = 0; private Skill.Skills trainedSkill = Skill.Skills.MINING; private double xpPerMine = 50.0; private int oresInBank = 0; private Tile mineArea = new Tile(3146,3150); private Tile bankArea = new Tile(3092,3245); private Tile intermediateArea = new Tile(3171,3408); private String[] oreType = {"Mithril ore", "Coal"}; private String[] rockType = {"Mithril rocks", "Coal rocks"}; public IInventoryAPI inventory() { return getAPIContext().inventory(); } public IMouseAPI mouse() { return getAPIContext().mouse(); } public ILocalPlayerAPI player() { return getAPIContext().localPlayer(); } public IGroundItemsAPI groundItems() { return getAPIContext().groundItems(); } public IObjectsAPI objects() { return getAPIContext().objects(); } public IBankAPI bank() { return getAPIContext().bank(); } public IWidgetsAPI widgets() { return getAPIContext().widgets(); } public IWalkingAPI walking() { return getAPIContext().walking(); } public IWebWalkingAPI webWalking() { return getAPIContext().webWalking(); } public ICameraAPI camera() { return getAPIContext().camera(); } public ISkillsAPI skills() { return getAPIContext().skills(); } @Override protected int loop() { if(!player().isAnimating()) { handleCalculations(); /*handleRandomEvent();*/ if (inventory().isFull()) { if (!scriptBanksOres) { dropOres(); dropGems(); } else { /*if(player().getY() < 3406) { walkToIntermediate(); }*/ walkToBank(); /*setCameraForBanking();*/ bankOres(); rotateCamera(); } } while(groundContainsOres() && !inventory().isFull()) { pickupOres(); } if(!inventory().contains(oreType[0]) && !inventory().contains(oreType[1])) { walkToMineArea(); } clickOre(); moveMouseRandomly(); rotateCamera(); Time.sleep(getSleepTime()); } return 3; } private void handleCalculations() { if (startExperience == 0) { startExperience = skills().get(trainedSkill).getExperience(); } else { experienceGained = skills().get(trainedSkill).getExperience() - startExperience; } } public static int getSleepTime() { int sleepMin = 1500; int sleepMax = 3000; return Random.nextInt(sleepMin, sleepMax); } public static int getShortSleepTime() { int sleepMin = 750; int sleepMax = 1683; return Random.nextInt(sleepMin, sleepMax); } public static int getAmountToTurnCamera() { return Random.nextInt(-100, 100); } public void dropOres() { status = "Dropping Ores"; for(int i = 0; i < oreType.length; i++) { int amount = inventory().getCount(oreType); oresDropped += amount; inventory().dropAll(oreType); } } public void pickupOres() { status = "Picking up ores"; rotateCamera(); for(int i = 0; i < oreType.length; i++) { GroundItem arrow = groundItems().query().named(oreType[i]).distance(2.0).reachable().results().nearest(); if(arrow != null) { arrow.interact("Take"); } } GroundItem uncut = groundItems().query().nameContains("Uncut").distance(2.0).reachable().results().nearest(); if(uncut != null) { uncut.interact("Take"); } } public void dropGems() { status = "Dropping Ores"; inventory().dropAll("Uncut sapphire"); inventory().dropAll("Uncut ruby"); inventory().dropAll("Uncut emerald"); inventory().dropAll("Uncut opal"); inventory().dropAll("Uncut jade"); inventory().dropAll("Uncut diamond"); } public void clickOre() { status = "Mining Ores"; if(player().isInCombat()) { return; } GameEntity mithrilRock = objects().query().named(rockType[0]).distance(10.0).results().nearest(); if(mithrilRock != null) { mithrilRock.interact("Mine"); rotateCamera(); Time.sleep(getShortSleepTime()); return; } GameEntity coal = objects().query().named(rockType[1]).distance(10.0).results().nearest(); if(coal != null) { coal.interact("Mine"); rotateCamera(); Time.sleep(getShortSleepTime()); return; } } public boolean groundContainsOres() { for(int i = 0; i < rockType.length; i++) { GroundItem ore = groundItems().query().named(oreType[i]).distance(2.0).results().nearest(); if(ore != null) { return true; } } return false; } public void walkToIntermediate() { status = "Walking to intermediary location"; webWalking().walkTo(getIntermediateTile()); if(!walking().isRunEnabled() && walking().getRunEnergy() > 50) { walking().setRun(true); } } public void walkToBank() { status = "Walking to bank"; webWalking().walkTo(getBankTile()); if(!walking().isRunEnabled() && walking().getRunEnergy() > 50) { walking().setRun(true); } Time.sleep(getShortSleepTime()); } public Tile getIntermediateTile() { int x = intermediateArea.getX(); int y = intermediateArea.getY(); int randomness = 2; int randomX = Random.nextInt(x - randomness, x + randomness); int randomY = Random.nextInt(y - randomness, y + randomness); return new Tile(randomX, randomY); } public Tile getBankTile() { int x = bankArea.getX(); int y = bankArea.getY(); int randomness = 0; int randomX = Random.nextInt(x - randomness, x + randomness); int randomY = Random.nextInt(y - randomness, y + randomness); return new Tile(x, y); } public Tile getMineTile() { int x = mineArea.getX(); int y = mineArea.getY(); int randomness = 0; int randomX = Random.nextInt(x - randomness, x + randomness); int randomY = Random.nextInt(y - randomness, y + randomness); return new Tile(x, y); } public void rotateCamera() { if(Random.nextInt(1, 5) != 1) { return; } Time.sleep(getShortSleepTime()); int currentYaw = camera().getYaw(); camera().setYaw(currentYaw + getAmountToTurnCamera()); } public void bankOres() { status = "Banking Ores"; int amount = 0; for(int i = 0; i < oreType.length; i++) { amount = inventory().getCount(oreType[i]); } GameEntity bank = objects().query().named("Bank booth").distance(5.0).results().nearest(); bank.interact("Bank"); while(!bank().isOpen()) { Time.sleep(); } clickBankAll(); oresDropped += amount; profitGenerated = oresDropped * 100; for(int i = 0; i < oreType.length; i++) { oresInBank = bank().getCount(oreType[i]); } } public void clickBankAll() { status = "Clicking Bank all"; bank().open(); Time.sleep(getShortSleepTime()); WidgetChild bankAllButton = widgets().get(12).getChild(42); mouse().click(bankAllButton); } public void walkToMineArea() { status = "Walking to Mine Area"; webWalking().walkTo(getMineTile()); if(!walking().isRunEnabled() && walking().getRunEnergy() > 50) { walking().setRun(true); } Time.sleep(getShortSleepTime()); } public void moveMouseRandomly() { if(Random.nextInt(1, 10) > 2) { mouse().moveRandomly(); } } private String rsFormat(Integer number) { String[] suffix = new String[]{"K", "M", "B", "T"}; int size = (number != 0) ? (int) Math.log10(number) : 0; if (size >= 3) { while (size % 3 != 0) { size = size - 1; } } return (size >= 3) ? +(Math.round((number / Math.pow(10, size)) * 10) / 10d) + suffix[(size / 3) - 1] : +number + ""; } private int getHourlyRate(int i) { return (int) (i / (runTimer.getElapsed() / 3600000.0D)); } @Override protected void onPaint(Graphics2D g, APIContext ctx) { PaintFrame frame = new PaintFrame("ELeetMiningGuild"); frame.addLine("[Time running]:", runTimer.toElapsedString()); frame.addLine("[Status]:", status); frame.addLine("[Ore Focus]:", oreType[oreIndex]); frame.addLine("", ""); frame.addLine("[Xp Gained]:", experienceGained); frame.addLine("[Xp Per Hour]:", rsFormat(getHourlyRate((int)experienceGained))); frame.addLine("",""); frame.addLine("[Ores Mined]:", (int)(experienceGained / xpPerMine)); frame.addLine("[Ores Per Hour]:", rsFormat(getHourlyRate((int)(experienceGained / xpPerMine)))); frame.addLine("",""); frame.addLine("[Ores In Bank]:", oresInBank); frame.addLine("[Profit Generated]:", profitGenerated); frame.addLine("[Total Ore Evaluation]:", (oresInBank * 175) + "gp"); frame.draw(g, 0, 155, ctx); } } Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.