ishyfishy 5 Share Posted July 16, 2015 https://www.youtube.com/watch?v=Hauj89skiZ0 import org.dreambot.api.methods.Calculations; import org.dreambot.api.methods.container.impl.bank.BankLocation; import org.dreambot.api.methods.map.Area; import org.dreambot.api.methods.map.Tile; import org.dreambot.api.script.AbstractScript; import org.dreambot.api.script.Category; import org.dreambot.api.script.ScriptManifest; import org.dreambot.api.utilities.impl.Condition; import org.dreambot.api.wrappers.interactive.GameObject; import org.dreambot.api.utilities.Timer; import org.dreambot.api.wrappers.widgets.message.Message; import javax.imageio.ImageIO; import java.awt.Graphics2D; import java.awt.*; import java.io.File; import java.io.IOException; import java.util.*; /** * Created by Ishaan on 7/14/2015. */ @ScriptManifest(category = Category.MINING, name = "varrock clay miner", author = "ishyfishy", version = 1.5) public class clayMiner extends AbstractScript { private final Tile CLAYTILE = new Tile(3180,3371,0); private final Area BANKAREA = new Area(3180,3441,3185,3433,0); private final Area SAFEAREA = new Area(3173,3382,3178,3377,0); private Timer myTimer = new Timer(); private int clayKnt = 0; private Image guiImg; private String status = ""; private enum State{ MINE, BANK, WALKTOBANK, WALKTOMINE, WAIT } private State getState(){ if(getInventory().isFull()){ if(BANKAREA.contains(getLocalPlayer())){ return State.BANK; } else { return State.WALKTOBANK; } } else { if (getLocalPlayer().getTile().distance(CLAYTILE) == 0) { if (getGameObjects().closest(13456) != null || getGameObjects().closest(13458) != null) { return State.MINE; } else { return State.WAIT; } } else { return State.WALKTOMINE; } } } @Override public int onLoop(){ if(getLocalPlayer().isMoving()){ if(getClient().getDestination().distance() > 5){ sleepUntil(new Condition() { @Override public boolean verify() { return getClient().getDestination().distance() < 5; } }, Calculations.random(500,732)); } } if(getLocalPlayer().getHealth() < 4){ getWalking().walk(BANKAREA.getRandomTile()); sleepUntil(new Condition() { @Override public boolean verify() { return BANKAREA.contains(getLocalPlayer()); } }, Calculations.random(15000,30000)); sleep(500000); } if(getLocalPlayer().isInCombat()){ log("Player in accidental combat, moving to safety..."); status = "Player in accidental combat, moving to safety..."; getWalking().walk(SAFEAREA.getRandomTile()); sleepUntil(new Condition() { @Override public boolean verify() { return SAFEAREA.contains(getLocalPlayer()); } }, Calculations.random(4000, 8000)); } if(getLocalPlayer().isAnimating()){ log("Suppressing unnecessary clicks..."); return Calculations.random(150,200); } Random srand = new Random(); double chances = srand.nextDouble(); if(chances < 0.096){ log("Antiban; changing camera angle..."); status = "Antiban; changing camera angle..."; getCamera().rotateToEvent(srand.nextInt()+360,srand.nextInt()+90); } else { } switch(getState()){ case MINE: GameObject clay = getGameObjects().closest(13456); GameObject clay2 = getGameObjects().closest(13458); int temp = (Math.random() <= 0.5) ? 1 : 2; switch(temp){ case 1: if(clay!=null){ log("Mining rock one..."); status = "Mining rock..."; clay.interact("Mine"); sleepWhile(new Condition() { @Override public boolean verify() { return clay.exists(); } }, Calculations.random(600,1200)); } break; case 2: if (clay2!=null){ log("Mining rock two..."); status = "Mining rock..."; clay2.interact("Mine"); sleepWhile(new Condition() { @Override public boolean verify() { return clay2.exists(); } }, Calculations.random(600,1200)); } break; } break; case WAIT: log("Waiting for new rocks..."); status = "Waiting for new rocks..."; sleepUntil(new Condition() { @Override public boolean verify() { GameObject clay = getGameObjects().closest(13456); GameObject clay2 = getGameObjects().closest(13458); return (clay != null || clay2 != null); } }, Calculations.random(100, 200)); break; case BANK: log("Banking the clay..."); status = "Banking the clay..."; if (getBank().isOpen()) { if(getInventory().contains("Bronze pickaxe") || getInventory().contains("Iron pickaxe") || getInventory().contains("Steel pickaxe") || getInventory().contains("Black pickaxe") || getInventory().contains("Mithril pickaxe") || getInventory().contains("Adamant pickaxe") || getInventory().contains("Rune pickaxe") || getInventory().contains("Dragon pickaxe")){ getBank().depositAll("Clay"); } else { getBank().depositAllItems(); } sleepUntil(() -> getInventory().isEmpty(), Calculations.random(800, 1250)); } else { getBank().open(); sleepUntil(() -> getBank().isOpen(), Calculations.random(500, 1250)); } log("Banked."); break; case WALKTOBANK: log("Inventory is full, walking to bank..."); status = "Inventory is full, walking to bank..."; getWalking().walk(BankLocation.VARROCK_WEST.getCenter()); break; case WALKTOMINE: log("Walking to the clay mine..."); status = "Walking to the clay mine..."; getWalking().walk(CLAYTILE); break; } return Calculations.random(200,400); } public void onExit(){ log("Thanks for using script."); } public void onPaint(Graphics g){ try{ guiImg = ImageIO.read(new File(".../gui.png")); } catch (IOException e){ e.printStackTrace(); } g.drawImage(guiImg, 5, 345, 490,113,null); g.setColor(Color.BLACK); g.drawLine(5,345,495,345); g.drawLine(5,458,495,458); g.drawLine(5,345,5,455); g.drawLine(495, 345, 495, 455); g.drawString("Run time: " + myTimer.formatTime(), 5, 420); g.drawString("Status: " + status, 5, 435); g.drawString("Logs chopped: " + clayKnt, 5, 450); } public void onMessage(Message m){ if(m.getMessage().contains("You manage to mine some clay.")){ clayKnt++; } } } Link to comment Share on other sites More sharing options...
yungbankchop 3 Share Posted July 16, 2015 if it was anywhere near as crowded as it was for your last clay you banked it wouldnt even be worth it lol. gotta hate it when there are like 5 other people at your spot doing the same thing on all worlds :/ Link to comment Share on other sites More sharing options...
ishyfishy 5 Author Share Posted July 16, 2015 if it was anywhere near as crowded as it was for your last clay you banked it wouldnt even be worth it lol. gotta hate it when there are like 5 other people at your spot doing the same thing on all worlds :/ Yeah LOL plus I was on a noob account with low mining as well... Noobs compete for clay. Link to comment Share on other sites More sharing options...
LovelyLady 13 Share Posted July 17, 2015 if it was anywhere near as crowded as it was for your last clay you banked it wouldnt even be worth it lol. gotta hate it when there are like 5 other people at your spot doing the same thing on all worlds :/ Members worlds are completely empty lol. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.