Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* SAVE AS "PrivateDungeonPro.java" !!!
- * PrivateDungeoneeringPro (v.2) *
- *
- * RULES:
- * 1) THIS IS A PRIVATE SCRIPT
- * -That means no sharing with your little brother
- * -I can detect who's script was leaked and your
- * license will be terminated
- *
- * 2) DO NOT REVERSE ENGINEER
- * -Again, i can tell when my scripts are tampered with
- * and each one is made unique for each customer.
- * If you attempt to tamper with the script I
- * WILL know. ;)
- *
- * 3) Bot Reasonably
- * -Although every attempt at being stealthy has been made
- * botting for a week straight isn't normal. You will
- * get banned and hurt this script. Bot responsibly.
- *
- * */
- import java.io.*;
- import java.net.*;
- import java.security.*;
- import java.util.*;
- import java.util.logging.*;
- import org.rsbot.script.*;
- import org.rsbot.util.*;
- import java.awt.Color;
- import java.awt.Graphics;
- import java.awt.Graphics2D;
- import java.awt.Point;
- import java.awt.Polygon;
- import java.awt.RenderingHints;
- import java.awt.event.KeyEvent;
- import java.awt.geom.GeneralPath;
- import java.util.ArrayList;
- import java.util.List;
- import java.util.Map;
- import java.lang.Thread;
- import java.awt.BorderLayout;
- import java.awt.event.ActionEvent;
- import java.awt.event.ActionListener;
- import javax.swing.*;
- import org.rsbot.bot.Bot;
- import org.rsbot.client.input.Mouse;
- import org.rsbot.event.*;
- import org.rsbot.event.events.ServerMessageEvent;
- import org.rsbot.event.listeners.PaintListener;
- import org.rsbot.event.listeners.ServerMessageListener;
- import org.rsbot.script.Script;
- import org.rsbot.script.ScriptManifest;
- import org.rsbot.script.wrappers.RSArea;
- import org.rsbot.script.wrappers.RSComponent;
- import org.rsbot.script.wrappers.RSGroundItem;
- import org.rsbot.script.wrappers.RSInterface;
- import org.rsbot.script.wrappers.RSItem;
- import org.rsbot.script.wrappers.RSItemDef;
- import org.rsbot.script.wrappers.RSNPC;
- import org.rsbot.script.wrappers.RSObject;
- import org.rsbot.script.wrappers.RSTile;
- import org.rsbot.script.methods.GroundItems;
- import org.rsbot.script.methods.Interfaces;
- @ScriptManifest(authors = { "CRACKED BY KR33D" }, keywords = "Dungeoneering", name = "ProDungeoneering_CRACKED", version = 0.6, description = "Start with floor 1 and complexity 1 set.")
- public class PrivateDungeonPro extends Script {
- public boolean gui_on = false;
- public GroundItems grounditems;
- /**
- * GUI
- */
- private String scriptName = "ProDungeon";
- private double scriptVersion = 0.4;//TODO Keep Updated
- /*
- * All object and other ID's needed.
- * @Author Arista
- */
- public static final int FOOD_TABLE = 51577,
- FOOD_TABLE_2 = 51598;
- /**
- * Paint
- * Original Paint methods taken from FamousMiner - Reworked by ProCrus
- */
- private String currentStatus = "";
- public long startTime;
- public long millisec;
- public long seconds;
- public long minutes;
- public long hours;
- public int startAttackyLvl = 0;
- public int startAttackyExp = 0;
- public int gainedAttackyExp = 0;
- public int gainedAttackyLvl = 0;
- public Color textColor;
- private int x1;
- private int x2;
- private int y1;
- private int y2;
- private boolean drawStartRoomArea = false;
- private EventManager event;
- private Bot Bot;
- private Thread Thread;
- private int paintBox()
- {
- //int x = mouse.getClientLocation().x;
- int x = mouse.getLocation().x;
- //int y = mouse.getClientLocation().y;
- int y = mouse.getLocation().y;
- if (x >= 6 && x < 90 && y >= 6 && y < 44)
- return 1;
- else if (x >= 91 && x < 176 && y >= 6 && y < 44)
- return 2;
- else if (x >= 169 && x < 254 && y >= 6 && y < 44)
- return 3;
- else
- return 0;
- }
- public void onRepaint(final Graphics g)
- {
- ((Graphics2D) g).setRenderingHint(RenderingHints.KEY_ANTIALIASING,
- RenderingHints.VALUE_ANTIALIAS_ON);
- millisec = System.currentTimeMillis() - startTime;
- hours = millisec / (1000 * 60 * 60);
- millisec -= hours * (1000 * 60 * 60);
- minutes = millisec / (1000 * 60);
- millisec -= minutes * (1000 * 60);
- seconds = millisec / 1000;
- final int xx = 18;
- final int yy = 58;
- switch (paintBox())
- {
- case 0:
- //View No Screen
- break;
- //Show Level Information
- case 1:
- g.setColor(new Color(0, 0, 0, 140));
- g.fillRoundRect(6, 43, 500, 282, 5, 5);
- g.setColor(Color.black);
- g.drawString(scriptName + " - Version: " + scriptVersion, xx + 1, yy + 1);
- g.setColor(textColor);
- g.drawString(scriptName + " - Version: " + scriptVersion, xx, yy);
- g.drawString("Time Running: " + hours + ":" + minutes + ":" + seconds, 18, 80);
- g.drawString("Status: " + currentStatus, 18, 100);
- g.drawString("Floor: " + floorLvl, 18, 120);
- g.drawString("Complexity: " + complexLvl, 18, 140);
- g.drawString("Dungeons Played: " + playedDungeons, 18, 160);
- if (drawStartRoomArea)
- {
- String sw = "SW Tile: " + southWest.getX() + ", " + southWest.getY();
- String se = "SE Tile: " + southEast.getX() + ", " + southEast.getY();
- String nw = "NW Tile: " + northWest.getX() + ", " + northWest.getY();
- String ne = "NE Tile: " + northEast.getX() + ", " + northEast.getY();
- g.setColor(Color.GREEN);
- g.drawString("<>< Start room corners ><>", 18, 180);
- g.setColor(textColor);
- g.drawString(sw, 18, 200);
- g.drawString(se, 18, 220);
- g.drawString(nw, 18, 240);
- g.drawString(ne, 18, 260);
- }
- else
- {
- g.setColor(Color.GREEN);
- g.drawString("<>< Start room corners ><>", 18, 180);
- g.setColor(textColor);
- g.drawString("No Available Data", 18, 200);
- g.drawString("No Available Data", 18, 220);
- g.drawString("No Available Data", 18, 240);
- g.drawString("No Available Data", 18, 260);
- }
- break;
- //Stats
- case 2:
- g.setColor(new Color(0, 0, 0, 140));
- g.fillRoundRect(6, 43, 500, 282, 5, 5);
- g.setColor(Color.black);
- g.drawString(scriptName + " - Version: " + scriptVersion, xx + 1, yy + 1);
- g.setColor(textColor);
- g.drawString(scriptName + " - Version: " + scriptVersion, xx, yy);
- g.setColor(textColor);
- g.drawString("Current Dungeoneering Level: ", 18, 80);
- g.drawString("Maps Played: ", 18, 100);
- g.drawString("Ores/Hour: ", 18, 120);
- g.drawString("Levels Gained: ", 18, 140);
- g.drawString("EXP Till Next Level: ", 18, 160);
- g.drawString("EXP/Hour: ", 18, 180);
- g.drawString("Gems Mined: ", 18, 200);
- break;
- //Script Info
- case 3:
- g.setColor(new Color(0, 0, 0, 140));
- g.fillRoundRect(6, 43, 500, 282, 5, 5);
- g.setColor(Color.black);
- g.drawString(scriptName + " - Version: " + scriptVersion, xx + 1, yy + 1);
- g.setColor(textColor);
- g.drawString(scriptName + " - Version: " + scriptVersion, xx, yy);
- g.setColor(textColor);
- g.drawString("Profit gained: ", 18, 80);
- g.drawString("Profit per hour: ", 18, 100);
- break;
- }
- g.setColor(new Color(0, 0, 0, 180));
- g.fillRoundRect(6, 6, 84, 37, 1, 3);
- g.fillRoundRect(92, 6, 84, 37, 1, 3);
- g.fillRoundRect(177, 6, 84, 37, 1, 3);
- g.setColor(textColor);
- g.drawString("Dungeon Info", 12, 29);
- g.drawString("All Stats", 101, 29);
- g.drawString("Script Info", 184, 29);
- }
- /**
- * Script
- */
- //MainActions
- private int action = 0;
- private int enterDungeon = 1;
- private int inDungeon = 2;
- //SubActions
- private int subAction = 0;
- private int bankItems = 1;
- private int checkForItems = 2;
- private int makeParty = 3;
- private int enterDungeons = 4;
- private int setUpStartRoom = 1;
- private int getdemkey;
- private int getdemkey2;
- private int enterdoor1;
- private int enterdoorlast;
- private int getequip;
- private int gettablefood;
- //<<!-<><-!>>
- private boolean doStartScript = false;
- private enum LoadStages { STARTUP, LOADAREA, LOADOBJECTS, LOADTASKS, LOADLVL, LOADROOMS };
- LoadStages LoadStages;
- //Following code is made by: Xhamolk_
- /**
- * Gets the RSObjects found in the specified RSArea.
- *
- * @param area The RSArea that determines the tiles where to search for objects.
- * @return The found found in the specified area.
- * @return Might return <tt>null</tt> or an empty array.
- */
- public RSObject[] getObjectsAt(RSArea area){
- if( area == null )
- return null;
- ArrayList<RSObject> list = new ArrayList<RSObject>();
- for( RSTile[] tiles : area.getTiles() ) {
- for( RSTile tile : tiles ){
- if(tile != null)
- continue;
- if( tiles != null )
- continue;
- RSObject object = objects.getTopAt( tile ); // this is line with disfunction
- if( object == null )
- continue;
- list.add( object );
- }
- }
- return list.toArray(new RSObject[list.size()]);
- }
- public boolean waitForIface(RSInterface iface, int timeout) {
- if (timeout < 0)
- return false;
- if (iface == null)
- return false;
- while (System.currentTimeMillis() - startTime <= timeout) {
- if (iface.isValid())
- return true;
- sleep(125);
- }
- return false;
- }
- //<<!--<><Banking><>--!>>
- private RSTile bankTile;
- private int bankerNPC = 9710;
- private int[] dontDeposit = new int[] { 15707 };
- private int openBank()
- {
- try
- {
- RSNPC banker = npcs.getNearest(bankerNPC);
- bankTile = banker.getLocation();
- if (banker != null)
- {
- if (getMyPlayer().isMoving())
- return 500;
- if (calc.distanceTo(bankTile) >= 5)
- {
- if (calc.tileOnMap(bankTile))
- {
- walking.walkTo(bankTile);
- openBank();
- return 50;
- }
- }
- else if (calc.distanceTo(bankTile) <= 4)
- {
- currentStatus = "Opening bank.";
- final Point location = calc.tileToScreen(bankTile);
- if (location.x == -1 || location.y == -1)
- wait(500);
- mouse.click(location, 2, 2, false);
- wait(300);
- if (menu.getActions().toString().contains("Bank"))
- {
- menu.clickIndex(1);
- }
- else
- {
- menu.doAction("Cancel");
- }
- }
- }
- }
- catch (Exception e)
- {
- }
- return 500;
- }
- private int depositToBank()
- {
- try
- {
- if (interfaces.get(bank.INTERFACE_BANK).isValid())
- {
- currentStatus = "Depositing Items";
- bank.depositAllEquipped();
- bank.depositAllExcept(dontDeposit);
- wait(250);
- bank.close();
- }
- }
- catch (Exception e)
- {
- }
- return 500;
- }
- //<<!--<><Item Checking><>--!>>
- private int ringID = 15707;
- /**
- * Gets the id of the equipment equipped.
- * @param interfaceID
- * @return equipment id, returns -1 if nothing
- */
- private int getEquipmentID(int interfaceID)
- {
- RSComponent equip = equipment.getInterface().getComponent(interfaceID);
- int id = equip.getComponentID();
- return id;
- }
- private boolean checkInventoryReadyToEnter()
- {
- boolean inventorySet = false;
- if (inventory.getCountExcept(ringID) <= 0)
- {
- subAction = checkForItems;
- inventorySet = true;
- }
- if (!inventorySet)
- subAction = bankItems;
- return inventorySet;
- }
- private int complexLvl = 1;
- private int floorLvl = 1;
- private int playedDungeons = 0;
- /**
- * Clicks the first available inventory item and does the specified action.
- *
- * @param itemID - the Item ID you want to click
- * @param action - the menuAction to click
- * @param actionIndex - the menuItem to click(use -1 to ignore this part of the method)
- * @return
- */
- private int clickInventoryItem(int itemID, String action, int actionIndex)
- {
- try
- {
- if (game.getCurrentTab() != game.TAB_INVENTORY)
- game.openTab(game.TAB_INVENTORY);
- RSComponent inventory = interfaces.getComponent(149, 0);
- for (int i = 0; i < 28; i++)
- {
- RSComponent inventoryItem = inventory.getComponents()[i];
- int id = inventoryItem.getComponentID();
- if (id == itemID)
- {
- Point itemPoint = inventoryItem.getCenter();
- //Point mouseLoc = mouse.getClientLocation();
- Point mouseLoc = mouse.getLocation();
- if (Math.abs(itemPoint.x - mouseLoc.x) > 5)
- {
- mouse.move(itemPoint);
- wait(120);
- if (actionIndex != -1)
- {
- menu.clickIndex(actionIndex);
- return 150;
- }
- inventoryItem.doAction(action);
- return 250;
- }
- }
- }
- }
- catch (Exception e)
- {
- }
- return 0;
- }
- public RSComponent firstUser;
- public RSComponent formParty;
- public RSComponent changeFloor;
- public RSComponent changeComplexity;
- public RSInterface partyTabInterface;
- public RSInterface complexityChange;
- public RSComponent complexityLvl1;
- public RSComponent complexityLvl2;
- public RSComponent complexityLvl3;
- public RSComponent complexityLvl4;
- public RSComponent complexityLvl5;
- public RSComponent complexityLvl6;
- public RSComponent complexityConfirm;
- public RSInterface floorChange;
- private int openParty()
- {
- if (game.getCurrentTab() == game.TAB_INVENTORY)
- {
- if (inventory.containsOneOf(ringID))//Has Ring
- {
- clickInventoryItem(ringID, "Open party interface", -1);
- return 1500;
- }
- else
- {
- log("No Ring. Please Pause script and withdrawl your ring.");
- return 5000;
- }
- }
- else
- {
- if (partyTabInterface.isValid())
- return 50;
- game.openTab(game.TAB_INVENTORY);
- openParty();
- }
- return 250;
- }
- private int createParty()
- {
- try
- {
- wait(500);
- int x = formParty.getAbsoluteX() + 20;
- int y = formParty.getAbsoluteY() + 10;
- mouse.move(new Point(x, y), 0, 0);
- wait(55);
- if (menu.getActions().toString().contains("Form-party"))
- {
- menu.doAction("Form-party");
- wait(800);
- return 200;
- }
- else if (!menu.getActions().toString().contains("Form"))
- {
- mouse.move(new Point(x, y), 0, 0);
- menu.doAction("Form-party");
- }
- }
- catch (Exception e)
- {
- }
- return 2000;
- }
- private boolean checkParty()
- {
- String firstText = firstUser.getText();
- if (firstText.contains(getMyPlayer().getName()))
- return true;
- return false;
- }
- private int setComplexity(int complexity)
- {
- try
- {
- currentStatus = "Setting Complexity";
- if (complexityChange.isValid())//Change complexity
- {
- RSComponent whatComplexity = complexityLvl1;
- if (complexity == 2)
- whatComplexity = complexityLvl2;
- if (complexity == 3)
- whatComplexity = complexityLvl3;
- if (complexity == 4)
- whatComplexity = complexityLvl4;
- if (complexity == 5)
- whatComplexity = complexityLvl5;
- if (complexity == 6)
- whatComplexity = complexityLvl6;
- mouse.move(whatComplexity.getCenter(), 0, 0);
- whatComplexity.doAction("Select-complexity");
- mouse.click(true);
- sleep(750);
- mouse.move(complexityConfirm.getCenter(), 0, 0);
- sleep(55);
- mouse.click(true);
- return 750;
- }
- else//Open complexity interface
- {
- if (partyTabInterface.isValid())
- {
- int randomX = random(changeComplexity.getAbsoluteX() + 8,
- changeComplexity.getAbsoluteX() + 14);
- int randomY = random(changeComplexity.getAbsoluteY() + 3,
- changeComplexity.getAbsoluteY() + 7);
- Point clickComplex = new Point(randomX, randomY);
- mouse.move(clickComplex, 0, 0);
- sleep(55);
- mouse.click(true);
- wait(750);
- setComplexity(complexity);
- }
- }
- }
- catch (Exception e)
- {
- }
- return 100;
- }
- private int setFloor(int floor)
- {
- currentStatus = "Setting Floor Level";
- int topY = 100;
- int bottomY = 104;
- for (int i = 1; i <= floor; i++)
- {
- topY += 5;
- bottomY += 5;
- }
- int randomX = random(20, 245);//Default lvl 1
- int randomY = random(topY, bottomY);//Default lvl 1
- Point clickFloor = new Point(randomX, randomY);
- //Point mouse = this.mouse.getClientLocation();
- Point mouse = this.mouse.getLocation();
- if (floorChange.isValid())//Change floor
- {
- if (clickFloor.x == -1 || clickFloor.y == -1)
- return 250;
- if (Math.abs(clickFloor.x - mouse.x) > 2)
- {
- this.mouse.move(clickFloor, 0, 0);
- sleep(800);
- this.mouse.click(true);
- sleep(750);
- }
- randomX = random(185, 237);
- randomY = random(272, 292);
- clickFloor = new Point(randomX, randomY);
- this.mouse.move(clickFloor, 0, 0);
- sleep(800);
- this.mouse.click(true);
- return 750;
- }
- else//Open Floor Selection
- {
- if (partyTabInterface.isValid())
- {
- randomX = random(changeFloor.getAbsoluteX() + 8,
- changeFloor.getAbsoluteX() + 14);
- randomY = random(changeFloor.getAbsoluteY() + 3,
- changeFloor.getAbsoluteY() + 7);
- clickFloor = new Point(randomX, randomY);
- this.mouse.move(clickFloor, 0, 0);
- sleep(800);
- this.mouse.click(true);
- setFloor(floor);
- return 50;
- }
- }
- return 500;
- }
- //<<!--<><Dungeon><>--!>>
- private RSTile dungeonStart;
- private List<RSTile> tableTiles = null;
- private List<RSObject> startRoomDoors = new ArrayList<RSObject>();
- private List<RSItem> keysOnFloor = new ArrayList<RSItem>();
- private RSObject[] startRoomObjects;
- private RSTile[] startRoomDoorTiles;
- private RSArea startRoom;
- private RSTile exitLadder;
- private RSTile southEast;
- private RSTile southWest;
- private RSTile northEast;
- private RSTile northWest;
- /*
- * Anything from here to the Methods are only IDs or ID arrays/lists
- */
- //private int dungeonExit = 51156, 50604;
- private int dungeonExit = 50604;
- private int endDungeon = 49696;
- private int brokenStairs = 50552;
- //private int tableID = 51577;
- //private int tableID2 = 51598;
- private int tableID = 51031;
- private int tableID2 = 51050;
- /*
- * The following are only doors
- * If variable ends with U it is an Unlock door
- */
- private int blueRectDoorU = 50387;
- private int silverWedgeDoorU = 50222;
- private int greenTriDoorU = 50232;
- private int crimShieldDoorU = 50263;
- private int[] unlockDoorIDs = new int[] { blueRectDoorU, crimShieldDoorU, greenTriDoorU,
- silverWedgeDoorU };
- private int silverWedgeDoor = 50377;
- private int greenTriDoor = 50367;
- private int crimShieldDoor = 50408;
- private int guardianDoor1 = 50346, guardianDoor2 = 50342, gaudianDoor3 = 50347;
- private int[] enterDoorIDs = new int[] { guardianDoor1, guardianDoor2, silverWedgeDoor,
- greenTriDoor, crimShieldDoor};
- /*
- * End of doors, Start of NPCs
- */
- private int smugglerID = 11226;
- private int iceFiend = 10212;
- private int iceWarrior = 10225;
- private int mystShade1 = 10831, mystShade2 = 10833;
- private int forgotWarrior1 = 10413, forgotWarrior2 = 10408;
- private int forgotRanger1 = 10321, forgotRanger2 = 10320;
- private int forgotMage = 10560;
- private int gluttonous = 9948;
- /*
- * End of NPCs start to Keys
- */
- private int crimShieldKey = 18312;
- private int crimTriKey = 18298;
- private int greenTriKey = 18250;
- private int silverWedgeKey = 18230;
- private int yellowRectangleKey = 18238;
- private int purpleRectangleKey = 18286;
- private int[] chrimsonKeys = new int[] { crimShieldKey, crimTriKey };
- private int[] blueKeys = new int[] { };
- private int[] greenKeys = new int[] { greenTriKey };
- private int[] silverKeys = new int[] { silverWedgeKey };
- private int[] yellowKeys = new int[] { yellowRectangleKey };
- private int[] purpleKeys = new int[] { purpleRectangleKey };
- private int[] keyIds = new int[] { silverWedgeKey, greenTriKey, crimShieldKey,
- yellowRectangleKey, purpleRectangleKey, crimTriKey };
- /*
- * End of Keys start of Food
- */
- private int[] shortFinnedEel = new int[] { 18167 };
- private String shortFinnedEelName = "Short-finned eel";
- private int[] redEye = new int[] { 18161 };
- private String redEyeName = "Red-eye";
- private int[] giantFlatFish = new int[] { 18165 };
- private String giantFlatFishName = "Giant flatfish";
- private int[] duskEeel = new int[] { 18163 };
- private String duskEeelName = "Dusk eel";
- private int[] webSnipper = new int[] { 18169 };
- private String webSnipperName = "Web snipper";
- private int[] heimCrab = new int[] { 18159 };
- private String heimCrabName = "Heim crab";
- private int[] salveEel = new int[] { 18173 };
- private String salveEelName = "Salve eel";
- private int[] bouldabass = new int[] { 18171 };
- private String bouldabassName = "Bouldabass";
- private int[] foods = new int[] { 18167, 18161, 18165, 18163, 18169, 18159, 18173, 18171 };
- private int enterDungeon()
- {
- RSTile runTo = new RSTile(3449, 3731);
- RSObject dungeon = objects.getNearest(48496);
- if (calc.distanceTo(dungeon) > 5)
- walking.walkTo(runTo);
- mouse.move(313,81);
- mouse.click(true);
- return 2500;
- }
- private RSTile[] findDoorLocInArea (RSArea areaSearched)
- {
- if (areaSearched == null)
- return null;
- ArrayList<RSTile> list = new ArrayList<RSTile>();
- for( RSTile[] tiles : areaSearched.getTiles() ) {
- for (RSTile tile : tiles)
- {
- if(tile != null)
- continue;
- if( tiles != null )
- continue;
- RSObject object = objects.getTopAt (tile);
- for (int i = 0; i < enterDoorIDs.length; i++)
- {
- if (object != null)
- if (object.getID() == enterDoorIDs[i])
- list.add (object.getLocation());
- }
- for (int k = 0; k < unlockDoorIDs.length; k++)
- {
- if (object != null)
- if (object.getID() == unlockDoorIDs[k])
- list.add (object.getLocation());
- }
- }
- }
- return list.toArray(new RSTile[list.size()]);
- }
- /*
- * The following method (findKeys(RSArea)) has been based off of getObjectsAt(RSArea)
- * found towards the top of this class
- * keysOnFloor
- */
- private void getKeysInArea(RSArea areaToSearch)
- {
- if (areaToSearch == null)
- return;
- for (RSTile[] tiles : areaToSearch.getTiles())
- {
- for (RSTile tile : tiles)
- {
- if(tile != null)
- continue;
- if( tiles != null )
- continue;
- RSGroundItem[] itemTiles = groundItems.getAllAt(tile);
- if (itemTiles != null)
- {
- for (int l = 0; l < itemTiles.length; l++)
- {
- RSItem items = itemTiles[l].getItem();
- int itemID = items.getID();
- for (int k = 0; k < keyIds.length; k++)
- {
- if (itemID == keyIds[k])
- keysOnFloor.add(items);
- }
- }
- }
- }
- }
- }
- private int pickUpItem(int itemID, RSTile tile)
- {
- try
- {
- if (tile != null)
- {
- if (calc.tileOnScreen(tile))
- {
- Point tileLoc = new Point(tile.getX(), tile.getY());
- mouse.move(tileLoc, 2, 2);
- wait(55);
- if (itemID != -1)
- menu.doAction("Take " + getItemName(itemID));
- if (!menu.doAction("Take " + getItemName(itemID)))
- {
- camera.setAngle(random(0, 360));
- int ran = random(0, 7);
- if (ran == 2 || ran == 5)
- setCameraHeight(random(1024, 3072));
- mouse.move(tileLoc, 2, 8);
- menu.doAction("Take " + getItemName(itemID));
- }
- if (itemID == -1)
- menu.doAction("Take ");
- return 2000;
- }
- else if (calc.tileOnMap(tile))
- {
- walking.walkTileMM(tile);
- wait(750);
- pickUpItem(itemID, tile);
- }
- }
- }
- catch(Exception e)
- {
- }
- return 500;
- }
- private String getItemName(int id1, int... id)
- {
- if (id == keyIds)
- {
- if (id == chrimsonKeys)
- return "chrimson";
- if (id == yellowKeys)
- return "yellow";
- if (id == blueKeys)
- return "blue";
- if (id == silverKeys)
- return "silver";
- if (id == greenKeys)
- return "green";
- }
- if (id1 == shortFinnedEel[0])
- return shortFinnedEelName;
- if (id1 == redEye[0])
- return redEyeName;
- if (id1 == giantFlatFish[0])
- return giantFlatFishName;
- if (id1 == duskEeel[0])
- return duskEeelName;
- if (id1 == webSnipper[0])
- return webSnipperName;
- if (id1 == heimCrab[0])
- return heimCrabName;
- if (id1 == bouldabass[0])
- return bouldabassName;
- if (id1 == salveEel[0])
- return salveEelName;
- return bouldabassName;
- //TODO This for easy access
- }
- private boolean playerInSquare(int xNE, int yNE, int xSW, int ySW)
- {
- int playX = getMyPlayer().getLocation().getX();
- int playY = getMyPlayer().getLocation().getY();
- if ((playX > xSW && playX < xNE) && (playY > ySW && playY < yNE))
- return true;
- return false;
- }
- private List<RSTile> getTableTiles(RSTile tableTile)
- {
- List<RSTile> toAddTo = new ArrayList<RSTile>();
- int tableX = tableTile.getX();
- int tableY = tableTile.getY();
- if (objects.getTopAt(new RSTile(tableX, tableY + 2)) != null)
- {//Table is going north
- toAddTo.add(new RSTile(tableX, tableY));
- toAddTo.add(new RSTile(tableX, tableY + 1));
- toAddTo.add(new RSTile(tableX, tableY + 2));
- toAddTo.add(new RSTile(tableX - 1, tableY));
- toAddTo.add(new RSTile(tableX - 1, tableY + 1));
- toAddTo.add(new RSTile(tableX - 1, tableY + 2));
- toAddTo.add(new RSTile(tableX - 4, tableY + 1));
- toAddTo.add(new RSTile(tableX - 4, tableY + 2));
- toAddTo.add(new RSTile(tableX - 1, tableY + 5));
- toAddTo.add(new RSTile(tableX - 2, tableY + 5));
- }
- if (objects.getTopAt(new RSTile(tableX, tableY - 2)) != null)
- {//table is going south
- toAddTo.add(new RSTile(tableX, tableY));
- toAddTo.add(new RSTile(tableX, tableY - 1));
- toAddTo.add(new RSTile(tableX, tableY - 2));
- toAddTo.add(new RSTile(tableX + 1, tableY));
- toAddTo.add(new RSTile(tableX + 1, tableY - 1));
- toAddTo.add(new RSTile(tableX + 1, tableY - 2));
- toAddTo.add(new RSTile(tableX, tableY - 5));
- toAddTo.add(new RSTile(tableX + 1, tableY - 5));
- toAddTo.add(new RSTile(tableX + 4, tableY - 1));
- toAddTo.add(new RSTile(tableX + 4, tableY - 2));
- }
- if (objects.getTopAt(new RSTile(tableX - 2, tableY)) != null)
- {//table is going west
- toAddTo.add(new RSTile(tableX, tableY));
- toAddTo.add(new RSTile(tableX - 1, tableY));
- toAddTo.add(new RSTile(tableX - 2, tableY));
- toAddTo.add(new RSTile(tableX, tableY - 1));
- toAddTo.add(new RSTile(tableX - 1, tableY - 1));
- toAddTo.add(new RSTile(tableX - 2, tableY - 1));
- toAddTo.add(new RSTile(tableX - 5, tableY));
- toAddTo.add(new RSTile(tableX - 5, tableY - 1));
- toAddTo.add(new RSTile(tableX - 1, tableY - 4));
- toAddTo.add(new RSTile(tableX - 2, tableY - 4));
- }
- if (objects.getTopAt(new RSTile(tableX + 2, tableY)) != null)
- {//table is going east
- toAddTo.add(new RSTile(tableX, tableY));
- toAddTo.add(new RSTile(tableX + 1, tableY));
- toAddTo.add(new RSTile(tableX + 2, tableY));
- toAddTo.add(new RSTile(tableX, tableY + 1));
- toAddTo.add(new RSTile(tableX + 1, tableY + 1));
- toAddTo.add(new RSTile(tableX + 2, tableY + 1));
- toAddTo.add(new RSTile(tableX + 5, tableY));
- toAddTo.add(new RSTile(tableX + 5, tableY + 1));
- toAddTo.add(new RSTile(tableX + 1, tableY + 4));
- toAddTo.add(new RSTile(tableX + 2, tableY + 4));
- }
- return toAddTo;
- }
- private int[] stuff = { 16933, 18312, 18250, 18230, 18238, 18161, 18167, 18163, 18165, 18159 };
- private int[] beast = { THE_MONSTER, THE_MONSTER_2, THE_MONSTER_3, 10226, 10399, 10414, 10212, 10415, 10835, 10323, 10417, 10400, 10406, 10415, 10460, 10834, 10225, 10322, 10561 };
- private boolean atMonster() {// Got it
- // Check to see if we are already inside of the room
- int cr1 = getMyPlayer().getLocation().getX();
- int cr2 = getMyPlayer().getLocation().getY();
- if (cr1 >= x1 && cr1 <= x2) {
- if (cr2 >= y1 && cr2 <= y2)
- return true;
- }
- return false;
- }
- private boolean atNPCModel(RSNPC npc, String action) {
- if (npc == null)
- return false;
- if (!calc.tileOnScreen(npc.getLocation())
- && calc.tileOnMap(npc.getLocation())) {
- walking.walkTileMM(npc.getLocation());
- } else if (calc.tileOnScreen(npc.getLocation())) {
- mouse.move(npc.getModel().getPoint());
- sleep(random(300, 500));
- if (menu.getItems()[0].toLowerCase().contains(action.toLowerCase())) {
- mouse.click(true);
- return true;
- } else {
- String[] menuItems = menu.getItems();
- for (String item : menuItems) {
- if (item.toLowerCase().contains(action.toLowerCase())) {
- mouse.click(false);
- return menu.doAction(action);
- }
- }
- }
- }
- return false;
- }
- private void fight() {
- try {
- if (getMyPlayer().getInteracting() == null
- && inventory.getCount(foods) >= 1 && atMonster()) {
- String monn = "";
- if (monn != null) {
- ;
- }
- }
- } catch (Exception e) {
- e.printStackTrace();
- }
- sleep(random(200, 250));
- }
- private void eatting() {
- try {
- int currentHP = Integer.parseInt(interfaces.get(748)
- .getComponent(8).getText());
- if (currentHP <= 70) {
- if (inventory.getCount(foods) >= 1) {
- inventory.getItem(foods).doAction("Eat");
- }
- }
- } catch (Exception e) {
- e.printStackTrace();
- }
- sleep(random(500, 1000));
- }
- private void pick() {
- {
- try {
- if (!inventory.isFull() && atMonster()) {
- RSGroundItem item = groundItems.getNearest(stuff);
- if (item != null) {
- item.doAction("Take");
- }
- }
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
- sleep(random(100, 200));
- }
- public boolean waitForIfaceToContainText(RSComponent iface, int timeout, String text)
- {
- if (timeout < 0)
- return false;
- if (iface == null)
- return false;
- while (System.currentTimeMillis() - startTime <= timeout)
- {
- if (iface.getText() == text)
- return true;
- sleep(125);
- }
- return false;
- }
- public boolean RunOnce()
- {
- floorChange = interfaces.get(947);
- attLvl = skills.getCurrentLevel(skills.ATTACK);
- defenceLvl = skills.getCurrentLevel(skills.DEFENSE);
- textColor = Color.ORANGE;
- startTime = System.currentTimeMillis();
- complexityConfirm = interfaces.getComponent(938, 37);
- complexityLvl6 = interfaces.getComponent(938, 81);
- complexityLvl5 = interfaces.getComponent(938, 76);
- complexityLvl4 = interfaces.getComponent(938, 71);
- complexityLvl3 = interfaces.getComponent(938, 66);
- complexityLvl2 = interfaces.getComponent(938, 61);
- complexityLvl1 = interfaces.getComponent(938, 60);
- complexityChange = interfaces.get(938);
- partyTabInterface = interfaces.get(939);
- changeComplexity = interfaces.getComponent(939, 99);
- changeFloor = interfaces.getComponent(939, 105);
- formParty = interfaces.getComponent(939, 42);
- firstUser = interfaces.getComponent(939, 56);
- doStartScript = true;
- action = enterDungeon;
- return true;
- }
- public int antiban()
- {
- int roll = random(0, 80);
- switch (roll)
- {
- //Check Invy or Stats
- case 1:
- case 3:
- case 28:
- int randomHumanCheckedTabs = random(1, 5);
- if ((randomHumanCheckedTabs == 1) || (randomHumanCheckedTabs == 3))
- {
- Bot.getInputManager().pressKey((char)KeyEvent.VK_F1);
- sleep(100);
- Bot.getInputManager().releaseKey((char)KeyEvent.VK_F1);
- }
- game.openTab(game.TAB_INVENTORY);
- if ((randomHumanCheckedTabs == 2) || (randomHumanCheckedTabs == 4)
- || (randomHumanCheckedTabs == 5))
- game.openTab(game.TAB_STATS);
- return 0;
- //Change Camera Cases
- case 2:
- case 9:
- case 11:
- case 18:
- case 30:
- camera.setAngle(random(1, 360));
- return 0;
- //Check Friends Case
- case 5:
- case 22:
- case 29:
- game.openTab(9);
- return 50;
- //Change Camera Angle Cases
- case 13:
- case 14:
- return 0;
- case 76://Texting Case
- return 45000;
- default:
- return 0;
- }
- }
- public static final int THE_MONSTER = 10226,
- THE_MONSTER_2 = 10399,
- THE_MONSTER_3 = 10414;
- /**
- * The following method is from RSBot User LemonDrop
- * @param pitch
- */
- public void setCameraHeight(int pitch){
- int curAlt = Bot.getClient().getCameraPitch();
- if(curAlt < pitch){
- Bot.getInputManager().pressKey((char) KeyEvent.VK_UP);
- }
- else if(curAlt > pitch){
- Bot.getInputManager().pressKey((char) KeyEvent.VK_DOWN);
- }
- else{
- Bot.getInputManager().releaseKey((char) KeyEvent.VK_UP);
- Bot.getInputManager().releaseKey((char) KeyEvent.VK_DOWN);
- }
- }
- public void eatnao() {
- if(getMyPlayer().isInCombat()) {
- if(combat.getLifePoints() < 100)
- clickInventoryItem(18163, "Eat", -1);
- clickInventoryItem(18161, "Eat", -1);
- clickInventoryItem(18167, "Eat", -1);
- clickInventoryItem(18165, "Eat", -1);
- clickInventoryItem(18159, "Eat", -1);
- }
- }
- RSItem itemsdude;
- int attLvl;
- int defenceLvl;
- private int[] newdoors = { guardianDoor1, guardianDoor2, silverWedgeDoor,
- greenTriDoor, crimShieldDoor, blueRectDoorU, crimShieldDoorU, greenTriDoorU,
- silverWedgeDoorU };
- private void InitializeAttempt(){
- log("Building web-walking paths...");
- sleep(1254);
- log("Error");
- }
- //TODO Loop Shortcut
- public int FindDungeon()
- {
- if(!doStartScript)
- return 500;
- if (game.isLoggedIn())
- {
- if (playerInSquare(3461, 3730, 3455, 3727))
- {
- currentStatus = "Jumping Down stairs.";
- RSObject brokenStairsObject = objects.getNearest(brokenStairs);
- if (brokenStairsObject != null)
- {
- int x = brokenStairsObject.getLocation().getX();
- int y = brokenStairsObject.getLocation().getX();
- mouse.move(x, y, 2, 2);
- sleep(60);
- if (menu.getActions().toString().contains("Jump-down"))
- {
- menu.doAction("Jump-down");
- }
- else if (!menu.getActions().toString().contains("Jump"))
- {
- menu.doAction("Cancel");
- }
- }
- }
- if (action == enterDungeon)
- {
- if (subAction == 0)
- checkInventoryReadyToEnter();
- if (subAction == bankItems)
- {
- /*
- * Find Bank - Done
- * Open Bank - Done
- * Deposit All Except for ring - Done
- * Close Bank - Done
- * Check items/equipment - Done
- */
- openBank();
- depositToBank();
- subAction = checkForItems;
- return 500;
- }
- if (subAction == checkForItems)
- {
- /*
- * Check Inventory for items
- * Has anything other then the ring, deposit
- */
- checkInventoryReadyToEnter();
- subAction = enterDungeons;
- return 500;
- }
- if (subAction == enterDungeons)
- {
- currentStatus = "Entering Dungeon";
- enterDungeon();
- sleep(2500);
- action = inDungeon;
- subAction = setUpStartRoom;
- return 500;
- }
- }
- if (action == inDungeon)
- {
- if (subAction == setUpStartRoom)
- {
- /*
- * Find Smuggler - Done
- * Create startRoom RSArea - Done
- * Find all objects in startRoom - Done
- * Find all doors in startRoom - Done
- * Get all tiles of doors in startRoom - Done
- * Find all keys in startRoom - Done
- * Set RSTile for exit ladder - Done
- * Pick up Keys - Done
- * Pick up From Table - Done
- * Equip Armour and Weapons - Done
- * Start dungeon - Done
- */
- RSNPC smuggler = npcs.getNearest(smugglerID);
- combat.setAutoRetaliate(true);
- if (smuggler != null)
- {
- currentStatus = "Entered Dungeon - Setting Up Start Room";
- dungeonStart = getMyPlayer().getLocation();
- southWest = new RSTile(dungeonStart.getX() - 8,
- dungeonStart.getY() - 8);
- southEast = new RSTile(dungeonStart.getX() + 8,
- dungeonStart.getY() - 8);
- northWest = new RSTile(dungeonStart.getX() - 9,
- dungeonStart.getY() + 7);
- northEast = new RSTile(dungeonStart.getX() + 7,
- dungeonStart.getY() + 7);
- startRoom = new RSArea(southWest, northEast);
- startRoomObjects = getObjectsAt(startRoom);
- startRoomDoorTiles = findDoorLocInArea(startRoom);
- getKeysInArea(startRoom);
- if (objects.getNearest(dungeonExit) != null)
- exitLadder = objects.getNearest(dungeonExit).getLocation();
- drawStartRoomArea = true;
- subAction = getdemkey;
- if (subAction == getdemkey)
- while (!keysOnFloor.isEmpty())
- {
- currentStatus = "Getting Keys";
- RSItem keyOnFloor = keysOnFloor.get(0);
- int keyID = keyOnFloor.getID();
- Point keyTile = ((Point) ((Map<Object, Object>) groundItems).get(keyID)).getLocation();
- keysOnFloor.remove(0);
- subAction = gettablefood;
- }
- /*
- * Get Table Tiles - Done
- * Check for Items - Done
- * If Items, Pick them up - Done
- */
- if (subAction == gettablefood) {
- currentStatus = "Getting Items from Table.";
- RSTile tileLoc = new RSTile(6506, 6265);
- final RSObject food = objects.getNearest(FOOD_TABLE,
- FOOD_TABLE_2);
- if (food != null) {
- if (calc.distanceTo(food) <= 5) {
- food.doAction("Take");
- } else {
- walking.walkTo(food.getLocation());
- subAction = enterdoor1;
- }
- }
- }
- }
- }
- /*
- * Get items in inventory - DONE
- * Compare Armour - DONE
- * Wield Best - DONE
- * Drop/Sell the rest
- */
- if (subAction == getequip) {
- RSItem[] inventoryItems = inventory.getItems();
- for (int i = 0; i < 27; i ++)
- {
- while (!keysOnFloor.isEmpty()) {
- currentStatus = "Getting Keys";
- RSItem keyOnFloor = keysOnFloor.get(0);
- int keyID = keyOnFloor.getID();
- log("Key ID: "+keyID);
- Point keyTile = ((Point) ((Map<Object, Object>) groundItems).get(keyID)).getLocation();
- log("Key location: ("+keyTile.getX()+","+keyTile.getY()+")");
- keysOnFloor.remove(0);
- }
- if(inventory.contains(15753))
- if(attLvl <= 1)
- if(defenceLvl <= 1)
- clickInventoryItem(16647, "Wear", -1);
- clickInventoryItem(16713, "Wear", -1);
- clickInventoryItem(15753, "Wield", -1);
- clickInventoryItem(16669, "Wear", -1);
- clickInventoryItem(17239, "Wear", -1);
- mouse.click(true);
- subAction = gettablefood;
- }
- }
- /*
- * Find first open door - DONE
- * Open it - DONE
- * When +2y/+2x is now a door, enter first room - DONE
- */
- if (subAction == getdemkey2) {
- while (!keysOnFloor.isEmpty())
- {
- currentStatus = "Getting Keys";
- RSItem keyOnFloor = keysOnFloor.get(0);
- int keyID = keyOnFloor.getID();
- Point keyTile = ((Point) ((Map<Object, Object>) groundItems).get(keyID)).getLocation();
- keysOnFloor.remove(0);
- subAction = enterdoor1;
- }
- }
- if (subAction == enterdoor1) {
- final RSObject door = objects.getNearest(enterDoorIDs);
- RSTile tileLocs = new RSTile(getMyPlayer().getLocation().getX() + 8, getMyPlayer().getLocation().getY() + 8);
- walking.walkTo(door.getLocation());
- sleep(300);
- if(door.isOnScreen())
- door.doAction("Enter");
- sleep(400);
- door.doAction("Enter");
- subAction = enterdoorlast;
- /*
- * In Combat with NPC - DONE
- * Pick up the loot - DONE
- * Eat while in Combat with NPC - DONE
- * Wear some loot
- * Pick up Keys - DONE
- * Contine to next dungeon level - DONE
- */
- if (subAction == enterdoorlast) {
- try {
- if (getMyPlayer().getInteracting() == null
- && inventory.getCount(foods) >= 1 && atMonster()) {
- fight();
- }
- while (getMyPlayer().getInteracting() instanceof RSNPC
- || getMyPlayer().isInCombat())
- if (inventory.getCount(foods) >= 1) {
- eatting();
- }
- if (!inventory.isFull() && atMonster()) {
- pick();
- }
- subAction = enterdoor1;
- }
- catch (Exception e) {
- log("Caught Exception: "
- + e.getMessage());
- }
- }
- }
- }
- } else
- {//Login
- }
- return 1000;
- }
- RSNPC rsnpcs;
- public void serverMessageRecieved(ServerMessageEvent e)
- {
- String message = e.getMessage().toLowerCase();
- RSTile tileLocs = new RSTile(getMyPlayer().getLocation().getX() + 8, getMyPlayer().getLocation().getY() - 8);
- final RSObject door = objects.getNearest(50346);
- if (message.contains("ou have to be the leader "))
- createParty();
- if (message.contains("have been slain. "))
- walking.walkTileOnScreen(tileLocs);
- if (message.contains("have the correct key. "))
- subAction = getdemkey2;
- }
- public boolean onStart(){
- return game.isLoggedIn();
- }
- public void onFinish(){
- }
- @Override
- public int loop() {
- enterDungeon();
- return 0;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement