Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import org.dreambot.api.methods.container.impl.bank.BankLocation;
- import org.dreambot.api.methods.map.Tile;
- import org.dreambot.api.methods.skills.Skill;
- import org.dreambot.api.script.AbstractScript;
- import org.dreambot.api.script.Category;
- import org.dreambot.api.script.ScriptManifest;
- import org.dreambot.api.wrappers.interactive.GameObject;
- import org.dreambot.api.wrappers.widgets.WidgetChild;
- import java.awt.event.KeyEvent;
- @ScriptManifest(
- author = "ZeddyBoi",
- description = "Crafting",
- category = Category.CRAFTING,
- version = 0.1,
- name = "Gold Ammy Crafter 0.2"
- )
- public class Main extends AbstractScript {
- public static int AMULET_MOULD = 1595;
- public static int GOLD_BAR = 2357;
- private static final Tile FURNACE_TILE = new Tile(3109,3499);
- @Override
- public int onLoop() {
- //Check if gold bar is in inventory
- if (getInventory().contains(GOLD_BAR)){
- // 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
- if (FURNACE_TILE.distance() >7 ){
- getWalking().walk(FURNACE_TILE);
- sleep(4000);
- //Looks for the closest furnace and clicks on it in order to see the interface
- GameObject Furnace = getGameObjects().closest("Furnace");
- if (Furnace != null){
- Furnace.interact("Smelt");
- }
- //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
- } else if (getInventory().isItemSelected()){
- getInventory().deselect();
- //finds out which part of the interface is the gold ammys
- }else {
- WidgetChild makeAllWidg = getWidgets().getWidgetChild(446,34);
- if (makeAllWidg != null && makeAllWidg.isVisible()){
- if (makeAllWidg.interact()){
- getMouse().click();
- if (sleepUntil(getLocalPlayer()::isAnimating, 5000)){
- //Checks if user is either on a level up screen or if the user is currently crafting
- int startCraftLvl = getSkills().getRealLevel(Skill.CRAFTING);
- sleepUntil(()-> !getInventory().contains(GOLD_BAR) || startCraftLvl != getSkills().getRealLevel(Skill.CRAFTING), 2*60*1000);
- }
- }
- }
- }
- //Check if bank interface is open
- } else if (getBank().isOpen()){
- //checks if inv is full and then deposits everything except mould
- if (getInventory().isFull()){
- getBank().depositAllExcept(AMULET_MOULD);
- //Checks if inv is empty but has mould and then will withdraw gold bars
- } else if (getInventory().contains(AMULET_MOULD)){
- getBank().withdrawAll(GOLD_BAR);
- sleep(1000);
- // Uses ESC key to exit the interface as no actual player will use the x button in the top right
- getKeyboard().typeSpecialKey(KeyEvent.VK_ESCAPE);
- // If for some reason you dont have an ammy mould in your inv then withdaw it
- }else {
- getBank().withdraw(AMULET_MOULD);
- }
- } else {
- getBank().openClosest();
- sleep(4000);
- }
- return 1000;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement