Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Map;
- import java.awt.Graphics;
- import java.awt.Color;
- import org.rsbot.script.ScriptManifest;
- import org.rsbot.bot.Bot;
- import org.rsbot.event.listeners.PaintListener;
- import org.rsbot.script.Constants;
- import org.rsbot.script.Script;
- import org.rsbot.script.wrappers.RSInterface;
- import org.rsbot.script.wrappers.RSInterfaceChild;
- import org.rsbot.script.wrappers.RSInterfaceComponent;
- import org.rsbot.script.wrappers.RSItemTile
- import org.rsbot.script.wrappers.RSTile;
- import org.rsbot.script.wrappers.RSNPC;
- @ScriptManifest(name = "TISolver", authors = {"Fred"}, category = "Other", version = 1.08, description = "<html><body><input type=\"checkbox\" name=\"Auto\" value=\"yes\">Auto Create Account?<br><table width=\"239\" border=\"0\"><tr><td width=\"7\"></td><td width=\"216\">Prefix: <input type=\"text\" name=\"prefix\" id=\"pref\" size=10 /></td></tr><tr><td></td><td>Password: <input type=\"text\" name=\"password\" id=\"pass\" size=10 /></td></tr></table><br><select name=\"skill\"><option value=\"Mining\">Mining</option><option value=\"Woodcutting\">Woodcutting</option></select></body></html>")
- public class TISolver extends Script implements PaintListener {
- boolean autoCreate = false, usernameTaken = false, passwordDunMatch = false;
- String prefix, password, username;
- int[] interfaceID;
- int suffix = -1;
- RSTile referenceTile;
- RSObject hole, plank, bag;
- RSNPC Vant, Goblin, Vant2, Roddeck;
- int[] NPCIDs = {8850, 8862, 8848, 8867};
- int[] armoursonfloor = {1117, 1173, 1277};
- int accountsCreated = 0;
- int height = 1;
- long startTime = 0;
- long totalTime = 0;
- long averageTime = 0;
- boolean disableRandoms = false;
- boolean disableAutoLogin = false;
- boolean mining = true;
- String blabla = "random stuff";
- @Override
- public boolean onStart(final Map<String, String> args) {
- disableRandoms = Bot.disableRandoms;
- disableAutoLogin = Bot.disableAutoLogin;
- Bot.disableRandoms = false;
- Bot.disableAutoLogin = true;
- if (args.get("Auto") != null) {
- autoCreate = true;
- prefix = args.get("prefix");
- password = args.get("password");
- }
- if (args.get("skill").equals("Woodcutting")) {
- mining = false;
- }
- return true;
- }
- @Override
- public void onFinish() {
- Bot.disableRandoms = disableRandoms;
- Bot.disableAutoLogin = disableAutoLogin;
- }
- @Override
- public int loop() {
- if (!isLoggedIn()) {
- if (getInterface(906).getChild(179).isValid()) {
- atInterface(getInterface(906, 179));
- return random(250, 300);
- }
- if (autoCreate) {
- startTime = System.currentTimeMillis();
- if (interfaceThatContains("Create a Free") == null) {
- if (getInterface(905, 58) == null) {
- return random(250, 300);
- }
- clickRSComponent(getInterface(905, 58), random(0, 6), true);
- wait(random(1000, 1500));
- }
- atInterface(getInterface(673, 103));
- wait(random(1000, 1500));
- do {
- if (usernameTaken) {
- atInterface(interfaceThatContains("close"));
- int numberOfCharToDelete = (suffix - 1 == -1) ? 0 : ("" + suffix).length();
- for (int i = 0; i < numberOfCharToDelete; i++) {
- Bot.getInputManager().pressKey((char) java.awt.event.KeyEvent.VK_BACK_SPACE);
- wait(random(200, 300));
- Bot.getInputManager().releaseKey((char) java.awt.event.KeyEvent.VK_BACK_SPACE);
- }
- }
- username = prefix + ((suffix == -1) ? "" : ("" + suffix));
- if (username.length() > 12) {
- log("Used up all account names");
- stopScript();
- return -1;
- }
- if (usernameTaken) {
- sendText("" + suffix, false);
- } else {
- sendText(username, false);
- }
- suffix++;
- atInterface(getInterface(673, 87));
- wait(random(1500, 2000));
- while (interfaceThatContains("Please wait...") != null) {
- wait(100);
- }
- usernameTaken = true;
- } while (getInterface(673, 117).getBackgroundColor() != 1803);
- usernameTaken = false;
- do {
- if (passwordDunMatch) {
- RSInterfaceChild temp = getInterface(673, 87);
- moveMouse(random(temp.getAbsoluteX() + 142, temp.getAbsoluteX() + temp.getWidth()), random(temp.getAbsoluteY(), temp.getAbsoluteY() + temp.getHeight()));
- clickMouse(true);
- wait(random(1000, 1500));
- int numberOfCharInTextBox = getInterface(673, 99).getText().length();
- for (int i = 0; i < numberOfCharInTextBox; i++) {
- Bot.getInputManager().pressKey((char) java.awt.event.KeyEvent.VK_BACK_SPACE);
- wait(random(200, 300));
- Bot.getInputManager().releaseKey((char) java.awt.event.KeyEvent.VK_BACK_SPACE);
- }
- }
- wait(random(1000, 1500));
- sendText(password, false);
- if (passwordDunMatch) {
- RSInterfaceChild temp = getInterface(673, 72);
- moveMouse(random(temp.getAbsoluteX() + 142, temp.getAbsoluteX() + temp.getWidth()), random(temp.getAbsoluteY(), temp.getAbsoluteY() + temp.getHeight()));
- clickMouse(true);
- wait(random(1000, 1500));
- int numberOfCharInTextBox = getInterface(673, 83).getText().length();
- for (int i = 0; i < numberOfCharInTextBox; i++) {
- Bot.getInputManager().pressKey((char) java.awt.event.KeyEvent.VK_BACK_SPACE);
- wait(random(200, 300));
- Bot.getInputManager().releaseKey((char) java.awt.event.KeyEvent.VK_BACK_SPACE);
- }
- } else {
- atInterface(getInterface(673, 72));
- }
- wait(random(1000, 1500));
- sendText(password, false);
- atInterface(getInterface(673, 28));
- wait(random(1500, 2000));
- passwordDunMatch = true;
- } while (interfaceThatContains("Please make sure both passwords match") != null);
- passwordDunMatch = false;
- while (interfaceThatContains("Please wait...") != null) {
- wait(100);
- }
- while (interfaceThatContains("Play RuneScape") != null) {
- atInterface(getInterface(669, 18));
- wait(random(1000, 2000));
- }
- atInterface(getInterface(596, 67));
- wait(random(1000, 1500));
- sendText(username, false);
- atInterface(getInterface(596, 74));
- wait(random(1000, 1500));
- sendText(password, false);
- while (interfaceThatContains("PLAY NOW") == null) {
- atInterface(getInterface(596, 75));
- wait(random(2000, 3000));
- }
- wait(random(750, 1000));
- while (interfaceThatContains("Character Setup") == null || interfaceThatContains("PLAY NOW") != null) {
- atInterface(getInterface(906, random(74, 77)));
- wait(random(3000, 4000));
- }
- atInterface(getInterface(900, 80));
- wait(random(2000, 3000));
- return 100;
- } else {
- log("Please login first =)");
- stopScript();
- return -1;
- }
- }
- if (canContinue()) {
- clickContinue();
- return random(200, 300);
- }
- if (!getInterface(752).getChild(4).getText().contains(blabla)) {
- blabla = getInterface(752).getChild(4).getText();
- moveMouse(random(188, 332), random(444, 453));
- clickMouse(true);
- return random(750, 1000);
- }
- if (interfaceThatContains("Controls") != null) {
- int key = java.awt.event.KeyEvent.VK_UP;
- Bot.getInputManager().pressKey((char) key);
- wait(random(1000, 1500));
- Bot.getInputManager().releaseKey((char) key);
- key = (random(0, 2) == 0) ? java.awt.event.KeyEvent.VK_LEFT : java.awt.event.KeyEvent.VK_RIGHT;
- Bot.getInputManager().pressKey((char) key);
- wait(random(1000, 1500));
- Bot.getInputManager().releaseKey((char) key);
- return random(200, 300);
- }
- if (interfaceThatContains("Rotate the camera using the arrow") != null || interfaceThatContains("Talk to Sir Vant to find out") != null) {
- if (interfaceThatContains("Great, you've got the dragon in the right place") != null) {
- Vant = getNearestNPCByID(NPCIDs[2]);
- } else {
- Vant = getNearestNPCByID(NPCIDs[0]);
- }
- if (Vant == null) {
- return random(200, 300);
- }
- if (!pointOnScreen(Vant.getScreenLocation())) {
- walkTo(Vant.getLocation());
- waitUntilNotMoving();
- }
- atNPC(Vant, "Talk");
- wait(random(1000, 2000));
- return random(200, 300);
- }
- if (interfaceThatContains("Right-click on the items on the floor") != null) {
- RSItemTile stuff = getNearestGroundItemByID(armoursonfloor);
- while (stuff != null) {
- atTile(stuff, "Take");
- wait(random(500, 750));
- stuff = getNearestGroundItemByID(armoursonfloor);
- }
- return random(200, 300);
- }
- if (interfaceThatContains("Click on the flashing") != null) {
- if (interfaceThatContains("worn items") != null) {
- openTab(TAB_EQUIPMENT);
- } else if (interfaceThatContains("quest journal") != null) {
- openTab(TAB_QUESTS);
- } else if (interfaceThatContains("objectives") != null) {
- atInterface(interfaceThatHasActions("Objectives"));
- } else if (interfaceThatContains("stats") != null) {
- openTab(TAB_STATS);
- } else {
- openTab(TAB_INVENTORY);
- }
- return random(200, 300);
- }
- if (interfaceThatContains("Right-click on an item in your inventory") != null) {
- while (getInventoryCount(1117) == 1) {
- atInventoryItem(1117, "Wear");
- wait(random(500, 750));
- }
- while (getInventoryCount(1173) == 1) {
- atInventoryItem(1173, "Wield");
- wait(random(500, 750));
- }
- while (getInventoryCount(1277) == 1) {
- atInventoryItem(1277, "Wield");
- wait(random(500, 750));
- }
- return random(200, 300);
- }
- if (interfaceThatContains("Your worn items screen shows you") != null) {
- while ((Goblin = getNearestNPCByID(NPCIDs[1])) != null) {
- if (Goblin.getAnimation() == 6182) {
- break;
- }
- if (!pointOnScreen(Goblin.getScreenLocation())) {
- walkTo(Goblin.getLocation());
- waitUntilNotMoving();
- }
- if (!getMyPlayer().isInCombat()) {
- atNPC(Goblin, "Attack");
- wait(random(3000, 4000));
- }
- }
- return random(300, 500);
- }
- if (interfaceThatContains("You'll see that Unstable Foundations is") != null) {
- moveMouse(random(564, 664), random(309, 314));
- clickMouse(true);
- return random(750, 1000);
- }
- if (interfaceThatContains("Now click on the world map") != null) {
- atInterface(interfaceThatHasActions("World Map"));
- return random(750, 1000);
- }
- if (interfaceThatContains("Click on the compass") != null) {
- while (RSInterface.getChildInterface(755, 0).getComponents().length > 0) {
- wait(100);
- }
- atInterface(interfaceThatHasActions("Face North"));
- return random(750, 1000);
- }
- if (interfaceThatContains("Time to get on with the quest") != null) {
- if (interfaceThatContains("You'll need to climb over") != null) {
- hole = getNearestObjectByID(45603);
- atObject(hole, "Climb");
- return random(750, 1000);
- }
- bag = getNearestObjectByID(45783);
- while (getInventoryCount(15277) == 0) {
- if (!tileOnScreen(bag.getLocation())) {
- walkTo(bag.getLocation());
- waitUntilNotMoving();
- }
- atObject(bag, "Search");
- wait(random(6000, 7000));
- }
- return random(750, 1000);
- }
- if (interfaceThatContains("The wall is too high") != null) {
- plank = getNearestObjectByID(45652);
- setCameraAltitude(true);
- atObject(plank, "Take");
- return random(1500, 2000);
- }
- if (interfaceThatContains("Right-click on the plank in your inventory") != null) {
- hole = getNearestObjectByID(45603);
- openTab(TAB_INVENTORY);
- while (getInventoryCount(15276) == 1) {
- atInventoryItem(15276, "Use");
- wait(random(750, 1000));
- atObject(hole, "Use");
- wait(random(2000, 3000));
- }
- return random(750, 1000);
- }
- if (interfaceThatContains("The ramp should make it possible for you") != null) {
- hole = getNearestObjectByID(45603);
- RSTile currentTile = getMyPlayer().getLocation();
- while (getMyPlayer().getLocation().getY() == currentTile.getY()) {
- atObject(hole, "Climb");
- wait(random(1000, 1500));
- while (getMyPlayer().getAnimation() != -1) {
- wait(100);
- }
- }
- return random(2000, 3000);
- }
- if (getNearestObjectByID(45795) != null) {
- if (distanceTo(getNearestObjectByID(45795).getLocation()) < 5) {
- while (getInventoryCount(15277) == 1) {
- atInventoryItem(15277, "Use");
- wait(random(300, 500));
- atObject(getNearestObjectByID(45795), "Use");
- wait(random(3000, 5000));
- }
- return random(200, 300);
- }
- }
- if (interfaceThatContains("Explore the cellar until") != null) {
- referenceTile = getNearestObjectByID(45563).getLocation();
- if (distanceTo(new RSTile(referenceTile.getX() - 1, referenceTile.getY() + 17)) > 5 && getMyPlayer().getLocation().getY() < referenceTile.getY() + 17) {
- walkTo(new RSTile(referenceTile.getX() - 1, referenceTile.getY() + 17));
- waitUntilNotMoving();
- setRun(true);
- walkTo(new RSTile(referenceTile.getX() - 1, referenceTile.getY() + 17));
- waitUntilNotMoving();
- }
- walkTo(new RSTile(referenceTile.getX() - 15, referenceTile.getY() + 24));
- waitUntilNotMoving();
- return random(750, 1000);
- }
- if (interfaceThatContains("Check the quest journal") != null) {
- setCameraAltitude(true);
- if (getInventoryCount(590) == 0) {
- bag = getNearestObjectByID(45783);
- while (getInventoryCount(590) == 0) {
- if (!tileOnScreen(bag.getLocation())) {
- walkTo(bag.getLocation());
- waitUntilNotMoving();
- }
- atObject(bag, "Search");
- wait(random(6000, 7000));
- }
- return random(500, 750);
- }
- if (getInventoryCount(15278) == 1) {
- atInventoryItem(15278, "Rip");
- return random(500, 750);
- }
- if (getInventoryCount(15280) > 0) {
- atInventoryItem(15284, "Use");
- wait(random(500, 750));
- atInventoryItem(15280, "Use");
- return random(500, 750);
- }
- RSObject Pillar = getNearestObjectByID(45564);
- if (getInventoryCount(15281) == 2) {
- atInventoryItem(15281, "Use");
- wait(random(500, 750));
- atObject(Pillar, "Use");
- return random(1000, 1500);
- }
- if (getInventoryCount(15282) == 1) {
- atInventoryItem(15282, "Use");
- wait(random(500, 750));
- atObject(Pillar, "Use");
- return random(1000, 1500);
- }
- Pillar = getNearestObjectByID(45565);
- if (!tileOnScreen(Pillar.getLocation())) {
- walkTo(Pillar.getLocation());
- waitUntilNotMoving();
- return random(500, 750);
- }
- if (getInventoryCount(15281) == 1) {
- atInventoryItem(15281, "Use");
- wait(random(500, 750));
- atObject(Pillar, "Use");
- return random(1000, 1500);
- }
- if (getInventoryCount(15283) == 1) {
- atInventoryItem(15283, "Use");
- wait(random(500, 750));
- atObject(Pillar, "Use");
- return random(1000, 1500);
- }
- }
- if (interfaceThatContains("give Sir Vant a tinderbox") != null) {
- setCameraAltitude(true);
- Vant = getNearestNPCByID(NPCIDs[2]);
- if (Vant == null) {
- return random(500, 750);
- }
- if (!pointOnScreen(Vant.getScreenLocation())) {
- walkTo(Vant.getLocation());
- waitUntilNotMoving();
- }
- while (getInventoryCount(590) > 1) {
- atInventoryItem(590, "Use");
- wait(random(500, 750));
- atNPC(Vant, "Use");
- return random(2000, 3000);
- }
- }
- if (interfaceThatContains("Use your tinderbox on the pillar") != null) {
- setCameraAltitude(true);
- RSObject Pillar = getNearestObjectByID(45565);
- if (!tileOnScreen(Pillar.getLocation())) {
- walkTo(Pillar.getLocation());
- waitUntilNotMoving();
- }
- atInventoryItem(590, "Use");
- wait(random(500, 750));
- atObject(Pillar, "Use");
- return random(3000, 4000);
- }
- if (interfaceThatContains("RUN! RUN! RUN!") != null) {
- RSObject Pillar = getNearestObjectByID(45565);
- walkTo(new RSTile(Pillar.getLocation().getX() + 7, Pillar.getLocation().getY()));
- return random(2000, 3000);
- }
- if (interfaceThatContains("Congratulations, the dragon's dead!") != null) {
- Roddeck = getNearestNPCByID(NPCIDs[3]);
- atNPC(Roddeck, "Talk");
- return random(1000, 1500);
- }
- if (interfaceThatContains("Click on the question mark button") != null) {
- atInterface(interfaceThatHasActions("Advisor"));
- return random(500, 750);
- }
- if (interfaceThatContains("Sir Vant wants his squire's kit back") != null) {
- openTab(TAB_EQUIPMENT);
- wait(random(500, 750));
- while (equipmentContains(1117)) {
- atEquippedItem(1117, "Remove");
- }
- while (equipmentContains(1173)) {
- atEquippedItem(1173, "Remove");
- }
- while (equipmentContains(1277)) {
- atEquippedItem(1277, "Remove");
- }
- return random(500, 750);
- }
- if (interfaceThatContains("To give Sir Vant an item") != null) {
- openTab(TAB_INVENTORY);
- wait(random(500, 750));
- Vant = getNearestNPCByID(NPCIDs[2]);
- if (!pointOnScreen(Vant.getScreenLocation())) {
- walkTo(Vant.getLocation());
- waitUntilNotMoving();
- }
- while (getInventoryCount(590) == 1) {
- atInventoryItem(590, "Use");
- wait(random(500, 750));
- atNPC(Vant, "Use");
- wait(random(5000, 6000));
- }
- return random(500, 750);
- }
- if (interfaceThatContains("Okay, I'll get on with it") != null) {
- atInterface(interfaceThatContains("Okay, I'll get on with it"));
- return random(500, 750);
- }
- if (interfaceThatContains("I'll mine through the rocks") != null) {
- if (mining) {
- atInterface(interfaceThatContains("I'll mine through the rocks"));
- } else {
- atInterface(interfaceThatContains("I'll chop through the roots"));
- }
- return random(500, 750);
- }
- if (interfaceThatContains("Speak to Roddeck, your advisor, about breaking") != null) {
- setCameraAltitude(true);
- Roddeck = getNearestNPCByID(NPCIDs[3]);
- if (!pointOnScreen(Roddeck.getScreenLocation())) {
- walkTo(Roddeck.getLocation());
- waitUntilNotMoving();
- }
- atNPC(Roddeck, "Talk");
- return random(500, 750);
- }
- if (interfaceThatContains("While you've got a pickaxe") != null) {
- RSObject damagedWallRock = getNearestObjectByID(45595);
- if (!tileOnScreen(damagedWallRock.getLocation())) {
- walkTo(damagedWallRock.getLocation());
- waitUntilNotMoving();
- }
- atObject(damagedWallRock, "Mine");
- wait(random(5000, 6000));
- return random(500, 750);
- }
- if (interfaceThatContains("While you've got a hatchet") != null) {
- RSObject roots = getNearestObjectByID(45598);
- if (!tileOnScreen(roots.getLocation())) {
- walkTo(roots.getLocation());
- waitUntilNotMoving();
- }
- atObject(roots, "Chop");
- wait(random(5000, 6000));
- return random(500, 750);
- }
- if (interfaceThatContains("Your current objective is to raise your Mining level") != null) {
- setCameraAltitude(true);
- RSObject Rocks = getNearestObjectByID(45580);
- if (!tileOnScreen(Rocks.getLocation())) {
- walkTo(Rocks.getLocation());
- waitUntilNotMoving();
- }
- while (skills.getCurrentSkillLevel(Constants.STAT_MINING) < 2) {
- atObject(Rocks, "Mine");
- wait(random(2000, 3000));
- while (getMyPlayer().getAnimation() == 6747) {
- wait(100);
- }
- }
- return random(500, 750);
- }
- if (interfaceThatContains("Your current objective is to raise your Woodcutting level") != null) {
- setCameraAltitude(true);
- RSObject treeRoots = getObjectAt(getNearestObjectByID(45589).getLocation().getX(), getNearestObjectByID(45589).getLocation().getY() + 1);
- if (!tileOnScreen(treeRoots.getLocation())) {
- walkTo(treeRoots.getLocation());
- waitUntilNotMoving();
- }
- while (skills.getCurrentSkillLevel(Constants.STAT_WOODCUTTING) < 2) {
- atObject(treeRoots, "Chop");
- wait(random(2000, 3000));
- while (getMyPlayer().getAnimation() == 879) {
- wait(100);
- }
- }
- return random(500, 750);
- }
- if (interfaceThatContains("set yourself an objective") != null) {
- atInterface(interfaceThatHasActions("Objectives"));
- wait(random(1000, 1500));
- if (mining) {
- if (interfaceThatContains("Increase Mining from") == null) {
- atInterface(interfaceThatHasActions("Give random objective"));
- }
- wait(random(1000, 1500));
- atInterface(interfaceThatContains("Increase Mining from"));
- wait(random(500, 750));
- } else {
- if (interfaceThatContains("Increase Woodcutting from") == null) {
- atInterface(interfaceThatHasActions("Give random objective"));
- }
- wait(random(1000, 1500));
- atInterface(interfaceThatContains("Increase Woodcutting from"));
- wait(random(500, 750));
- }
- if (interfaceThatContains("Advisor") == null) {
- atInterface(interfaceThatHasActions("Advisor"));
- }
- return random(1000, 2000);
- }
- if (interfaceThatContains("advisor button") != null) {
- if (interfaceThatContains("How can I raise my") == null) {
- atInterface(interfaceThatHasActions("Advisor"));
- }
- wait(random(1000, 1500));
- if (interfaceThatContains("How can I raise my") == null) {
- return random(500, 750);
- }
- atInterface(interfaceThatContains("How can I raise my"));
- return random(500, 750);
- }
- if (interfaceThatContains("Your Mining level is now high enough") != null) {
- RSObject damagedWallRock = getNearestObjectByID(45595);
- if (damagedWallRock != null) {
- if (!tileOnScreen(damagedWallRock.getLocation())) {
- walkTo(damagedWallRock.getLocation());
- waitUntilNotMoving();
- }
- atObject(damagedWallRock, "Mine");
- return random(500, 750);
- } else {
- damagedWallRock = getNearestObjectByID(45597);
- if (damagedWallRock == null) {
- return random(200, 300);
- }
- atObject(damagedWallRock, "Climb");
- wait(random(750, 1000));
- while (getMyPlayer().getAnimation() == 12280 || getMyPlayer().isMoving()) {
- wait(100);
- }
- return random(500, 750);
- }
- }
- if (interfaceThatContains("Your Woodcutting level is now high enough") != null) {
- RSObject root = getNearestObjectByID(45598);
- if (root != null) {
- if (!tileOnScreen(root.getLocation())) {
- walkTo(root.getLocation());
- waitUntilNotMoving();
- }
- atObject(root, "Chop");
- return random(500, 750);
- } else {
- root = getNearestObjectByID(45600);
- if (root == null) {
- return random(200, 300);
- }
- atObject(root, "Climb");
- wait(random(750, 1000));
- while (getMyPlayer().isMoving()) {
- wait(100);
- }
- return random(500, 750);
- }
- }
- if (interfaceThatContains("Escape up the ladder to freedom!") != null) {
- openTab(TAB_INVENTORY);
- while (inventoryContains(15286)) {
- atInventoryItem(15286, "Drop");
- wait(random(500, 750));
- clickContinue();
- }
- while (inventoryContains(15285)) {
- atInventoryItem(15285, "Drop");
- wait(random(500, 750));
- clickContinue();
- }
- RSObject ladder = getNearestObjectByID(45784);
- if (ladder == null) {
- return random(250, 300);
- }
- atInterface(interfaceThatHasActions("Face North"));
- if (distanceTo(ladder.getLocation()) > 3) {
- walkTo(ladder.getLocation());
- waitUntilNotMoving();
- }
- while (interfaceThatContains("Thank you again") == null) {
- ladder = getNearestObjectByID(45784);
- if (ladder == null) {
- break;
- }
- atTile(ladder.getLocation(), random(20, 50), 0.5, 1, "Climb");
- }
- return random(500, 750);
- }
- if (interfaceThatContains("You're out!") != null) {
- Vant = getNearestNPCByID(NPCIDs[2]);
- if (Vant == null) {
- moveMouse(random(188, 332), random(444, 453));
- clickMouse(true);
- return random(500, 750);
- }
- if (Vant.isMoving()) {
- moveMouse(random(188, 332), random(444, 453));
- clickMouse(true);
- return random(500, 750);
- }
- walkTo(Vant.getLocation());
- setCameraAltitude(true);
- waitUntilNotMoving();
- if (!pointOnScreen(Vant.getScreenLocation())) {
- walkTo(Vant.getLocation());
- waitUntilNotMoving();
- }
- atNPC(Vant, "Talk");
- return random(500, 750);
- }
- if (interfaceThatContains("Roddeck would like to offer you some") != null) {
- setCameraAltitude(true);
- Roddeck = getNearestNPCByID(NPCIDs[3]);
- if (!pointOnScreen(Roddeck.getScreenLocation())) {
- walkTo(Roddeck.getLocation());
- waitUntilNotMoving();
- }
- atNPC(Roddeck, "Talk");
- return random(500, 750);
- }
- if (interfaceThatContains("You may now leave via the door") != null) {
- atInterface(interfaceThatHasActions("Face North"));
- RSObject door = getNearestObjectByID(45801);
- if (door == null) {
- return random(200, 300);
- }
- atTile(door.getLocation(), random(20, 50), random(0.0, 1.0), 0, "Open");
- return random(500, 750);
- }
- if (distanceTo(new RSTile(3204, 3246)) < 8) {
- if (!autoCreate) {
- log("Tutorial Finished! =)");
- logoutToLogin();
- stopScript();
- } else {
- java.io.BufferedWriter out;
- java.io.FileWriter fstream;
- java.io.File accounts = new java.io.File("Accounts.txt");
- if (accounts.exists()) {
- try {
- fstream = new java.io.FileWriter("Accounts.txt", true);
- out = new java.io.BufferedWriter(fstream);
- out.newLine();
- out.write(username);
- out.close();
- } catch (java.io.IOException e) {
- }
- } else {
- try {
- fstream = new java.io.FileWriter("Accounts.txt", false);
- out = new java.io.BufferedWriter(fstream);
- out.write(username);
- out.close();
- } catch (java.io.IOException e) {
- }
- }
- log("Account " + username + " has been saved");
- accountsCreated++;
- totalTime += System.currentTimeMillis() - startTime;
- averageTime = totalTime / accountsCreated;
- logoutToLogin();
- while (isLoggedIn()) {
- wait(10);
- }
- return random(200, 300);
- }
- }
- return random(200, 300);
- }
- public void onRepaint(Graphics g) {
- final int x = 515 - 230;
- int y = 4;
- long timeToDisplay = averageTime;
- long minutes = timeToDisplay / 1000 / 60;
- timeToDisplay -= minutes * 1000 * 60;
- long seconds = timeToDisplay / 1000;
- g.setColor(new Color(0, 0, 0, 150));
- g.fillRoundRect(x, y, 230, height, 15, 15);
- g.setColor(new Color(0, 255, 0, 255));
- g.drawRoundRect(x, y, 230, height, 20, 15);
- g.drawString("TISolver v" + getVersion(), x + 76, y += 15);
- if (autoCreate) {
- g.drawString("Accounts Created: " + accountsCreated, x + 60, y += 15);
- if (accountsCreated > 0) {
- g.drawString("Average Time per Account: " + minutes + "min" + seconds + "sec", x + 10, y += 15);
- }
- }
- height = y + 3;
- }
- public String getVersion() {
- return "" + getClass().getAnnotation(ScriptManifest.class).version();
- }
- public RSInterfaceChild interfaceThatContains(String str) {
- if (Bot.getClient().getRSInterfaceCache() == null) {
- return null;
- }
- for (RSInterface interfaces : RSInterface.getAllInterfaces()) {
- if (interfaces.isValid()) {
- for (RSInterfaceChild children : interfaces.getChildren()) {
- if (children.isValid()) {
- if (children.getComponents().length > 0) {
- for (RSInterfaceComponent component : children.getComponents()) {
- if (component.isValid()) {
- if (component.containsText(str)) {
- return component;
- }
- }
- }
- } else {
- if (children.containsText(str)) {
- return children;
- }
- }
- }
- }
- }
- }
- return null;
- }
- public int[] interfaceIDThatContains(String str) {
- if (Bot.getClient().getRSInterfaceCache() == null) {
- return null;
- }
- for (int i = 0; i < RSInterface.getAllInterfaces().length; i++) {
- if (RSInterface.getAllInterfaces()[i].isValid()) {
- for (int o = 0; o < RSInterface.getAllInterfaces()[i].getChildren().length; o++) {
- if (RSInterface.getAllInterfaces()[i].getChildren()[o].isValid()) {
- if (RSInterface.getAllInterfaces()[i].getChildren()[o].getComponents().length > 0) {
- for (int l = 0; l < RSInterface.getAllInterfaces()[i].getChildren()[o].getComponents().length; o++) {
- if (RSInterface.getAllInterfaces()[i].getChildren()[o].getComponents()[l].isValid()) {
- if (RSInterface.getAllInterfaces()[i].getChildren()[o].getComponents()[l].containsText(str)) {
- return new int[]{i, o, l};
- }
- }
- }
- } else {
- if (RSInterface.getAllInterfaces()[i].getChildren()[o].containsText(str)) {
- return new int[]{i, o};
- }
- }
- }
- }
- }
- }
- return null;
- }
- public RSInterfaceChild interfaceThatHasActions(String str) {
- if (Bot.getClient().getRSInterfaceCache() == null) {
- return null;
- }
- for (RSInterface interfaces : RSInterface.getAllInterfaces()) {
- if (interfaces.isValid()) {
- for (RSInterfaceChild children : interfaces.getChildren()) {
- if (children.isValid()) {
- if (children.getComponents().length > 0) {
- for (RSInterfaceComponent component : children.getComponents()) {
- if (component.isValid() && component.getActions() != null) {
- if (component.getActions().length > 0) {
- if (component.getActions()[0] != null) {
- if (component.getActions()[0].contains(str)) {
- return component;
- }
- }
- }
- }
- }
- } else {
- if (children.getActions() != null) {
- if (children.getActions().length > 0) {
- if (children.getActions()[0] != null) {
- if (children.getActions()[0].contains(str)) {
- return children;
- }
- }
- }
- }
- }
- }
- }
- }
- }
- return null;
- }
- public void waitUntilNotMoving() {
- wait(random(700, 1000));
- while (getMyPlayer().isMoving()) {
- wait(random(25, 100));
- }
- }
- public void logoutToLogin() {
- while (Bot.getClient().isSpellSelected() || isItemSelected()) {
- while (RSInterface.getInterface(620).isValid()) {
- atInterface(620, 7);
- wait(random(1000, 1300));
- }
- int currentTab = getCurrentTab();
- int randomTab = random(1, 6);
- while (randomTab == currentTab) {
- randomTab = random(1, 6);
- }
- do {
- openTab(randomTab);
- wait(random(400, 800));
- } while (Bot.getClient().isSpellSelected() || isItemSelected() == true);
- }
- while (!isOnLogoutTab()) {
- atInterface(548, 175);
- int timesToWait = 0;
- while (!isOnLogoutTab() && timesToWait < 5) {
- wait(random(200, 400));
- timesToWait++;
- }
- }
- atInterface(182, 15);
- wait(random(1500, 2000));
- }
- @Override
- public RSInterfaceChild getContinueChildInterface() {
- if (Bot.getClient().getRSInterfaceCache() == null) {
- return null;
- }
- RSInterface[] valid = RSInterface.getAllInterfaces();
- for (RSInterface iface : valid) {
- if (iface.getIndex() != 137 && iface.getIndex() != 752) {
- int len = iface.getChildCount();
- for (int i = 0; i < len; i++) {
- RSInterfaceChild child = iface.getChild(i);
- if (child.containsText("Click here to continue") && child.getWidth() > 30 && child.getAbsoluteY() > 337) {
- return child;
- }
- }
- }
- }
- return null;
- }
- @Override
- public boolean canContinue() {
- return getContinueChildInterface() != null;
- @Override
- public boolean clickContinue() {
- RSInterfaceChild cont = getContinueChildInterface();
- return !(cont != null && cont.isValid()) || atInterface(cont);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement