Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Random;
- import org.dreambot.api.input.event.impl.InteractionEvent;
- import org.dreambot.api.input.event.impl.InteractionSetting;
- import org.dreambot.api.input.mouse.destination.impl.EntityDestination;
- import org.dreambot.api.methods.Calculations;
- import org.dreambot.api.methods.map.Area;
- import org.dreambot.api.methods.map.Tile;
- import org.dreambot.api.methods.walking.pathfinding.impl.obstacle.impl.PassableObstacle;
- import org.dreambot.api.methods.walking.pathfinding.impl.web.WebFinder;
- import org.dreambot.api.methods.walking.web.node.AbstractWebNode;
- import org.dreambot.api.methods.walking.web.node.impl.BasicWebNode;
- import org.dreambot.api.script.AbstractScript;
- import org.dreambot.api.script.ScriptManifest;
- import org.dreambot.api.script.Category;
- import org.dreambot.api.wrappers.interactive.Entity;
- import org.dreambot.api.wrappers.interactive.GameObject;
- @ScriptManifest(author = "Zappy", name = "Stronghold", version = 1.0, description = "A Stronghold of Security Bot.", category = Category.MINIGAME)
- public class main extends AbstractScript {
- public void onStart() {
- }
- public void onExit() {
- }
- public Area stronghold = new Area(3077, 3425, 3088, 3416, 0);
- public Random Rand = new Random();
- int timeout = 0;
- public void walkToStrongHold() {
- if (getLocalPlayer().getY() < 4000) {
- TravelTo(stronghold);
- }
- }
- public void walkDownHole() {
- GameObject hole = getGameObjects().closest("Entrance");
- if (hole != null) {
- hole.interact("Climb-down");
- }
- }
- public void opengate(Tile tile) {
- GameObject gate = getGameObjects().getTopObjectOnTile(tile);
- interact("Open", gate);
- sleep(15000 + Rand.nextInt(1000));
- if (getDialogues().inDialogue()) {
- doDialogue("Decline the offer and report that player.", "Don't give them my password.",
- "Authenticator and two-step login on my registered email.",
- "Don't give them the information and send an 'Abuse Report'.", "Report the player for phishing.",
- "No.", "No, you should never buy an account.",
- "Don't give out your password to anyone. Not even close friends.",
- "Set up 2 step authentication with my email provider.",
- "Don't type in my password backwards and report the player.",
- "Do not visit the website and report the player who messaged you.",
- "Use the Account Recovery System.",
- "Don't click any links, forward the email to reportphishing@jagex.com.",
- "Virus scan my device then change my password.",
- "Through account settings on oldshcool.runescape.com.", "No, you should never buy an account.",
- "Report the incident and do not click any links.", "Me.", "No.",
- "No, you should never allow anyone to level your account.",
- "No way! You'll just take my gold for your own! Reported!",
- "Inform Jagex by emailing reportphishing@jagex.com.",
- "Don't tell them anything and click the Report Abuse button.",
- "Don't tell them anything and click the 'Report Abuse' button.", "Nobody.",
- "Read the text and follow the advice given.", "No way! I'm reporting you to Jagex!",
- "Only on the Old School Runescape website.");
- }
- sleep(600 + Rand.nextInt(600));
- if (getDialogues().inDialogue()) {
- doDialogue("Decline the offer and report that player.", "Don't give them my password.",
- "Authenticator and two-step login on my registered email.",
- "Don't give them the information and send an 'Abuse Report'.", "Report the player for phishing.",
- "No.", "No, you should never buy an account.",
- "Don't give out your password to anyone. Not even close friends.",
- "Set up 2 step authentication with my email provider.",
- "Don't type in my password backwards and report the player.",
- "Do not visit the website and report the player who messaged you.",
- "Use the Account Recovery System.",
- "Don't click any links, forward the email to reportphishing@jagex.com.",
- "Virus scan my device then change my password.",
- "Through account settings on oldshcool.runescape.com.", "No, you should never buy an account.",
- "Report the incident and do not click any links.", "Me.", "No.",
- "No, you should never allow anyone to level your account.",
- "No way! You'll just take my gold for your own! Reported!",
- "Inform Jagex by emailing reportphishing@jagex.com.",
- "Don't tell them anything and click the Report Abuse button.",
- "Don't tell them anything and click the 'Report Abuse' button.", "Nobody.",
- "Read the text and follow the advice given.", "No way! I'm reporting you to Jagex!",
- "Only on the Old School Runescape website.");
- }
- sleep(600 + Rand.nextInt(600));
- if (getDialogues().inDialogue()) {
- doDialogue("Decline the offer and report that player.", "Don't give them my password.",
- "Authenticator and two-step login on my registered email.",
- "Don't give them the information and send an 'Abuse Report'.", "Report the player for phishing.",
- "No.", "No, you should never buy an account.",
- "Don't give out your password to anyone. Not even close friends.",
- "Set up 2 step authentication with my email provider.",
- "Don't type in my password backwards and report the player.",
- "Do not visit the website and report the player who messaged you.",
- "Use the Account Recovery System.",
- "Don't click any links, forward the email to reportphishing@jagex.com.",
- "Virus scan my device then change my password.",
- "Through account settings on oldshcool.runescape.com.", "No, you should never buy an account.",
- "Report the incident and do not click any links.", "Me.", "No.",
- "No, you should never allow anyone to level your account.",
- "No way! You'll just take my gold for your own! Reported!",
- "Inform Jagex by emailing reportphishing@jagex.com.",
- "Don't tell them anything and click the Report Abuse button.",
- "Don't tell them anything and click the 'Report Abuse' button.", "Nobody.",
- "Read the text and follow the advice given.", "No way! I'm reporting you to Jagex!",
- "Only on the Old School Runescape website.");
- }
- sleep(600 + Rand.nextInt(600));
- if (getDialogues().inDialogue()) {
- doDialogue("Decline the offer and report that player.", "Don't give them my password.",
- "Authenticator and two-step login on my registered email.",
- "Don't give them the information and send an 'Abuse Report'.", "Report the player for phishing.",
- "No.", "No, you should never buy an account.",
- "Don't give out your password to anyone. Not even close friends.",
- "Set up 2 step authentication with my email provider.",
- "Don't type in my password backwards and report the player.",
- "Do not visit the website and report the player who messaged you.",
- "Use the Account Recovery System.",
- "Don't click any links, forward the email to reportphishing@jagex.com.",
- "Virus scan my device then change my password.",
- "Through account settings on oldshcool.runescape.com.", "No, you should never buy an account.",
- "Report the incident and do not click any links.", "Me.", "No.",
- "No, you should never allow anyone to level your account.",
- "No way! You'll just take my gold for your own! Reported!",
- "Inform Jagex by emailing reportphishing@jagex.com.",
- "Don't tell them anything and click the Report Abuse button.",
- "Don't tell them anything and click the 'Report Abuse' button.", "Nobody.",
- "Read the text and follow the advice given.", "No way! I'm reporting you to Jagex!",
- "Only on the Old School Runescape website.");
- }
- sleep(600 + Rand.nextInt(600));
- }
- //This is just some more doors i changed how the code runs a bit and I didn't delete this part.
- public void work() {
- opengate(new Tile(1879, 5240, 0));
- sleep(600 + Rand.nextInt(600));
- opengate(new Tile(1884, 5244, 0));
- sleep(600 + Rand.nextInt(600));
- opengate(new Tile(1887, 5244, 0));
- sleep(600 + Rand.nextInt(600));
- opengate(new Tile(1904, 5243, 0));
- sleep(600 + Rand.nextInt(600));
- opengate(new Tile(1908, 5243, 0));
- sleep(600 + Rand.nextInt(600));
- opengate(new Tile(1905, 5233, 0));
- sleep(600 + Rand.nextInt(600));
- opengate(new Tile(1905, 5230, 0));
- sleep(600 + Rand.nextInt(600));
- GameObject giftopeace = getGameObjects().closest("Gift of Peace");
- giftopeace.interact("Open");
- }
- private boolean inArea(Area area) {
- if(area.contains(getLocalPlayer().getTile())){
- return true;
- }return false;
- }
- private enum State {
- WALKTOAREA, CLIMBDOWNHOLE, DOOR1, DOOR2, DOOR3, DOOR4, DOOR5, WAIT
- };
- Area door1 = new Area(1865, 5244, 1858, 5239, 0);
- Area door2 = new Area(1859, 5238, 1858, 5236, 0);
- Area door3 = new Area(1864, 5235, 1858, 5213, 0);
- Area door4 = new Area(1867, 5227, 1865, 5226, 0);
- Area door5 = new Area(1875, 5243, 1868, 5226, 0);
- private State getState() {
- if(!inArea(stronghold) & !inArea(door1) & !inArea(door2) & !inArea(door3) & !inArea(door4) & !inArea(door5)) {
- return State.WALKTOAREA;
- }
- if(inArea(stronghold)) {
- return State.CLIMBDOWNHOLE;
- }
- if(inArea(door1)) {
- return State.DOOR1;
- }
- if(inArea(door2)) {
- return State.DOOR2;
- }
- if(inArea(door3)) {
- return State.DOOR3;
- }
- if(inArea(door4)) {
- return State.DOOR4;
- }
- if(inArea(door5)) {
- return State.DOOR5;
- }
- return State.WAIT;
- }
- @Override
- public int onLoop() {
- switch (getState()){
- case WALKTOAREA:
- walkToStrongHold();
- break;
- case CLIMBDOWNHOLE:
- walkDownHole();
- break;
- case DOOR1:
- if (getWalking().isRunEnabled()) {
- getWalking().toggleRun();
- }
- opengate(new Tile(1859, 5239, 0));
- sleep(600 + Rand.nextInt(600));
- break;
- case DOOR2:
- opengate(new Tile(1859, 5235, 0));
- sleep(600 + Rand.nextInt(600));
- break;
- case DOOR3:
- addNode1();
- Tile door3tile = new Tile(1865, 5227, 0);
- getWalking().walkOnScreen(door3tile.getRandomizedTile(1));
- opengate(new Tile(1865, 5227, 0));
- sleep(600 + Rand.nextInt(600));
- break;
- case DOOR4:
- opengate(new Tile(1868, 5226, 0));
- sleep(600 + Rand.nextInt(600));
- break;
- case DOOR5:
- addNode2();
- Tile door5tile = new Tile(1875, 5240, 0);
- getWalking().walkOnScreen(door5tile.getRandomizedTile(1));
- opengate(new Tile(1875, 5240, 0));
- sleep(600 + Rand.nextInt(600));
- break;
- case WAIT:
- sleep(300);
- break;
- }
- return Calculations.random(500, 600);
- }
- //These im not really sure if there doing anything I heard the dungeon might not be mapped so I added web nodes from a tutorial with a script.
- public void addNode1() {
- AbstractWebNode webNode0 = new BasicWebNode(1858, 5235);
- AbstractWebNode webNode1 = new BasicWebNode(1864, 5226);
- AbstractWebNode webNode2 = new BasicWebNode(1864, 5227);
- webNode0.addConnections(webNode1);
- webNode0.addConnections(webNode2);
- webNode1.addConnections(webNode0);
- webNode2.addConnections(webNode0);
- WebFinder webFinder = getWalking().getWebPathFinder();
- AbstractWebNode[] webNodes = {webNode2, webNode1, webNode0};
- for (AbstractWebNode webNode : webNodes) {
- webFinder.addWebNode(webNode);
- }
- }
- public void addNode2() {
- AbstractWebNode webNode0 = new BasicWebNode(1868, 5226);
- AbstractWebNode webNode1 = new BasicWebNode(1875, 5240);
- AbstractWebNode webNode2 = new BasicWebNode(1875, 5239);
- webNode0.addConnections(webNode1);
- webNode0.addConnections(webNode2);
- webNode1.addConnections(webNode0);
- webNode2.addConnections(webNode0);
- WebFinder webFinder = getWalking().getWebPathFinder();
- AbstractWebNode[] webNodes = {webNode2, webNode1, webNode0};
- for (AbstractWebNode webNode : webNodes) {
- webFinder.addWebNode(webNode);
- }
- }
- public boolean interact(String action, Entity target) {
- if (target.isOnScreen()) {
- EntityDestination ed = new EntityDestination(getClient(), target);
- InteractionEvent ie = new InteractionEvent(ed);
- return ie.interactForceRight(action);
- } else {
- return target.interactForceRight(action);
- }
- }
- public boolean doDialogue(String... chooseOptions) {
- if (getDialogues().canContinue()) {
- getDialogues().continueDialogue();
- return true;
- }
- String options[] = getDialogues().getOptions();
- if (options == null) {
- return false;
- }
- for (int i = 0; i < options.length; i++) {
- for (String chooseOption : chooseOptions) {
- if (options[i].contains(chooseOption)) {
- getDialogues().chooseOption(i + 1);
- return true;
- }
- }
- }
- return false;
- }
- public void TravelTo(Area destination) {
- // clicks really frequently when close to location
- // think i fixed this by changing this
- // getWalking().walk(destination.getCenter()); from getRandom()
- // https://dreambot.org/forums/index.php?/topic/4512-walking-a-path-with-doors/
- /*
- * while (!destination.contains(getLocalPlayer())) {
- * getWalking().walk(destination.getCenter()); sleepUntil(() ->
- * getWalking().getDestination().distance() < Calculations.random(5, 7) ,
- * Calculations.random(3400, 4250)); sleep(Calculations.random(300, 600));
- * sleepUntil( () -> !getLocalPlayer().isMoving() || getLocalPlayer().distance(
- * getClient().getDestination()) < Calculations.random( 7, 12),
- * Calculations.random(5000, 6666));
- *
- * }
- */
- // Walking algorithm modified from Before's Cooks Assistant quest bot
- // issues: since this will sleep until the user has stopped moving + some random
- // time there is a lot of standing around
- // however it does not have the issue of spam clicking once you get close to the
- // destination
- while (!destination.contains(getLocalPlayer()) && !destination.contains(getWalking().getDestination())) {
- getWalking().walk(destination.getRandomTile());
- getWalking().getAStarPathFinder().addObstacle(new PassableObstacle("Door", "Open", null, null, null));
- // sleep(2000+Rand.nextInt(1000));
- if (getWalking().isRunEnabled()) {
- getWalking().toggleRun();
- }
- sleepUntil(() -> getLocalPlayer().isStandingStill(), Rand.nextInt(6000));
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement