Jump to content
Frequently Asked Questions
  • Are you not able to open the client? Try following our getting started guide
  • Still not working? Try downloading and running JarFix
  • Help! My bot doesn't do anything! Enable fresh start in client settings and restart the client
  • How to purchase with PayPal/OSRS/Crypto gold? You can purchase vouchers from other users
  • Used ChatGPT to write a rogues den safe cracker script.


    Aniwidgets

    Recommended Posts

    Im not sure how to add it to the bot, I also dont have the requirements to even test it. Looking at the code it looks like it might bank after getting just one gem in your inventory so will need some edits.

     

    import org.dreambot.api.methods.Calculations;
    import org.dreambot.api.methods.container.impl.bank.Bank;
    import org.dreambot.api.methods.container.impl.bank.BankLocation;
    import org.dreambot.api.methods.interactive.GameObjects;
    import org.dreambot.api.methods.interactive.NPCs;
    import org.dreambot.api.methods.map.Area;
    import org.dreambot.api.methods.map.Tile;
    import org.dreambot.api.methods.walking.path.impl.LocalPath;
    import org.dreambot.api.methods.walking.web.node.impl.bank.WebBank;
    import org.dreambot.api.methods.walking.web.node.impl.bank.WebBankNode;
    import org.dreambot.api.methods.walking.web.node.impl.bank.WebBankPath;
    import org.dreambot.api.methods.walking.web.node.impl.bank.WebBankUtils;
    import org.dreambot.api.methods.walking.web.path.impl.LocalWebPath;
    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.interactive.NPC;
    
    @ScriptManifest(category = Category.THIEVING, name = "Safe Cracker", author = "Your Name", version = 1.0)
    public class SafeCracker extends AbstractScript {
    
        private static final int[] GEMS = {1623, 1621, 1619, 1617}; // Uncut gems to bank
        private static final int LOCKPICK_ID = 1523; // Lockpick item id
    
        private static final Tile[] ROGUES_DEN_PATH = {new Tile(3049, 4969, 0), new Tile(3052, 4971, 0), new Tile(3056, 4971, 0), new Tile(3060, 4972, 0), new Tile(3064, 4973, 0), new Tile(3068, 4973, 0), new Tile(3072, 4973, 0), new Tile(3072, 4977, 0), new Tile(3071, 4981, 0), new Tile(3070, 4985, 0), new Tile(3070, 4989, 0), new Tile(3069, 4993, 0), new Tile(3070, 4997, 0), new Tile(3070, 5001, 0)};
        private static final Tile ROGUES_DEN_BANK_TILE = new Tile(3055, 4975, 0);
        private static final Area ROGUES_DEN_AREA = new Area(3044, 4974, 3070, 5001);
    
        private static final int CHEST_ID = 7236;
        private static final int SAFECRACKER_ID = 2240;
    
        private NPC safecracker;
        private GameObject safe;
    
        @Override
        public int onLoop() {
            if (!ROGUES_DEN_AREA.contains(getLocalPlayer())) {
                walkToRoguesDen();
            } else if (hasGems()) {
                bankGems();
            } else {
                crackSafe();
            }
            return Calculations.random(500, 1000);
        }
    
    private void walkToRoguesDen() {
            LocalWebPath path = WebBankPath.buildTo(ROGUES_DEN_TILE);
            if (path != null) {
                path.walk();
            } else {
                log("Unable to find path to Rogue's Den");
            }
        }
    
        private void crackSafe() {
            if (safecracker == null || !safecracker.exists()) {
                safecracker = NPCs.closest(SAFECRACKER_ID);
            }
            if (safe == null || !safe.exists()) {
                safe = GameObjects.closest(CHEST_ID);
            }
            if (!safe.hasAction("Crack")) {
                safe = null;
            }
            if (safecracker != null && safe != null) {
                if (safe.distance(safecracker) > 4) {
                    walkTo(safe.getTile());
                } else if (getLocalPlayer().getAnimation() == -1) {
                    safe.interact("Crack");
                    sleepUntil(() -> getLocalPlayer().getAnimation() == -1, Calculations.random(2000, 3000));
                }
            }
        }
    
        private boolean hasGems() {
            for (int gem : GEMS) {
                if (getInventory().contains(gem)) {
                    return true;
                }
            }
            return false;
        }
    
        private void bankGems() {
            if (getBank().isOpen()) {
                for (int gem : GEMS) {
                    Bank.depositAllExcept(LOCKPICK_ID, GEMS);
                }
                sleepUntil(() -> !getInventory().contains(GEMS), Calculations.random(2000, 3000));
            } else {
                WebBank.open(BankLocation.ROGUES_DEN);
            }
        }
    
    }

     

    Edited by Aniwidgets
    Link to comment
    Share on other sites

    • 2 weeks later...

    Create an account or sign in to comment

    You need to be a member in order to leave a comment

    Create an account

    Sign up for a new account in our community. It's easy!

    Register a new account

    Sign in

    Already have an account? Sign in here.

    Sign In Now
    ×
    ×
    • Create New...

    Important Information

    We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.