Advertisement
Leffen

Gold Ammy 2nd attempt

Aug 1st, 2019
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 3.56 KB | None | 0 0
  1. import org.dreambot.api.methods.container.impl.bank.BankLocation;
  2. import org.dreambot.api.methods.map.Tile;
  3. import org.dreambot.api.methods.skills.Skill;
  4. import org.dreambot.api.script.AbstractScript;
  5. import org.dreambot.api.script.Category;
  6. import org.dreambot.api.script.ScriptManifest;
  7. import org.dreambot.api.wrappers.interactive.GameObject;
  8. import org.dreambot.api.wrappers.widgets.WidgetChild;
  9.  
  10. import java.awt.event.KeyEvent;
  11.  
  12.  
  13. @ScriptManifest(
  14.         author = "ZeddyBoi",
  15.         description = "Crafting",
  16.         category = Category.CRAFTING,
  17.         version = 0.1,
  18.         name = "Gold Ammy Crafter 0.2"
  19. )
  20. public class Main extends AbstractScript {
  21.  
  22.     public static int AMULET_MOULD = 1595;
  23.     public static int GOLD_BAR = 2357;
  24.  
  25.     private static final Tile FURNACE_TILE = new Tile(3109,3499);
  26.     @Override
  27.     public int onLoop() {
  28.         //Check if gold bar is in inventory
  29.         if (getInventory().contains(GOLD_BAR)){
  30.  
  31.             // Checks if the player is greater than 7 tiles away from the bank then makes them walk to the furnace if the inv has gold bars and is away from furnace
  32.             if (FURNACE_TILE.distance() >7 ){
  33.                 getWalking().walk(FURNACE_TILE);
  34.                 sleep(4000);
  35.                 //Looks for the closest furnace and clicks on it in order to see the interface
  36.                 GameObject Furnace = getGameObjects().closest("Furnace");
  37.                 if (Furnace != null){
  38.                     Furnace.interact("Smelt");
  39.  
  40.                 }
  41.  
  42.                 //Makes sure there is not an item selected and this will deselect, dont really need as no longer need to as you just click the furnace now adays
  43.             } else if (getInventory().isItemSelected()){
  44.                 getInventory().deselect();
  45.  
  46.             //finds out which part of the interface is the gold ammys
  47.             }else {
  48.                 WidgetChild makeAllWidg = getWidgets().getWidgetChild(446,34);
  49.                 if (makeAllWidg != null && makeAllWidg.isVisible()){
  50.                     if (makeAllWidg.interact()){
  51.                         getMouse().click();
  52.                         if (sleepUntil(getLocalPlayer()::isAnimating, 5000)){
  53.                             //Checks if user is either on a level up screen or if the user is currently crafting
  54.                             int startCraftLvl = getSkills().getRealLevel(Skill.CRAFTING);
  55.                             sleepUntil(()-> !getInventory().contains(GOLD_BAR)  || startCraftLvl != getSkills().getRealLevel(Skill.CRAFTING), 2*60*1000);
  56.                         }
  57.                     }
  58.                 }
  59.             }
  60.         //Check if bank interface is open
  61.         } else if (getBank().isOpen()){
  62.             //checks if inv is full and then deposits everything except mould
  63.             if (getInventory().isFull()){
  64.                 getBank().depositAllExcept(AMULET_MOULD);
  65.             //Checks if inv is empty but has mould and then will withdraw gold bars
  66.             } else if (getInventory().contains(AMULET_MOULD)){
  67.                 getBank().withdrawAll(GOLD_BAR);
  68.                 sleep(1000);
  69.                 // Uses ESC key to exit the interface as no actual player will use the x button in the top right
  70.                 getKeyboard().typeSpecialKey(KeyEvent.VK_ESCAPE);
  71.             // If for some reason you dont have an ammy mould in your inv then withdaw it
  72.             }else {
  73.                 getBank().withdraw(AMULET_MOULD);
  74.             }
  75.         } else {
  76.             getBank().openClosest();
  77.             sleep(4000);
  78.         }
  79.         return 1000;
  80.     }
  81. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement