Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.awt.Color;
- import java.awt.Graphics;
- import org.dreambot.api.methods.Calculations;
- import org.dreambot.api.methods.container.impl.bank.BankMode;
- import org.dreambot.api.methods.map.Area;
- import org.dreambot.api.methods.map.Tile;
- import org.dreambot.api.methods.skills.Skill;
- import org.dreambot.api.methods.tabs.Tab;
- import org.dreambot.api.methods.widget.Widget;
- import org.dreambot.api.script.AbstractScript;
- import org.dreambot.api.script.Category;
- import org.dreambot.api.script.ScriptManifest;
- import org.dreambot.api.utilities.Timer;
- import org.dreambot.api.wrappers.interactive.Entity;
- import org.dreambot.api.wrappers.interactive.NPC;
- import org.dreambot.api.wrappers.widgets.WidgetChild;
- @ScriptManifest(author = "Banker & TheMcPker", category = Category.MONEYMAKING, name = "HideTanner", version = 2.0)
- public class main extends AbstractScript {
- public boolean toGe = false;
- public boolean teleported = false;
- Pricer price;
- public int tanned = 0;
- Area tannerArea = new Area(3277, 3189, 3270, 3193);
- Area walkhere = new Area();
- Area tanWalk = new Area(new Tile(3274, 3191), new Tile(3274, 3193), new Tile(3277, 3193), new Tile(3276, 3190));
- Area alBank = new Area(3269, 3169, 3270, 3164);
- public Area GE = new Area(3172, 3494, 3157, 3481);
- Area varrock = new Area(new Tile(3206, 3433), new Tile(3209, 3420), new Tile(3216, 3424), new Tile(3221, 3428), new Tile(3216, 3435));
- public int pricehide = 1830;
- public int priceleather = 1885;
- public int hidesbuy;
- public String ring;
- public String trip = "";
- public String item = "Green dragonhide";
- public String Stamina;
- public int trips = 0;
- Timer t;
- Timer t2;
- public void onStart() {
- t = new Timer();
- t2 = new Timer();
- }
- public enum State {
- TANNING, BANKING, GO_TO_GE, GRAND_EXCHANGE, WAITING
- }
- public State getState() {
- if(getInventory().contains(1753) && getInventory().contains("Coins")) {
- return State.TANNING;
- }
- else if(toGe) {
- return State.GO_TO_GE;
- } else if(GE.contains(getLocalPlayer())) {
- return State.GRAND_EXCHANGE;
- }
- else if(!getInventory().contains(1753) || !getInventory().contains("Coins")) {
- return State.BANKING;
- }
- return State.WAITING;
- }
- @Override
- public int onLoop() {
- antiban();
- switch(getState()) {
- case TANNING:
- tanning();
- break;
- case BANKING:
- banking(alBank, "Green dragonhide");
- break;
- case GO_TO_GE:
- goToGE();
- break;
- case GRAND_EXCHANGE:
- geSupport();
- break;
- case WAITING:
- sleep(300);
- break;
- }
- return Calculations.random(250, 600);
- }
- public void goToGE() {
- if(!getInventory().contains("Varrock teleport") && !getInventory().contains("Green dragon leather") && alBank.contains(getLocalPlayer())) {
- getBank().openClosest();
- sleepUntil(() -> getBank().isOpen(), 10000);
- if(getBank().isOpen()) {
- getBank().withdrawAll("Coins");
- sleepUntil(() -> getInventory().contains("Coins"), 4600);
- getBank().withdraw("Varrock teleport");
- sleepUntil(() -> getInventory().contains("Varrock teleport"), 4500);
- getBank().setWithdrawMode(BankMode.NOTE);
- getBank().withdrawAll("Green dragon leather");
- sleepUntil(() -> getInventory().contains("Green dragon leather"), 4500);
- getBank().close();
- }
- } else {
- if(!teleported) {
- getInventory().interact("Varrock teleport", "Break");
- teleported = true;
- sleepUntil(() -> varrock.contains(getLocalPlayer()), 12000);
- }
- if(!GE.contains(getLocalPlayer())) {
- getWalking().walk(GE.getRandomTile());
- } else {
- geSupport();
- }
- }
- }
- public void tanning()
- {
- if(!tannerArea.contains(getLocalPlayer())) { getWalking().walk(tannerArea.getRandomTile()); sleep(2000, 4000);}
- else{
- NPC Tanner = getNpcs().closest("Ellis"); Tanner.interact("Trade");
- sleep(500, 1000);
- getWidgets().getWidget(324).getChild(112).interact("Tan ALL");
- sleep(500, 1000);
- tanned = tanned + getInventory().count("Green dragon leather");
- }
- }
- public void Calculate()
- {
- hidesbuy = (getInventory().count("Coins") / (pricehide + 50));
- }
- public void getRing()
- {
- if(getBank().contains("Ring of dueling(8)")) {ring = "Ring of dueling(8)";}
- else if(getBank().contains("Ring of dueling(7)")) {ring = "Ring of dueling(7)";}
- else if(getBank().contains("Ring of dueling(6)")) {ring = "Ring of dueling(6)";}
- else if(getBank().contains("Ring of dueling(5)")) {ring = "Ring of dueling(5)";}
- else if(getBank().contains("Ring of dueling(4)")) {ring = "Ring of dueling(4)";}
- else if(getBank().contains("Ring of dueling(3)")) {ring = "Ring of dueling(3)";}
- else if(getBank().contains("Ring of dueling(2)")) {ring = "Ring of dueling(2)";}
- else if(getBank().contains("Ring of dueling(1)")) {ring = "Ring of dueling(1)";}
- }
- public void geSupport()
- {
- priceleather = (int) (price.getAverageBuyOffer(1745)*0.9);
- pricehide = (int) (price.getAverageSellOffer(1753)*1.1);
- if(getGrandExchange().isOpen())
- {
- getGrandExchange().collect();
- sleep(500, 1000);
- if((getInventory().count("Coins") > 300000) && !getInventory().contains("Green dragon leather"))
- {
- sleep(780,1029);
- Calculate();
- sleepUntil(() -> getGrandExchange().openBuyScreen(getGrandExchange().getFirstOpenSlot()), 2000);
- sleepUntil(() -> getGrandExchange().buyItem("Green dragonhide", hidesbuy, pricehide), 3500);
- sleepUntil(() -> getGrandExchange().confirm(), 3000);
- sleepUntil(() -> getGrandExchange().collect(), 3000);
- sleep(500, 1000);
- if(getInventory().contains("Green dragonhide"));
- {
- sleepUntil(() -> getGrandExchange().close(), 3000);
- if(getBank().open())
- {
- getBank().depositAllItems();
- sleepUntil(() -> getInventory().isEmpty(), 4500);
- getRing();
- getRing();
- sleep(500, 1000);
- getBank().withdraw(ring);
- sleep(500, 1000);
- getBank().close();
- sleepUntil(() -> !getBank().isOpen(), 3500);
- getInventory().interact(ring, "Rub");
- sleepUntil(() -> getDialogues().inDialogue(), 4500);
- if(getDialogues().getOptions() != null)
- {
- getDialogues().chooseOption(1);
- sleep(2000, 3000);
- teleported = false;
- toGe = false;
- }
- }
- else
- {
- NPC Banker = getNpcs().closest("Banker");
- sleepUntil(() -> Banker.interact("Bank"), 2000);
- }
- }
- }
- else
- {
- sleepUntil(() -> getGrandExchange().collect(), 1500);
- if(getInventory().contains("Green dragon leather"));
- {
- sleepUntil(() -> getGrandExchange().openSellScreen(getGrandExchange().getFirstOpenSlot()), 2000);
- sleepUntil(() -> getGrandExchange().sellItem("Green dragon leather", getInventory().count("Green dragon leather"), priceleather), 7000);
- sleepUntil(() -> getGrandExchange().confirm(), 3000);
- sleep(1240,1950);
- getGrandExchange().collect();
- sleep(1232, 2341);
- getGrandExchange().close();
- sleep(3500,5000);
- }
- }
- }
- else
- {
- NPC exchange = getNpcs().closest("Grand Exchange Clerk");
- exchange.interact("Exchange");
- }
- }
- public void banking(Area bank, String item) {
- priceleather = (int) (price.getAverageBuyOffer(1745)*0.9);
- pricehide = (int) (price.getAverageSellOffer(1753)*1.1);
- getMouse().getMouseSettings().setWordsPerMinute(Calculations.random(150, 300));
- if(!bank.contains(getLocalPlayer())) {
- getWalking().walk(bank.getRandomTile());
- sleep(500, 1500);
- } else
- {
- if(!getBank().isOpen()) {
- NPC Banker = getNpcs().closest("Banker");
- Banker.interact("Bank");
- sleep(500, 1000);
- } else {
- if(!getBank().contains(item)) {
- toGe = true;
- }
- trips++;
- if(getBank().contains("Stamina potion(1)")) {Stamina = "Stamina potion(1)";}
- else if(getBank().contains("Stamina potion(2)")) {Stamina = "Stamina potion(2)";}
- else if(getBank().contains("Stamina potion(3)")) {Stamina = "Stamina potion(3)";}
- else if(getBank().contains("Stamina potion(4)")) {Stamina = "Stamina potion(4)";}
- else{log("Bot has ran out of Stamina potions");}
- getBank().depositAllExcept("Coins");
- sleep(500, 1000);
- if(getInventory().contains("Coins")) {
- if(trips == 4) {
- getBank().withdraw(Stamina);
- sleepUntil(() -> getInventory().contains(Stamina), 500);
- trips = 0;
- }
- if(!toGe) {
- sleepUntil(() -> getInventory().contains("Coins"), 5000);
- getBank().withdraw(item, Calculations.random(128, 7821));
- sleepUntil(() -> getInventory().contains(item), 4500);
- getBank().close();
- trip = t2.formatTime();
- t2.reset();
- sleepUntil(() -> !getBank().isOpen(), 4500);
- if(getInventory().contains(Stamina)) {
- getInventory().interact(Stamina, "Drink");
- sleep(450,750);
- }
- }
- if(trips == 0)
- {
- if(!getWalking().isRunEnabled()) {
- getWalking().toggleRun();
- }
- }
- }
- else
- {
- getBank().withdrawAll("Coins");
- sleep(300, 500);
- }
- }
- }
- }
- public void antiban()
- {
- int random = Calculations.random((int)1, (int)3000);
- if (random <= 2) {
- if (!this.getTabs().isOpen(Tab.STATS)) {
- this.getTabs().open(Tab.STATS);
- this.getSkills().hoverSkill(Skill.FISHING);
- sleep((int)Calculations.random((int)1000, (int)2000));
- this.getTabs().open(Tab.INVENTORY);
- }
- } else if (random <= 10) {
- if (!this.getTabs().isOpen(Tab.INVENTORY)) {
- this.getTabs().open(Tab.INVENTORY);
- }
- } else if (random <= 15) {
- this.getCamera().rotateToTile(this.alBank.getRandomTile());
- } else if (random <= 20) {
- this.getCamera().rotateToEntity((Entity)this.getLocalPlayer());
- } else if (random <= 50 && this.getMouse().isMouseInScreen() && this.getMouse().moveMouseOutsideScreen()) {
- sleep((int)Calculations.random((int)1500, (int)3000));
- }
- }
- public void onPaint(Graphics g) {
- g.setColor(Color.WHITE);
- g.drawString("State: "+getState(), 20, 40);
- g.drawString("Runtime: "+t.formatTime(), 20, 60);
- g.drawString("Leather Price: "+priceleather, 20, 80);
- g.drawString("Hide Price: "+pricehide, 20, 100);
- g.drawString("Est. Profit Per Hide: "+((pricehide-20)-priceleather), 20, 120);
- g.setColor(Color.CYAN);
- g.drawString("Last Trip Took: "+trip, 20, 140);
- g.drawString("Hides tanned: " + tanned + "Hr/" + t.getHourlyRate(tanned), 40, 160);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement