Advertisement
JeremyFTW

BIGMiner

Aug 22nd, 2019
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.52 KB | None | 0 0
  1. package BIGMining;
  2.  
  3. import org.dreambot.api.methods.Calculations;
  4. import org.dreambot.api.methods.map.Area;
  5. import org.dreambot.api.script.AbstractScript;
  6. import org.dreambot.api.script.ScriptManifest;
  7. import org.dreambot.api.wrappers.interactive.GameObject;
  8. import org.dreambot.api.wrappers.interactive.NPC;
  9. import org.dreambot.api.script.Category;
  10.  
  11. @ScriptManifest(author = "JeremyFTW", name = "BIGMiner 1.1", version = 1.1, description = "Advanced Miner", category = Category.MINING)
  12. public class main extends AbstractScript {
  13.  
  14.     Area bankArea = new Area(3207, 3220, 3210, 3221, 2);
  15.     Area oreArea = new Area(3232, 3152, 3220, 3142);
  16.  
  17.     private void idle() {
  18.         sleep(250);
  19.     }
  20.  
  21.     public void onStart() {
  22.         log("Starting...");
  23.         log("Welcome to BIGMiner, Version: 1.0");
  24.         log("This Script is in early developement.");
  25.         log("Please post any issues or questions on the forms!");
  26.         log("This is a FREE version");
  27.     }
  28.  
  29.     public void onExit() {
  30.         log("Thank you for using my bots!");
  31.         log("Exiting...");
  32.     }
  33.  
  34.     @Override
  35.     public int onLoop() {
  36. // mining ore
  37.         if (getLocalPlayer().isAnimating()) {
  38.             idle();
  39.         } else if (!getInventory().isFull()) {
  40.             if (oreArea.contains(getLocalPlayer())) {
  41.                 mineOre(11161); // change "Tree" to the name of your tree.
  42.                 log("Mining Ore");
  43.             } else {
  44.                 if (getWalking().walk(oreArea.getRandomTile())) {
  45.                     log("walking to oreArea");
  46.                     sleep(Calculations.random(3000, 5500));
  47.                 }
  48.             }
  49.         }
  50. //banking
  51.         if (getInventory().isFull()) { // it is time to bank
  52.             if (bankArea.contains(getLocalPlayer())) {
  53.                 bank();
  54.             } else {
  55.                 if (getWalking().walk(bankArea.getRandomTile())) {
  56.                     sleep(Calculations.random(3000, 6000));
  57.                 }
  58.             }
  59.         }
  60.         return 0;
  61.     }
  62.  
  63. //mining ore function
  64.     public void mineOre(int nameOfOre) {
  65.         GameObject rocks = getGameObjects()
  66.                 .closest(gameObject -> gameObject != null && gameObject.getID() == nameOfOre);
  67.         if (rocks != null) {
  68.             rocks.interact("Mine");
  69.             sleepUntil(() -> getLocalPlayer().isAnimating(), 5000);
  70.         }
  71.     }
  72.  
  73. //banking function
  74.     public void bank() {
  75.         NPC banker = getNpcs().closest(npc -> npc != null && npc.hasAction("Bank"));
  76.         if (banker != null && banker.interact("Bank")) {
  77.             if (sleepUntil(() -> getBank().isOpen(), 9000)) {
  78.                 if (getBank().depositAllExcept(item -> item != null && item.getName().contains("Pickaxe"))) {
  79.                     if (sleepUntil(() -> !getInventory().isFull(), 8000)) {
  80.                         if (getBank().close()) {
  81.                             sleepUntil(() -> !getBank().isOpen(), 8000);
  82.                         }
  83.                     }
  84.                 }
  85.             }
  86.         }
  87.     }
  88. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement