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
  • Minigame teleport snippet


    Rabrg

    Recommended Posts


    import org.dreambot.api.Client;
    import org.dreambot.api.methods.MethodContext;
    import org.dreambot.api.methods.MethodProvider;
    import org.dreambot.api.methods.map.Tile;
    import org.dreambot.api.methods.tabs.Tab;
    import org.dreambot.api.wrappers.widgets.WidgetChild;

    public final class MinigameTeleport {

    public enum Minigame {
    BARBARIAN_ASSAULT("Barbarian Assault"),
    BLAST_FURNACE("Blast Furnace"),
    BURTHORPE_GAMES_ROOM("Burhorpe Games Room"),
    CASTLE_WARS("Castle Wars"),
    CLAN_WARS("Clan Wars"),
    DAGGANNOTH_KINGS("Dagannoth Kings"),
    FISHING_TRAWLER("Fishing Trawler"),
    GOD_WARS("God Wars"),
    NIGHTMARE_ZONE("Nightmare Zone"),
    PEST_CONTROL("Pest Control"),
    PLAYER_OWNED_HOUSES("Player Owned Houses"),
    RAT_PITS("Rat Pits"),
    SHADES_OF_MORTTON("Shades of Mort'ton"),
    SHIELD_OF_ARRAV("Shield of Arrav");

    private final String text;

    Minigame(final String text) {
    this.text = text;
    }

    private String getText() {
    return text;
    }
    }

    public static boolean teleport(final Minigame minigame) {
    final MethodContext ctx = Client.getClient().getMethodContext();
    final WidgetChild selectedWidget = ctx.getWidgets().getChildWidget(76, 11);
    final WidgetChild teleport = ctx.getWidgets().getChildWidget(76, 31);
    final Tile initialTile = ctx.getLocalPlayer().getTile();

    if ((ctx.getTabs().isOpen(Tab.QUEST) || ctx.getTabs().open(Tab.QUEST))
    && (selectedWidget.getText().equals(minigame.getText()) || selectedWidget.interact()
    && ctx.getWidgets().getWidgetChildrenContainingText(minigame.getText()).get(0).interact())
    && teleport.interact())
    MethodProvider.sleepUntil(() -> !initialTile.equals(ctx.getLocalPlayer().getTile()), 20000);
    return !initialTile.equals(ctx.getLocalPlayer().getTile());
    }
    }

    Link to comment
    Share on other sites

    wat

     

            if ((ctx.getTabs().isOpen(Tab.QUEST) || ctx.getTabs().open(Tab.QUEST))
                    && (selectedWidget.getText().equals(minigame.getText()) || selectedWidget.interact()
                    && ctx.getWidgets().getWidgetChildrenContainingText(minigame.getText()).get(0).interact())
                    && teleport.interact())
                MethodProvider.sleepUntil(() -> !initialTile.equals(ctx.getLocalPlayer().getTile()), 20000);
            return !initialTile.equals(ctx.getLocalPlayer().getTile());
        }
    }
    
    
    Link to comment
    Share on other sites

    why didnt u just put the method inside the enum class, it doesnt need to be wrapped with MinigameTeleport, then u dont need to pass in a param

    Link to comment
    Share on other sites

    Archived

    This topic is now archived and is closed to further replies.

    ×
    ×
    • 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.