TheCloakdOne 389 Share Posted May 27, 2020 Hi guys, noticed that the tut island has some new tricks up its sleeve past few days, found this script on the forums (forgive me i forgot who wrote it, please let me know and ill credit) and adjusted it to handle both old and new tutorial islands with a few improvements to sleeps etc. Ive had it running for the past weeks and not noticed many bugs but if there are please let me know. 02/02/2020 NOTE: This is now most likely out of date and will get stuck. Use with caution. I was planning on releasing this Saturday fully tested but seems people might need it sooner. Sub 6 min new tutorial island will be released on the weekend. RandomName.class I HIGHLY RECCOMEND THAT THESE NAMES ARE CHANGED import java.util.Random; public class RandomName { private static String[] Beginning = {"Kr", "Ca", "Ra", "Mrok", "Cru", "Ray", "Bre", "Zed", "Drak", "Mor", "Jag", "Mer", "Jar", "Mjol", "Zork", "Mad", "Cry", "Zur", "Creo", "Azak", "Azur", "Rei", "Cro", "Mar", "Luk", "Beep", "Dragon", "Celes", "Maser", "Trans", "Elem", "Sassle"}; private static String[] Middle = {"air", "ir", "mi", "sor", "mee", "clo", "red", "cra", "ark", "arc", "miri", "lori", "cres", "mur", "zer", "marac", "zoir", "slamar", "salmar", "urak"}; public RandomName() { } public String NewName() { Random rand = new Random(); String id = String.format("%04d", rand.nextInt(10000)); return Beginning[rand.nextInt(Beginning.length)] + Middle[rand.nextInt(Middle.length)] + id; } } Main.Class import java.awt.*; import java.io.IOException; import java.util.List; import org.dreambot.api.data.GameState; import org.dreambot.api.input.event.impl.InteractionEvent; import org.dreambot.api.input.mouse.destination.impl.shape.RectangleDestination; import org.dreambot.api.methods.Calculations; import org.dreambot.api.methods.MethodProvider; import org.dreambot.api.methods.interactive.GameObjects; import org.dreambot.api.methods.magic.Normal; import org.dreambot.api.methods.map.Area; import org.dreambot.api.methods.map.Tile; import org.dreambot.api.methods.prayer.Prayer; import org.dreambot.api.methods.skills.Skill; import org.dreambot.api.methods.tabs.Tab; import org.dreambot.api.methods.widget.Widget; import org.dreambot.api.randoms.RandomEvent; import org.dreambot.api.script.AbstractScript; import org.dreambot.api.script.Category; import org.dreambot.api.script.ScriptManifest; import org.dreambot.api.utilities.Timer; import org.dreambot.api.utilities.impl.Condition; import org.dreambot.api.methods.container.impl.equipment.EquipmentSlot; import org.dreambot.api.methods.filter.*; import org.dreambot.api.wrappers.interactive.Entity; import org.dreambot.api.wrappers.interactive.GameObject; import org.dreambot.api.wrappers.interactive.NPC; import org.dreambot.api.wrappers.items.GroundItem; import org.dreambot.api.wrappers.items.Item; import org.dreambot.api.wrappers.widgets.WidgetChild; @ScriptManifest(version = 1.7, author = "TheCloakdOne", category = Category.MINING, name = "CloakdIsland") public class Main extends AbstractScript { private final int TAB_CONFIG = 1021; private final int PERC_COMP = 406; private final int ATT_SPEED = 843; private final int POLL_OPEN = 375; private final int TUT_PROG = 281; private final int TUT_PROG_NEW = 2686; private final int TUT_PROG_MAJOR = 2687; private final int TUT_PROG_MINOR = 2686; private final int APPEAR_PAR = 269; private final int[][] appChildren = {{106, 113}, {107, 114}, {108, 115}, {109, 116}, {110, 117}, {111, 118}, {112, 119}, {105, 121}, {123, 127}, {122, 129}, {124, 130}, {125, 131}}; private final int ACCEPT = 100; private final String RUNESCAPE_GUIDE = "Gielinor Guide"; private final String SURVIVAL_EXPERT = "Survival Expert"; private final String COOK_GUIDE = "Master Chef"; private final String MASTER_NAVIGATOR = "Master Navigator"; private final String QUEST_GUIDE = "Quest Guide"; private final String MINING_GUIDE = "Mining Instructor"; private final String COMBAT_GUIDE = "Combat Instructor"; private final String FINANCIAL_GUIDE = "Account Guide"; private final String PRAY_GUIDE = "Brother Brace"; private final String MAGIC_GUIDE = "Magic Instructor"; Tile[] cookToQuest = new Tile[]{new Tile(3072, 3090, 0), new Tile(3072, 3092, 0), new Tile(3072, 3094, 0), new Tile(3071, 3095, 0), new Tile(3071, 3097, 0), new Tile(3071, 3099, 0), new Tile(3071, 3101, 0), new Tile(3071, 3103, 0), new Tile(3072, 3104, 0), new Tile(3073, 3105, 0), new Tile(3074, 3106, 0), new Tile(3076, 3106, 0), new Tile(3077, 3107, 0), new Tile(3077, 3109, 0), new Tile(3077, 3111, 0), new Tile(3077, 3113, 0), new Tile(3077, 3115, 0), new Tile(3077, 3117, 0), new Tile(3076, 3119, 0), new Tile(3076, 3121, 0), new Tile(3076, 3123, 0), new Tile(3077, 3125, 0), new Tile(3079, 3125, 0), new Tile(3080, 3126, 0), new Tile(3082, 3126, 0), new Tile(3084, 3126, 0), new Tile(3086, 3126, 0)}; Tile[] combatToLadder = new Tile[]{new Tile(3106, 9509, 0), new Tile(3107, 9510, 0), new Tile(3108, 9511, 0), new Tile(3109, 9512, 0), new Tile(3110, 9513, 0), new Tile(3111, 9515, 0), new Tile(3112, 9516, 0), new Tile(3112, 9518, 0), new Tile(3112, 9520, 0), new Tile(3112, 9522, 0), new Tile(3112, 9524, 0), new Tile(3111, 9525, 0)}; Tile[] finToPray = new Tile[]{new Tile(3130, 3124, 0), new Tile(3132, 3124, 0), new Tile(3133, 3123, 0), new Tile(3133, 3121, 0), new Tile(3134, 3119, 0), new Tile(3134, 3117, 0), new Tile(3133, 3115, 0), new Tile(3132, 3114, 0), new Tile(3131, 3113, 0), new Tile(3131, 3111, 0), new Tile(3130, 3110, 0), new Tile(3130, 3108, 0)}; Tile[] prayToMage = new Tile[]{new Tile(3122, 3102, 0), new Tile(3123, 3101, 0), new Tile(3124, 3100, 0), new Tile(3125, 3099, 0), new Tile(3126, 3098, 0), new Tile(3127, 3097, 0), new Tile(3128, 3096, 0), new Tile(3129, 3095, 0), new Tile(3130, 3094, 0), new Tile(3132, 3094, 0), new Tile(3133, 3093, 0), new Tile(3134, 3092, 0), new Tile(3135, 3091, 0), new Tile(3136, 3090, 0), new Tile(3137, 3089, 0), new Tile(3138, 3088, 0), new Tile(3140, 3087, 0), new Tile(3141, 3088, 0)}; public static final Rectangle GAME_SCREEN = new Rectangle(5, 5, 511, 333); public static final Rectangle CANVAS = new Rectangle(0, 0, 765, 503); private boolean hover = false; private boolean forceEmail = false; private int conf; boolean started = false; boolean accMade = false; boolean inNewTutorial = false; private State state; private Timer t; private enum State { CREATE_ACC, OPEN_TAB, DO_TUT } private State getState() { if (!started) { return State.CREATE_ACC; } // if (getPlayerSettings().getConfig(TAB_CONFIG) > 0) { // return State.OPEN_TAB; // } return State.DO_TUT; } @Override public void onStart() { getRandomManager().disableSolver(RandomEvent.RESIZABLE_DISABLER); accMade = true; started = true; t = new Timer(); } private WidgetChild getClickHereToContinue() { if (!getDialogues().inDialogue()) { log("Not in dialogue"); return null; } List<WidgetChild> children = getWidgets().getWidgetChildrenContainingText("Click here to continue"); if (children.isEmpty()) { children = getWidgets().getWidgetChildrenContainingText("Click to continue"); } if (children.isEmpty()) { return null; } for (WidgetChild wc : children) { if (wc.isVisible()) { if (wc.getParentID() != 137) { if (wc.isGrandChild()) { if (wc.getID() != 107 && wc.isVisible()) return wc; } else if (wc.isVisible()) { return wc; } } } } children = getWidgets().getWidgetChildrenContainingText("Click to continue"); for (WidgetChild wc : children) { if (wc.isVisible()) { if (wc.getParentID() != 137) { if (wc.isGrandChild()) { if (wc.getID() != 107 && wc.isVisible()) return wc; } else if (wc.isVisible()) { return wc; } } } } return null; } private boolean isRoofEnabled() { return false; } private int toggleRoof() { if (!isRoofEnabled()) return -1; return -1; } private int makeAccount() { sleepUntil(new Condition() { public boolean verify() { return getWidgets().getWidget(APPEAR_PAR) != null; } }, 30000); return Calculations.random(250, 350); } private boolean inNewTutorial() { return getPlayerSettings().getConfig(TUT_PROG_NEW) > getPlayerSettings().getConfig(TUT_PROG); } @Override public int onLoop() { state = getState(); log("Current State: " + state); if (getDialogues().inDialogue() && !getLocalPlayer().isInCombat() && !getLocalPlayer().isHealthBarVisible()) { if (getDialogues().canContinue()) { log("Space to continue"); getDialogues().spaceToContinue(); return Calculations.random(400, 800); } } if (getDialogues().canContinue() && !getLocalPlayer().isInCombat() && !getLocalPlayer().isHealthBarVisible()) { log("Space to continue"); getDialogues().spaceToContinue(); return Calculations.random(400, 800); } if (state != State.CREATE_ACC) { List<WidgetChild> clickToContinue = getWidgets().getWidgetChildrenContainingText("Click to continue"); if (!clickToContinue.isEmpty()) { WidgetChild wc = clickToContinue.get(0); if (wc != null && wc.isVisible()) { wc.interact(); sleep(900, 1200); } } } switch (state) { case CREATE_ACC: if (!getClient().isLoggedIn()) { int res = makeAccount(); if (res == -1) { return res; } } else { accMade = true; t = new Timer(); log("appearance"); final Widget par = getWidgets().getWidget(APPEAR_PAR); if (par != null && par.isVisible()) { for (int i = 0; i < appChildren.length; i++) { if (getClient().seededRandom() >= 1) { if (getClient().seededRandom() > 1) { for (int ii = 0; ii < 5; ii++) { par.getChild(appChildren[i][0]).interact(); sleep(100, 150); } } else { for (int ii = 0; ii < 5; ii++) { par.getChild(appChildren[i][1]).interact(); sleep(100, 150); } } sleep(200, 300); } } par.getChild(ACCEPT).interact(); sleepUntil(new Condition() { public boolean verify() { WidgetChild wc = par.getChild(ACCEPT); return wc == null || !wc.isVisible(); } }, 1200); started = true; } } break; case DO_TUT: //Detect what tutorial we are in if (this.inNewTutorial()) { conf = getPlayerSettings().getConfig(TUT_PROG_NEW); } else { conf = getPlayerSettings().getConfig(TUT_PROG); } if (getWidgets().getWidget(162) != null && getWidgets().getWidget(162).isVisible() && getWidgets().getWidget(162).getChild(45) != null && getWidgets().getWidget(162).getChild(45).isVisible()) { log("Dialogue covering progress, clearing"); // getWidgets().getWidget(162).getChild(45).interact(); getKeyboard().type(" "); sleepUntil(() -> !getWidgets().getWidget(162).isVisible(), 400); return 0; } log("conf " + conf); //Scroll to exact value if we can // if (conf == 2 && getClientSettings().isResizableActive() && getClientSettings().getExactZoomValue() != 512) { // log("Zooming into good zoom level"); // getMouse().scrollWhile(true, 200, () -> getClientSettings().getExactZoomValue() != 512); // return 0; // } if (conf > 3 && getClientSettings().isResizableActive()) { log("Enabling Resizable mode solver"); getRandomManager().enableSolver(RandomEvent.RESIZABLE_DISABLER); return 0; } // //Enable the roof disabler // if (conf > 3 && !getClientSettings().roofsEnabled()) { // log("Enabling roof disabler"); // getRandomManager().enableSolver(RandomEvent.ROOF_DISABLER); // return 0; // } switch (conf) { case 0: case 1: //663 Widget oldNameWidget = getWidgets().getWidget(663); if (oldNameWidget != null && oldNameWidget.isVisible()) { log("Setting name"); //Look up name oldNameWidget.getChild(17).interact(); log("Thinking of new name"); sleep(2000, 3000); String name = new RandomName().NewName(); log("Setting Name: " + name); getKeyboard().type(name, true, true); sleepUntil(() -> oldNameWidget.getChild(11).getText().equals(name) && oldNameWidget.getChild(12).getText().equals("Great! This display name is <col=00ff00>available</col>!"), 6000); oldNameWidget.getChild(18).interact(); sleepUntil(() -> !oldNameWidget.isVisible(), 10000); break; } //Set name Widget nameWidget = getWidgets().getWidget(558); if (nameWidget != null && nameWidget.isVisible()) { log("Setting name"); //Look up name nameWidget.getChild(17).interact(); log("Thinking of new name"); sleep(2000, 3000); String name = new RandomName().NewName(); log("Setting Name: " + name); getKeyboard().type(name, true, true); sleepUntil(() -> nameWidget.getChild(11).getText().equals(name) && nameWidget.getChild(12).getText().equals("Great! This display name is <col=00ff00>available</col>!"), 6000); nameWidget.getChild(18).interact(); sleepUntil(() -> !nameWidget.isVisible(), 5000); break; } if (getWidgets().getWidget(269) != null && getWidgets().getWidget(269).isVisible()) { this.setApperance(); // sleep(1000, 2000); break; } talkTo(RUNESCAPE_GUIDE); break; case 7: case 2: //Adjust camera, should help with misclicks if (getCamera().getPitch() < 250) { getCamera().rotateToPitch(Calculations.random(250, 300)); } talkTo(RUNESCAPE_GUIDE); break; case 3: if (getClientSettings().isResizableActive() || getClientSettings().getExactZoomValue() != 512) { log("Manual resizeable mode attempt"); if (getClientSettings().isResizableActive()) { //turn off resizable getMouse().move(new Rectangle(666, 469, 30, 40)); sleep(200, 500); getMouse().click(); sleepUntil(() -> !getClientSettings().isResizableActive(), Calculations.random(2000, 3000)); sleep(200, 500); } else if (getClientSettings().getExactZoomValue() != 512) { //set default zoom getClientSettings().setDefaultZoom(); sleep(900, 1200); } return Calculations.random(200, 500); } //open settings break; case 10: if (!getWalking().isRunEnabled()) { getWalking().toggleRun(); } GameObject door = getGameObjects().closest("Door"); if (door != null) { if (door.interact("Open")) { walkingSleep(); sleepUntil(new Condition() { public boolean verify() { return getPlayerSettings().getConfig(TUT_PROG) != 10; } }, Calculations.random(1600, 2000)); } } //open door break; case 60: case 20: talkTo(SURVIVAL_EXPERT); //talked to survival expert break; case 30: if (!getTabs().isOpen(Tab.INVENTORY)) { getTabs().openWithMouse(Tab.INVENTORY); sleep(200, 600); } //opened invnetory break; case 40: if (getLocalPlayer().getAnimation() != -1) { sleepUntil(new Condition() { public boolean verify() { return getPlayerSettings().getConfig(TUT_PROG) != 80; } }, 5000); break; } NPC pool = getNpcs().closest("Fishing spot"); if (pool != null) { if (pool.interact("Net")) { walkingSleep(); sleepUntil(new Condition() { public boolean verify() { return getPlayerSettings().getConfig(TUT_PROG) != 80; } }, Calculations.random(4000, 5000)); } } //caught shrimp break; case 50: //opened skills log("opening skills tab"); getTabs().openWithMouse(Tab.SKILLS); sleepUntil(() -> getTabs().isOpen(Tab.SKILLS), 600); break; case 70: chopClosestTree(); sleep(600, 1200); //chopped logs break; case 80: boolean useableFire = getGameObjects().closest("Fire") != null && getGameObjects().closest("Fire").distance(getLocalPlayer().getTile()) > 2; if (!getInventory().contains("Logs") && useableFire) { sleepUntil(new Condition() { public boolean verify() { return getPlayerSettings().getConfig(TUT_PROG) != 50; } }, 1000); chopClosestTree(); break; } lightFire(); //lit logs break; case 90: case 100: cookShrimp(); //burned shrimp break; case 110: if (!getInventory().contains("Raw shrimps")) { if (getLocalPlayer().getAnimation() != -1) { sleepUntil(new Condition() { public boolean verify() { return getInventory().contains("Raw shrimps"); } }, 5000); } else { pool = getNpcs().closest("Fishing spot"); if (pool != null) { pool.interact("Net"); sleepUntil(new Condition() { public boolean verify() { return getInventory().contains("Raw shrimps"); } }, 5000); } } } else { cookShrimp(); } //cooked second shrimp break; case 120: Tile gateTile = new Tile(3091, 3092, 0); if (inNewTutorial()) { gateTile = new Tile(1683, 6100, 0); } if (getLocalPlayer().getTile().distance(gateTile) > 5) { getWalking().walk(gateTile); walkingSleep(); } else { GameObject gate = getGameObjects().closest("Gate"); if (gate != null) { if (gate.interact("Open")) { walkingSleep(); sleepUntil(new Condition() { public boolean verify() { return getPlayerSettings().getConfig(TUT_PROG) != 120; } }, Calculations.random(1400, 1800)); } } } //went through gate break; case 130: Tile doorTile = new Tile(3080, 3084, 0); if (inNewTutorial()) { doorTile = new Tile(1671, 6092, 0); } if (getLocalPlayer().getTile().distance(doorTile) > 5) { getWalking().walk(doorTile); walkingSleep(); } else { GameObject gate = getGameObjects().closest("Door"); if (gate != null) { if (gate.interact("Open")) { walkingSleep(); sleepUntil(new Condition() { public boolean verify() { return getPlayerSettings().getConfig(TUT_PROG) != 130; } }, 1200); } } } //went through cook door break; case 140: if (inNewTutorial()) { talkTo(MASTER_NAVIGATOR); } else { talkTo(COOK_GUIDE); } //talked to cook break; case 145: if (!inNewTutorial()) break; if (getWidgets().getWidget(160) != null) { log("Opening world map"); getWidgets().getWidget(160).getChild(46).interact(); sleepUntil(() -> getWidgets().getWidget(595) != null && getWidgets().getWidget(595).isVisible(), 2000); sleep(1200, 4000); //Have a look at the map log("Closing world map"); getWidgets().getWidget(160).getChild(46).interact(); sleepUntil(() -> getWidgets().getWidget(595) == null, 2000); } break; case 150: if (inNewTutorial()) { talkTo(MASTER_NAVIGATOR); break; } if (!getInventory().isItemSelected()) { if (getInventory().interact("Bucket of water", "Use")) { sleepUntil(new Condition() { public boolean verify() { return getInventory().isItemSelected(); } }, Calculations.random(1200, 1400)); } } else { if (getInventory().interact("Pot of flour", "Use")) { sleepUntil(new Condition() { public boolean verify() { return getInventory().contains("Bread dough"); } }, Calculations.random(1200, 1400)); } } //made dough break; case 155: if (inNewTutorial()) { talkTo(MASTER_NAVIGATOR); break; } case 160: case 166: if (inNewTutorial()) { talkTo(MASTER_NAVIGATOR); break; } if (!getInventory().isItemSelected()) { if (getInventory().interact("Bread dough", "Use")) { sleepUntil(new Condition() { public boolean verify() { return getInventory().isItemSelected(); } }, Calculations.random(1200, 1400)); } } else { GameObject range = getGameObjects().closest("Range"); if (range.interact("Use")) { walkingSleep(); sleepUntil(new Condition() { public boolean verify() { return getInventory().contains("Bread"); } }, Calculations.random(2000, 3000)); } } //cooked bread break; case 170: case 180: Tile doorExitTile = new Tile(3073, 3090, 0); if (inNewTutorial()) { doorExitTile = new Tile(1665, 6098, 0); } if (getLocalPlayer().getTile().distance(doorExitTile) > 5) { getWalking().walk(doorExitTile); walkingSleep(); } else { GameObject gate = getGameObjects().closest("Door"); if (gate != null) { if (gate.interact("Open")) { walkingSleep(); sleepUntil(new Condition() { public boolean verify() { return getPlayerSettings().getConfig(TUT_PROG) != 180; } }, Calculations.random(1200, 1600)); } } } //opened cook door break; case 183: //opened emotes break; case 200: log("Toggling run"); getWalking().toggleRun(); sleep(400, 600); // Rectangle r = new Rectangle(558, 115, 15, 25); //// Rectangle r = new Rectangle(560, 213, 20, 40); // getMouse().move(r); // log("Clicking run rectangle"); // getMouse().click(); // sleepUntil(new Condition() { // public boolean verify() { // return getPlayerSettings().getConfig(TUT_PROG) != 210; // } // }, 5000); //use emote break; case 190: //opened settings break; case 205: //261,65 WidgetChild wc = getWidgets().getChildWidget(261, 63); if (wc != null && wc.isVisible()) { wc.interact(); sleepUntil(new Condition() { public boolean verify() { return getWalking().isRunEnabled(); } }, 1200); } //turned on run in settings break; case 164: case 165: case 167: case 168: case 169: case 210: Tile questDoorEnter = new Tile(3086, 3126, 0); if (inNewTutorial()) { questDoorEnter = new Tile(1678, 6134, 0); } if (getLocalPlayer().getTile().distance(questDoorEnter) > 5) { getWalking().walk(questDoorEnter);//, Calculations.random(10,15)); sleepUntil(new Condition() { public boolean verify() { return getLocalPlayer().isMoving(); } }, 1200); sleepUntil(new Condition() { public boolean verify() { Tile dest = getClient().getDestination(); return !getLocalPlayer().isMoving() || dest == null || getLocalPlayer().distance(dest) < 5; } }, Calculations.random(2600, 3000)); } else { GameObject gate = getGameObjects().closest("Door"); if (gate != null) { if (gate.interact("Open")) { walkingSleep(); sleepUntil(new Condition() { public boolean verify() { return getPlayerSettings().getConfig(TUT_PROG) != 210; } }, Calculations.random(1200, 1400)); } } } //opened door break; // case 240: case 230: //open quest tab if (!getTabs().isOpen(Tab.QUEST)) { log("opening quest tab"); getTabs().openWithMouse(Tab.QUEST); } break; case 220: case 240: talkTo(QUEST_GUIDE); break; //talked to quest guy case 250: GameObject gate = getGameObjects().closest("Ladder"); if (gate != null) { log("Climbing down ladder"); if (gate.interact("Climb-down")) { walkingSleep(); sleepUntil(new Condition() { public boolean verify() { return getPlayerSettings().getConfig(TUT_PROG) != 250; } }, Calculations.random(4000, 6000)); } } //TODO Still gets stuck on camera getCamera().rotateToPitch(Calculations.random(320, 400)); sleepUntil(() -> getCamera().getPitch() > 320, 500); //climb down ladder break; case 330: case 290: case 260: if (inNewTutorial()) { doorExitTile = new Tile(1665, 6098, 0); Tile closerToMiningTrainer = new Tile(1674, 12512, 0); if (getLocalPlayer().getTile().distance(closerToMiningTrainer) > 5) { getWalking().walk(closerToMiningTrainer); walkingSleep(); break; } } else { Tile closerToMiningTrainer = new Tile(3082, 9505, 0); if (getLocalPlayer().getTile().distance(closerToMiningTrainer) > 5) { getWalking().walk(closerToMiningTrainer); walkingSleep(); break; } } talkTo(MINING_GUIDE); //talk to mining instructor break; case 270: Tile tinRock = new Tile(3077, 9504, 0); if (inNewTutorial()) { tinRock = new Tile(1665, 6098, 0); } // GameObject tin = getGameObjects().closest(37945); // GameObject tin = getGameObjects().closest(new Filter<GameObject>() { // public boolean match(GameObject g) { // if (g == null || g.getName() == null) // return false; // if (!g.getName().equals("Rocks")) // return false; // if (g.getTile().equals(tinRock)) // return true; // return false; // } // }); // if (tin != null) { // if (tin.interact("Prospect")) { // walkingSleep(); // sleepUntil(new Condition() { // public boolean verify() { // return getPlayerSettings().getConfig(TUT_PROG) != 270; // } // }, Calculations.random(3000, 4000)); // } // } //inspect tin break; case 280: GameObject ptin = getGameObjects().closest(37945); // tin = getGameObjects().closest(new Filter<GameObject>() { // public boolean match(GameObject g) { // if (g == null || g.getName() == null) // return false; // if (!g.getName().equals("Rocks")) // return false; // if (g.getTile().equals(new Tile(3083, 9501, 0))) // return true; // return false; // } // }); if (ptin != null) { if (ptin.interact("Prospect")) { sleepUntil(new Condition() { public boolean verify() { return getPlayerSettings().getConfig(TUT_PROG) != 280; } }, Calculations.random(4000, 5000)); } } //inspect copper break; case 300: int rocks = 10080; if (inNewTutorial()) rocks = 37945; // tin = getGameObjects().closest(new Filter<GameObject>() { // public boolean match(GameObject g) { // if (g == null || g.getName() == null) // return false; // if (!g.getName().equals("Rocks")) // return false; // if (g.getTile().equals(new Tile(3077, 9504, 0))) // return true; // return false; // } // }); GameObject tin = getGameObjects().closest(rocks); if (tin != null) { if (tin.interact("Mine")) { walkingSleep(); sleepUntil(new Condition() { public boolean verify() { return getPlayerSettings().getConfig(TUT_PROG) != 300; } }, Calculations.random(2000, 3000)); } } //mine tin break; case 310: rocks = 10079; if (inNewTutorial()) rocks = 37944; GameObject copper = getGameObjects().closest(rocks); // tin = getGameObjects().closest(new Filter<GameObject>() { // public boolean match(GameObject g) { // if (g == null || g.getName() == null) // return false; // if (!g.getName().equals("Rocks")) // return false; // if (g.getTile().equals(new Tile(3083, 9501, 0))) // return true; // return false; // } // }); if (copper != null) { if (copper.interact("Mine")) { walkingSleep(); sleepUntil(new Condition() { public boolean verify() { return getPlayerSettings().getConfig(TUT_PROG) != 310; } }, Calculations.random(2000, 3000)); } } //mine copper break; case 320: if (!getInventory().isItemSelected()) { sleep(1200, 1800); getInventory().interact("Tin ore", "Use"); sleepUntil(new Condition() { public boolean verify() { return getInventory().isItemSelected(); } }, Calculations.random(800, 1200)); } else if (getWidgets().getWidget(270) != null && getWidgets().getWidget(270).isVisible()) { getWidgets().getWidget(270).getChild(14).interact("Smelt"); sleepUntil(new Condition() { public boolean verify() { return getInventory().contains("Bronze bar"); } }, Calculations.random(2000, 3000)); } else { GameObject furnace = getGameObjects().closest(10082); if (inNewTutorial()) { furnace = getGameObjects().closest(37947); } if (furnace != null) { if (furnace.interact("Use")) { walkingSleep(); sleepUntil(new Condition() { public boolean verify() { return getInventory().contains("Bronze bar"); } }, Calculations.random(2000, 3000)); } } } //smelt bronze break; case 340: if (!getInventory().isItemSelected()) { getInventory().interact("Bronze bar", "Use"); sleepUntil(new Condition() { public boolean verify() { return getInventory().isItemSelected(); } }, 1200); } else { GameObject furnace = getGameObjects().closest("Anvil"); if (furnace != null) { if (furnace.interact("Use")) { walkingSleep(); sleepUntil(new Condition() { public boolean verify() { return getPlayerSettings().getConfig(TUT_PROG) != 340; } }, Calculations.random(2000, 3000)); } } } if (getWidgets().getChildWidget(312, 9) != null && getWidgets().getChildWidget(312, 9).isVisible()) { getWidgets().getChildWidget(312, 9).interact(); sleepUntil(new Condition() { public boolean verify() { return getPlayerSettings().getConfig(TUT_PROG) != 350; } }, 3000); //smith knife } //open anvil panel break; case 350: if (inNewTutorial()) { Tile newUndergroundGate = new Tile(1686, 12510, 0); if (getLocalPlayer().getTile().distance(newUndergroundGate) > 5) { getWalking().walk(newUndergroundGate); walkingSleep(); } else { gate = getGameObjects().closest("Gate"); if (gate != null) { if (gate.interact("Open")) { walkingSleep(); sleepUntil(new Condition() { public boolean verify() { return getPlayerSettings().getConfig(TUT_PROG) != 360; } }, Calculations.random(1200, 1800)); } } } break; } getWidgets().getChildWidget(312, 9).interact(); sleepUntil(new Condition() { public boolean verify() { return getPlayerSettings().getConfig(TUT_PROG) != 350; } }, 3000); //smith knife break; case 360: if (inNewTutorial()) { talkTo(COMBAT_GUIDE); break; } if (getLocalPlayer().getTile().distance(new Tile(3094, 9502, 0)) > 5) { getWalking().walk(new Tile(3094, 9502, 0)); walkingSleep(); } else { gate = getGameObjects().closest("Gate"); if (gate != null) { if (gate.interact("Open")) { walkingSleep(); sleepUntil(new Condition() { public boolean verify() { return getPlayerSettings().getConfig(TUT_PROG) != 360; } }, Calculations.random(1200, 1800)); } } } //open gate break; case 410: case 370: talkTo(COMBAT_GUIDE); //tlak to combat instructor break; case 390: //open equipment if (!getTabs().isOpen(Tab.EQUIPMENT)) { log("opening EQUIPMENT tab"); getTabs().openWithMouse(Tab.EQUIPMENT); } break; case 400: getWidgets().getChildWidget(387, 1).interact(); sleepUntil(new Condition() { public boolean verify() { return getPlayerSettings().getConfig(TUT_PROG) != 400; } }, Calculations.random(1200, 1600)); //open equipment stats break; case 405: if (getInventory().interact("Bronze dagger", "Equip")) { sleepUntil(new Condition() { public boolean verify() { return getPlayerSettings().getConfig(TUT_PROG) != 410; } }, Calculations.random(1200, 1600)); } else if (getInventory().interact("Bronze dagger", "Wield")) { sleepUntil(new Condition() { public boolean verify() { return getPlayerSettings().getConfig(TUT_PROG) != 410; } }, Calculations.random(1200, 1600)); } getWidgets().getChildWidget(84, 4).interact(); //equip dagger break; case 420: Item i = getEquipment().getItemInSlot(EquipmentSlot.WEAPON.getSlot()); if (i != null && (i.getName().contains("dagger") || i.getName().contains("axe"))) { getEquipment().unequip(EquipmentSlot.WEAPON); sleepUntil(new Condition() { public boolean verify() { return getEquipment().getItemInSlot(EquipmentSlot.WEAPON.getSlot()) == null; } }, Calculations.random(1200, 1600)); } else { if (i != null) { getInventory().interact("Wooden shield", "Wield"); sleepUntil(new Condition() { public boolean verify() { return getEquipment().getItemInSlot(EquipmentSlot.SHIELD.getSlot()) != null; } }, Calculations.random(1200, 1600)); } else { getInventory().interact("Bronze sword", "Wield"); sleepUntil(new Condition() { public boolean verify() { return getEquipment().getItemInSlot(EquipmentSlot.WEAPON.getSlot()) != null; } }, Calculations.random(1200, 1600)); } } //unequip knife //equip sword/shield break; case 430: //open combat tab //open equipment if (!getTabs().isOpen(Tab.COMBAT)) { log("opening COMBAT tab"); getTabs().openWithMouse(Tab.COMBAT); } break; case 440: Tile mouseCageGate = new Tile(3111, 9518, 0); if (inNewTutorial()) { mouseCageGate = new Tile(1704, 12526, 0); } if (getLocalPlayer().getTile().distance(mouseCageGate) > 5) { getWalking().walk(mouseCageGate); walkingSleep(); } else { gate = getGameObjects().closest("Gate"); if (gate != null) { if (gate.interact("Open")) { walkingSleep(); sleepUntil(new Condition() { public boolean verify() { return getPlayerSettings().getConfig(TUT_PROG) != 360; } }, Calculations.random(1200, 1600)); } } } //open rat gate break; case 450: if (getLocalPlayer().isInCombat()) { log("Player in combat"); sleepUntil(() -> !getLocalPlayer().isInCombat(), 600); break; } attackRat(); //attack rat break; case 460: sleepUntil(new Condition() { public boolean verify() { return getPlayerSettings().getConfig(TUT_PROG) != 460; } }, 2400); //killed rat break; case 465: if (getInventory().contains("Bones")) { log("Bones in inventory"); break; } else { //TODO Go back to rats and get some bones } GroundItem bones = getGroundItems().closest("Bones"); if (bones == null) { break; } bones.interact("Take"); sleepUntil(new Condition() { public boolean verify() { return getPlayerSettings().getConfig(TUT_PROG) != 465; } }, 2400); //looted bones case 470: if (!getInventory().contains("Bones")) { log("Missing bones in inventory"); bones = getGroundItems().closest("Bones"); if (bones == null && !getLocalPlayer().isInCombat()) { //Kill new rat for bones attackRat(); break; } log("Picking up bones"); bones.interact("Take"); sleepUntil(() -> getInventory().contains("Bones"), 3000); break; } mouseCageGate = new Tile(3111, 9518, 0); if (inNewTutorial()) { mouseCageGate = new Tile(1704, 12526, 0); } //TODO handle in cage better if (!getMap().canReach(mouseCageGate)) { gate = getGameObjects().closest("Gate"); if (gate != null) { if (gate.distance(getLocalPlayer().getTile()) > 7) { log("Walking closer to gate"); getWalking().walk(gate.getTile()); walkingSleep(); } if (gate.interact("Open")) { walkingSleep(); sleepUntil(new Condition() { public boolean verify() { return getLocalPlayer().getTile().getX() == 3111; } }, Calculations.random(1200, 1400)); } } } else talkTo(COMBAT_GUIDE); //talk to combat instructor break; case 480: if (getEquipment().isSlotEmpty(EquipmentSlot.ARROWS.getSlot())) { getInventory().interact("Bronze arrow", "Wield"); sleepUntil(new Condition() { public boolean verify() { return getEquipment().isSlotFull(EquipmentSlot.ARROWS.getSlot()); } }, Calculations.random(1200, 1600)); } else if (getInventory().contains("Shortbow")) { getInventory().interact("Shortbow", "Wield"); sleepUntil(new Condition() { public boolean verify() { return !getInventory().contains("Shortbow"); } }, Calculations.random(1200, 1600)); } else { attackRat(); } //equip bow & arrow //attack rat break; case 490: if (getEquipment().isSlotEmpty(EquipmentSlot.ARROWS.getSlot())) { getInventory().interact("Bronze arrow", "Wield"); sleepUntil(new Condition() { public boolean verify() { return getEquipment().isSlotFull(EquipmentSlot.ARROWS.getSlot()); } }, 1200); } else if (getInventory().contains("Shortbow")) { getInventory().interact("Shortbow", "Wield"); sleepUntil(new Condition() { public boolean verify() { return !getInventory().contains("Shortbow"); } }, 1200); } else { if (getLocalPlayer().getInteractingCharacter() == null) { attackRat(); } else { sleepUntil(new Condition() { public boolean verify() { return getPlayerSettings().getConfig(TUT_PROG) != 490; } }, Calculations.random(2400, 3000)); } } //killed rat break; case 500: Tile ladderUpTile = new Tile(3112, 9525, 0); if (inNewTutorial()) { ladderUpTile = new Tile(1703, 12533, 0); } if (getLocalPlayer().getTile().distance(ladderUpTile) > 5) { if (inNewTutorial()) { getWalking().walk(ladderUpTile); } else { getWalking().walk(combatToLadder[combatToLadder.length - 1]);//, Calculations.random(10,15)); } walkingSleep(); } else { gate = getGameObjects().closest("Ladder"); if (gate != null) { if (gate.interact("Climb-up")) { walkingSleep(); sleepUntil(new Condition() { public boolean verify() { return getPlayerSettings().getConfig(TUT_PROG) != 500; } }, Calculations.random(2400, 3600)); } } } //go up ladder break; case 510: if (inNewTutorial()) { walkToPrayer(); break; } talkToBanker(); //use bank booth //continue through convo break; case 520: if (inNewTutorial()) { openPrayerTab(); break; } usePollBooth(); //use poll booth //continue through convo //close poll booth break; case 525: if (inNewTutorial()) { openPrayerTab(); break; } usePollBooth(); door = getGameObjects().closest(new Filter<GameObject>() { public boolean match(GameObject g) { if (g == null || g.getName() == null) return false; if (!g.getName().equals("Door")) return false; return g.getTile().equals(new Tile(3125, 3124, 0)); } }); if (door != null) { if (door.interact("Open")) { walkingSleep(); sleepUntil(new Condition() { public boolean verify() { return getPlayerSettings().getConfig(TUT_PROG) != 525; } }, Calculations.random(1600, 2400)); } } //go through door break; case 530: if (inNewTutorial()) { turnOnThickSkin(); break; } //talk to financial guy talkTo(FINANCIAL_GUIDE); sleep(600, 800); break; case 531: case 532: //quickly moves to logout tab briefly if (!getTabs().isOpen(Tab.LOGOUT) && !getTabs().isOpen(Tab.ACCOUNT_MANAGEMENT)) { log("opening ACCOUNT_MANAGEMENT tab"); getTabs().openWithMouse(Tab.ACCOUNT_MANAGEMENT); sleepUntil(() -> getTabs().isOpen(Tab.ACCOUNT_MANAGEMENT), 600); break; } if (getDialogues().canContinue()) { log("InDialog - Space to continue"); getDialogues().spaceToContinue(); return Calculations.random(400, 800); } // //open ACCOUNT_MANAGEMENT tab // if (!getTabs().isOpen(Tab.ACCOUNT_MANAGEMENT)) { //TODO this is glitchy as it flashes // log("opening ACCOUNT_MANAGEMENT tab"); // getTabs().openWithMouse(Tab.ACCOUNT_MANAGEMENT); // } //talk to financial guy talkTo(FINANCIAL_GUIDE); break; case 535: openPrayerTab(); break; case 540: if (inNewTutorial()) { buryBones(); break; } openBankDoor(); //go through door break; case 545: talkTo(PRAY_GUIDE); break; case 550: if (inNewTutorial()) { openFriendsTab(); break; } if (getLocalPlayer().getTile().distance(new Tile(3126, 3106, 0)) > 5) { getWalking().walk(finToPray[finToPray.length - 1]);//, Calculations.random(10,15)); walkingSleep(); } else { gate = getGameObjects().closest(new Filter<GameObject>() { public boolean match(GameObject g) { if (g == null || g.getName() == null) { return false; } if (!g.getName().equals("Large door")) return false; return g.getTile().equals(new Tile(3129, 3107, 0)); } }); if (gate != null && !getMap().canReach(getNpcs().closest(PRAY_GUIDE).getTile())) { if (gate.interact("Open")) { sleep(600, 900); } } talkTo(PRAY_GUIDE); } //3128,3107 //check if double doors closed //talk to prayer guy break; case 555: openFriendsTab(); break; case 560: if (inNewTutorial()) { openLargeDoor(); break; } openPrayerTab(); break; case 565: talkToBanker(); break; //run to bank case 600: case 570: if (inNewTutorial()) { usePollBooth(); break; } talkTo(PRAY_GUIDE); //talk to pray guy break; case 580: if (inNewTutorial()) { openBankDoor(); break; } openFriendsTab(); break; case 590: //open ignore break; case 610: openLargeDoor(); //open door break; case 620: walkToWizard(); //talkt o mage guy break; case 630: //open magic tab if (!getTabs().isOpen(Tab.MAGIC)) { log("opening MAGIC tab"); getTabs().openWithMouse(Tab.MAGIC); } break; case 640: talkTo(MAGIC_GUIDE); //talk to mage guy break; case 650: killChicken(); //click spell //click chicken break; case 670: if (getDialogues().getOptions() != null) { if (!inNewTutorial() && getDialogues().getOptions().length == 2) getDialogues().clickOption(1); else getDialogues().clickOption(3); break; } talkTo(MAGIC_GUIDE); break; case 680: //Home teleport homeTeleport(); break; case 1000: log("You're done!"); log("Finished in: " + this.t.formatTime()); sleep(1000, 5000); getTabs().logout(); return -1; } break; case OPEN_TAB: log("OPEN_TAB"); final Tab t = getTab(); if (t == null) { log("Tab is null?"); break; } if (getTabs().openWithMouse(t)) { sleepUntil(new Condition() { public boolean verify() { return getTabs().isOpen(t); } }, Calculations.random(1200, 1600)); } break; } return Calculations.random(200, 300); } private void openLargeDoor() { GameObject door = getGameObjects().closest("Door"); if (door != null) { if (door.interact("Open")) { walkingSleep(); sleepUntil(new Condition() { public boolean verify() { return getPlayerSettings().getConfig(TUT_PROG) != (inNewTutorial() ? 560 : 610); } }, Calculations.random(1600, 2400)); } } } private void openBankDoor() { Tile doorTile; Tile previousDoorTile = new Tile(3125, 3124, 0); if (inNewTutorial()) { doorTile = new Tile(1722, 6132, 0); if (getLocalPlayer().distance(doorTile) > 2) { getWalking().walk(doorTile); walkingSleep(); return; } } else { doorTile = new Tile(3130, 3124, 0); if (getLocalPlayer().getTile().distance(doorTile) < getLocalPlayer().getTile().distance(previousDoorTile) && getGameObjects().getTopObjectOnTile(previousDoorTile) != null && getGameObjects().getTopObjectOnTile(previousDoorTile).hasAction("Open")) { log("First door closed, opening"); getGameObjects().getTopObjectOnTile(previousDoorTile).interact("Open"); sleep(Calculations.random(1600, 2400)); return; } } GameObject doorObject = getGameObjects().getTopObjectOnTile(doorTile); if (doorObject != null && doorObject.interact("Open")) { walkingSleep(); sleepUntil(new Condition() { public boolean verify() { return getPlayerSettings().getConfig(TUT_PROG) != 540; } }, Calculations.random(1600, 2400)); } } private void openTab(Tab t) { if (getTabs().openWithMouse(t)) { sleepUntil(new Condition() { public boolean verify() { return getTabs().isOpen(t); } }, Calculations.random(1200, 1600)); } } private boolean attackRat() { NPC rat = getNpcs().closest(new Filter<NPC>() { public boolean match(NPC n) { if (n == null || n.getName() == null) return false; return n.getName().equals("Giant rat") && !n.isInCombat(); } }); if (rat != null) { if (rat.interact("Attack")) { walkingSleep(); sleepUntil(new Condition() { public boolean verify() { return getPlayerSettings().getConfig(TUT_PROG) != 450; } }, Calculations.random(1200, 2000)); return true; } else { if (getCamera().getPitch() < Calculations.random(150, 200)) { getCamera().rotateToPitch(Calculations.random(200, 360)); } } } return false; } private void talkToBanker() { Tile bankTile; if (inNewTutorial()) { bankTile = new Tile(1713, 6129, 0); } else { bankTile = new Tile(3122, 3123, 0); } if (getLocalPlayer().distance(bankTile) > 5) { getWalking().walk(bankTile); walkingSleep(); } else { if (getDialogues().getOptionIndex("Yes.") > 0) { getDialogues().clickOption("Yes."); sleepUntil(new Condition() { public boolean verify() { return getBank().isOpen(); } }, Calculations.random(1200, 1600)); getBank().depositAllItems(); sleepUntil(new Condition() { public boolean verify() { return getInventory().isEmpty(); } }, Calculations.random(800, 1200)); getBank().depositAllEquipment(); sleepUntil(new Condition() { public boolean verify() { return getEquipment().isEmpty(); } }, Calculations.random(800, 1200)); getBank().close(); sleepUntil(new Condition() { public boolean verify() { return !getBank().isOpen(); } }, Calculations.random(800, 1200)); } else { if (!getDialogues().canContinue()) { GameObject bankBooth = getGameObjects().closest("Bank booth"); if (bankBooth != null) { if (bankBooth.interact("Use")) { sleepUntil(new Condition() { public boolean verify() { return getDialogues().canContinue(); } }, Calculations.random(2400, 3000)); } } } else { getDialogues().clickContinue(); sleepUntil(new Condition() { public boolean verify() { return !getDialogues().canContinue(); } }, Calculations.random(1200, 1400)); } } } } private void usePollBooth() { if (getBank().isOpen()) { getBank().close(); sleepUntil(new Condition() { public boolean verify() { return !getBank().isOpen(); } }, Calculations.random(1200, 1600)); return; } log("Poll Open config: " + getPlayerSettings().getConfig(POLL_OPEN)); //Old method open if (getPlayerSettings().getConfig(POLL_OPEN) == 0) { GameObject pbooth = getGameObjects().closest("Poll booth"); if (pbooth != null) { if (pbooth.interact("Use")) { walkingSleep(); sleepUntil(new Condition() { public boolean verify() { return getDialogues().canContinue(); } }, 2400); } } if (getDialogues().canContinue()) { while (getDialogues().canContinue() || getPlayerSettings().getConfig(POLL_OPEN) == 0) { getDialogues().spaceToContinue(); sleep(300, 500); } } log("Poll config: " + getPlayerSettings().getConfig(POLL_OPEN)); sleep(300, 500); return; } Widget pollWidget = getWidgets().getWidget(345); log("Attempting new poll booth close"); if (pollWidget != null && pollWidget.isVisible()) { if (closePollBooth()) return; } //Close via old method if (getPlayerSettings().getConfig(POLL_OPEN) > 65536) { //TODO hacky WidgetChild bar = getWidgets().getChildWidget(310, 1); if (bar != null) { bar = bar.getChild(11); } if (bar != null && bar.isVisible()) { bar.interact(); sleepUntil(new Condition() { public boolean verify() { return getPlayerSettings().getConfig(POLL_OPEN) == 0; } }, Calculations.random(1200, 1500)); } return; } GameObject pbooth = getGameObjects().closest("Poll booth"); if (pbooth != null) { if (pbooth.interact("Use")) { walkingSleep(); sleepUntil(new Condition() { public boolean verify() { return getDialogues().canContinue(); } }, 2400); } } } private boolean closePollBooth() { Widget pollWidget = getWidgets().getWidget(345); if (pollWidget != null && pollWidget.isVisible()) { WidgetChild closeButton = pollWidget.getChild(2).getChild(11); if (closeButton == null) { log("Unable to find close button"); return false; } log("Closing poll booth"); closeButton.interact(); sleepUntil(() -> !pollWidget.isVisible(), 2000); return true; } return true; } private void homeTeleport() { Tile finalArea = new Tile(1733, 6096); getMagic().castSpell(Normal.HOME_TELEPORT); sleepUntil(() -> !finalArea.getArea(5).contains(getLocalPlayer().getTile()), 15000); } private void killChicken() { Tile chickenTile; if (inNewTutorial()) { chickenTile = new Tile(1733, 6099, 0); if (tryOtherWizard) { chickenTile = new Tile(1727, 6121, 0); } } else { chickenTile = new Tile(3139, 3091, 0); } if (getLocalPlayer().getTile().distance(chickenTile) > 2) { log("Walking closer to chicken"); getWalking().walk(chickenTile); walkingSleep(); return; } Entity chicken = getNpcs().closest("Chicken"); if (chicken == null) { log("Unable to find chicken to case wind strike"); return; } log("Casting wind strike on chicken"); if (getMagic().castSpellOn(Normal.WIND_STRIKE, chicken)) { sleepUntil(new Condition() { public boolean verify() { return getPlayerSettings().getConfig(TUT_PROG) != 650; } }, Calculations.random(1600, 2400)); } } private boolean tryOtherWizard = false; private void walkToWizard() { Tile wizardTile; //Random other wizard tile i think i have Tile otherWizardTile = new Tile(1727, 6121, 0); if (inNewTutorial()) { wizardTile = new Tile(1732, 6095, 0); if (tryOtherWizard) { log("Trying other wizard location"); wizardTile = otherWizardTile; } } else { wizardTile = new Tile(3141, 3088, 0); } if (getLocalPlayer().getTile().distance(wizardTile) > 5) { if (inNewTutorial()) { getWalking().walk(wizardTile); } else { getWalking().walk(prayToMage[prayToMage.length - 1]);//;,Calculations.random(10,15)); walkingSleep(); } } else { talkTo(MAGIC_GUIDE); } } private void walkToPrayer() { Tile prayerTile; if (inNewTutorial()) { prayerTile = new Tile(1714, 6115, 0); } else { prayerTile = new Tile(3122, 3123, 0); } if (getLocalPlayer().distance(prayerTile) > 5) { getWalking().walk(prayerTile); walkingSleep(); return; } openPrayerTab(); //Start chat with dude } private void openPrayerTab() { //open pray tab log("opening PRAYER tab"); getTabs().openWithMouse(Tab.PRAYER); sleepUntil(() -> getTabs().isOpen(Tab.PRAYER), 400); talkTo(PRAY_GUIDE); } private void openFriendsTab() { //open friends log("opening FRIENDS tab"); getTabs().openWithMouse(Tab.FRIENDS); sleepUntil(() -> getTabs().isOpen(Tab.FRIENDS), 400); talkTo(PRAY_GUIDE); } private boolean prayedAtAltar = false; private void turnOnThickSkin() { //open pray tab if (!getTabs().isOpen(Tab.PRAYER)) { log("opening PRAYER tab"); getTabs().openWithMouse(Tab.PRAYER); sleepUntil(() -> getTabs().isOpen(Tab.PRAYER), 600); return; } if (getSkills().getBoostedLevels(Skill.PRAYER) > 0 && !prayedAtAltar) { log("Turning on thick skin"); if (!getPrayer().isActive(Prayer.THICK_SKIN)) { getPrayer().toggle(true, Prayer.THICK_SKIN); sleepUntil(() -> getPrayer().isActive(Prayer.THICK_SKIN), 800); return; } sleepUntil(() -> getSkills().getBoostedLevels(Skill.PRAYER) == 0, 3000); return; } if (getSkills().getBoostedLevels(Skill.PRAYER) == 0) { log("Praying at altar"); if (getGameObjects().closest("Altar").interact("Pray-at")) prayedAtAltar = true; return; } talkTo(PRAY_GUIDE); } private void buryBones() { if (!getTabs().isOpen(Tab.INVENTORY)) { getTabs().openWithMouse(Tab.INVENTORY); sleepUntil(() -> getTabs().isOpen(Tab.INVENTORY), 600); } if (getInventory().get("Bones") != null) { getInventory().get("Bones").interact("Bury"); sleepUntil(() -> getInventory().get("Bones") == null, 700); } } private void cookShrimp() { GameObject fire = getGameObjects().closest("Fire"); if (fire == null) lightFire(); else { if (!getInventory().isItemSelected()) { if (getInventory().interact("Raw shrimps", "Use")) { sleepUntil(new Condition() { public boolean verify() { return getInventory().isItemSelected(); } }, Calculations.random(800, 1200)); } } if (getInventory().isItemSelected()) { if (fire.interact("Use")) { walkingSleep(); sleepUntil(new Condition() { public boolean verify() { return getLocalPlayer().getAnimation() != -1; } }, Calculations.random(2000, 3000)); sleepUntil(new Condition() { public boolean verify() { return getLocalPlayer().getAnimation() == -1; } }, Calculations.random(2000, 3000)); } } } } private void lightFire() { if (!getInventory().contains("Logs")) { GameObject tree = getGameObjects().closest("Tree"); if (tree != null) { if (tree.interact("Chop down")) { walkingSleep(); sleepUntil(new Condition() { public boolean verify() { return getInventory().contains("Logs"); } }, Calculations.random(1200, 1600)); } if (getLocalPlayer().getAnimation() != -1) { sleepUntil(new Condition() { public boolean verify() { return getInventory().contains("Logs"); } }, Calculations.random(4000, 5000)); } } } if (getGameObjects().getTopObjectOnTile(getLocalPlayer().getTile()) != null && getGameObjects().getTopObjectOnTile(getLocalPlayer().getTile()).getName().equals("Fire")) { log("fire in the way, moving"); if (inNewTutorial()) { getWalking().walk(getLocalPlayer().getTile().getArea(2).getRandomTile()); walkingSleep(); return; } else { //Avoid burning where the other bots do Area burnArea = new Area(new Tile(3104, 3098), new Tile(3106, 3100)); getWalking().walk(burnArea.getRandomTile()); sleep(1000, 4000); } } if (getInventory().contains("Logs")) { if (!getInventory().isItemSelected()) { getInventory().interact("Tinderbox", "Use"); sleepUntil(new Condition() { public boolean verify() { return getInventory().isItemSelected(); } }, Calculations.random(800, 1200)); } if (getInventory().isItemSelected()) { getInventory().interact("Logs", "Use"); sleepUntil(new Condition() { public boolean verify() { return getLocalPlayer().getAnimation() != -1; } }, Calculations.random(1200, 1600)); sleepUntil(new Condition() { public boolean verify() { return getLocalPlayer().getAnimation() == -1; } }, Calculations.random(6000, 8000)); } } } private void talkTo(String npc) { log("Talking to: " + npc); List<WidgetChild> clickToContinue = getWidgets().getWidgetChildrenContainingText("Click to continue"); if (!clickToContinue.isEmpty()) { WidgetChild wc = clickToContinue.get(0); if (wc != null && wc.isVisible()) { log("Interacting with widget"); wc.interact(); sleep(900, 1200); } log("no widget interaction"); } //If speaking to RS Guide, check for the option of experienced player if (getWidgets().getWidget(219) != null && getWidgets().getWidget(219).isVisible()) { if (getWidgets().getWidget(219).getChild(1) != null && getWidgets().getWidget(219).getChild(1).isVisible()) { WidgetChild[] widgetOptions = getWidgets().getWidget(219).getChild(1).getChildren(); for (int idx = 0; idx < widgetOptions.length; idx++) { log("Option (" + idx + ") ='" + widgetOptions[idx].getText() + "'"); if (widgetOptions[idx].getText().equals("I am an experienced player.")) { log("Option detected at idx: " + idx); getKeyboard().type(idx); sleep(600, 1200); break; } if (widgetOptions[idx].getText().equals("No, I'm not planning to do that.")) { log("Option detected at idx: " + idx); getKeyboard().type(idx); sleep(600, 1200); break; } } } } String[] options = getDialogues().getOptions(); if (options != null) { log("Options detected: " + options.toString()); for (int i = 0; i < options.length; i++) { log("Option (" + i + ") ='" + options[i] + "'"); } getKeyboard().type("1"); sleep(600, 800); } if (getDialogues().canContinue()) { log("talkTo - Space continue"); getDialogues().spaceToContinue(); return; } final NPC guide = getNpcs().closest(npc); log("finding npc " + guide); if (npc.equals(MAGIC_GUIDE) && guide == null) { log("Cant find wizard, trying other location"); tryOtherWizard = true; return; } if (guide != null) { if (!getClientSettings().isResizableActive()) { if (guide.isOnScreen()) { if (guide.interact("Talk-to")) { walkingSleep(); sleepUntil(new Condition() { public boolean verify() { return getDialogues().canContinue(); } }, Calculations.random(1200, 1600)); } } else { getWalking().walk(guide); walkingSleep(); } } else { Point p = guide.getModel().calculateCenterPoint(); p.setLocation(p.getX() * (CANVAS.getWidth() / GAME_SCREEN.getWidth()), p.getY() * (CANVAS.getHeight() / GAME_SCREEN.getHeight())); getMouse().hop(p); sleep(50, 80); getMouse().click(true); sleep(200, 400); } } if (getClient().getMenu().isMenuVisible()) { if (getClient().getMenu().contains("Talk-to")) { getClient().getMenu().clickAction("Talk-to"); sleepUntil(() -> getDialogues().canContinue(), Calculations.random(2000, 3000)); } else { getClient().getMenu().close(); sleep(600, 900); } } } private int chopClosestTree() { GameObject tree = getGameObjects().closest("Tree"); if (tree != null) { if (getLocalPlayer().getAnimation() != -1) { sleepUntil(new Condition() { public boolean verify() { return getInventory().contains("Logs"); } }, Calculations.random(1000, 2000)); return 0; } if (tree.interact("Chop down")) { walkingSleep(); sleepUntil(new Condition() { public boolean verify() { return getInventory().contains("Logs"); } }, Calculations.random(1000, 2000)); } } log("Unable to find tree close to player"); return 0; } private int setApperance() { Rectangle acceptBox = new Rectangle(246, 269, 50, 40); sleep(this.clickArea(acceptBox)); return 0; } private int clickArea(Rectangle area) { getMouse().move(area); sleep(200, 500); getMouse().click(); return Calculations.random(0, 600); } private Tab getTab() { int conf = getPlayerSettings().getConfig(TAB_CONFIG); switch (conf) { case 1: return Tab.COMBAT; case 2: return Tab.STATS; case 3: return Tab.QUEST; case 4: return Tab.INVENTORY; case 5: return Tab.EQUIPMENT; case 6: return Tab.PRAYER; case 7: return Tab.MAGIC; case 8: return Tab.CLAN; case 10: case 9: return Tab.FRIENDS; case 11: return Tab.LOGOUT; case 12: return Tab.OPTIONS; case 13: return Tab.EMOTES; case 14: return Tab.MUSIC; } return null; } private void getCurrentStep() { int maj = getPlayerSettings().getConfig(TUT_PROG_MAJOR); int min = getPlayerSettings().getConfig(TUT_PROG_MINOR); } private void walkingSleep() { sleepUntil(new Condition() { public boolean verify() { return getLocalPlayer().isMoving(); } }, Calculations.random(1200, 1600)); sleepUntil(new Condition() { public boolean verify() { return !getLocalPlayer().isMoving(); } }, Calculations.random(2400, 3600)); } public void onPaint(Graphics g) { if (state != null) { g.drawString("State: " + state.toString(), 10, 40); } g.drawString("Current progress: " + (inNewTutorial() ? getPlayerSettings().getConfig(TUT_PROG_NEW) : getPlayerSettings().getConfig(TUT_PROG)), 10, 60); if (t != null) g.drawString("Runtime: " + t.formatTime(), 10, 80); g.drawString("inNewTutorial: " + this.inNewTutorial(), 10, 100); g.drawString("exactZoomValue: " + getClientSettings().getExactZoomValue(), 10, 120); } } Link to comment Share on other sites More sharing options...
fluffy 2 Share Posted May 27, 2020 very nice 😛 Link to comment Share on other sites More sharing options...
TheCloakdOne 389 Author Share Posted May 28, 2020 Thanks its quick and dirty just to get anyone struggling back up and running, will tidy on the weekend with a full release of one built from scratch Link to comment Share on other sites More sharing options...
LordJashin32 54 Share Posted August 28, 2020 Wow that is a long script for the 15min island lol. We need AI for this at this point i think. Cheers. Nice. Link to comment Share on other sites More sharing options...
creaseme 1 Share Posted September 1, 2020 how can i use this i tried putting it all in a text file and renaming it to a .jar im not well versed Link to comment Share on other sites More sharing options...
AsBakedAsCake 203 Share Posted September 1, 2020 5 hours ago, creaseme said: how can i use this i tried putting it all in a text file and renaming it to a .jar im not well versed You need to use an IDE to compile the script into a jar. Link to comment Share on other sites More sharing options...
creaseme 1 Share Posted September 2, 2020 i used eclipse to try that lastnight before you replied but its not not being recognized by dreambot does it need to be a runnable jar? Link to comment Share on other sites More sharing options...
AsBakedAsCake 203 Share Posted September 2, 2020 14 hours ago, creaseme said: i used eclipse to try that lastnight before you replied but its not not being recognized by dreambot does it need to be a runnable jar? For DB2 you'll need to add the client.jar as a library in your project structure. To do this on DB3 you'll use the client-3.0.0.jar or w/e Output the artifact to your dreambot scripts folder. Link to comment Share on other sites More sharing options...
TheCloakdOne 389 Author Share Posted September 3, 2020 just FYI guys this script is most likely out of date now and will probably get stuck. Use with caution! Link to comment Share on other sites More sharing options...
JAG98 4 Share Posted November 24, 2020 Trying to work on a tut island script. Noob question: How do you identify / know what each player config value represents? Any doc, sources, anything? Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.