Rabrg 83 Share Posted May 11, 2016 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 More sharing options...
Mad 86 Share Posted May 11, 2016 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 More sharing options...
Rabrg 83 Author Share Posted May 11, 2016 writing easily readable code is less fun Link to comment Share on other sites More sharing options...
Mad 86 Share Posted May 11, 2016 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 More sharing options...
Rabrg 83 Author Share Posted May 11, 2016 should prob do that Link to comment Share on other sites More sharing options...
Dogerina 330 Share Posted May 11, 2016 thank u Link to comment Share on other sites More sharing options...
Diddy 265 Share Posted May 11, 2016 ow sweet, thanks Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.