Advertisement
UberMouse

Untitled

Apr 19th, 2011
205
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 42.06 KB | None | 0 0
  1. /*      SAVE AS "PrivateDungeonPro.java" !!!
  2.  *      PrivateDungeoneeringPro (v.2) *
  3.  *
  4.  * RULES:
  5.  * 1) THIS IS A PRIVATE SCRIPT
  6.  *      -That means no sharing with your little brother
  7.  *      -I can detect who's script was leaked and your
  8.  *          license will be terminated
  9.  *         
  10.  * 2) DO NOT REVERSE ENGINEER
  11.  *      -Again, i can tell when my scripts are tampered with
  12.  *          and each one is made unique for each customer.
  13.  *          If you attempt to tamper with the script I
  14.  *          WILL know. ;)
  15.  *
  16.  * 3) Bot Reasonably
  17.  *      -Although every attempt at being stealthy has been made
  18.  *          botting for a week straight isn't normal. You will
  19.  *          get banned and hurt this script. Bot responsibly.
  20.  *
  21.  * */
  22. import java.io.*;
  23. import java.net.*;
  24. import java.security.*;
  25. import java.util.*;
  26. import java.util.logging.*;
  27. import org.rsbot.script.*;
  28. import org.rsbot.util.*;
  29. import java.awt.Color;
  30. import java.awt.Graphics;
  31. import java.awt.Graphics2D;
  32. import java.awt.Point;
  33. import java.awt.Polygon;
  34. import java.awt.RenderingHints;
  35. import java.awt.event.KeyEvent;
  36. import java.awt.geom.GeneralPath;
  37. import java.util.ArrayList;
  38. import java.util.List;
  39. import java.util.Map;
  40. import java.lang.Thread;
  41. import java.awt.BorderLayout;
  42. import java.awt.event.ActionEvent;
  43. import java.awt.event.ActionListener;
  44. import javax.swing.*;
  45. import org.rsbot.bot.Bot;
  46. import org.rsbot.client.input.Mouse;
  47. import org.rsbot.event.*;
  48. import org.rsbot.event.events.ServerMessageEvent;
  49. import org.rsbot.event.listeners.PaintListener;
  50. import org.rsbot.event.listeners.ServerMessageListener;
  51. import org.rsbot.script.Script;
  52. import org.rsbot.script.ScriptManifest;
  53. import org.rsbot.script.wrappers.RSArea;
  54. import org.rsbot.script.wrappers.RSComponent;
  55. import org.rsbot.script.wrappers.RSGroundItem;
  56. import org.rsbot.script.wrappers.RSInterface;
  57. import org.rsbot.script.wrappers.RSItem;
  58. import org.rsbot.script.wrappers.RSItemDef;
  59. import org.rsbot.script.wrappers.RSNPC;
  60. import org.rsbot.script.wrappers.RSObject;
  61. import org.rsbot.script.wrappers.RSTile;
  62. import org.rsbot.script.methods.GroundItems;
  63. import org.rsbot.script.methods.Interfaces;
  64.  
  65.  
  66. @ScriptManifest(authors = { "CRACKED BY KR33D" }, keywords = "Dungeoneering", name = "ProDungeoneering_CRACKED", version = 0.6, description = "Start with floor 1 and complexity 1 set.")
  67. public class PrivateDungeonPro extends Script {
  68.    
  69.     public boolean gui_on = false;
  70.    
  71.     public GroundItems grounditems;
  72.  
  73.     /**
  74.      * GUI
  75.      */
  76.     private String scriptName = "ProDungeon";
  77.     private double scriptVersion = 0.4;//TODO Keep Updated
  78.  
  79.     /*
  80.      * All object and other ID's needed.
  81.      * @Author Arista
  82.      */
  83.     public static final int FOOD_TABLE = 51577,
  84.                 FOOD_TABLE_2 = 51598;
  85.  
  86.  
  87.     /**
  88.      * Paint
  89.      * Original Paint methods taken from FamousMiner - Reworked by ProCrus
  90.      */
  91.     private String currentStatus = "";
  92.     public long startTime;
  93.     public long millisec;
  94.     public long seconds;
  95.     public long minutes;
  96.     public long hours;
  97.     public int startAttackyLvl = 0;
  98.     public int startAttackyExp = 0;
  99.     public int gainedAttackyExp = 0;
  100.     public int gainedAttackyLvl = 0;
  101.     public Color textColor;
  102.     private int x1;
  103.         private int x2;
  104.         private int y1;
  105.         private int y2;
  106.  
  107.     private boolean drawStartRoomArea = false;
  108.     private EventManager event;
  109.     private Bot Bot;
  110.     private Thread Thread;
  111.     private int paintBox()
  112.     {
  113.         //int x = mouse.getClientLocation().x;
  114.         int x = mouse.getLocation().x;
  115.         //int y = mouse.getClientLocation().y;
  116.         int y = mouse.getLocation().y;
  117.         if (x >= 6 && x < 90 && y >= 6 && y < 44)
  118.             return 1;
  119.         else if (x >= 91 && x < 176 && y >= 6 && y < 44)
  120.             return 2;
  121.         else if (x >= 169 && x < 254 && y >= 6 && y < 44)
  122.             return 3;
  123.         else
  124.             return 0;
  125.     }
  126.  
  127.     public void onRepaint(final Graphics g)
  128.     {
  129.         ((Graphics2D) g).setRenderingHint(RenderingHints.KEY_ANTIALIASING,
  130.                 RenderingHints.VALUE_ANTIALIAS_ON);
  131.  
  132.         millisec = System.currentTimeMillis() - startTime;
  133.         hours = millisec / (1000 * 60 * 60);
  134.         millisec -= hours * (1000 * 60 * 60);
  135.         minutes = millisec / (1000 * 60);
  136.         millisec -= minutes * (1000 * 60);
  137.         seconds = millisec / 1000;
  138.  
  139.         final int xx = 18;
  140.         final int yy = 58;
  141.  
  142.         switch (paintBox())
  143.         {
  144.         case 0:
  145.             //View No Screen
  146.             break;
  147.  
  148.             //Show Level Information
  149.         case 1:
  150.             g.setColor(new Color(0, 0, 0, 140));
  151.             g.fillRoundRect(6, 43, 500, 282, 5, 5);
  152.             g.setColor(Color.black);
  153.             g.drawString(scriptName + " - Version: " + scriptVersion, xx + 1, yy + 1);
  154.             g.setColor(textColor);
  155.             g.drawString(scriptName + " - Version: " + scriptVersion, xx, yy);
  156.             g.drawString("Time Running: " + hours + ":" + minutes + ":" + seconds, 18, 80);
  157.             g.drawString("Status: " + currentStatus, 18, 100);
  158.             g.drawString("Floor: " + floorLvl, 18, 120);
  159.             g.drawString("Complexity: " + complexLvl, 18, 140);
  160.             g.drawString("Dungeons Played: " + playedDungeons, 18, 160);
  161.             if (drawStartRoomArea)
  162.             {
  163.  
  164.                 String sw = "SW Tile: " + southWest.getX() + ", " + southWest.getY();
  165.                 String se = "SE Tile: " + southEast.getX() + ", " + southEast.getY();
  166.                 String nw = "NW Tile: " + northWest.getX() + ", " + northWest.getY();
  167.                 String ne = "NE Tile: " + northEast.getX() + ", " + northEast.getY();
  168.                 g.setColor(Color.GREEN);
  169.                 g.drawString("<>< Start room corners ><>", 18, 180);
  170.                 g.setColor(textColor);
  171.                 g.drawString(sw, 18, 200);
  172.                 g.drawString(se, 18, 220);
  173.                 g.drawString(nw, 18, 240);
  174.                 g.drawString(ne, 18, 260);
  175.             }
  176.             else
  177.             {
  178.                 g.setColor(Color.GREEN);
  179.                 g.drawString("<>< Start room corners ><>", 18, 180);
  180.                 g.setColor(textColor);
  181.                 g.drawString("No Available Data", 18, 200);
  182.                 g.drawString("No Available Data", 18, 220);
  183.                 g.drawString("No Available Data", 18, 240);
  184.                 g.drawString("No Available Data", 18, 260);
  185.             }
  186.             break;
  187.  
  188.             //Stats
  189.         case 2:
  190.             g.setColor(new Color(0, 0, 0, 140));
  191.             g.fillRoundRect(6, 43, 500, 282, 5, 5);
  192.             g.setColor(Color.black);
  193.             g.drawString(scriptName + " - Version: " + scriptVersion, xx + 1, yy + 1);
  194.             g.setColor(textColor);
  195.             g.drawString(scriptName + " - Version: " + scriptVersion, xx, yy);
  196.             g.setColor(textColor);
  197.             g.drawString("Current Dungeoneering Level: ", 18, 80);
  198.             g.drawString("Maps Played: ", 18, 100);
  199.             g.drawString("Ores/Hour: ", 18, 120);
  200.             g.drawString("Levels Gained: ", 18, 140);
  201.             g.drawString("EXP Till Next Level: ", 18, 160);
  202.             g.drawString("EXP/Hour: ", 18, 180);
  203.             g.drawString("Gems Mined: ", 18, 200);
  204.             break;
  205.  
  206.             //Script Info
  207.         case 3:
  208.             g.setColor(new Color(0, 0, 0, 140));
  209.             g.fillRoundRect(6, 43, 500, 282, 5, 5);
  210.             g.setColor(Color.black);
  211.             g.drawString(scriptName + " - Version: " + scriptVersion, xx + 1, yy + 1);
  212.             g.setColor(textColor);
  213.             g.drawString(scriptName + " - Version: " + scriptVersion, xx, yy);
  214.             g.setColor(textColor);
  215.             g.drawString("Profit gained: ", 18, 80);
  216.             g.drawString("Profit per hour: ", 18, 100);
  217.             break;
  218.         }
  219.         g.setColor(new Color(0, 0, 0, 180));
  220.         g.fillRoundRect(6, 6, 84, 37, 1, 3);
  221.         g.fillRoundRect(92, 6, 84, 37, 1, 3);
  222.         g.fillRoundRect(177, 6, 84, 37, 1, 3);
  223.         g.setColor(textColor);
  224.         g.drawString("Dungeon Info", 12, 29);
  225.         g.drawString("All Stats", 101, 29);
  226.         g.drawString("Script Info", 184, 29);
  227.     }
  228.  
  229.     /**
  230.      * Script
  231.      */
  232.     //MainActions
  233.     private int action = 0;
  234.     private int enterDungeon = 1;
  235.     private int inDungeon = 2;
  236.  
  237.     //SubActions
  238.     private int subAction = 0;
  239.     private int bankItems = 1;
  240.     private int checkForItems = 2;
  241.     private int makeParty = 3;
  242.     private int enterDungeons = 4;
  243.  
  244.     private int setUpStartRoom = 1;
  245.     private int getdemkey;
  246.     private int getdemkey2;
  247.     private int enterdoor1;
  248.     private int enterdoorlast;
  249.     private int getequip;
  250.     private int gettablefood;
  251.  
  252.     //<<!-<><-!>>
  253.  
  254.     private boolean doStartScript = false;
  255.  
  256.     private enum LoadStages { STARTUP, LOADAREA, LOADOBJECTS, LOADTASKS, LOADLVL, LOADROOMS };
  257.     LoadStages LoadStages;
  258.  
  259.     //Following code is made by: Xhamolk_
  260.     /**
  261.      * Gets the RSObjects found in the specified RSArea.
  262.      *
  263.      * @param area The RSArea that determines the tiles where to search for objects.
  264.      * @return The found found in the specified area.
  265.      * @return Might return <tt>null</tt> or an empty array.
  266.      */
  267.     public RSObject[] getObjectsAt(RSArea area){
  268.         if( area == null )
  269.             return null;
  270.  
  271.         ArrayList<RSObject> list = new ArrayList<RSObject>();
  272.         for( RSTile[] tiles : area.getTiles() ) {
  273.             for( RSTile tile : tiles ){
  274.                 if(tile != null)
  275.                     continue;
  276.                 if( tiles != null )
  277.                     continue;
  278.                 RSObject object = objects.getTopAt( tile ); // this is line with disfunction
  279.                 if( object == null )
  280.                     continue;
  281.                 list.add( object );
  282.             }
  283.         }
  284.  
  285.         return list.toArray(new RSObject[list.size()]);
  286.     }
  287.     public boolean waitForIface(RSInterface iface, int timeout) {
  288.         if (timeout < 0)
  289.             return false;
  290.  
  291.         if (iface == null)
  292.             return false;
  293.  
  294.         while (System.currentTimeMillis() - startTime <= timeout) {
  295.             if (iface.isValid())
  296.                 return true;
  297.             sleep(125);
  298.         }
  299.  
  300.         return false;
  301.     }
  302.  
  303.     //<<!--<><Banking><>--!>>
  304.     private RSTile bankTile;
  305.     private int bankerNPC = 9710;
  306.     private int[] dontDeposit = new int[] { 15707 };
  307.  
  308.     private int openBank()
  309.     {
  310.         try
  311.         {
  312.             RSNPC banker = npcs.getNearest(bankerNPC);
  313.             bankTile = banker.getLocation();
  314.             if (banker != null)
  315.             {
  316.                 if (getMyPlayer().isMoving())
  317.                     return 500;
  318.                 if (calc.distanceTo(bankTile) >= 5)
  319.                 {
  320.                     if (calc.tileOnMap(bankTile))
  321.                     {
  322.                         walking.walkTo(bankTile);
  323.                         openBank();
  324.                         return 50;
  325.                     }
  326.                 }
  327.                 else if (calc.distanceTo(bankTile) <= 4)
  328.                 {
  329.                     currentStatus = "Opening bank.";
  330.                     final Point location = calc.tileToScreen(bankTile);
  331.                     if (location.x == -1 || location.y == -1)
  332.                         wait(500);
  333.                     mouse.click(location, 2, 2, false);
  334.                     wait(300);
  335.                     if (menu.getActions().toString().contains("Bank"))
  336.                     {
  337.                         menu.clickIndex(1);
  338.                     }
  339.                     else
  340.                     {
  341.                         menu.doAction("Cancel");
  342.  
  343.                     }
  344.                 }
  345.             }
  346.  
  347.         }
  348.         catch (Exception e)
  349.         {
  350.  
  351.         }
  352.         return 500;
  353.     }
  354.     private int depositToBank()
  355.     {
  356.         try
  357.         {
  358.             if (interfaces.get(bank.INTERFACE_BANK).isValid())
  359.             {
  360.                 currentStatus = "Depositing Items";
  361.                 bank.depositAllEquipped();
  362.                 bank.depositAllExcept(dontDeposit);
  363.                 wait(250);
  364.                 bank.close();
  365.             }
  366.         }
  367.         catch (Exception e)
  368.         {
  369.  
  370.         }
  371.         return 500;
  372.     }
  373.  
  374.     //<<!--<><Item Checking><>--!>>
  375.     private int ringID = 15707;
  376.  
  377.     /**
  378.      * Gets the id of the equipment equipped.
  379.      * @param interfaceID
  380.      * @return equipment id, returns -1 if nothing
  381.      */
  382.     private int getEquipmentID(int interfaceID)
  383.     {
  384.         RSComponent equip = equipment.getInterface().getComponent(interfaceID);
  385.         int id = equip.getComponentID();
  386.         return id;
  387.     }
  388.     private boolean checkInventoryReadyToEnter()
  389.     {
  390.         boolean inventorySet = false;
  391.         if (inventory.getCountExcept(ringID) <= 0)
  392.         {
  393.             subAction = checkForItems;
  394.             inventorySet = true;
  395.         }
  396.         if (!inventorySet)
  397.             subAction = bankItems;
  398.         return inventorySet;
  399.     }
  400.     private int complexLvl = 1;
  401.     private int floorLvl = 1;
  402.     private int playedDungeons = 0;
  403.  
  404.     /**
  405.      * Clicks the first available inventory item and does the specified action.
  406.      *
  407.      * @param itemID - the Item ID you want to click
  408.      * @param action - the menuAction to click
  409.      * @param actionIndex - the menuItem to click(use -1 to ignore this part of the method)
  410.      * @return
  411.      */
  412.     private int clickInventoryItem(int itemID, String action, int actionIndex)
  413.     {
  414.         try
  415.         {
  416.             if (game.getCurrentTab() != game.TAB_INVENTORY)
  417.                 game.openTab(game.TAB_INVENTORY);
  418.  
  419.             RSComponent inventory = interfaces.getComponent(149, 0);
  420.             for (int i = 0; i < 28; i++)
  421.             {
  422.                 RSComponent inventoryItem = inventory.getComponents()[i];
  423.                 int id = inventoryItem.getComponentID();
  424.                 if (id == itemID)
  425.                 {
  426.                     Point itemPoint = inventoryItem.getCenter();
  427.                     //Point mouseLoc = mouse.getClientLocation();
  428.                     Point mouseLoc = mouse.getLocation();
  429.                     if (Math.abs(itemPoint.x - mouseLoc.x) > 5)
  430.                     {
  431.                         mouse.move(itemPoint);
  432.                         wait(120);
  433.                         if (actionIndex != -1)
  434.                         {
  435.                             menu.clickIndex(actionIndex);
  436.                             return 150;
  437.                         }
  438.                         inventoryItem.doAction(action);
  439.                         return 250;
  440.                     }
  441.                 }
  442.             }
  443.         }
  444.         catch (Exception e)
  445.         {
  446.  
  447.         }
  448.  
  449.         return 0;
  450.     }
  451.  
  452.     public RSComponent firstUser;
  453.     public RSComponent formParty;
  454.     public RSComponent changeFloor;
  455.     public RSComponent changeComplexity;
  456.     public RSInterface partyTabInterface;
  457.  
  458.     public RSInterface complexityChange;
  459.     public RSComponent complexityLvl1;
  460.     public RSComponent complexityLvl2;
  461.     public RSComponent complexityLvl3;
  462.     public RSComponent complexityLvl4;
  463.     public RSComponent complexityLvl5;
  464.     public RSComponent complexityLvl6;
  465.     public RSComponent complexityConfirm;
  466.  
  467.     public RSInterface floorChange;
  468.  
  469.     private int openParty()
  470.     {
  471.         if (game.getCurrentTab() == game.TAB_INVENTORY)
  472.         {
  473.             if (inventory.containsOneOf(ringID))//Has Ring
  474.             {
  475.                 clickInventoryItem(ringID, "Open party interface", -1);
  476.                 return 1500;
  477.             }
  478.             else
  479.             {
  480.                 log("No Ring. Please Pause script and withdrawl your ring.");
  481.                 return 5000;
  482.             }
  483.         }
  484.         else
  485.         {
  486.             if (partyTabInterface.isValid())
  487.                 return 50;
  488.             game.openTab(game.TAB_INVENTORY);
  489.             openParty();
  490.         }
  491.         return 250;
  492.     }
  493.     private int createParty()
  494.     {
  495.         try
  496.         {
  497.             wait(500);
  498.             int x = formParty.getAbsoluteX() + 20;
  499.             int y = formParty.getAbsoluteY() + 10;
  500.             mouse.move(new Point(x, y), 0, 0);
  501.             wait(55);
  502.             if (menu.getActions().toString().contains("Form-party"))
  503.             {
  504.                 menu.doAction("Form-party");
  505.                 wait(800);
  506.                 return 200;
  507.             }
  508.             else if (!menu.getActions().toString().contains("Form"))
  509.             {
  510.                 mouse.move(new Point(x, y), 0, 0);
  511.                 menu.doAction("Form-party");
  512.             }
  513.         }
  514.         catch (Exception e)
  515.         {
  516.  
  517.         }
  518.         return 2000;
  519.     }
  520.     private boolean checkParty()
  521.     {
  522.         String firstText = firstUser.getText();
  523.         if (firstText.contains(getMyPlayer().getName()))
  524.             return true;
  525.         return false;
  526.     }
  527.     private int setComplexity(int complexity)
  528.     {
  529.         try
  530.         {
  531.             currentStatus = "Setting Complexity";
  532.             if (complexityChange.isValid())//Change complexity
  533.             {
  534.                 RSComponent whatComplexity = complexityLvl1;
  535.                 if (complexity == 2)
  536.                     whatComplexity = complexityLvl2;
  537.                 if (complexity == 3)
  538.                     whatComplexity = complexityLvl3;
  539.                 if (complexity == 4)
  540.                     whatComplexity = complexityLvl4;
  541.                 if (complexity == 5)
  542.                     whatComplexity = complexityLvl5;
  543.                 if (complexity == 6)
  544.                     whatComplexity = complexityLvl6;
  545.                 mouse.move(whatComplexity.getCenter(), 0, 0);
  546.                 whatComplexity.doAction("Select-complexity");
  547.                 mouse.click(true);
  548.                 sleep(750);
  549.                 mouse.move(complexityConfirm.getCenter(), 0, 0);
  550.                 sleep(55);
  551.                 mouse.click(true);
  552.                 return 750;
  553.             }
  554.             else//Open complexity interface
  555.             {
  556.                 if (partyTabInterface.isValid())
  557.                 {
  558.  
  559.                     int randomX = random(changeComplexity.getAbsoluteX() + 8,
  560.                             changeComplexity.getAbsoluteX() + 14);
  561.                     int randomY = random(changeComplexity.getAbsoluteY() + 3,
  562.                             changeComplexity.getAbsoluteY() + 7);
  563.                     Point clickComplex = new Point(randomX, randomY);
  564.                     mouse.move(clickComplex, 0, 0);
  565.                     sleep(55);
  566.                     mouse.click(true);
  567.                     wait(750);
  568.                     setComplexity(complexity);
  569.                 }
  570.             }
  571.         }
  572.         catch (Exception e)
  573.         {
  574.  
  575.         }
  576.         return 100;
  577.     }
  578.     private int setFloor(int floor)
  579.     {
  580.         currentStatus = "Setting Floor Level";
  581.         int topY = 100;
  582.         int bottomY = 104;
  583.         for (int i = 1; i <= floor; i++)
  584.         {
  585.             topY += 5;
  586.             bottomY += 5;
  587.         }
  588.         int randomX = random(20, 245);//Default lvl 1
  589.         int randomY = random(topY, bottomY);//Default lvl 1
  590.         Point clickFloor = new Point(randomX, randomY);
  591.         //Point mouse = this.mouse.getClientLocation();
  592.         Point mouse = this.mouse.getLocation();
  593.         if (floorChange.isValid())//Change floor
  594.         {
  595.             if (clickFloor.x == -1 || clickFloor.y == -1)
  596.                 return 250;
  597.             if (Math.abs(clickFloor.x - mouse.x) > 2)
  598.             {
  599.                 this.mouse.move(clickFloor, 0, 0);
  600.                 sleep(800);
  601.                 this.mouse.click(true);
  602.                 sleep(750);
  603.             }
  604.             randomX = random(185, 237);
  605.             randomY = random(272, 292);
  606.             clickFloor = new Point(randomX, randomY);
  607.             this.mouse.move(clickFloor, 0, 0);
  608.             sleep(800);
  609.             this.mouse.click(true);
  610.             return 750;
  611.         }
  612.         else//Open Floor Selection
  613.         {
  614.             if (partyTabInterface.isValid())
  615.             {
  616.                 randomX = random(changeFloor.getAbsoluteX() + 8,
  617.                         changeFloor.getAbsoluteX() + 14);
  618.                 randomY = random(changeFloor.getAbsoluteY() + 3,
  619.                         changeFloor.getAbsoluteY() + 7);
  620.                 clickFloor = new Point(randomX, randomY);
  621.                 this.mouse.move(clickFloor, 0, 0);
  622.                 sleep(800);
  623.                 this.mouse.click(true);
  624.                 setFloor(floor);
  625.                 return 50;
  626.             }
  627.         }
  628.         return 500;
  629.     }
  630.  
  631.     //<<!--<><Dungeon><>--!>>
  632.     private RSTile dungeonStart;
  633.     private List<RSTile> tableTiles = null;
  634.     private List<RSObject> startRoomDoors = new ArrayList<RSObject>();
  635.     private List<RSItem> keysOnFloor = new ArrayList<RSItem>();
  636.     private RSObject[] startRoomObjects;
  637.     private RSTile[] startRoomDoorTiles;
  638.     private RSArea startRoom;
  639.     private RSTile exitLadder;
  640.     private RSTile southEast;
  641.     private RSTile southWest;
  642.     private RSTile northEast;
  643.     private RSTile northWest;
  644.  
  645.     /*
  646.      * Anything from here to the Methods are only IDs or ID arrays/lists
  647.      */
  648.     //private int dungeonExit = 51156, 50604;
  649.     private int dungeonExit = 50604;
  650.     private int endDungeon = 49696;
  651.     private int brokenStairs = 50552;
  652.     //private int tableID = 51577;
  653.     //private int tableID2 = 51598;
  654.     private int tableID = 51031;
  655.     private int tableID2 = 51050;
  656.     /*
  657.      * The following are only doors
  658.      * If variable ends with U it is an Unlock door
  659.      */
  660.     private int blueRectDoorU = 50387;
  661.     private int silverWedgeDoorU = 50222;
  662.     private int greenTriDoorU = 50232;
  663.     private int crimShieldDoorU = 50263;
  664.  
  665.     private int[] unlockDoorIDs = new int[] { blueRectDoorU, crimShieldDoorU, greenTriDoorU,
  666.             silverWedgeDoorU };
  667.  
  668.     private int silverWedgeDoor = 50377;
  669.     private int greenTriDoor = 50367;
  670.     private int crimShieldDoor = 50408;
  671.     private int guardianDoor1 = 50346, guardianDoor2 = 50342, gaudianDoor3 = 50347;
  672.  
  673.     private int[] enterDoorIDs = new int[] { guardianDoor1, guardianDoor2, silverWedgeDoor,
  674.             greenTriDoor, crimShieldDoor};
  675.     /*
  676.      * End of doors, Start of NPCs
  677.      */
  678.  
  679.     private int smugglerID = 11226;
  680.     private int iceFiend = 10212;
  681.     private int iceWarrior = 10225;
  682.     private int mystShade1 = 10831, mystShade2 = 10833;
  683.     private int forgotWarrior1 = 10413, forgotWarrior2 = 10408;
  684.     private int forgotRanger1 = 10321, forgotRanger2 = 10320;
  685.     private int forgotMage = 10560;
  686.     private int gluttonous = 9948;
  687.  
  688.     /*
  689.      * End of NPCs start to Keys
  690.      */
  691.     private int crimShieldKey = 18312;
  692.     private int crimTriKey = 18298;
  693.     private int greenTriKey = 18250;
  694.     private int silverWedgeKey = 18230;
  695.     private int yellowRectangleKey = 18238;
  696.     private int purpleRectangleKey = 18286;
  697.  
  698.     private int[] chrimsonKeys = new int[] { crimShieldKey, crimTriKey };
  699.     private int[] blueKeys = new int[] {  };
  700.     private int[] greenKeys = new int[] { greenTriKey };
  701.     private int[] silverKeys = new int[] { silverWedgeKey };
  702.     private int[] yellowKeys = new int[] { yellowRectangleKey };
  703.     private int[] purpleKeys = new int[] { purpleRectangleKey };
  704.    
  705.     private int[] keyIds = new int[] { silverWedgeKey, greenTriKey, crimShieldKey,
  706.             yellowRectangleKey, purpleRectangleKey, crimTriKey };
  707.  
  708.     /*
  709.      * End of Keys start of Food
  710.      */
  711.     private int[] shortFinnedEel = new int[] { 18167 };
  712.     private String shortFinnedEelName = "Short-finned eel";
  713.     private int[] redEye = new int[] { 18161 };
  714.     private String redEyeName = "Red-eye";
  715.     private int[] giantFlatFish = new int[] { 18165 };
  716.     private String giantFlatFishName = "Giant flatfish";
  717.     private int[] duskEeel = new int[] { 18163 };
  718.     private String duskEeelName = "Dusk eel";
  719.     private int[] webSnipper = new int[] { 18169 };
  720.     private String webSnipperName = "Web snipper";
  721.     private int[] heimCrab = new int[] { 18159 };
  722.     private String heimCrabName = "Heim crab";
  723.     private int[] salveEel = new int[] { 18173 };
  724.     private String salveEelName = "Salve eel";
  725.     private int[] bouldabass = new int[] { 18171 };
  726.     private String bouldabassName = "Bouldabass";
  727.  
  728.     private int[] foods = new int[] { 18167, 18161, 18165, 18163, 18169, 18159, 18173, 18171 };
  729.  
  730.  
  731.     private int enterDungeon()
  732.     {
  733.         RSTile runTo = new RSTile(3449, 3731);
  734.         RSObject dungeon = objects.getNearest(48496);
  735.         if (calc.distanceTo(dungeon) > 5)
  736.             walking.walkTo(runTo);
  737.             mouse.move(313,81);
  738.             mouse.click(true);
  739.         return 2500;
  740.     }
  741.     private RSTile[] findDoorLocInArea (RSArea areaSearched)
  742.     {
  743.         if (areaSearched == null)
  744.             return null;
  745.  
  746.         ArrayList<RSTile> list = new ArrayList<RSTile>();
  747.         for( RSTile[] tiles : areaSearched.getTiles() ) {
  748.             for (RSTile tile : tiles)
  749.             {
  750.                 if(tile != null)
  751.                     continue;
  752.                 if( tiles != null )
  753.                     continue;
  754.                 RSObject object = objects.getTopAt (tile);
  755.                 for (int i = 0; i < enterDoorIDs.length; i++)
  756.                 {
  757.                     if (object != null)
  758.                         if (object.getID() == enterDoorIDs[i])
  759.                             list.add (object.getLocation());
  760.                 }
  761.                 for (int k = 0; k < unlockDoorIDs.length; k++)
  762.                 {
  763.                     if (object != null)
  764.                         if (object.getID() == unlockDoorIDs[k])
  765.                             list.add (object.getLocation());
  766.                 }
  767.             }
  768.         }
  769.  
  770.         return list.toArray(new RSTile[list.size()]);
  771.  
  772.     }
  773.  
  774.     /*
  775.      * The following method (findKeys(RSArea)) has been based off of getObjectsAt(RSArea)
  776.      * found towards the top of this class
  777.      * keysOnFloor
  778.      */
  779.     private void getKeysInArea(RSArea areaToSearch)
  780.     {
  781.         if (areaToSearch == null)
  782.             return;
  783.  
  784.         for (RSTile[] tiles : areaToSearch.getTiles())
  785.         {
  786.             for (RSTile tile : tiles)
  787.             {
  788.                 if(tile != null)
  789.                     continue;
  790.                 if( tiles != null )
  791.                     continue;
  792.                 RSGroundItem[] itemTiles = groundItems.getAllAt(tile);
  793.                 if (itemTiles != null)
  794.                 {
  795.                     for (int l = 0; l < itemTiles.length; l++)
  796.                     {
  797.                         RSItem items = itemTiles[l].getItem();
  798.                         int itemID = items.getID();
  799.                         for (int k = 0; k < keyIds.length; k++)
  800.                         {
  801.                             if (itemID == keyIds[k])
  802.                                 keysOnFloor.add(items);
  803.                         }
  804.                     }
  805.                 }
  806.             }
  807.         }
  808.     }
  809.     private int pickUpItem(int itemID, RSTile tile)
  810.     {
  811.         try
  812.         {
  813.             if (tile != null)
  814.             {
  815.                 if (calc.tileOnScreen(tile))
  816.                 {
  817.                     Point tileLoc = new Point(tile.getX(), tile.getY());
  818.                     mouse.move(tileLoc, 2, 2);
  819.                     wait(55);
  820.                     if (itemID != -1)
  821.                         menu.doAction("Take " + getItemName(itemID));
  822.                         if (!menu.doAction("Take " + getItemName(itemID)))
  823.                         {
  824.                             camera.setAngle(random(0, 360));
  825.                             int ran = random(0, 7);
  826.                             if (ran == 2 || ran == 5)
  827.                                 setCameraHeight(random(1024, 3072));
  828.                             mouse.move(tileLoc, 2, 8);
  829.                             menu.doAction("Take " + getItemName(itemID));
  830.                         }
  831.                     if (itemID == -1)
  832.                         menu.doAction("Take ");
  833.                     return 2000;
  834.                 }
  835.                 else if (calc.tileOnMap(tile))
  836.                 {
  837.                     walking.walkTileMM(tile);
  838.                     wait(750);
  839.                     pickUpItem(itemID, tile);
  840.                 }
  841.             }
  842.         }
  843.         catch(Exception e)
  844.         {
  845.  
  846.         }
  847.         return 500;
  848.     }
  849.     private String getItemName(int id1, int... id)
  850.     {
  851.         if (id == keyIds)
  852.         {
  853.             if (id == chrimsonKeys)
  854.                 return "chrimson";
  855.             if (id == yellowKeys)
  856.                 return "yellow";
  857.             if (id == blueKeys)
  858.                 return "blue";
  859.             if (id == silverKeys)
  860.                 return "silver";
  861.             if (id == greenKeys)
  862.                 return "green";
  863.         }
  864.         if (id1 == shortFinnedEel[0])
  865.             return shortFinnedEelName;
  866.         if (id1 == redEye[0])
  867.             return redEyeName;
  868.         if (id1 == giantFlatFish[0])
  869.             return giantFlatFishName;
  870.         if (id1 == duskEeel[0])
  871.             return duskEeelName;
  872.         if (id1 == webSnipper[0])
  873.             return webSnipperName;
  874.         if (id1 == heimCrab[0])
  875.             return heimCrabName;
  876.         if (id1 == bouldabass[0])
  877.             return bouldabassName;
  878.         if (id1 == salveEel[0])
  879.             return salveEelName;
  880.         return bouldabassName;
  881.  
  882.         //TODO This for easy access
  883.     }
  884.     private boolean playerInSquare(int xNE, int yNE, int xSW, int ySW)
  885.     {
  886.         int playX = getMyPlayer().getLocation().getX();
  887.         int playY = getMyPlayer().getLocation().getY();
  888.         if ((playX > xSW && playX < xNE) && (playY > ySW && playY < yNE))
  889.             return true;
  890.         return false;
  891.     }
  892.     private List<RSTile> getTableTiles(RSTile tableTile)
  893.     {
  894.         List<RSTile> toAddTo = new ArrayList<RSTile>();
  895.  
  896.         int tableX = tableTile.getX();
  897.         int tableY = tableTile.getY();
  898.         if (objects.getTopAt(new RSTile(tableX, tableY + 2)) != null)
  899.         {//Table is going north
  900.             toAddTo.add(new RSTile(tableX, tableY));
  901.             toAddTo.add(new RSTile(tableX, tableY + 1));
  902.             toAddTo.add(new RSTile(tableX, tableY + 2));
  903.             toAddTo.add(new RSTile(tableX - 1, tableY));
  904.             toAddTo.add(new RSTile(tableX - 1, tableY + 1));
  905.             toAddTo.add(new RSTile(tableX - 1, tableY + 2));
  906.  
  907.             toAddTo.add(new RSTile(tableX - 4, tableY + 1));
  908.             toAddTo.add(new RSTile(tableX - 4, tableY + 2));
  909.             toAddTo.add(new RSTile(tableX - 1, tableY + 5));
  910.             toAddTo.add(new RSTile(tableX - 2, tableY + 5));
  911.         }
  912.         if (objects.getTopAt(new RSTile(tableX, tableY - 2)) != null)
  913.         {//table is going south
  914.             toAddTo.add(new RSTile(tableX, tableY));
  915.             toAddTo.add(new RSTile(tableX, tableY - 1));
  916.             toAddTo.add(new RSTile(tableX, tableY - 2));
  917.             toAddTo.add(new RSTile(tableX + 1, tableY));
  918.             toAddTo.add(new RSTile(tableX + 1, tableY - 1));
  919.             toAddTo.add(new RSTile(tableX + 1, tableY - 2));
  920.            
  921.             toAddTo.add(new RSTile(tableX, tableY - 5));
  922.             toAddTo.add(new RSTile(tableX + 1, tableY - 5));
  923.             toAddTo.add(new RSTile(tableX + 4, tableY - 1));
  924.             toAddTo.add(new RSTile(tableX + 4, tableY - 2));
  925.         }
  926.         if (objects.getTopAt(new RSTile(tableX - 2, tableY)) != null)
  927.         {//table is going west
  928.             toAddTo.add(new RSTile(tableX, tableY));
  929.             toAddTo.add(new RSTile(tableX - 1, tableY));
  930.             toAddTo.add(new RSTile(tableX - 2, tableY));
  931.             toAddTo.add(new RSTile(tableX, tableY - 1));
  932.             toAddTo.add(new RSTile(tableX - 1, tableY - 1));
  933.             toAddTo.add(new RSTile(tableX - 2, tableY - 1));
  934.            
  935.             toAddTo.add(new RSTile(tableX - 5, tableY));
  936.             toAddTo.add(new RSTile(tableX - 5, tableY - 1));
  937.             toAddTo.add(new RSTile(tableX - 1, tableY - 4));
  938.             toAddTo.add(new RSTile(tableX - 2, tableY - 4));
  939.         }
  940.         if (objects.getTopAt(new RSTile(tableX + 2, tableY)) != null)
  941.         {//table is going east
  942.             toAddTo.add(new RSTile(tableX, tableY));
  943.             toAddTo.add(new RSTile(tableX + 1, tableY));
  944.             toAddTo.add(new RSTile(tableX + 2, tableY));
  945.             toAddTo.add(new RSTile(tableX, tableY + 1));
  946.             toAddTo.add(new RSTile(tableX + 1, tableY + 1));
  947.             toAddTo.add(new RSTile(tableX + 2, tableY + 1));
  948.            
  949.             toAddTo.add(new RSTile(tableX + 5, tableY));
  950.             toAddTo.add(new RSTile(tableX + 5, tableY + 1));
  951.             toAddTo.add(new RSTile(tableX + 1, tableY + 4));
  952.             toAddTo.add(new RSTile(tableX + 2, tableY + 4));
  953.         }
  954.         return toAddTo;
  955.     }
  956.     private int[] stuff = { 16933, 18312, 18250, 18230, 18238, 18161, 18167, 18163, 18165, 18159 };
  957.     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 };
  958.     private boolean atMonster() {// Got it
  959.                 // Check to see if we are already inside of the room
  960.                 int cr1 = getMyPlayer().getLocation().getX();
  961.         int cr2 = getMyPlayer().getLocation().getY();
  962.             if (cr1 >= x1 && cr1 <= x2) {
  963.                             if (cr2 >= y1 && cr2 <= y2)
  964.                                      return true;
  965.                 }
  966.                 return false;
  967.         }
  968.  
  969.         private boolean atNPCModel(RSNPC npc, String action) {
  970.                 if (npc == null)
  971.                         return false;
  972.                 if (!calc.tileOnScreen(npc.getLocation())
  973.                                 && calc.tileOnMap(npc.getLocation())) {
  974.                         walking.walkTileMM(npc.getLocation());
  975.                 } else if (calc.tileOnScreen(npc.getLocation())) {
  976.                         mouse.move(npc.getModel().getPoint());
  977.                         sleep(random(300, 500));
  978.                         if (menu.getItems()[0].toLowerCase().contains(action.toLowerCase())) {
  979.                                 mouse.click(true);
  980.                                 return true;
  981.                         } else {
  982.                                 String[] menuItems = menu.getItems();
  983.                                 for (String item : menuItems) {
  984.                                         if (item.toLowerCase().contains(action.toLowerCase())) {
  985.                                                 mouse.click(false);
  986.                                                 return menu.doAction(action);
  987.                                         }
  988.                                 }
  989.                         }
  990.                 }
  991.                 return false;
  992.         }
  993.  
  994.         private void fight() {
  995.                 try {
  996.                         if (getMyPlayer().getInteracting() == null
  997.                                         && inventory.getCount(foods) >= 1 && atMonster()) {
  998.                                 String monn = "";
  999.                                 if (monn != null) {
  1000.                                         ;
  1001.                                 }
  1002.                         }
  1003.                 } catch (Exception e) {
  1004.                         e.printStackTrace();
  1005.                 }
  1006.                 sleep(random(200, 250));
  1007.         }
  1008.  
  1009.         private void eatting() {
  1010.                 try {
  1011.                         int currentHP = Integer.parseInt(interfaces.get(748)
  1012.                                         .getComponent(8).getText());
  1013.                         if (currentHP <= 70) {
  1014.                                 if (inventory.getCount(foods) >= 1) {
  1015.                                         inventory.getItem(foods).doAction("Eat");
  1016.                                 }
  1017.                         }
  1018.                 } catch (Exception e) {
  1019.                         e.printStackTrace();
  1020.                 }
  1021.                 sleep(random(500, 1000));
  1022.         }
  1023.  
  1024.         private void pick() {
  1025.                 {
  1026.                         try {
  1027.                                 if (!inventory.isFull() && atMonster()) {
  1028.                                         RSGroundItem item = groundItems.getNearest(stuff);
  1029.                                         if (item != null) {
  1030.                                                 item.doAction("Take");
  1031.                                         }
  1032.                                 }
  1033.                         } catch (Exception e) {
  1034.                                 e.printStackTrace();
  1035.                         }
  1036.                 }
  1037.                 sleep(random(100, 200));
  1038.         }
  1039.     public boolean waitForIfaceToContainText(RSComponent iface, int timeout, String text)
  1040.     {
  1041.         if (timeout < 0)
  1042.             return false;
  1043.  
  1044.         if (iface == null)
  1045.             return false;
  1046.  
  1047.         while (System.currentTimeMillis() - startTime <= timeout)
  1048.         {
  1049.             if (iface.getText() == text)
  1050.                 return true;
  1051.             sleep(125);
  1052.         }
  1053.  
  1054.         return false;
  1055.     }
  1056.  
  1057.  
  1058.     public boolean RunOnce()
  1059.     {
  1060.         floorChange = interfaces.get(947);
  1061.         attLvl = skills.getCurrentLevel(skills.ATTACK);
  1062.         defenceLvl = skills.getCurrentLevel(skills.DEFENSE);
  1063.         textColor = Color.ORANGE;
  1064.         startTime = System.currentTimeMillis();
  1065.         complexityConfirm = interfaces.getComponent(938, 37);
  1066.         complexityLvl6 = interfaces.getComponent(938, 81);
  1067.         complexityLvl5 = interfaces.getComponent(938, 76);
  1068.         complexityLvl4 = interfaces.getComponent(938, 71);
  1069.         complexityLvl3 = interfaces.getComponent(938, 66);
  1070.         complexityLvl2 = interfaces.getComponent(938, 61);
  1071.         complexityLvl1 = interfaces.getComponent(938, 60);
  1072.         complexityChange = interfaces.get(938);
  1073.         partyTabInterface = interfaces.get(939);
  1074.         changeComplexity = interfaces.getComponent(939, 99);
  1075.         changeFloor = interfaces.getComponent(939, 105);
  1076.         formParty = interfaces.getComponent(939, 42);
  1077.         firstUser = interfaces.getComponent(939, 56);
  1078.         doStartScript = true;
  1079.                 action = enterDungeon;
  1080.         return true;
  1081.     }
  1082.     public int antiban()
  1083.     {
  1084.        
  1085.         int roll = random(0, 80);
  1086.         switch (roll)
  1087.         {
  1088.             //Check Invy or Stats
  1089.         case 1:
  1090.         case 3:
  1091.         case 28:
  1092.             int randomHumanCheckedTabs = random(1, 5);
  1093.             if ((randomHumanCheckedTabs == 1) || (randomHumanCheckedTabs == 3))
  1094.             {
  1095.                 Bot.getInputManager().pressKey((char)KeyEvent.VK_F1);
  1096.                 sleep(100);            
  1097.                 Bot.getInputManager().releaseKey((char)KeyEvent.VK_F1);
  1098.             }
  1099.                 game.openTab(game.TAB_INVENTORY);
  1100.             if ((randomHumanCheckedTabs == 2) || (randomHumanCheckedTabs == 4)
  1101.                     || (randomHumanCheckedTabs == 5))
  1102.                 game.openTab(game.TAB_STATS);
  1103.             return 0;
  1104.             //Change Camera Cases
  1105.         case 2:
  1106.         case 9:
  1107.         case 11:
  1108.         case 18:
  1109.         case 30:
  1110.             camera.setAngle(random(1, 360));
  1111.             return 0;
  1112.             //Check Friends Case
  1113.         case 5:
  1114.         case 22:
  1115.         case 29:
  1116.             game.openTab(9);
  1117.             return 50;
  1118.             //Change Camera Angle Cases
  1119.         case 13:
  1120.         case 14:
  1121.             return 0;
  1122.         case 76://Texting Case
  1123.             return 45000;
  1124.             default:
  1125.                
  1126.                 return 0;
  1127.         }
  1128.     }
  1129.  
  1130.     public static final int THE_MONSTER = 10226,
  1131.                     THE_MONSTER_2 = 10399,
  1132.                     THE_MONSTER_3 = 10414;
  1133.  
  1134.     /**
  1135.      * The following method is from RSBot User LemonDrop
  1136.      * @param pitch
  1137.      */
  1138.     public void setCameraHeight(int pitch){
  1139.         int curAlt = Bot.getClient().getCameraPitch();
  1140.         if(curAlt < pitch){
  1141.             Bot.getInputManager().pressKey((char) KeyEvent.VK_UP);
  1142.         }
  1143.         else if(curAlt > pitch){
  1144.             Bot.getInputManager().pressKey((char) KeyEvent.VK_DOWN);
  1145.         }
  1146.         else{
  1147.             Bot.getInputManager().releaseKey((char) KeyEvent.VK_UP);
  1148.             Bot.getInputManager().releaseKey((char) KeyEvent.VK_DOWN);
  1149.         }
  1150.     }
  1151.    
  1152.     public void eatnao() {
  1153.                         if(getMyPlayer().isInCombat()) {
  1154.                             if(combat.getLifePoints() < 100)
  1155.                                 clickInventoryItem(18163, "Eat", -1);
  1156.                                 clickInventoryItem(18161, "Eat", -1);
  1157.                                 clickInventoryItem(18167, "Eat", -1);
  1158.                                 clickInventoryItem(18165, "Eat", -1);
  1159.                                 clickInventoryItem(18159, "Eat", -1);
  1160.                                     }
  1161.     }
  1162.  
  1163.     RSItem itemsdude;
  1164.  
  1165.     int attLvl;
  1166.     int defenceLvl;
  1167.     private int[] newdoors = { guardianDoor1, guardianDoor2, silverWedgeDoor,
  1168.             greenTriDoor, crimShieldDoor, blueRectDoorU, crimShieldDoorU, greenTriDoorU,
  1169.             silverWedgeDoorU };
  1170.    
  1171.     private void InitializeAttempt(){
  1172.         log("Building web-walking paths...");
  1173.         sleep(1254);
  1174.         log("Error");
  1175.     }
  1176.  
  1177.     //TODO Loop Shortcut
  1178.     public int FindDungeon()
  1179.     {
  1180.         if(!doStartScript)
  1181.             return 500;
  1182.         if (game.isLoggedIn())
  1183.         {
  1184.             if (playerInSquare(3461, 3730, 3455, 3727))
  1185.             {
  1186.                 currentStatus = "Jumping Down stairs.";
  1187.                 RSObject brokenStairsObject = objects.getNearest(brokenStairs);
  1188.                 if (brokenStairsObject != null)
  1189.                 {
  1190.                     int x = brokenStairsObject.getLocation().getX();
  1191.                     int y = brokenStairsObject.getLocation().getX();
  1192.                     mouse.move(x, y, 2, 2);
  1193.                     sleep(60);
  1194.                     if (menu.getActions().toString().contains("Jump-down"))
  1195.                     {
  1196.                         menu.doAction("Jump-down");
  1197.                     }
  1198.                     else if (!menu.getActions().toString().contains("Jump"))
  1199.                     {
  1200.                         menu.doAction("Cancel");
  1201.                     }
  1202.                 }
  1203.             }
  1204.             if (action == enterDungeon)
  1205.             {
  1206.                 if (subAction == 0)
  1207.                     checkInventoryReadyToEnter();
  1208.                 if (subAction == bankItems)
  1209.                 {
  1210.                     /*
  1211.                      * Find Bank - Done
  1212.                      * Open Bank - Done
  1213.                      * Deposit All Except for ring - Done
  1214.                      * Close Bank - Done
  1215.                      * Check items/equipment - Done
  1216.                      */
  1217.                     openBank();
  1218.                     depositToBank();
  1219.                     subAction = checkForItems;
  1220.                     return 500;
  1221.                 }
  1222.                 if (subAction == checkForItems)
  1223.                 {
  1224.                     /*
  1225.                      * Check Inventory for items
  1226.                      * Has anything other then the ring, deposit
  1227.                      */
  1228.                     checkInventoryReadyToEnter();
  1229.                     subAction = enterDungeons;
  1230.                     return 500;
  1231.                 }
  1232.                 if (subAction == enterDungeons)
  1233.                 {
  1234.                     currentStatus = "Entering Dungeon";
  1235.                     enterDungeon();
  1236.                     sleep(2500);
  1237.                     action = inDungeon;
  1238.                     subAction = setUpStartRoom;
  1239.                     return 500;
  1240.                 }
  1241.             }
  1242.             if (action == inDungeon)
  1243.             {
  1244.                 if (subAction == setUpStartRoom)
  1245.                 {
  1246.                         /*
  1247.                          * Find Smuggler - Done
  1248.                          * Create startRoom RSArea - Done
  1249.                          * Find all objects in startRoom - Done
  1250.                          * Find all doors in startRoom - Done
  1251.                          * Get all tiles of doors in startRoom - Done
  1252.                          * Find all keys in startRoom - Done
  1253.                          * Set RSTile for exit ladder - Done
  1254.                          * Pick up Keys - Done
  1255.                          * Pick up From Table - Done
  1256.                          * Equip Armour and Weapons - Done
  1257.                          * Start dungeon - Done
  1258.                          */
  1259.                         RSNPC smuggler = npcs.getNearest(smugglerID);
  1260.                         combat.setAutoRetaliate(true);
  1261.                         if (smuggler != null)
  1262.                         {
  1263.                             currentStatus = "Entered Dungeon - Setting Up Start Room";
  1264.                             dungeonStart = getMyPlayer().getLocation();
  1265.                             southWest = new RSTile(dungeonStart.getX() - 8,
  1266.                                     dungeonStart.getY() - 8);
  1267.                             southEast = new RSTile(dungeonStart.getX() + 8,
  1268.                                     dungeonStart.getY() - 8);
  1269.                             northWest = new RSTile(dungeonStart.getX() - 9,
  1270.                                     dungeonStart.getY() + 7);
  1271.                             northEast = new RSTile(dungeonStart.getX() + 7,
  1272.                                     dungeonStart.getY() + 7);
  1273.                             startRoom = new RSArea(southWest, northEast);
  1274.                             startRoomObjects = getObjectsAt(startRoom);
  1275.                             startRoomDoorTiles = findDoorLocInArea(startRoom);
  1276.  
  1277.                             getKeysInArea(startRoom);
  1278.                             if (objects.getNearest(dungeonExit) != null)
  1279.                                 exitLadder = objects.getNearest(dungeonExit).getLocation();
  1280.  
  1281.                             drawStartRoomArea = true;
  1282.                                 subAction = getdemkey;
  1283.                     if (subAction == getdemkey)
  1284.                             while (!keysOnFloor.isEmpty())
  1285.                             {
  1286.                                 currentStatus = "Getting Keys";
  1287.                                 RSItem keyOnFloor = keysOnFloor.get(0);
  1288.                                 int keyID = keyOnFloor.getID();
  1289.                                 Point keyTile = ((Point) ((Map<Object, Object>) groundItems).get(keyID)).getLocation();
  1290.                                 keysOnFloor.remove(0);
  1291.                                 subAction = gettablefood;
  1292.                             }
  1293.                             /*
  1294.                              * Get Table Tiles - Done
  1295.                              * Check for Items - Done
  1296.                              * If Items, Pick them up - Done
  1297.                              */
  1298.                         if (subAction == gettablefood) {
  1299.                                 currentStatus = "Getting Items from Table.";
  1300.                                 RSTile tileLoc = new RSTile(6506, 6265);
  1301.                                         final RSObject food = objects.getNearest(FOOD_TABLE,
  1302.                                                 FOOD_TABLE_2);
  1303.                                 if (food != null) {
  1304.                                     if (calc.distanceTo(food) <= 5) {
  1305.                                         food.doAction("Take");
  1306.                                 } else {
  1307.                                         walking.walkTo(food.getLocation());
  1308.                                         subAction = enterdoor1;
  1309.                                     }
  1310.                                 }
  1311.                                                    
  1312.                                 }
  1313.                             }
  1314.                          }
  1315.                             /*
  1316.                              * Get items in inventory - DONE
  1317.                              * Compare Armour - DONE
  1318.                              * Wield Best - DONE
  1319.                              * Drop/Sell the rest
  1320.                              */
  1321.                         if (subAction == getequip) {
  1322.  
  1323.                             RSItem[] inventoryItems = inventory.getItems();
  1324.                             for (int i = 0; i < 27; i ++)
  1325.                             {
  1326.                             while (!keysOnFloor.isEmpty()) {
  1327.                                 currentStatus = "Getting Keys";
  1328.                                 RSItem keyOnFloor = keysOnFloor.get(0);
  1329.                                 int keyID = keyOnFloor.getID();
  1330.                                 log("Key ID: "+keyID);
  1331.                                 Point keyTile = ((Point) ((Map<Object, Object>) groundItems).get(keyID)).getLocation();
  1332.                                 log("Key location: ("+keyTile.getX()+","+keyTile.getY()+")");
  1333.                                 keysOnFloor.remove(0);
  1334.                             }
  1335.                                 if(inventory.contains(15753))
  1336.                                     if(attLvl <= 1)
  1337.                                         if(defenceLvl <= 1)
  1338.                                             clickInventoryItem(16647, "Wear", -1);
  1339.                                             clickInventoryItem(16713, "Wear", -1);
  1340.                                             clickInventoryItem(15753, "Wield", -1);
  1341.                                             clickInventoryItem(16669, "Wear", -1);
  1342.                                             clickInventoryItem(17239, "Wear", -1);
  1343.                                             mouse.click(true);
  1344.                                             subAction = gettablefood;
  1345.                                 }
  1346.                             }
  1347.                            
  1348.                             /*
  1349.                              * Find first open door - DONE
  1350.                              * Open it - DONE
  1351.                              * When +2y/+2x is now a door, enter first room - DONE
  1352.                              */
  1353.                     if (subAction == getdemkey2) {
  1354.                             while (!keysOnFloor.isEmpty())
  1355.                             {
  1356.                                 currentStatus = "Getting Keys";
  1357.                                 RSItem keyOnFloor = keysOnFloor.get(0);
  1358.                                 int keyID = keyOnFloor.getID();
  1359.                                 Point keyTile = ((Point) ((Map<Object, Object>) groundItems).get(keyID)).getLocation();
  1360.                                 keysOnFloor.remove(0);
  1361.                                 subAction = enterdoor1;
  1362.                             }
  1363.                           }
  1364.                         if (subAction == enterdoor1) {
  1365.                                 final RSObject door = objects.getNearest(enterDoorIDs);
  1366.                                 RSTile tileLocs = new RSTile(getMyPlayer().getLocation().getX() + 8, getMyPlayer().getLocation().getY() + 8);
  1367.                                         walking.walkTo(door.getLocation());
  1368.                                         sleep(300);
  1369.                                     if(door.isOnScreen())
  1370.                                         door.doAction("Enter");
  1371.                                             sleep(400);
  1372.                                         door.doAction("Enter");
  1373.  
  1374.                                 subAction = enterdoorlast;
  1375.                             /*
  1376.                              * In Combat with NPC - DONE
  1377.                              * Pick up the loot - DONE
  1378.                              * Eat while in Combat with NPC - DONE
  1379.                              * Wear some loot
  1380.                              * Pick up Keys - DONE
  1381.                              * Contine to next dungeon level - DONE
  1382.                              */
  1383.                     if (subAction == enterdoorlast) {
  1384.         try {
  1385.                         if (getMyPlayer().getInteracting() == null
  1386.                                         && inventory.getCount(foods) >= 1 && atMonster()) {
  1387.                                 fight();
  1388.                         }
  1389.                         while (getMyPlayer().getInteracting() instanceof RSNPC
  1390.                                         || getMyPlayer().isInCombat())
  1391.                                 if (inventory.getCount(foods) >= 1) {
  1392.                                         eatting();
  1393.                                 }
  1394.                         if (!inventory.isFull() && atMonster()) {
  1395.                                 pick();
  1396.                         }
  1397.                         subAction = enterdoor1;
  1398.                     }
  1399.                     catch (Exception e) {
  1400.                         log("Caught Exception: "
  1401.                                         + e.getMessage());
  1402.            
  1403.              }
  1404.               }
  1405.         }
  1406.     }
  1407.     }       else
  1408.         {//Login
  1409.  
  1410.         }
  1411.         return 1000;
  1412.     }
  1413.  
  1414.     RSNPC rsnpcs;
  1415.  
  1416.     public void serverMessageRecieved(ServerMessageEvent e)
  1417.     {
  1418.         String message = e.getMessage().toLowerCase();
  1419.         RSTile tileLocs = new RSTile(getMyPlayer().getLocation().getX() + 8, getMyPlayer().getLocation().getY() - 8);
  1420.         final RSObject door = objects.getNearest(50346);
  1421.         if (message.contains("ou have to be the leader "))
  1422.             createParty();
  1423.         if (message.contains("have been slain. "))
  1424.             walking.walkTileOnScreen(tileLocs);
  1425.         if (message.contains("have the correct key. "))
  1426.             subAction = getdemkey2;
  1427.  
  1428.     }
  1429.    
  1430.     public boolean onStart(){
  1431.         return game.isLoggedIn();
  1432.     }
  1433.    
  1434.     public void onFinish(){
  1435.     }
  1436.    
  1437.     @Override
  1438.     public int loop() {
  1439.         enterDungeon();
  1440.         return 0;
  1441.     }
  1442.    
  1443. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement