Share Pastebin
Guest
Public paste!

Dragonkk's Living Rock Caverns Miner

By: a guest | Mar 21st, 2010 | Syntax: None | Size: 78.12 KB | Hits: 823 | Expires: Never
Copy text to clipboard
  1. import java.awt.Color;
  2. import java.awt.Font;
  3. import java.awt.Graphics;
  4. import java.awt.Point;
  5. import java.awt.event.KeyEvent;
  6. import java.awt.image.BufferedImage;
  7. import java.io.BufferedReader;
  8. import java.io.File;
  9. import java.io.FileNotFoundException;
  10. import java.io.IOException;
  11. import java.io.InputStream;
  12. import java.io.InputStreamReader;
  13. import java.io.RandomAccessFile;
  14. import java.net.URL;
  15. import java.util.ArrayList;
  16. import java.util.HashMap;
  17. import java.util.List;
  18. import java.util.Map;
  19. import javax.imageio.ImageIO;
  20. import javax.swing.JFileChooser;
  21. import javax.swing.JOptionPane;
  22.  
  23. import org.rsbot.bot.Bot;
  24. import org.rsbot.bot.input.Mouse;
  25. import org.rsbot.event.events.ServerMessageEvent;
  26. import org.rsbot.event.listeners.PaintListener;
  27. import org.rsbot.event.listeners.ServerMessageListener;
  28. import org.rsbot.script.Calculations;
  29. import org.rsbot.script.Constants;
  30. import org.rsbot.script.GrandExchange;
  31. import org.rsbot.script.Script;
  32. import org.rsbot.script.ScriptManifest;
  33. import org.rsbot.script.randoms.WelcomeScreen;
  34. import org.rsbot.script.wrappers.RSInterface;
  35. import org.rsbot.script.wrappers.RSInterfaceChild;
  36. import org.rsbot.script.wrappers.RSInterfaceComponent;
  37. import org.rsbot.script.wrappers.RSItem;
  38. import org.rsbot.script.wrappers.RSNPC;
  39. import org.rsbot.script.wrappers.RSObject;
  40. import org.rsbot.script.wrappers.RSPlayer;
  41. import org.rsbot.script.wrappers.RSTile;
  42.  
  43. @ScriptManifest(authors = { "Dragonkk" }, category = "Mining", name = "Rock Living Cavern", version = 1.33, description = "<html><head>"
  44.         + "</head><body>"
  45.         + "<center>"
  46.         + "<img src=\"http://privateftp.no-ip.info/rlcstart.png\"/>"
  47.         + "<br></br>"
  48.         + "<i><font size=\"4\" color=\"black\">Mines and banks ores in Rock living cavern. Soon with the option to PowerMine.</font></i>"
  49.         + "<br></br>"
  50.         + "<b><font size=\"4\" color=\"black\">Which location would you like to mine in?</font></b>"
  51.         + "<br></br>"
  52.         + "<select name='location'>"
  53.         + "<option>Rock Living Dungeon"
  54.         + "<br></br>"
  55.         + "<b><font size=\"4\" color=\"black\">Which rock would you like to mine?</font></b>"
  56.         + "<br></br>"
  57.         + "<select name='Rock'>"
  58.         + "<option>2 Gold Rocks"
  59.         + "<option>3 Gold Rocks"
  60.         //+ "<option>3 Gold Rocks with Clan Chat"
  61.         + "<br></br>"
  62.         + "<b><font size=\"4\" color=\"black\">Would you like to Power Mine?</font></b>"
  63.         + "<br></br>"
  64.         + "<select name='powerMine'>"
  65.         + "<option>No"
  66.         + "<option>Yes"
  67.         + "<br></br>"
  68.         + "<b><font size=\"4\" color=\"black\">What food would you like to eat?</font></b>"
  69.         + "<br></br>"
  70.         + "<select name='FoodToEat'>"
  71.         + "<option>None"
  72.         + "<option>Trout"
  73.         + "<option>Salmon"
  74.         + "<option>Tuna"
  75.         + "<option>Lobster"
  76.         + "<option>Swordfish"
  77.         + "<option>Monkfish"
  78.         + "<option>Manta ray"
  79.         + "<option>Shark"
  80.         + "<option>Cavefish"
  81.         + "<option>Rocktail"
  82.         + "<br></br>"
  83.         + "<b><font size=\"4\" color=\"black\">Quick deposit carried Items?(Quick Deposit)</font></b>"
  84.         + "<br></br>"
  85.         + "<select name='quickdeposit'>"
  86.         + "<option>No"
  87.         + "<option>Yes"
  88.         + "<br></br>"
  89.         + "<b><font size=\"4\" color=\"black\">Want to use familiar?</font></b>"
  90.         + "<br></br>"
  91.         + "<select name='familiar'>"
  92.         + "<option>None"
  93.         + "<option>Desert wyrm"
  94.         + "<option>Spirit terrorbird"
  95.         + "<option>War tortoise"
  96.         + "<option>Obsidian golem"
  97.         + "<option>Lava titan"
  98.         + "<option>Pack yak"
  99.         + "<br></br>"
  100.         + "<b><font size=\"4\" color=\"black\">Stop if logged out?</font></b>"
  101.         + "<br></br>"
  102.         + "<select name='stopiflogout'>"
  103.         + "<option>No"
  104.         + "<option>Yes"
  105.         + "<br></br>"
  106.         + "Id you can please donate us here:"
  107.         + "<br></br>"
  108.         + "https://www.paypal.com/cgi-bin/webscr?cmd=_donations"
  109.         + "<br></br>"
  110.         + "&business=brandonm254%40gmail%2ecom&lc=US"
  111.         + "<br></br>"
  112.         +"&item_name=Dragonkk%20scripts&currency_code=USD&bn=PP%2dDonationsBF%3"
  113.         + "<br></br>"
  114.         +"abtn_donateCC_LG%2egif%3aNonHosted"
  115.         + "<br></br>"
  116.         + "<br></br>" + "</body></html>")
  117.  
  118. public class Rock_Living_Cavern extends Script implements PaintListener, ServerMessageListener {
  119.         ScriptManifest properties = getClass().getAnnotation(ScriptManifest.class);
  120.        
  121.         public class RSPlayerLRC extends RSPlayer  {
  122.                 public RSPlayerLRC() {
  123.                         super(Bot.getClient().getMyRSPlayer());
  124.                 }
  125.                 public int getLoopCycleStatus() {
  126.                         return c.getLoopCycleStatus();
  127.                 }
  128.         }
  129. Thread clanchat;
  130. public boolean stopcc = false;
  131.         private class ClanChat implements Runnable {
  132.                 String lastText = "";
  133.                 String ClanName = null;
  134.                 public void run() {
  135.                         while(!stopcc) {
  136.                         readChat();
  137.                         try {
  138.                                 t.wait(10);
  139.                         } catch (InterruptedException e) {
  140.                                 e.printStackTrace();
  141.                         }
  142.                         }
  143.                 }
  144.         public String getChildText(int iface, int child) {
  145.             return RSInterface.getInterface(iface).getChild(child).getText();
  146.         }
  147.         public String[] getChatMessages(boolean stripName) {
  148.             String[] temp = new String[100];
  149.             int tempi=0;
  150.             for(int i=159; i >= 59; i--)
  151.                 if(getChildText(137,i).contains("<col=800000>")) {
  152.                     if(stripName) {
  153.                         temp[tempi] = getChildText(137,i);
  154.                         tempi++;
  155.                     } else {
  156.                         temp[tempi] = getChildText(137,i).replaceAll("<col=0000ff>", "").replaceAll("</col>", "").replaceAll("<col=800000>", "");
  157.                         tempi++;
  158.                     }
  159.                 }
  160.             return temp;
  161.         }
  162.         public void readChat() {
  163.                 if (!isLoggedIn())
  164.                         return;
  165.             String[] chat2 = getChatMessages(false);
  166.             if (chat2[0] == null || lastText.equals(chat2[0]))
  167.                 return;
  168.                 ClanName = chat2[0].substring(chat2[0].indexOf("[")+1,chat2[0].indexOf("]"));
  169.             String PlayerName = chat2[0].substring(chat2[0].indexOf("]")+1,chat2[0].indexOf(":"));
  170.             String Text = chat2[0].substring(chat2[0].indexOf(":")+2);
  171.             lastText = chat2[0];
  172.            //log.info("chat: "+chat2[0]);
  173.            //log.info("ClanName: "+ClanName);
  174.           // log.info("PlayerName: "+PlayerName);
  175.            RocksStatusByClan(Text);
  176.         }
  177.         public void RocksStatusByClan(String Text) {
  178.                 if (Text.equalsIgnoreCase("seu") || Text.equalsIgnoreCase("se") || Text.equalsIgnoreCase("se up") || Text.equalsIgnoreCase("se u")) {
  179.                         DeadRocks[0] = false;
  180.                         log.info("seu: "+Text);
  181.                 }else if (Text.equalsIgnoreCase("sed") || Text.equalsIgnoreCase("se down") || Text.equalsIgnoreCase("se d")) {
  182.                         DeadRocks[0] = true;
  183.                         log.info("sed: "+Text);
  184.                 }else if (Text.equalsIgnoreCase("swu") || Text.equalsIgnoreCase("sw") || Text.equalsIgnoreCase("sw up") || Text.equalsIgnoreCase("sw u")) {
  185.                         DeadRocks[1] = false;
  186.                         log.info("swu: "+Text);
  187.                 }else if (Text.equalsIgnoreCase("swd") || Text.equalsIgnoreCase("sw down") || Text.equalsIgnoreCase("sw d")) {
  188.                         DeadRocks[1] = true;
  189.                         log.info("swd: "+Text);
  190.                 }else if (Text.equalsIgnoreCase("neu") || Text.equalsIgnoreCase("ne") || Text.equalsIgnoreCase("ne up") || Text.equalsIgnoreCase("ne u")) {
  191.                         DeadRocks[2] = false;
  192.                         log.info("neu: "+Text);
  193.                 }else if (Text.equalsIgnoreCase("ned") || Text.equalsIgnoreCase("ne down") || Text.equalsIgnoreCase("ne d")) {
  194.                         DeadRocks[2] = true;
  195.                         log.info("ned: "+Text);
  196.                 }else if (Text.equalsIgnoreCase("nwu") || Text.equalsIgnoreCase("nw") || Text.equalsIgnoreCase("nw up") || Text.equalsIgnoreCase("nw u")) {
  197.                         //DeadRocks[3] = false;
  198.                 }else if (Text.equalsIgnoreCase("nwd") || Text.equalsIgnoreCase("nw down") || Text.equalsIgnoreCase("nw d")) {
  199.                         //DeadRocks[3] = true;
  200.                 }
  201.         }
  202.     }
  203.         public class LoadInformation {
  204.                 private Script script = null;
  205.                 private Map<String, String> args = null;
  206.                 private double version = 0.0;
  207.                 public List<Short> pickaxes = new ArrayList<Short>();
  208.                 public List<String> messages = new ArrayList<String>();
  209.                 public List<Long> add = new ArrayList<Long>();
  210.                 public HashMap<RSTile,RSTile> safespots = new HashMap<RSTile,RSTile>();
  211.                 //public short safespotX[][] = new short[5000][11000];
  212.                 //public short safespotY[][] = new short[5000][11000];
  213.                 public double Version = 0;
  214.                 private void resetLoadedInform() {
  215.                         pickaxes = new ArrayList<Short>();
  216.                         messages = new ArrayList<String>();
  217.                         add = new ArrayList<Long>();
  218.                         //safespotX = new short[5000][11000];
  219.                         //safespotY = new short[5000][11000];
  220.                 }
  221.                 public LoadInformation(Script script, Map<String, String> arg, double version){
  222.                         this.script = script;
  223.                         this.args = args;
  224.                         this.version = version;
  225.                         LoadCache();
  226.                 }
  227.                 private void DownloaderUpdate() throws Exception {
  228.                         if (JOptionPane.showConfirmDialog(null,
  229.                         "Update found. Do you want to update?") == 0) {
  230.                 JOptionPane
  231.                                 .showMessageDialog(null,
  232.                                                 "Please choose your scripts folder and hit 'Open'");
  233.                 JFileChooser fc = new JFileChooser();
  234.                 fc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
  235.                 if (fc.showOpenDialog(null) == JFileChooser.APPROVE_OPTION) {
  236.                         File fileplace = new File(fc.getSelectedFile().getPath()+"/Rock_Living_Cavern.java");
  237.                         URL url = new URL("http://privateftp.no-ip.info/Rock_Living_Cavern.java");
  238.                         if (url == null) {
  239.                                 return;
  240.                         }
  241.                         RandomAccessFile file = new RandomAccessFile(fileplace, "rw");
  242.                         InputStream in = url.openStream();
  243.                         byte[] buf = new byte[4 * 1024];
  244.                         int bytesRead;
  245.                         while ((bytesRead = in.read(buf)) != -1) {
  246.                                 file.write(buf, 0, bytesRead);
  247.                         }
  248.                         file.close();
  249.                         JOptionPane.showMessageDialog(null, "Auto updated. Please recompile your scrits and restart rsbot.");
  250.                 }else
  251.                         JOptionPane.showMessageDialog(null,"Auto Update canceled. You need to upload to can run script.");
  252.                         }else
  253.                         JOptionPane.showMessageDialog(null,"Auto Update canceled. You need to upload to can run script.");
  254.                         stopScript();
  255.                 }
  256.  
  257.                 private double loadVersion(RandomAccessFile cache, short position) throws IOException {
  258.                         cache.seek(position);
  259.                         if (cache.readUTF().equals("<Version>")) {
  260.                                 return Version = cache.readDouble();
  261.                         }
  262.                         return 1.0;
  263.                 }
  264.                 private void loadPickaxes(RandomAccessFile cache, short position) throws IOException {
  265.                         cache.seek(position);
  266.                         if (cache.readUTF().equals("<Pickaxes>")) {
  267.                                 byte m = cache.readByte();
  268.                                 for(byte i = 0; i <  m; i++)
  269.                                         pickaxes.add(cache.readShort());
  270.                         }
  271.                 }
  272.                 private void loadMessages(RandomAccessFile cache, short position) throws IOException {
  273.                         cache.seek(position);
  274.                         if (cache.readUTF().equals("<Messages>")) {
  275.                                 byte m = cache.readByte();
  276.                                 for(byte i = 0; i <  m; i++)
  277.                                         messages.add(cache.readUTF());
  278.                         }
  279.                 }
  280.                 private void loadSafeSpots(RandomAccessFile cache, short position) throws IOException {
  281.                         cache.seek(position);
  282.                         if (cache.readUTF().equals("<SafeSpots>")) {
  283.                                 byte m = cache.readByte();
  284.                                 for(byte i = 0; i <  m; i++)
  285.                                         safespots.put(new RSTile(cache.readShort(),cache.readShort()),new RSTile(cache.readShort(),cache.readShort()));
  286.                         }
  287.                 }
  288.                 private double getCacheVersion() {
  289.                         return 1.33;
  290.                 }
  291.                 private void loadPlayer(RandomAccessFile cache, short position) throws IOException {
  292.                         cache.seek(position);
  293.                         if (cache.readUTF().equals("<Player>")) {
  294.                                 byte m = cache.readByte();
  295.                                 for(byte i = 0; i <  m; i++)
  296.                                         add.add(cache.readLong());
  297.                         }
  298.                         CheckPlayer();
  299.                 }
  300.                 public void DeleteCache() {
  301.                         resetLoadedInform();
  302.                 }
  303.                 private String Downloader() throws Exception {
  304.                         String filePlace = "DragonkkCache.idx";
  305.                         new File(filePlace).delete();
  306.                                 URL url = new URL("http://privateftp.no-ip.info/RlcCache.idx");
  307.                                 if (url == null) {
  308.                                         return filePlace;
  309.                                 }
  310.                                 RandomAccessFile file = new RandomAccessFile(new File(filePlace), "rw");
  311.                                 InputStream in = url.openStream();
  312.                                 byte[] buf = new byte[4 * 1024];
  313.                                 int bytesRead;
  314.                                 while ((bytesRead = in.read(buf)) != -1) {
  315.                                         file.write(buf, 0, bytesRead);
  316.                                 }
  317.                                 file.close();
  318.                                 in.close();
  319.                         return filePlace;
  320.                 }
  321.                 private void LoadCache() {
  322.                         try {
  323.                                 resetLoadedInform();
  324.                                 String dl = Downloader();
  325.                                 RandomAccessFile cache = new RandomAccessFile(new File(dl), "r");
  326.                                 byte nop;
  327.                                 nop = cache.readByte();
  328.                                 Short position[] = new Short[nop];
  329.                                 for(byte i = 0; i <  nop; i++)
  330.                                         position[i] = cache.readShort();
  331.                                 if (loadVersion(cache, position[0]) <= getCacheVersion()) {
  332.                                         loadPickaxes(cache, position[1]);
  333.                                         loadMessages(cache, position[2]);
  334.                                         loadSafeSpots(cache, position[3]);
  335.                                         loadPlayer(cache, position[4]);
  336.                                 }else{
  337.                                         DownloaderUpdate();
  338.                                 }
  339.                                 cache.close();
  340.                                 new File(dl).delete();
  341.                         } catch (Exception e) {
  342.                                 new File("DragonkkCache.idx").delete();
  343.                                 e.printStackTrace();
  344.                         }
  345.                 }
  346.                 public String getnewLocation() {
  347.                         String p = null;
  348.                         try {
  349.                                 p = new BufferedReader(new InputStreamReader((new URL("http://whatismyip.com/automation/n09230945.asp")).openStream())).readLine();
  350.                         } catch(Exception e) {
  351.                                 p = "error";
  352.                         }
  353.                         return p;
  354.                 }
  355.                 private void CheckPlayer() {
  356.                         /*if (!add.contains(sTL(getnewLocation()))) {
  357.                         script.stopScript();
  358.                         script.onFinish();
  359.                 }*/
  360.                 }
  361.  
  362.         }
  363. public boolean stop = false;
  364.     public int AllPic[] = {1275, 1271, 1273, 1269, 1267, 1265};
  365.     public int[] Rock;
  366.     public int Type = 0;
  367.     public String Ore;
  368. public int miningoreprice = 0;
  369.     public int OresMined = 0;
  370.     long StartTime = 0;
  371.     public int XPHour = 0;
  372.     public int TotalXp = 0;
  373.     public int LvlGained = 0;
  374.     public int OresGained = 0;
  375.     public int StartXP = 0;
  376.     public int StartLvl = 0;
  377.         public int runEnergy = random(20, 95);
  378.         public boolean setAltitude = false;
  379.         Thread t;
  380.         String Updated = "Fully Updated :)";
  381.         Color transGreen = new Color(0, 255, 0, 50);
  382.         Color transRed = new Color(255, 0, 0, 50);
  383.         private void actualRock(final Graphics g, final RSTile t, final Color c, String Message)throws Exception {
  384.                 final Point p = Calculations.tileToScreen(t);
  385.                 final Point pn = Calculations.tileToScreen(t.getX(), t.getY(), 0, 0, 0);
  386.                 final Point px = Calculations.tileToScreen(t.getX() + 1, t.getY(), 0,
  387.                                 0, 0);
  388.                 final Point py = Calculations.tileToScreen(t.getX(), t.getY() + 1, 0,
  389.                                 0, 0);
  390.                 final Point pxy = Calculations.tileToScreen(t.getX() + 1, t.getY() + 1,
  391.                                 0, 0, 0);
  392.                 final Point[] points = { p, pn, px, py, pxy };
  393.                 for (final Point point : points) {
  394.                         if (!pointOnScreen(point)) {
  395.                                 return;
  396.                         }
  397.                 }
  398.         Point minimap = tileToMinimap(t);
  399.                 g.setColor(c);
  400.                        
  401.         if (minimap != null) {
  402.             g.fillOval((int) minimap.getX() - 2, (int) minimap.getY() - 2, 4, 4);
  403.         }
  404.                 g.drawPolygon(new int[] { py.x, pxy.x, px.x, pn.x }, new int[] { py.y,
  405.                                 pxy.y, px.y, pn.y }, 4);
  406.                 g.drawString(Message, p.x - 30, p.y - 40);
  407.         }
  408.         private double getVersion() {
  409.                 return 1.33;
  410.         }
  411.         LoadInformation cache = null;
  412.         public int FOOD_ID = 0;
  413.         public boolean powerMine;
  414.         public boolean quickdeposit;
  415.         boolean summoningfamiliar = false;
  416.         boolean usingstore = false;
  417. boolean hasStore = false;
  418.         int restoresummonpointsat = 0;
  419.         int restoresummonpouchid = 0;
  420.         int familiarnpcid = 0;
  421.         boolean stopiflogout = false;
  422.     public boolean onStart(Map<String, String> args) {
  423.         try{
  424.         cache = new LoadInformation(this, args, getVersion());
  425.         StartTime = System.currentTimeMillis();
  426.         log(cache.messages.get(14)+getVersion()+".");
  427.         String familiar = args.get("familiar");
  428.         powerMine = args.get("powerMine").equals("Yes");
  429.         quickdeposit = args.get("quickdeposit").equals("Yes");
  430.         stopiflogout = args.get("stopiflogout").equals("Yes");
  431.                 final String FIM2 = args.get("location");
  432.                 final String FIM5 = args.get("Rock");
  433.                 final String FIM6 = args.get("FoodToEat");
  434.                 if (!FIM2.equals("Rock Living Dungeon"))
  435.                         return false;
  436.                
  437.                 if (familiar.equals("Desert wyrm")) {
  438.                         summoningfamiliar = true;
  439.                         restoresummonpointsat = 2;
  440.                         restoresummonpouchid = 12049;
  441.                         usingstore = false;
  442.                 }              
  443.                 if (familiar.equals("Spirit terrorbird")) {
  444.                         summoningfamiliar = true;
  445.                         restoresummonpointsat = 7;
  446.                         restoresummonpouchid = 12007;
  447.                         familiarnpcid = 6794;
  448.                         usingstore = true;
  449.                 }
  450.                 if (familiar.equals("War tortoise")) {
  451.                         summoningfamiliar = true;
  452.                         restoresummonpointsat = 8;
  453.                         restoresummonpouchid = 12031;
  454.                         familiarnpcid = 6815;
  455.                         usingstore = true;
  456.                 }
  457.                 if (familiar.equals("Obsidian golem")) {
  458.                         summoningfamiliar = true;
  459.                         restoresummonpointsat = 9;
  460.                         restoresummonpouchid = 12792;
  461.                         usingstore = false;
  462.                 }
  463.                 if (familiar.equals("Lava titan")) {
  464.                         summoningfamiliar = true;
  465.                         restoresummonpointsat = 83;
  466.                         restoresummonpouchid = 12788;
  467.                         usingstore = false;
  468.                 }
  469.                 if (familiar.equals("Pack yak")) {
  470.                         summoningfamiliar = true;
  471.                         restoresummonpointsat = 11;
  472.                         restoresummonpouchid = 12093;
  473.                         familiarnpcid = 6873;
  474.                         usingstore = true;
  475.                 }      
  476.         if (FIM6.equals("None"))
  477.                 FOOD_ID = 0;
  478.         if (FIM6.equals("Rockail"))
  479.                 FOOD_ID = 15272;
  480.         if (FIM6.equals("Cavefish"))
  481.                 FOOD_ID = 15266;
  482.         if (FIM6.equals("Manta ray"))
  483.                 FOOD_ID = 391;
  484.         if (FIM6.equals("Shark"))
  485.                 FOOD_ID = 385;
  486.         if (FIM6.equals("Monkfish"))
  487.                 FOOD_ID = 7946;
  488.         if (FIM6.equals("Swordfish"))
  489.                 FOOD_ID = 373;
  490.         if (FIM6.equals("Lobster"))
  491.                 FOOD_ID = 379;
  492.         if (FIM6.equals("Tuna"))
  493.                 FOOD_ID = 361;
  494.         if (FIM6.equals("Trout"))
  495.                 FOOD_ID = 333;
  496.         if (FIM6.equals("Salmon"))
  497.                 FOOD_ID = 329;
  498.         miningoreprice = new GrandExchange().loadItemInfo(444).getMarketPrice();
  499.         RealStatus = cache.messages.get(0);
  500.                 if (FIM5.equals("2 Gold Rocks")) {
  501.                         threeRocks = false;
  502.                         if (IsAtGoldRock2()) {
  503.                                 MiningGoldRock = 2;
  504.                                 return true;
  505.                         } else if (IsAtGoldRock1() || IsAtBank()) {
  506.                                 MiningGoldRock = 1;
  507.                                 return true;
  508.                         }else{
  509.                                 MiningGoldRock = 1;
  510.                                 return true;
  511.                         }
  512.                 }else if (FIM5.equals("3 Gold Rocks")) {
  513.                         threeRocks = true;
  514.                         if (IsAtGoldRock3()) {
  515.                                 MiningGoldRock = 3;
  516.                                 return true;
  517.                         }else if (IsAtGoldRock2()) {
  518.                                 MiningGoldRock = 2;
  519.                                 return true;
  520.                         } else if (IsAtGoldRock1() || IsAtBank()) {
  521.                                 MiningGoldRock = 1;
  522.                                 return true;
  523.                         }else{
  524.                                 MiningGoldRock = 1;
  525.                                 return true;
  526.                         }
  527.                 }else if (FIM5.equals("3 Gold Rocks with Clan Chat")) {
  528.                         t = new Thread(new ClanChat());
  529.                         t.start();
  530.                         miningwithcc = true;
  531.                         threeRocks = true;
  532.                         if (IsAtGoldRock3()) {
  533.                                 MiningGoldRock = 3;
  534.                                 return true;
  535.                         }else if (IsAtGoldRock2()) {
  536.                                 MiningGoldRock = 2;
  537.                                 return true;
  538.                         } else if (IsAtGoldRock1() || IsAtBank()) {
  539.                                 MiningGoldRock = 1;
  540.                                 return true;
  541.                         }else{
  542.                                 MiningGoldRock = 1;
  543.                                 return true;
  544.                         }
  545.                 }
  546.                         return false;
  547.         } catch(Exception e) {
  548.                 return false;
  549.         }
  550.     }
  551.     private boolean miningwithcc = false;
  552.     private boolean forcebank = false;
  553.     private boolean forcelogout = false;
  554.         public boolean isInventoryFull() {
  555.                 if (forcebank||forcelogout)
  556.                         return true;
  557.                 return getInventoryCount() == 28;
  558.         }
  559.         int actualStatus = 0;
  560.         int numberofChecksAttacked = 0;
  561.         public RSPlayerLRC me;
  562.         private boolean gettingAttacked()throws Exception {
  563.                 if (!isLoggedIn()) {
  564.                         return false;
  565.                 }
  566.                 if (actualStatus == 0)
  567.                         actualStatus = -1000;
  568.                 if (actualStatus != me.getLoopCycleStatus()) {
  569.                         actualStatus = me.getLoopCycleStatus();
  570.                         if (numberofChecksAttacked > 0) {
  571.                                 numberofChecksAttacked--;
  572.                                 return false;
  573.                         }
  574.                         numberofChecksAttacked = random(1,2);
  575.                         return true;
  576.                 }
  577.                 return false;
  578.         }
  579.     public void startRunning(final int energy)throws Exception {
  580.                 if (getEnergy() >= energy && !isRunning()) {
  581.                         runEnergy = random(40, 95);
  582.                         setRun(true);
  583.                         wait(random(500, 750));
  584.                 }
  585.         }
  586.     public void dropAllExcept(final boolean leftToRight, final int... items) {
  587.                 while (!inventoryEmptyExcept(items)) {
  588.                         if (!leftToRight) {
  589.                                 for (int c = 0; c < 4; c++) {
  590.                                         for (int r = 0; r < 7; r++) {
  591.                                                 boolean found = false;
  592.                                                 for (int i = 0; i < items.length && !found; i++) {
  593.                                                         found = items[i] == getInventoryArray()[c + r * 4];
  594.                                                 }
  595.                                                 if (!found) {
  596.                                                         dropItem(c, r);
  597.                                                 }
  598.                                         }
  599.                                 }
  600.                         } else {
  601.                                 for (int r = 0; r < 7; r++) {
  602.                                         for (int c = 0; c < 4; c++) {
  603.                                                 boolean found = false;
  604.                                                 for (int i = 0; i < items.length && !found; i++) {
  605.                                                         found = items[i] == getInventoryArray()[c + r * 4];
  606.                                                 }
  607.                                                 if (!found) {
  608.                                                         dropItem(c, r);
  609.                                                 }
  610.                                         }
  611.                                 }
  612.                         }
  613.                         wait(random(500, 800));
  614.                 }
  615.         }
  616.     private boolean LastGoldRock2 = false;
  617.     RSTile[] RopePath = {
  618.                 new RSTile(3652,5115)
  619.                 , new RSTile(3653,5115)
  620.                 , new RSTile(3654,5116)
  621.                 , new RSTile(3655,5116)
  622.                 , new RSTile(3656,5116)
  623.                 , new RSTile(3657,5116)
  624.                 , new RSTile(3658,5116)
  625.                 , new RSTile(3658,5117)
  626.                 , new RSTile(3658,5118)
  627.                 , new RSTile(3658,5119)
  628.                 , new RSTile(3657,5119)
  629.                 , new RSTile(3656,5120)
  630.                 , new RSTile(3655,5120)
  631.                 , new RSTile(3654,5120)
  632.                 , new RSTile(3653,5120)
  633.                 , new RSTile(3652,5121)
  634.                 };
  635.     RSTile[] ObeliskPath = {
  636.                 new RSTile(3012,9832)
  637.                 , new RSTile(3013,9832)
  638.                 , new RSTile(3014,9832)
  639.                 , new RSTile(3015,9832)
  640.                 , new RSTile(3016,9832)
  641.                 , new RSTile(3017,9832)
  642.                 , new RSTile(3018,9831)
  643.                 , new RSTile(3019,9830)
  644.                 , new RSTile(3020,9829)
  645.                 , new RSTile(3021,9828)
  646.                 , new RSTile(3022,9828)
  647.                 , new RSTile(3023,9828)
  648.                 , new RSTile(3024,9828)
  649.                 , new RSTile(3025,9828)
  650.                 , new RSTile(3026,9827)
  651.                 , new RSTile(3027,9826)
  652.                 , new RSTile(3028,9825)
  653.                 , new RSTile(3029,9824)
  654.                 , new RSTile(3030,9824)
  655.                 , new RSTile(3031,9823)
  656.                 };
  657.     RSTile[] BankToGoldRock1 = {
  658.                 new RSTile(3654,5113)
  659.                 , new RSTile(3655,5113)
  660.                 , new RSTile(3656,5113)
  661.                 , new RSTile(3657,5112)
  662.                 , new RSTile(3657,5111)
  663.                 , new RSTile(3657,5110)
  664.                 , new RSTile(3657,5109)
  665.                 , new RSTile(3657,5108)
  666.                 , new RSTile(3657,5107)
  667.                 , new RSTile(3657,5106)
  668.                 , new RSTile(3657,5105)
  669.                 , new RSTile(3657,5104)
  670.                 , new RSTile(3657,5103)
  671.                 , new RSTile(3657,5102)
  672.                 , new RSTile(3657,5101)
  673.                 , new RSTile(3657,5100)
  674.                 , new RSTile(3657,5099)
  675.                 , new RSTile(3657,5098)
  676.                 , new RSTile(3657,5097)
  677.                 , new RSTile(3657,5096)
  678.                 , new RSTile(3657,5095)
  679.                 , new RSTile(3657,5094)
  680.                 , new RSTile(3657,5093)
  681.                 , new RSTile(3657,5092)
  682.                 , new RSTile(3657,5091)
  683.                 , new RSTile(3657,5090)
  684.                 , new RSTile(3658,5089)
  685.                 , new RSTile(3659,5089)
  686.                 , new RSTile(3659,5088)
  687.                 , new RSTile(3660,5087)
  688.                 , new RSTile(3661,5086)
  689.                 , new RSTile(3662,5085)
  690.                 , new RSTile(3663,5084)
  691.                 , new RSTile(3664,5084)
  692.                 , new RSTile(3664,5083)
  693.                 , new RSTile(3665,5082)
  694.                 , new RSTile(3666,5082)
  695.                 , new RSTile(3666,5081)
  696.                 , new RSTile(3667,5080)
  697.                 , new RSTile(3668,5079)
  698.                 , new RSTile(3669,5078)
  699.                 , new RSTile(3669,5077)
  700.                 , new RSTile(3669,5076)
  701.                 };
  702.     RSTile[] BankToGoldRock2 = {
  703.                 new RSTile(3654,5113)
  704.                 , new RSTile(3655,5113)
  705.                 , new RSTile(3656,5113)
  706.                 , new RSTile(3657,5112)
  707.                 , new RSTile(3657,5111)
  708.                 , new RSTile(3657,5110)
  709.                 , new RSTile(3657,5109)
  710.                 , new RSTile(3657,5108)
  711.                 , new RSTile(3657,5107)
  712.                 , new RSTile(3657,5106)
  713.                 , new RSTile(3657,5105)
  714.                 , new RSTile(3657,5104)
  715.                 , new RSTile(3657,5103)
  716.                 , new RSTile(3657,5102)
  717.                 , new RSTile(3657,5101)
  718.                 , new RSTile(3657,5100)
  719.                 , new RSTile(3656,5099)
  720.                 , new RSTile(3655,5098)
  721.                 , new RSTile(3654,5097)
  722.                 , new RSTile(3653,5097)
  723.                 , new RSTile(3652,5096)
  724.                 , new RSTile(3651,5095)
  725.                 , new RSTile(3650,5095)
  726.                 , new RSTile(3649,5095)
  727.                 , new RSTile(3648,5095)
  728.                 , new RSTile(3647,5095)
  729.                 , new RSTile(3646,5095)
  730.                 , new RSTile(3645,5095)
  731.                 , new RSTile(3644,5095)
  732.                 , new RSTile(3643,5095)
  733.                 , new RSTile(3642,5095)
  734.                 , new RSTile(3641,5095)
  735.                 , new RSTile(3640,5095)
  736.                 };
  737.     RSTile[][] BankToGoldRock3 = {
  738.                 {new RSTile(3653,5115)
  739.     , new RSTile(3654,5116)
  740.     , new RSTile(3655,5116)
  741.     , new RSTile(3656,5116)
  742.     , new RSTile(3657,5116)
  743.     , new RSTile(3658,5116)
  744.     , new RSTile(3659,5116)
  745.     , new RSTile(3660,5117)
  746.     , new RSTile(3661,5118)
  747.     , new RSTile(3662,5119)
  748.     , new RSTile(3662,5120)
  749.     , new RSTile(3662,5121)
  750.     , new RSTile(3662,5122)
  751.     , new RSTile(3662,5123)
  752.     , new RSTile(3662,5124)
  753.     , new RSTile(3662,5125)
  754.     , new RSTile(3662,5126)
  755.     , new RSTile(3663,5127)
  756.     , new RSTile(3664,5128)
  757.     , new RSTile(3665,5129)
  758.     , new RSTile(3666,5130)
  759.     , new RSTile(3666,5131)
  760.     , new RSTile(3666,5132)
  761.     , new RSTile(3667,5132)
  762.     , new RSTile(3668,5133)
  763.     , new RSTile(3669,5134)
  764.     , new RSTile(3669,5135)
  765.     , new RSTile(3669,5136)
  766.     , new RSTile(3669,5137)
  767.     , new RSTile(3669,5138)
  768.     , new RSTile(3670,5139)
  769.     , new RSTile(3670,5140)
  770.     , new RSTile(3670,5141)
  771.     , new RSTile(3670,5142)
  772.     , new RSTile(3670,5143)
  773.     , new RSTile(3670,5144)
  774.     , new RSTile(3670,5145)
  775.     , new RSTile(3670,5146)
  776.     , new RSTile(3670,5147)
  777.     , new RSTile(3670,5148)
  778.     , new RSTile(3670,5149)
  779.     , new RSTile(3670,5150)
  780.     , new RSTile(3670,5151)
  781.     , new RSTile(3671,5151)
  782.     , new RSTile(3672,5151)
  783.     , new RSTile(3673,5151)
  784.     , new RSTile(3674,5152)
  785.     , new RSTile(3675,5153)
  786.     , new RSTile(3676,5154)
  787.     , new RSTile(3677,5155)
  788.     , new RSTile(3678,5156)
  789.     , new RSTile(3679,5157)
  790.     , new RSTile(3680,5158)
  791.     , new RSTile(3680,5159)
  792.     , new RSTile(3680,5160)}, {
  793.         new RSTile(3653,5115)
  794.         , new RSTile(3654,5116)
  795.         , new RSTile(3655,5116)
  796.         , new RSTile(3656,5116)
  797.         , new RSTile(3657,5116)
  798.         , new RSTile(3658,5116)
  799.         , new RSTile(3659,5116)
  800.         , new RSTile(3660,5117)
  801.         , new RSTile(3661,5118)
  802.         , new RSTile(3662,5119)
  803.         , new RSTile(3662,5120)
  804.         , new RSTile(3662,5121)
  805.         , new RSTile(3662,5122)
  806.         , new RSTile(3662,5123)
  807.         , new RSTile(3662,5124)
  808.         , new RSTile(3661,5125)
  809.         , new RSTile(3660,5126)
  810.         , new RSTile(3659,5127)
  811.         , new RSTile(3658,5128)
  812.         , new RSTile(3658,5129)
  813.         , new RSTile(3657,5129)
  814.         , new RSTile(3657,5130)
  815.         , new RSTile(3657,5131)
  816.         , new RSTile(3657,5132)
  817.         , new RSTile(3656,5133)
  818.         , new RSTile(3656,5134)
  819.         , new RSTile(3656,5135)
  820.         , new RSTile(3656,5136)
  821.         , new RSTile(3656,5137)
  822.         , new RSTile(3656,5138)
  823.         , new RSTile(3657,5139)
  824.         , new RSTile(3658,5140)
  825.         , new RSTile(3659,5141)
  826.         , new RSTile(3660,5142)
  827.         , new RSTile(3661,5143)
  828.         , new RSTile(3662,5143)
  829.         , new RSTile(3663,5144)
  830.         , new RSTile(3664,5145)
  831.         , new RSTile(3665,5146)
  832.         , new RSTile(3666,5147)
  833.         , new RSTile(3666,5148)
  834.         , new RSTile(3666,5149)
  835.         , new RSTile(3667,5150)
  836.         , new RSTile(3668,5151)
  837.         , new RSTile(3669,5152)
  838.         , new RSTile(3670,5153)
  839.         , new RSTile(3671,5153)
  840.         , new RSTile(3672,5154)
  841.         , new RSTile(3673,5155)
  842.         , new RSTile(3674,5156)
  843.         , new RSTile(3675,5156)
  844.         , new RSTile(3676,5156)
  845.         , new RSTile(3677,5156)
  846.         , new RSTile(3678,5156)
  847.         , new RSTile(3679,5157)
  848.         , new RSTile(3680,5158)
  849.         , new RSTile(3680,5159)
  850.         , new RSTile(3680,5160)
  851.         }};
  852.     RSTile[] GoldRock1ToGoldRock2 = {
  853.                         new RSTile(3669,5076)
  854.                         , new RSTile(3669,5077)
  855.                         , new RSTile(3669,5078)
  856.                         , new RSTile(3669,5079)
  857.                         , new RSTile(3668,5080)
  858.                         , new RSTile(3668,5081)
  859.                         , new RSTile(3667,5081)
  860.                         , new RSTile(3666,5082)
  861.                         , new RSTile(3666,5083)
  862.                         , new RSTile(3665,5083)
  863.                         , new RSTile(3665,5084)
  864.                         , new RSTile(3664,5085)
  865.                         , new RSTile(3663,5086)
  866.                         , new RSTile(3662,5086)
  867.                         , new RSTile(3661,5086)
  868.                         , new RSTile(3660,5086)
  869.                         , new RSTile(3659,5086)
  870.                         , new RSTile(3658,5087)
  871.                         , new RSTile(3657,5088)
  872.                         , new RSTile(3656,5089)
  873.                         , new RSTile(3655,5089)
  874.                         , new RSTile(3654,5089)
  875.                         , new RSTile(3653,5089)
  876.                         , new RSTile(3652,5089)
  877.                         , new RSTile(3651,5089)
  878.                         , new RSTile(3650,5089)
  879.                         , new RSTile(3649,5089)
  880.                         , new RSTile(3648,5089)
  881.                         , new RSTile(3647,5090)
  882.                         , new RSTile(3646,5091)
  883.                         , new RSTile(3645,5092)
  884.                         , new RSTile(3644,5093)
  885.                         , new RSTile(3644,5094)
  886.                         , new RSTile(3643,5094)
  887.                         , new RSTile(3642,5095)
  888.                         , new RSTile(3641,5095)
  889.                         , new RSTile(3640,5095)
  890.                         };
  891.     RSTile[][] GoldRock1ToGoldRock3 = {{
  892.         new RSTile(3669,5076)
  893.         , new RSTile(3669,5077)
  894.         , new RSTile(3669,5078)
  895.         , new RSTile(3669,5079)
  896.         , new RSTile(3668,5080)
  897.         , new RSTile(3667,5081)
  898.         , new RSTile(3666,5082)
  899.         , new RSTile(3666,5083)
  900.         , new RSTile(3665,5083)
  901.         , new RSTile(3665,5084)
  902.         , new RSTile(3665,5085)
  903.         , new RSTile(3665,5086)
  904.         , new RSTile(3664,5087)
  905.         , new RSTile(3663,5088)
  906.         , new RSTile(3663,5089)
  907.         , new RSTile(3662,5089)
  908.         , new RSTile(3662,5090)
  909.         , new RSTile(3662,5091)
  910.         , new RSTile(3662,5092)
  911.         , new RSTile(3662,5093)
  912.         , new RSTile(3662,5094)
  913.         , new RSTile(3662,5095)
  914.         , new RSTile(3662,5096)
  915.         , new RSTile(3662,5097)
  916.         , new RSTile(3662,5098)
  917.         , new RSTile(3661,5099)
  918.         , new RSTile(3661,5100)
  919.         , new RSTile(3661,5101)
  920.         , new RSTile(3661,5102)
  921.         , new RSTile(3661,5103)
  922.         , new RSTile(3661,5104)
  923.         , new RSTile(3661,5105)
  924.         , new RSTile(3661,5106)
  925.         , new RSTile(3661,5107)
  926.         , new RSTile(3661,5108)
  927.         , new RSTile(3661,5109)
  928.         , new RSTile(3661,5110)
  929.         , new RSTile(3661,5111)
  930.         , new RSTile(3661,5112)
  931.         , new RSTile(3661,5113)
  932.         , new RSTile(3661,5114)
  933.         , new RSTile(3661,5115)
  934.         , new RSTile(3661,5116)
  935.         , new RSTile(3661,5117)
  936.         , new RSTile(3661,5118)
  937.         , new RSTile(3662,5119)
  938.         , new RSTile(3662,5120)
  939.         , new RSTile(3662,5121)
  940.         , new RSTile(3662,5122)
  941.         , new RSTile(3662,5123)
  942.         , new RSTile(3662,5124)
  943.         , new RSTile(3662,5125)
  944.         , new RSTile(3662,5126)
  945.         , new RSTile(3663,5127)
  946.         , new RSTile(3664,5128)
  947.         , new RSTile(3665,5129)
  948.         , new RSTile(3666,5130)
  949.         , new RSTile(3666,5131)
  950.         , new RSTile(3666,5132)
  951.         , new RSTile(3667,5132)
  952.         , new RSTile(3668,5133)
  953.         , new RSTile(3669,5134)
  954.         , new RSTile(3669,5135)
  955.         , new RSTile(3669,5136)
  956.         , new RSTile(3669,5137)
  957.         , new RSTile(3669,5138)
  958.         , new RSTile(3670,5139)
  959.         , new RSTile(3670,5140)
  960.         , new RSTile(3670,5141)
  961.         , new RSTile(3670,5142)
  962.         , new RSTile(3670,5143)
  963.         , new RSTile(3670,5144)
  964.         , new RSTile(3670,5145)
  965.         , new RSTile(3670,5146)
  966.         , new RSTile(3670,5147)
  967.         , new RSTile(3670,5148)
  968.         , new RSTile(3670,5149)
  969.         , new RSTile(3670,5150)
  970.         , new RSTile(3670,5151)
  971.         , new RSTile(3671,5151)
  972.         , new RSTile(3672,5151)
  973.         , new RSTile(3673,5151)
  974.         , new RSTile(3674,5152)
  975.         , new RSTile(3675,5153)
  976.         , new RSTile(3676,5154)
  977.         , new RSTile(3677,5155)
  978.         , new RSTile(3678,5156)
  979.         , new RSTile(3679,5157)
  980.         , new RSTile(3680,5158)
  981.         , new RSTile(3680,5159)
  982.         , new RSTile(3680,5160)
  983.         },{
  984.                 new RSTile(3669,5076)
  985.                 , new RSTile(3669,5077)
  986.                 , new RSTile(3669,5078)
  987.                 , new RSTile(3669,5079)
  988.                 , new RSTile(3669,5080)
  989.                 , new RSTile(3669,5081)
  990.                 , new RSTile(3669,5082)
  991.                 , new RSTile(3669,5083)
  992.                 , new RSTile(3669,5084)
  993.                 , new RSTile(3669,5085)
  994.                 , new RSTile(3669,5086)
  995.                 , new RSTile(3669,5087)
  996.                 , new RSTile(3669,5088)
  997.                 , new RSTile(3669,5089)
  998.                 , new RSTile(3669,5090)
  999.                 , new RSTile(3669,5091)
  1000.                 , new RSTile(3669,5092)
  1001.                 , new RSTile(3669,5093)
  1002.                 , new RSTile(3669,5094)
  1003.                 , new RSTile(3669,5095)
  1004.                 , new RSTile(3670,5096)
  1005.                 , new RSTile(3671,5097)
  1006.                 , new RSTile(3671,5098)
  1007.                 , new RSTile(3671,5099)
  1008.                 , new RSTile(3671,5100)
  1009.                 , new RSTile(3671,5101)
  1010.                 , new RSTile(3671,5102)
  1011.                 , new RSTile(3671,5103)
  1012.                 , new RSTile(3671,5104)
  1013.                 , new RSTile(3671,5105)
  1014.                 , new RSTile(3671,5106)
  1015.                 , new RSTile(3671,5107)
  1016.                 , new RSTile(3671,5108)
  1017.                 , new RSTile(3671,5109)
  1018.                 , new RSTile(3671,5110)
  1019.                 , new RSTile(3671,5111)
  1020.                 , new RSTile(3671,5112)
  1021.                 , new RSTile(3671,5113)
  1022.                 , new RSTile(3671,5114)
  1023.                 , new RSTile(3671,5115)
  1024.                 , new RSTile(3671,5116)
  1025.                 , new RSTile(3671,5117)
  1026.                 , new RSTile(3671,5118)
  1027.                 , new RSTile(3671,5119)
  1028.                 , new RSTile(3671,5120)
  1029.                 , new RSTile(3671,5121)
  1030.                 , new RSTile(3671,5122)
  1031.                 , new RSTile(3671,5123)
  1032.                 , new RSTile(3671,5124)
  1033.                 , new RSTile(3671,5125)
  1034.                 , new RSTile(3671,5126)
  1035.                 , new RSTile(3671,5127)
  1036.                 , new RSTile(3671,5128)
  1037.                 , new RSTile(3671,5129)
  1038.                 , new RSTile(3671,5130)
  1039.                 , new RSTile(3671,5131)
  1040.                 , new RSTile(3671,5132)
  1041.                 , new RSTile(3671,5133)
  1042.                 , new RSTile(3671,5134)
  1043.                 , new RSTile(3671,5135)
  1044.                 , new RSTile(3671,5136)
  1045.                 , new RSTile(3671,5137)
  1046.                 , new RSTile(3671,5138)
  1047.                 , new RSTile(3671,5139)
  1048.                 , new RSTile(3671,5140)
  1049.                 , new RSTile(3671,5141)
  1050.                 , new RSTile(3671,5142)
  1051.                 , new RSTile(3671,5143)
  1052.                 , new RSTile(3671,5144)
  1053.                 , new RSTile(3671,5145)
  1054.                 , new RSTile(3671,5146)
  1055.                 , new RSTile(3671,5147)
  1056.                 , new RSTile(3671,5148)
  1057.                 , new RSTile(3671,5149)
  1058.                 , new RSTile(3671,5150)
  1059.                 , new RSTile(3671,5151)
  1060.                 , new RSTile(3671,5152)
  1061.                 , new RSTile(3672,5152)
  1062.                 , new RSTile(3673,5152)
  1063.                 , new RSTile(3674,5152)
  1064.                 , new RSTile(3675,5153)
  1065.                 , new RSTile(3676,5154)
  1066.                 , new RSTile(3677,5155)
  1067.                 , new RSTile(3678,5156)
  1068.                 , new RSTile(3679,5157)
  1069.                 , new RSTile(3680,5158)
  1070.                 , new RSTile(3680,5159)
  1071.                 , new RSTile(3680,5160)
  1072.                 },{
  1073.                 new RSTile(3669,5076)
  1074.                 , new RSTile(3669,5077)
  1075.                 , new RSTile(3669,5078)
  1076.                 , new RSTile(3669,5079)
  1077.                 , new RSTile(3668,5080)
  1078.                 , new RSTile(3667,5081)
  1079.                 , new RSTile(3666,5082)
  1080.                 , new RSTile(3665,5083)
  1081.                 , new RSTile(3665,5084)
  1082.                 , new RSTile(3665,5085)
  1083.                 , new RSTile(3664,5086)
  1084.                 , new RSTile(3663,5087)
  1085.                 , new RSTile(3662,5088)
  1086.                 , new RSTile(3662,5089)
  1087.                 , new RSTile(3662,5090)
  1088.                 , new RSTile(3662,5091)
  1089.                 , new RSTile(3662,5092)
  1090.                 , new RSTile(3662,5093)
  1091.                 , new RSTile(3662,5094)
  1092.                 , new RSTile(3662,5095)
  1093.                 , new RSTile(3662,5096)
  1094.                 , new RSTile(3662,5097)
  1095.                 , new RSTile(3662,5098)
  1096.                 , new RSTile(3661,5099)
  1097.                 , new RSTile(3661,5100)
  1098.                 , new RSTile(3661,5101)
  1099.                 , new RSTile(3661,5102)
  1100.                 , new RSTile(3661,5103)
  1101.                 , new RSTile(3661,5104)
  1102.                 , new RSTile(3661,5105)
  1103.                 , new RSTile(3661,5106)
  1104.                 , new RSTile(3661,5107)
  1105.                 , new RSTile(3661,5108)
  1106.                 , new RSTile(3661,5109)
  1107.                 , new RSTile(3661,5110)
  1108.                 , new RSTile(3661,5111)
  1109.                 , new RSTile(3661,5112)
  1110.                 , new RSTile(3661,5113)
  1111.                 , new RSTile(3661,5114)
  1112.                 , new RSTile(3661,5115)
  1113.                 , new RSTile(3661,5116)
  1114.                 , new RSTile(3661,5117)
  1115.                 , new RSTile(3661,5118)
  1116.                 , new RSTile(3662,5119)
  1117.                 , new RSTile(3662,5120)
  1118.                 , new RSTile(3662,5121)
  1119.                 , new RSTile(3662,5122)
  1120.                 , new RSTile(3662,5123)
  1121.                 , new RSTile(3662,5124)
  1122.                 , new RSTile(3661,5125)
  1123.                 , new RSTile(3660,5126)
  1124.                 , new RSTile(3659,5127)
  1125.                 , new RSTile(3658,5128)
  1126.                 , new RSTile(3658,5129)
  1127.                 , new RSTile(3657,5129)
  1128.                 , new RSTile(3657,5130)
  1129.                 , new RSTile(3657,5131)
  1130.                 , new RSTile(3657,5132)
  1131.                 , new RSTile(3656,5133)
  1132.                 , new RSTile(3656,5134)
  1133.                 , new RSTile(3656,5135)
  1134.                 , new RSTile(3656,5136)
  1135.                 , new RSTile(3656,5137)
  1136.                 , new RSTile(3656,5138)
  1137.                 , new RSTile(3657,5139)
  1138.                 , new RSTile(3658,5140)
  1139.                 , new RSTile(3659,5141)
  1140.                 , new RSTile(3660,5142)
  1141.                 , new RSTile(3661,5143)
  1142.                 , new RSTile(3662,5143)
  1143.                 , new RSTile(3663,5144)
  1144.                 , new RSTile(3664,5145)
  1145.                 , new RSTile(3664,5146)
  1146.                 , new RSTile(3664,5147)
  1147.                 , new RSTile(3665,5148)
  1148.                 , new RSTile(3665,5149)
  1149.                 , new RSTile(3666,5150)
  1150.                 , new RSTile(3666,5151)
  1151.                 , new RSTile(3667,5152)
  1152.                 , new RSTile(3668,5153)
  1153.                 , new RSTile(3669,5154)
  1154.                 , new RSTile(3670,5155)
  1155.                 , new RSTile(3671,5155)
  1156.                 , new RSTile(3672,5155)
  1157.                 , new RSTile(3673,5155)
  1158.                 , new RSTile(3674,5155)
  1159.                 , new RSTile(3675,5155)
  1160.                 , new RSTile(3676,5155)
  1161.                 , new RSTile(3677,5155)
  1162.                 , new RSTile(3678,5156)
  1163.                 , new RSTile(3679,5157)
  1164.                 , new RSTile(3680,5158)
  1165.                 , new RSTile(3680,5159)
  1166.                 , new RSTile(3680,5160)
  1167.                 }};
  1168.     RSTile[][] GoldRock2ToGoldRock3 = {{new RSTile(3638,5096)
  1169.     , new RSTile(3639,5096)
  1170.     , new RSTile(3640,5096)
  1171.     , new RSTile(3641,5096)
  1172.     , new RSTile(3642,5096)
  1173.     , new RSTile(3643,5096)
  1174.     , new RSTile(3644,5096)
  1175.     , new RSTile(3645,5096)
  1176.     , new RSTile(3646,5096)
  1177.     , new RSTile(3647,5096)
  1178.     , new RSTile(3648,5096)
  1179.     , new RSTile(3649,5095)
  1180.     , new RSTile(3650,5095)
  1181.     , new RSTile(3651,5095)
  1182.     , new RSTile(3652,5095)
  1183.     , new RSTile(3653,5096)
  1184.     , new RSTile(3654,5097)
  1185.     , new RSTile(3654,5098)
  1186.     , new RSTile(3655,5099)
  1187.     , new RSTile(3656,5100)
  1188.     , new RSTile(3657,5101)
  1189.     , new RSTile(3657,5102)
  1190.     , new RSTile(3657,5103)
  1191.     , new RSTile(3657,5104)
  1192.     , new RSTile(3657,5105)
  1193.     , new RSTile(3657,5106)
  1194.     , new RSTile(3657,5107)
  1195.     , new RSTile(3657,5108)
  1196.     , new RSTile(3657,5109)
  1197.     , new RSTile(3657,5110)
  1198.     , new RSTile(3657,5111)
  1199.     , new RSTile(3657,5112)
  1200.     , new RSTile(3657,5113)
  1201.     , new RSTile(3658,5114)
  1202.     , new RSTile(3658,5115)
  1203.     , new RSTile(3659,5116)
  1204.     , new RSTile(3660,5117)
  1205.     , new RSTile(3661,5118)
  1206.     , new RSTile(3662,5119)
  1207.     , new RSTile(3662,5120)
  1208.     , new RSTile(3662,5121)
  1209.     , new RSTile(3662,5122)
  1210.     , new RSTile(3662,5123)
  1211.     , new RSTile(3662,5124)
  1212.     , new RSTile(3662,5125)
  1213.     , new RSTile(3662,5126)
  1214.     , new RSTile(3663,5127)
  1215.     , new RSTile(3664,5128)
  1216.     , new RSTile(3665,5129)
  1217.     , new RSTile(3666,5130)
  1218.     , new RSTile(3666,5131)
  1219.     , new RSTile(3666,5132)
  1220.     , new RSTile(3667,5132)
  1221.     , new RSTile(3668,5133)
  1222.     , new RSTile(3669,5134)
  1223.     , new RSTile(3669,5135)
  1224.     , new RSTile(3669,5136)
  1225.     , new RSTile(3669,5137)
  1226.     , new RSTile(3669,5138)
  1227.     , new RSTile(3670,5139)
  1228.     , new RSTile(3670,5140)
  1229.     , new RSTile(3670,5141)
  1230.     , new RSTile(3670,5142)
  1231.     , new RSTile(3670,5143)
  1232.     , new RSTile(3670,5144)
  1233.     , new RSTile(3670,5145)
  1234.     , new RSTile(3670,5146)
  1235.     , new RSTile(3670,5147)
  1236.     , new RSTile(3670,5148)
  1237.     , new RSTile(3670,5149)
  1238.     , new RSTile(3670,5150)
  1239.     , new RSTile(3670,5151)
  1240.     , new RSTile(3671,5152)
  1241.     , new RSTile(3672,5152)
  1242.     , new RSTile(3673,5152)
  1243.     , new RSTile(3674,5152)
  1244.     , new RSTile(3675,5153)
  1245.     , new RSTile(3676,5154)
  1246.     , new RSTile(3677,5155)
  1247.     , new RSTile(3678,5156)
  1248.     , new RSTile(3679,5157)
  1249.     , new RSTile(3680,5158)
  1250.     , new RSTile(3680,5159)
  1251.     , new RSTile(3680,5160)
  1252.     },{
  1253.         new RSTile(3638,5096)
  1254.         , new RSTile(3638,5097)
  1255.         , new RSTile(3638,5098)
  1256.         , new RSTile(3638,5099)
  1257.         , new RSTile(3638,5100)
  1258.         , new RSTile(3638,5101)
  1259.         , new RSTile(3638,5102)
  1260.         , new RSTile(3638,5103)
  1261.         , new RSTile(3638,5104)
  1262.         , new RSTile(3638,5105)
  1263.         , new RSTile(3638,5106)
  1264.         , new RSTile(3638,5107)
  1265.         , new RSTile(3638,5108)
  1266.         , new RSTile(3638,5109)
  1267.         , new RSTile(3638,5110)
  1268.         , new RSTile(3638,5111)
  1269.         , new RSTile(3638,5112)
  1270.         , new RSTile(3638,5113)
  1271.         , new RSTile(3638,5114)
  1272.         , new RSTile(3638,5115)
  1273.         , new RSTile(3638,5116)
  1274.         , new RSTile(3638,5117)
  1275.         , new RSTile(3638,5118)
  1276.         , new RSTile(3638,5119)
  1277.         , new RSTile(3638,5120)
  1278.         , new RSTile(3639,5121)
  1279.         , new RSTile(3639,5122)
  1280.         , new RSTile(3640,5123)
  1281.         , new RSTile(3641,5124)
  1282.         , new RSTile(3642,5125)
  1283.         , new RSTile(3643,5126)
  1284.         , new RSTile(3644,5126)
  1285.         , new RSTile(3645,5127)
  1286.         , new RSTile(3646,5128)
  1287.         , new RSTile(3647,5129)
  1288.         , new RSTile(3648,5130)
  1289.         , new RSTile(3649,5131)
  1290.         , new RSTile(3650,5132)
  1291.         , new RSTile(3651,5133)
  1292.         , new RSTile(3651,5134)
  1293.         , new RSTile(3652,5135)
  1294.         , new RSTile(3653,5136)
  1295.         , new RSTile(3654,5137)
  1296.         , new RSTile(3655,5137)
  1297.         , new RSTile(3656,5138)
  1298.         , new RSTile(3657,5139)
  1299.         , new RSTile(3658,5140)
  1300.         , new RSTile(3659,5141)
  1301.         , new RSTile(3660,5142)
  1302.         , new RSTile(3661,5143)
  1303.         , new RSTile(3662,5143)
  1304.         , new RSTile(3663,5143)
  1305.         , new RSTile(3664,5143)
  1306.         , new RSTile(3665,5143)
  1307.         , new RSTile(3666,5143)
  1308.         , new RSTile(3667,5143)
  1309.         , new RSTile(3668,5143)
  1310.         , new RSTile(3669,5144)
  1311.         , new RSTile(3670,5145)
  1312.         , new RSTile(3670,5146)
  1313.         , new RSTile(3670,5147)
  1314.         , new RSTile(3670,5148)
  1315.         , new RSTile(3671,5149)
  1316.         , new RSTile(3672,5150)
  1317.         , new RSTile(3673,5151)
  1318.         , new RSTile(3674,5152)
  1319.         , new RSTile(3675,5153)
  1320.         , new RSTile(3676,5154)
  1321.         , new RSTile(3677,5155)
  1322.         , new RSTile(3678,5156)
  1323.         , new RSTile(3679,5157)
  1324.         , new RSTile(3680,5158)
  1325.         , new RSTile(3680,5159)
  1326.         , new RSTile(3680,5160)
  1327.         }};
  1328. RSTile GoldRock1 = new RSTile(3668, 5076);
  1329. RSTile GoldRock2 = new RSTile(3638, 5095);
  1330. RSTile GoldRock3 = new RSTile(3678, 5161);
  1331. RSTile SafeSpot = null;
  1332. public boolean IsAtDungeon()throws Exception{
  1333.         if ((getLocation().getX() >= 3600 && getLocation().getX() <= 3750 && getLocation().getY() >= 5050 && getLocation().getY() <= 5162))
  1334.                         return true;
  1335.         else
  1336.                         return false;
  1337. }
  1338. public boolean IsAtBank()throws Exception{
  1339.         if ((getLocation().getX() >= 3652 && getLocation().getX() <= 3658 && getLocation().getY() >= 5112 && getLocation().getY() <= 5116))
  1340.                         return true;
  1341.         else
  1342.                         return false;
  1343. }
  1344. public boolean IsAtGoldRock1()throws Exception{
  1345.         if ((getLocation().getX() >= 3665 && getLocation().getX() <= 3670 && getLocation().getY() >= 5073 && getLocation().getY() <= 5079))
  1346.                         return true;
  1347.         else
  1348.                         return false;
  1349. }
  1350. public boolean IsAtGoldRock2()throws Exception{
  1351.         if ((getLocation().getX() >= 3634 && getLocation().getX() <= 3641 && getLocation().getY() >= 5092 && getLocation().getY() <= 5099))
  1352.                         return true;
  1353.         else
  1354.                         return false;
  1355. }
  1356. public boolean IsAtGoldRock3()throws Exception{
  1357.         if ((getLocation().getX() >= 3674 && getLocation().getX() <= 3682 && getLocation().getY() >= 5157 && getLocation().getY() <= 5162))
  1358.                         return true;
  1359.         else
  1360.                         return false;
  1361. }
  1362. public boolean IsAtCoalRock1()throws Exception{
  1363.         if ((getLocation().getX() >= 3662 && getLocation().getX() <= 3668 && getLocation().getY() >= 5088 && getLocation().getY() <= 5093))
  1364.                         return true;
  1365.         else
  1366.                         return false;
  1367. }
  1368. public boolean IsAtCoalRock2()throws Exception{
  1369.         if ((getLocation().getX() >= 3672 && getLocation().getX() <= 3677 && getLocation().getY() >= 5097 && getLocation().getY() <= 5101))
  1370.                         return true;
  1371.         else
  1372.                         return false;
  1373. }
  1374. public boolean IsAtCoalRock3()throws Exception{
  1375.         if ((getLocation().getX() >= 3683 && getLocation().getX() <= 3690 && getLocation().getY() >= 5103 && getLocation().getY() <= 5110))
  1376.                         return true;
  1377.         else
  1378.                         return false;
  1379. }
  1380. public boolean openDeposit() {
  1381.         final RSObject deposit = getNearestObjectByID(45079);
  1382.                 ActualPlace = deposit.getLocation();
  1383.         if (deposit == null) {
  1384.                 return false;
  1385.         }
  1386.         if (!tileOnScreen(deposit.getLocation())) {
  1387.                 wait(1);
  1388.                 //turnToTile(deposit.getLocation(), 15);
  1389.         }
  1390.         return atTile(deposit.getLocation(), "Deposit");
  1391. }
  1392. public RSTile SafeZone() throws Exception{
  1393.         if (!RealStatus.equals(cache.messages.get(1)) && !RealStatus.contains(cache.messages.get(2)))
  1394.                 return null;
  1395.         RSPlayer player = getMyPlayer();
  1396.         int x = player.getLocation().getX();
  1397.         int y = player.getLocation().getY();
  1398.         RSTile loc = player.getLocation();
  1399. //      if      (cache.safespotX[x][y] != 0 && cache.safespotY[x][y] != 0)
  1400. //              return new RSTile(cache.safespotX[x][y], cache.safespotY[x][y]);
  1401.         if (cache.safespots.containsKey(loc))
  1402.                 return cache.safespots.get(loc);
  1403.          if (IsAtGoldRock3()) {
  1404.          return new RSTile(3680, 5160);
  1405.         }else if (IsAtGoldRock2()) {
  1406.         return new RSTile(3638, 5096);
  1407.         }else if (IsAtGoldRock1()) {
  1408.         return new RSTile(3669,5076);
  1409.         }else if (IsAtBank()){ //Cant Happen
  1410.         return null;
  1411.         }else{ //Cant Happen unless out route etc
  1412.         return null;
  1413.         }
  1414. }
  1415. public boolean depositContains(final int... itemID) {
  1416.         for (final int i : itemID) {
  1417.                 if (getdepositInventoryItemByID(i) == null) {
  1418.                         return false;
  1419.                 }
  1420.         }
  1421.         return true;
  1422. }
  1423. public RSItem getdepositInventoryItemByID(final int... ids) {
  1424.         final RSItem[] items = getdepositInventoryItems();
  1425.         for (final RSItem item : items) {
  1426.                 for (final int id : ids) {
  1427.                         if (item.getID() == id) {
  1428.                                 return item;
  1429.                         }
  1430.                 }
  1431.         }
  1432.         return null;
  1433. }
  1434. public RSItem[] getdepositInventoryItems() {
  1435.         final RSInterfaceChild invIface = RSInterface.getInterface(11).getChild(17);
  1436.         if (invIface != null) {
  1437.                 if (invIface.getComponents().length > 0) {
  1438.                         int len = 0;
  1439.                         for (final RSInterfaceComponent com : invIface.getComponents()) {
  1440.                                 if (com.getType() == 5) {
  1441.                                         len++;
  1442.                                 }
  1443.                         }
  1444.  
  1445.                         final RSItem[] inv = new RSItem[len];
  1446.                         for (int i = 0; i < len; i++) {
  1447.                                 try {
  1448.                                         final RSInterfaceComponent item = invIface
  1449.                                                         .getComponents()[i];
  1450.                                         inv[item.getComponentIndex()] = new RSItem(item);
  1451.                                 } catch (final Exception e) {
  1452.                                         wait(random(500, 700));
  1453.                                         return getdepositInventoryItems();
  1454.                                 }
  1455.                         }
  1456.  
  1457.                         return inv;
  1458.                 }
  1459.         }
  1460.         return new RSItem[0]; // give scripters as few nulls as possible!
  1461. }
  1462. public boolean atDepositItem(final int itemID, final String option)throws Exception {
  1463.         try {
  1464.  
  1465.                 final RSInterfaceChild inventory = RSInterface.getInterface(11).getChild(17);
  1466.                 if (inventory == null || inventory.getComponents() == null) {
  1467.                         return false;
  1468.                 }
  1469.  
  1470.                 final java.util.List<RSInterfaceComponent> possible = new ArrayList<RSInterfaceComponent>();
  1471.                 for (final RSInterfaceComponent item : inventory.getComponents()) {
  1472.                         if (item != null && item.getComponentID() == itemID) {
  1473.                                 possible.add(item);
  1474.                         }
  1475.                 }
  1476.  
  1477.                 if (possible.size() == 0) {
  1478.                         return false;
  1479.                 }
  1480.  
  1481.                 final RSInterfaceComponent item = possible.get(random(0, Math.min(
  1482.                                 2, possible.size())));
  1483.                 return atInterface(item, option);
  1484.         } catch (final Exception e) {
  1485.                 return false;
  1486.         }
  1487. }
  1488. private boolean Eat()throws Exception {
  1489.                 if (FOOD_ID != 0) {
  1490.                                 atInventoryItem(FOOD_ID, "Eat");
  1491.                                 return true;
  1492.                 }
  1493.                 return false;
  1494. }
  1495. boolean WalkToClick(RSTile T)throws Exception {
  1496.     final Point p = Calculations.tileToScreen(T);
  1497.     final Point pn = Calculations.tileToScreen(T.getX(), T.getY(), 0, 0, 0);
  1498.     final Point px = Calculations.tileToScreen(T.getX() + 1, T.getY(), 0,
  1499.             0, 0);
  1500.     final Point py = Calculations.tileToScreen(T.getX(), T.getY() + 1, 0,
  1501.             0, 0);
  1502.     final Point pxy = Calculations.tileToScreen(T.getX() + 1, T.getY() + 1,
  1503.             0, 0, 0);
  1504.     final Point[] points = {p, pn, px, py, pxy};
  1505.     for (final Point point : points) {
  1506.         if (!pointOnScreen(point)) {
  1507.             return false;
  1508.         }
  1509.     }
  1510.     clickMouse(p.x, p.y, false);
  1511.     return true;
  1512. }
  1513. public String RealStatus = null;
  1514. public boolean MiningGold = false;
  1515. public int MiningGoldRock = 0;
  1516. public boolean []DeadRocks = new boolean[3];
  1517.     @Override
  1518.     public int loop() {
  1519.         try{
  1520.                 if (!isLoggedIn() || stop == true) {
  1521.                 Bot.disableRandoms = false;
  1522.                 if (stopiflogout)
  1523.                 stopScript();
  1524.                 return -1;
  1525.         }
  1526.                         if (me==null && isLoggedIn())
  1527.                                 me = new RSPlayerLRC();
  1528.                 if (!RealStatus.equals(cache.messages.get(1)) && !RealStatus.contains(cache.messages.get(3)))
  1529.                         ActualPlace = null;
  1530.                 else
  1531.                         ActualRoute = null;
  1532.                 if (getMyPlayer().getHPPercent() <= 75) {
  1533.                         Eat();
  1534.                 }
  1535.                 if (getMyPlayer().getHPPercent() <= 40) {
  1536.                         setRun(true);
  1537.                         forcelogout = true;
  1538.                 }
  1539.                 if (!IsAtDungeon() && Bot.disableRandoms){
  1540.                         if (Bot.disableRandoms) {
  1541.                         Bot.disableRandoms = false;
  1542.                         log.info(cache.messages.get(12));
  1543.                         }
  1544.                 }else {
  1545.                         if (IsAtDungeon() && !Bot.disableRandoms) {
  1546.                                 if (inventoryContains(14664)) {
  1547.                                         if (Bot.disableRandoms) {
  1548.                                         Bot.disableRandoms = false;
  1549.                                         log.info(cache.messages.get(12));
  1550.                                         }
  1551.                                 }else if (RSInterface.getInterface(WelcomeScreen.WELCOME_SCREEN_ID)
  1552.                                                 .getChild(WelcomeScreen.WELCOME_SCREEN_BUTTON_PLAY)
  1553.                                                 .getAbsoluteY() > 2) {
  1554.                                         if (Bot.disableRandoms) {
  1555.                                                 Bot.disableRandoms = false;
  1556.                                                 log.info(cache.messages.get(12));
  1557.                                                 }              
  1558.                                 }else{
  1559.                                         if (!Bot.disableRandoms) {
  1560.                         Bot.disableRandoms = true;
  1561.                         log.info(cache.messages.get(11));
  1562.                                         }
  1563.                         }
  1564.                         }
  1565.                 }
  1566.                 if (!Bot.disableRandoms) {
  1567.                         return 100;
  1568.                 }
  1569.                 if (path != null) {
  1570.                         walkPath(path, false);
  1571.                         path = null;
  1572.                         return 1;
  1573.                 }
  1574.                 if (gettingAttacked()) {
  1575.                         RSPlayer player = getMyPlayer();
  1576.                         int x = player.getLocation().getX();
  1577.                         int y = player.getLocation().getY();
  1578.                         setRun(true);
  1579.     RSTile safePlace = SafeZone();
  1580.     if (safePlace != null && forcebank == false && forcelogout == false) {
  1581.         if ((x == 3689 || x == 3688) && y == 5106)
  1582.                 forcebank = true;
  1583.         else
  1584.         RealStatus = "CheckingRock_"+MiningGoldRock;
  1585.         if (tileOnScreen(safePlace))
  1586.                 atTile(safePlace, "Walk here");
  1587.         else
  1588.         walkTileMM(safePlace);
  1589.         return random(1900, 2200);
  1590.     }
  1591. }
  1592. startRunning(runEnergy);
  1593. if (getCurrentTab() == TAB_INVENTORY && needRenew == true) {
  1594. if (inventoryContains(restoresummonpouchid)) {
  1595.         if (Integer.parseInt(getInterface(747,5).getText()) <= restoresummonpointsat) {
  1596.                 if(!atInventoryItem(12140, "Drink"))
  1597.                 if(!atInventoryItem(12142, "Drink"))
  1598.                 if(!atInventoryItem(12144, "Drink"))
  1599.                 if(!atInventoryItem(12146, "Drink")) {
  1600.                         familiarnpcid = 0;
  1601.                         summoningfamiliar = false;
  1602.                         usingstore = false;
  1603.                         hasStore = false;
  1604.                 return 1;
  1605.                 }
  1606.         }
  1607.         atInventoryItem(229, "Drop");
  1608.        
  1609.         atInterface(747, 5, "Renew Familiar");
  1610.         wait(random(600,1200));
  1611. }else{
  1612.         familiarnpcid = 0;
  1613.         summoningfamiliar = false;
  1614.         usingstore = false;
  1615.         hasStore = false;
  1616. }
  1617. needRenew = false;
  1618. }
  1619. if (!getMyPlayer().isInCombat() && (RealStatus.equals(cache.messages.get(1))))
  1620.     if (random(0, 101) == 50)
  1621.         Antiban.run();
  1622.  
  1623.         if(!setAltitude) {
  1624.                         setCameraAltitude(true);
  1625.                         wait(random(250, 500));
  1626.                         setAltitude = true;
  1627.                         return random(50, 100);
  1628.                 }
  1629.         if(StartXP == 0) {
  1630.                         StartXP = skills.getCurrentSkillExp(skills.getStatIndex("mining"));
  1631.                         StartLvl = skills.getCurrentSkillLevel(skills.getStatIndex("mining"));
  1632.                 }
  1633.         if (RealStatus.equals(cache.messages.get(4))|| (!RSInterface.getInterface(Constants.INTERFACE_DEPOSITBOX).isValid() && isInventoryFull())) {
  1634.                         RealStatus = cache.messages.get(4);
  1635.                         if (usingstore && !forcebank && !hasStore) {
  1636.                                 if (gettingAttacked()) {
  1637.                                         hasStore = false;
  1638.                                         forcebank = true;
  1639.                                         return 1;
  1640.                                         }
  1641.                                 RSTile walkplace = null;
  1642.                                 if (MiningGoldRock == 1)
  1643.                                         walkplace = new RSTile(3672, 5078+random(0, 3));
  1644.                                 if (MiningGoldRock == 2)
  1645.                                         walkplace = new RSTile(3638+random(-1, 2), 5099);
  1646.                                 if (walkplace != null && walkplace!= getLocation())
  1647.                         if (tileOnScreen(walkplace))
  1648.                                 atTile(walkplace, "Walk here");
  1649.                         else
  1650.                         walkTileMM(walkplace);
  1651.                         wait(random(2200, 3000));
  1652.                         RSNPC familiar = getNearestNPCByID(familiarnpcid);
  1653.                                 if (!atNPC(familiar, "Store")) {
  1654.                         //if (!onTile(familiar.getLocation(), familiar.getName(), "Store", 0.5, 0, 300)) {
  1655.                                         hasStore = false;
  1656.                                         forcebank = true;
  1657.                                         log(cache.messages.get(13));
  1658.                                 }else{
  1659.                                         wait(random(900, 1200));
  1660.                                         if (RSInterface.getInterface(665).isValid()) {
  1661.                                                 atInventoryItem(444, "Store-All");
  1662.                                                 wait(random(900, 1200));
  1663.                                                 atInterface(671,13,"Close");
  1664.                                                 hasStore = true;
  1665.                                                 RealStatus = "CheckingRock_"+MiningGoldRock;
  1666.                                                 wait(random(1300, 2000));
  1667.                                         }
  1668.                                         return (random(900, 1200));
  1669.                                 }
  1670.                                
  1671.                         }
  1672.                         if (powerMine == true && !forcebank) {
  1673.                                 dropAllExcept(random(0,2) == 0 ? true : false, cache.pickaxes.get(0),cache.pickaxes.get(1),cache.pickaxes.get(2),cache.pickaxes.get(3),cache.pickaxes.get(4),cache.pickaxes.get(5),cache.pickaxes.get(6), FOOD_ID);
  1674.                                 RealStatus = "CheckingRock_"+MiningGoldRock;
  1675.                                 return 1;
  1676.                         }
  1677.                                
  1678.                 if (IsAtBank()) {
  1679.                         if (RSInterface.getInterface(Constants.INTERFACE_DEPOSITBOX).isValid()) {
  1680.                                 if (!quickdeposit) {
  1681.                                         atDepositItem(444, "Deposit-All");
  1682.                                         atDepositItem(995, "Deposit-All");
  1683.                                         }else{
  1684.                                                 atInterface(11,18,"Deposit carried items");
  1685.                                         }
  1686.                                 if (hasStore) {
  1687.                                         atInterface(11,22);
  1688.                                         hasStore = false;
  1689.                                 }
  1690.                                 forcebank = false;
  1691.                                 RealStatus = cache.messages.get(0);
  1692.                         return (random(900, 1100));
  1693.                         }else{
  1694.                         openDeposit();
  1695.                         return (random(600, 2000));
  1696.                         }
  1697.                 }else if (MiningGoldRock == 1) {
  1698.                         forcebank = true;
  1699.                         walkPath(BankToGoldRock1, true);
  1700.                         return 1;
  1701.                 }else if (MiningGoldRock == 2) {
  1702.                         forcebank = true;
  1703.                         walkPath(BankToGoldRock2, true);
  1704.                         return 1;
  1705.                 }else if (MiningGoldRock == 3) {
  1706.                         forcebank = true;
  1707.                         walkPath(BankToGoldRock3[random(0, BankToGoldRock3.length)], true);
  1708.                         return 1;
  1709.                 }
  1710.         }else{
  1711.                 if (IsAtBank() || RealStatus.equals(cache.messages.get(0))) {
  1712.                         if (forcelogout) {
  1713.                                 stopScript();
  1714.                                 return 1;
  1715.                         }
  1716.                         /*if (summoningfamiliar) {
  1717.                                 if (Integer.parseInt(getInterface(747,5).getText()) <= restoresummonpointsat) {
  1718.                                         wait(random(100, 200));
  1719.  
  1720.                                         walkPath(RopePath, false);
  1721.                                         wait(random(1500,2000));
  1722.                                         while(distanceTo(ObeliskPath[0]) > 1) {
  1723.                                                 //clickMouse((getNearestObjectByID(45078).getLocation()), "Rope");
  1724.                                                 atRope(getNearestObjectByID(45078), "Climb");
  1725.  
  1726.                                         //onTile(getNearestObjectByID(45078).getLocation(), "Rope", "Climb", 0.67, 0, 450);
  1727.                                         wait(random(200,600));
  1728.                                         }
  1729.                                         wait(random(1200, 2000));
  1730.                                         walkPath(ObeliskPath, false);
  1731.                                         wait(random(1100,1200));
  1732.                                         while(!atTile(new RSTile(3032, 9823), "Renew-points") || (Integer.parseInt(getInterface(747,5).getText()) <= restoresummonpointsat))
  1733.                                                 wait(random(1000,2000));
  1734.                                        
  1735.                                         wait(random(600,900));
  1736.                                         walkPath(ObeliskPath, true);
  1737.                                         wait(random(600,900));
  1738.                                         while(distanceTo(RopePath[RopePath.length-1]) > 1) {
  1739.                                                 atRope(getNearestObjectByID(45077), "Climb");
  1740.                                                 //onTile(getNearestObjectByID(45077).getLocation(), "Rope", "Climb", 0.67, 0, 0);
  1741.                                                 wait(random(200,600));
  1742.                                                 }
  1743.                                         wait(random(1200, 2000));
  1744.                                         walkPath(RopePath, true);
  1745.                                         return 1;
  1746.                                 }
  1747.                         }*/
  1748.                         if (miningwithcc) {
  1749.                         if (DeadRocks[0] == false) {
  1750.                                 RealStatus = cache.messages.get(5);
  1751.                                 walkPath(BankToGoldRock1, false);
  1752.                         }else if (DeadRocks[1] == false){
  1753.                                 RealStatus = cache.messages.get(6);
  1754.                                 walkPath(BankToGoldRock2, false);
  1755.                         }else if (DeadRocks[2] == false){
  1756.                                 RealStatus = cache.messages.get(7);
  1757.                                 walkPath(BankToGoldRock3[random(0, BankToGoldRock3.length)], false);
  1758.                         }
  1759.                                 return random(1,200);
  1760.                         }
  1761.                         if (MiningGoldRock == 1) {
  1762.                                 walkPath(BankToGoldRock1, false);
  1763.                         }else if (MiningGoldRock == 2) {
  1764.                                 walkPath(BankToGoldRock2, false);
  1765.                         }else if (MiningGoldRock == 3) {
  1766.                                 walkPath(BankToGoldRock3[random(0, BankToGoldRock3.length)], false);
  1767.                         }
  1768.                         RealStatus = "CheckingRock_"+MiningGoldRock;
  1769.                         return random(1,200);
  1770.                 }else if (RealStatus.equals(cache.messages.get(5))){
  1771.                                 RSObject Rock = getObjectAt(GoldRock1);
  1772.                                 while (!tileOnScreen(Rock.getLocation()))
  1773.                                         wait(1);
  1774.                                         /*if (!tileOnScreen(Rock.getLocation()) && !getMyPlayer().isMoving())
  1775.                                                 turnToTile(Rock.getLocation(), 15);*/
  1776.                                 if (!tileOnScreen(Rock.getLocation()))
  1777.                                         wait(1);
  1778.                                 if (Rock.getID() != 45075) {
  1779.                                         atObject(Rock, "Mine");
  1780.                                         antimiss = System.currentTimeMillis();
  1781.                                         ActualPlace = Rock.getLocation();
  1782.                                         RealStatus = cache.messages.get(1);
  1783.                                         if (!miningwithcc)
  1784.                                                 DeadRocks = new boolean[3];
  1785.                                                 else
  1786.                                                 DeadRocks[0] = false;
  1787.                                 }else{
  1788.                                         DeadRocks[0] = true;
  1789.                                         RealStatus = Finding_new_rock();
  1790.                                 }
  1791.                 }else if (RealStatus.equals(cache.messages.get(6))){
  1792.                                 RSObject Rock = getObjectAt(GoldRock2);
  1793.                                 while (!tileOnScreen(Rock.getLocation()))
  1794.                                         wait(1);
  1795.                                         /*if (!tileOnScreen(Rock.getLocation()) && !getMyPlayer().isMoving())
  1796.                                                 turnToTile(Rock.getLocation(), 15);*/
  1797.                                 if (!tileOnScreen(Rock.getLocation()))
  1798.                                         wait(1);
  1799.                                 if (Rock.getID() != 45075) {
  1800.                                         atObject(Rock, "Mine");
  1801.                                         antimiss = System.currentTimeMillis();
  1802.                                         ActualPlace = Rock.getLocation();
  1803.                                         RealStatus = cache.messages.get(1);
  1804.                                         if (!miningwithcc)
  1805.                                                 DeadRocks = new boolean[3];
  1806.                                                 else
  1807.                                                 DeadRocks[1] = false;
  1808.                                 }else{
  1809.                                         DeadRocks[1] = true;
  1810.                                         RealStatus = Finding_new_rock();
  1811.                                 }
  1812.                 }else if (RealStatus.equals(cache.messages.get(7))){
  1813.                                 RSObject Rock = getObjectAt(GoldRock3);
  1814.                                 while (!tileOnScreen(Rock.getLocation()))
  1815.                                 wait(1);
  1816.                                 /*if (!tileOnScreen(Rock.getLocation()) && !getMyPlayer().isMoving())
  1817.                                         turnToTile(Rock.getLocation(), 15);*/
  1818.                                 if (!tileOnScreen(Rock.getLocation()))
  1819.                                                 wait(1);
  1820.                                 if (Rock.getID() != 45075) {
  1821.                                         atObject(Rock, "Mine");
  1822.                                         antimiss = System.currentTimeMillis();
  1823.                                         ActualPlace = Rock.getLocation();
  1824.                                         RealStatus = cache.messages.get(1);
  1825.                                         if (!miningwithcc)
  1826.                                         DeadRocks = new boolean[3];
  1827.                                         else
  1828.                                         DeadRocks[2] = false;
  1829.                                 }else{
  1830.                                         DeadRocks[2] = true;
  1831.                                         RealStatus = Finding_new_rock();
  1832.                                 }
  1833.                 }else if (RealStatus.equals(cache.messages.get(1))){
  1834.                         RSObject Rock = null;
  1835.                         if (MiningGoldRock == 1)
  1836.                                 Rock = getObjectAt(GoldRock1);
  1837.                         else if (MiningGoldRock == 2)
  1838.                         Rock = getObjectAt(GoldRock2);
  1839.                         else if (MiningGoldRock == 3)
  1840.                         Rock = getObjectAt(GoldRock3);
  1841.                                 if (!tileOnScreen(Rock.getLocation()))
  1842.                                         wait(1);
  1843.                                         //turnToTile(Rock.getLocation(), 15);
  1844.                                 if (Rock.getID() == 45076) {
  1845.                                         ActualPlace = Rock.getLocation();
  1846.                                         RealStatus = cache.messages.get(1);
  1847.                                         DeadRocks = new boolean[3];
  1848.                                         if (getMyPlayer().getAnimation() == -1) {
  1849.                                         if ((System.currentTimeMillis()-antimiss) > (random(3000,6000)))
  1850.                                                 RealStatus = "CheckingRock_"+MiningGoldRock;
  1851.                                         }else
  1852.                                         antimiss = System.currentTimeMillis();
  1853.                                 }else{
  1854.                                         DeadRocks[MiningGoldRock-1] = true;
  1855.                                         RealStatus = Finding_new_rock();
  1856.                                 }
  1857.                 }
  1858.                
  1859.                 return 1;
  1860.         }
  1861.        
  1862.         return 1;
  1863.         } catch(Exception e) {
  1864.                 return 1;
  1865.                 }
  1866.     }
  1867.     public int bankedtimes;
  1868.     public long antimiss;
  1869.     public boolean threeRocks = false;
  1870.         public boolean atRope(final RSObject tree, final String action) {
  1871.                 final RSTile loc1 = tree.getLocation();
  1872.                 // @SuppressWarnings("unused")
  1873.                 // final RSTile loc2 = new RSTile(loc1.getX() + 1, loc1.getY());
  1874.                 // @SuppressWarnings("unused")
  1875.                 // final RSTile loc3 = new RSTile(loc1.getX(), loc1.getY() + 1);
  1876.                 final RSTile loc4 = tree.getLocation();
  1877.  
  1878.                 final Point sloc1 = Calculations.tileToScreen(loc1.getX(), loc1.getY(),
  1879.                                 90);
  1880.                 final Point sloc2 = Calculations.tileToScreen(loc4.getX(), loc4.getY(),
  1881.                                 90);
  1882.                 /*final Point screenLoc = new Point((sloc1.x + sloc2.x) / 2,
  1883.                                 (sloc1.y + sloc2.y) / 2);*/
  1884.                 final Point screenLoc = Calculations.tileToScreen(loc1.getX(), loc1.getY(),90);
  1885.                 if (screenLoc.x == -1 || screenLoc.y == -1) {
  1886.                         return false;
  1887.                 }
  1888.                 moveMouse(screenLoc, 3, 3);
  1889.                 return atMenu(action);
  1890.         }              
  1891.     public boolean onTile(RSTile tile, String search, String action, double dx, double dy, int height) {
  1892.         if (!tile.isValid()) {
  1893.             return false;
  1894.         }
  1895.        
  1896.         Point checkScreen = null;
  1897.         checkScreen = Calculations.tileToScreen(tile, dx, dy, height);
  1898.         if (!pointOnScreen(checkScreen)) {
  1899.                 walkTileMM(tile);
  1900.             wait(random(340, 1310));
  1901.         }
  1902.  
  1903.         try {
  1904.             Point screenLoc = null;
  1905.             for (int i = 0; i < 30; i++) {
  1906.                 screenLoc = Calculations.tileToScreen(tile, dx, dy, height);
  1907.                 if (!pointOnScreen(screenLoc)) {
  1908.                     return false;
  1909.                 }              
  1910.                 if(getMenuItems().get(0).toLowerCase().contains(search.toLowerCase())) {
  1911.                         break;                
  1912.                 }                  
  1913.                 if (getMouseLocation().equals(screenLoc)) {
  1914.                     break;
  1915.                 }
  1916.                 moveMouse(screenLoc);
  1917.             }
  1918.             screenLoc = Calculations.tileToScreen(tile, height);
  1919.             if (getMenuItems().size() <= 1) {
  1920.                 return false;
  1921.             }
  1922.             wait(random(100, 200));
  1923.             if (getMenuItems().get(0).toLowerCase().contains(action.toLowerCase())) {
  1924.                 clickMouse(true);
  1925.                 return true;
  1926.             } else {
  1927.                 clickMouse(false);
  1928.                 return atMenu(action);
  1929.             }
  1930.         } catch (Exception e) {
  1931.             e.printStackTrace();
  1932.             return false;
  1933.         }
  1934.     }
  1935. public String Finding_new_rock() {
  1936. if (MiningGoldRock == 1) {
  1937.         if (threeRocks) {
  1938.                 if (DeadRocks[0] == false)
  1939.                         return cache.messages.get(5);
  1940.         if (DeadRocks[0] == true && DeadRocks[1] == true && DeadRocks[2] == true) {
  1941.                 MiningGoldRock = 1;
  1942.                 return cache.messages.get(5);
  1943.         } else if (DeadRocks[1] == false) {
  1944.                 walkPath(GoldRock1ToGoldRock2, false);
  1945.                 MiningGoldRock = 2;
  1946.                 return cache.messages.get(6);
  1947.         }else if (DeadRocks[1] == true && DeadRocks[2] == false) {
  1948.                 walkPath(GoldRock1ToGoldRock3[random(0, GoldRock1ToGoldRock3.length)], false);
  1949.                 MiningGoldRock = 3;
  1950.                 return cache.messages.get(7);
  1951.         }      
  1952. }else {
  1953.         if (DeadRocks[0] == false)
  1954.                 return cache.messages.get(5);
  1955.         if (DeadRocks[0] == true && DeadRocks[1] == true) {
  1956.                 MiningGoldRock = 1;
  1957.                 return cache.messages.get(5);
  1958.         } else if (DeadRocks[1] == false) {
  1959.                 walkPath(GoldRock1ToGoldRock2, false);
  1960.                 MiningGoldRock = 2;
  1961.                 return cache.messages.get(6);
  1962.         }
  1963. }
  1964. }else if (MiningGoldRock == 2) {
  1965.         if (threeRocks) {
  1966.                 if (DeadRocks[0] == true && DeadRocks[1] == false)
  1967.                         return cache.messages.get(6);
  1968.         if (DeadRocks[0] == true && DeadRocks[1] == true && DeadRocks[2] == true) {
  1969.                 MiningGoldRock = 2;
  1970.                 return cache.messages.get(6);
  1971.         }
  1972.         if (DeadRocks[0] == false) {
  1973.                 walkPath(GoldRock1ToGoldRock2, true);
  1974.                 MiningGoldRock = 1;
  1975.                 return cache.messages.get(5);
  1976.         }else if (DeadRocks[0] == true && DeadRocks[2] == false) {
  1977.                 walkPath(GoldRock2ToGoldRock3[random(0, GoldRock2ToGoldRock3.length)], false);
  1978.                 MiningGoldRock = 3;
  1979.                 return cache.messages.get(7);
  1980.         }      
  1981.         }else{
  1982.                 if (DeadRocks[0] == true && DeadRocks[1] == false)
  1983.                         return cache.messages.get(6);
  1984.                 if (DeadRocks[0] == true && DeadRocks[1] == true) {
  1985.                         MiningGoldRock = 2;
  1986.                         return cache.messages.get(6);
  1987.                 }
  1988.                 if (DeadRocks[0] == false) {
  1989.                         walkPath(GoldRock1ToGoldRock2, true);
  1990.                         MiningGoldRock = 1;
  1991.                         return cache.messages.get(5);
  1992.                 }
  1993.         }
  1994. }else if (MiningGoldRock == 3) {
  1995.         if (!threeRocks)
  1996.                 if (DeadRocks[0] == true && DeadRocks[1] == true && DeadRocks[2] == false)
  1997.                         return cache.messages.get(7);
  1998.         if (DeadRocks[0] == false && DeadRocks[1] == true) { //shouldnt happen
  1999.                 walkPath(GoldRock1ToGoldRock3[random(0, GoldRock1ToGoldRock3.length)], true);
  2000.                 MiningGoldRock = 1;
  2001.                 return cache.messages.get(5);
  2002.         }else if (DeadRocks[1] == false && DeadRocks[0] == true) { //shouldnt happen
  2003.                 walkPath(GoldRock2ToGoldRock3[random(0, GoldRock2ToGoldRock3.length)], true);
  2004.                 MiningGoldRock = 2;
  2005.                 return cache.messages.get(6);
  2006.         }else{
  2007.                 if (random(1,3) == 1) {
  2008.                 walkPath(GoldRock1ToGoldRock3[random(0, GoldRock1ToGoldRock3.length)], true);
  2009.                 MiningGoldRock = 1;
  2010.                 return cache.messages.get(5);
  2011.                 }else {
  2012.                 walkPath(GoldRock2ToGoldRock3[random(0, GoldRock2ToGoldRock3.length)], true);
  2013.                 MiningGoldRock = 2;
  2014.                 return cache.messages.get(6);
  2015.                 }
  2016.         }
  2017. }
  2018.         return cache.messages.get(1);
  2019. }
  2020. RSTile[] path = null;
  2021.         public void walkPath(RSTile[] path, final boolean reverse) {
  2022.                 path = reverse ? reversePath(path) : path;
  2023.                 path = randomizePath(path, 2, 2);
  2024.                 ActualRoute = path;
  2025.                 try{
  2026.                 while(distanceTo(path[path.length-1]) > random(4,6)) {
  2027.                         if (RSInterface.getInterface(Constants.INTERFACE_DEPOSITBOX).isValid()) {
  2028.                         if (depositContains(444)) {
  2029.                                 try {
  2030.                                         if (!quickdeposit) {
  2031.                                         atDepositItem(444, "Deposit-All");
  2032.                                         atDepositItem(995, "Deposit-All");
  2033.                                         }else{
  2034.                                                 atInterface(11,18,"Deposit carried items");
  2035.                                         }
  2036.                                         } catch (Exception e) {
  2037.                                         }
  2038.                                 wait(random(300, 600));
  2039.                                 continue;
  2040.                         }
  2041.                         }
  2042.                         if (gettingAttacked())
  2043.                                 setRun(true);
  2044.                         startRunning(runEnergy);
  2045.                 if (getMyPlayer().getHPPercent() <= 75) {
  2046.                         Eat();
  2047.                 }
  2048.                 if (!IsAtDungeon() && Bot.disableRandoms){
  2049.                         if (Bot.disableRandoms) {
  2050.                         Bot.disableRandoms = false;
  2051.                         log.info(cache.messages.get(12));
  2052.                         }
  2053.                 }else {
  2054.                         if (IsAtDungeon() && !Bot.disableRandoms) {
  2055.                                 if (inventoryContains(14664)) {
  2056.                                         if (Bot.disableRandoms) {
  2057.                                         Bot.disableRandoms = false;
  2058.                                         log.info(cache.messages.get(12));
  2059.                                         }
  2060.                                 }else if (RSInterface.getInterface(WelcomeScreen.WELCOME_SCREEN_ID)
  2061.                                                 .getChild(WelcomeScreen.WELCOME_SCREEN_BUTTON_PLAY)
  2062.                                                 .getAbsoluteY() > 2) {
  2063.                                         if (Bot.disableRandoms) {
  2064.                                                 Bot.disableRandoms = false;
  2065.                                                 log.info(cache.messages.get(12));
  2066.                                                 }              
  2067.                                 }else{
  2068.                                         if (!Bot.disableRandoms) {
  2069.                         Bot.disableRandoms = true;
  2070.                         log.info(cache.messages.get(11));
  2071.                                         }
  2072.                         }
  2073.                         }
  2074.                 }
  2075.                 if (!Bot.disableRandoms) {
  2076.                         this.path = path;
  2077.                         break;
  2078.                 }
  2079.                         if (random(1, 11) == 5 && getCurrentTab() != Constants.TAB_INVENTORY) {
  2080.                         Bot.getInputManager().pressKey((char)KeyEvent.VK_F1);
  2081.                          wait(random(20,50));
  2082.                         Bot.getInputManager().releaseKey((char)KeyEvent.VK_F1);
  2083.                         }
  2084.                         if (!getMyPlayer().isMoving() || distanceTo(getDestination()) <= random(5,7)) {
  2085.       if (!walkPathMM(path, random(14,16), 2 ,2))
  2086.           walkPathMM(path, random(10,14), 2 ,2);
  2087.       wait(random(600, 800));
  2088.                 }
  2089.                       wait(random(100, 200));
  2090.                 }
  2091.         } catch (Exception e) {  
  2092.                 walkPath(path, false);
  2093.         }  
  2094.      
  2095.     }
  2096. public boolean needRenew = false;
  2097.         @Override
  2098.     public void serverMessageRecieved(final ServerMessageEvent arg0) {
  2099.         final String Message = arg0.getMessage();
  2100.        // log.info(Message);
  2101.         if (summoningfamiliar)
  2102.          if (Message.contains("This is not your familiar.")) {
  2103.                                         hasStore = false;
  2104.                                         forcebank = true;
  2105.                 }
  2106.         if (Message.contains("before your familiar vanishes."))
  2107.                 needRenew = true;              
  2108.  
  2109.         if (Message.contains("mine some coal")){
  2110.                 TotalXp = TotalXp + 50;
  2111.                 OresMined++;
  2112.         }
  2113.         if (Message.contains("two pieces of coal")){
  2114.                 TotalXp = TotalXp + 100;
  2115.                 OresMined= OresMined+2;
  2116.         }
  2117.         if (Message.contains("two gold ores!")){
  2118.                 TotalXp = TotalXp + 130;
  2119.                 OresMined= OresMined+2;
  2120.         }
  2121.         if (Message.contains("Varrock Armour")){
  2122.                 TotalXp = TotalXp + 65;
  2123.                 OresMined++;
  2124.         }
  2125.         if (Message.contains("mine some gold")){
  2126.                 TotalXp = TotalXp + 65;
  2127.                 OresMined++;
  2128.         }
  2129.     }
  2130.         public BufferedImage loadImage(String ref) {  
  2131.                 try{
  2132.                         String filePlace = "goldore.gif";
  2133.                         new File(filePlace).delete();
  2134.                                 URL url = new URL("http://privateftp.no-ip.info/goldore.gif");
  2135.                                 if (url == null) {
  2136.                                         return null;
  2137.                                 }
  2138.                                 RandomAccessFile file = new RandomAccessFile(new File(filePlace), "rw");
  2139.                                 InputStream in = url.openStream();
  2140.                                 byte[] buf = new byte[4 * 1024];
  2141.                                 int bytesRead;
  2142.                                 while ((bytesRead = in.read(buf)) != -1) {
  2143.                                         file.write(buf, 0, bytesRead);
  2144.                                 }
  2145.                                 file.close();
  2146.         BufferedImage bimg = null;  
  2147.         try {  
  2148.  
  2149.             bimg = ImageIO.read(new File(filePlace));  
  2150.         } catch (Exception e) {  
  2151.             e.printStackTrace();  
  2152.         }  
  2153.         new File(filePlace).delete();
  2154.         return bimg;  
  2155.                 }catch (Exception E) {
  2156.                         return null;
  2157.                 }
  2158.     }  
  2159.           BufferedImage goldOreI = loadImage("goldore");  
  2160.           long startTime = System.currentTimeMillis();
  2161.           int profit = 0;
  2162.           int startLvl = 0;
  2163.           int startexp = 0;
  2164.           int xpGained = 0;
  2165.           Color gold = new Color(250,250,0,50);
  2166.                         public void onRepaint(Graphics g) {
  2167.                         if (!isLoggedIn())
  2168.                         return;
  2169.                        
  2170.                         try{
  2171.                                 if (ActualRoute != null) {
  2172.                                          for (int i = 0; i < ActualRoute.length; i++) {
  2173.                                                  actualRock(g, ActualRoute[i], transRed, "Step: "+i);
  2174.                                          }
  2175.                                 }
  2176.         if (ActualPlace != null)
  2177.         actualRock(g, ActualPlace, transGreen, "Actual Place: ");
  2178.                         }catch(Exception e) {
  2179.         }
  2180.                           int profit = miningoreprice*OresMined;
  2181.                             long millis = System.currentTimeMillis() - startTime;
  2182.                             long hours = millis / (1000 * 60 * 60);
  2183.                             millis -= hours * (1000 * 60 * 60);
  2184.                             long minutes = millis / (1000 * 60);
  2185.                             millis -= minutes * (1000 * 60);
  2186.                             long seconds = millis / 1000;
  2187.                             float profitsec = 0;
  2188.                             if ((minutes > 0 || hours > 0 || seconds > 0)) {
  2189.                                 profitsec = ((float) profit)/(float)(seconds + (minutes*60) + (hours*60*60));  
  2190.                             float profitmin = profitsec * 60;
  2191.                             float profithour = profitmin * 60;
  2192.                             if (startexp == 0) {
  2193.                                          startexp = skills.getCurrentSkillExp(STAT_MINING);
  2194.                                 }
  2195.                             xpGained = (skills.getCurrentSkillExp(STAT_MINING) - startexp);
  2196.                             float xpsec = 0;
  2197.                                 if ((minutes > 0 || hours > 0 || seconds > 0) && xpGained > 0) {
  2198.                                     xpsec = ((float) xpGained)/(float)(seconds + (minutes*60) + (hours*60*60));
  2199.                                 }
  2200.                                 float xpmin = xpsec * 60;
  2201.                                 float xphour = xpmin * 60;
  2202.                                if (startLvl == 0)startLvl = skills.getCurrentSkillLevel(STAT_MINING);
  2203.                                
  2204.                             int currentLvl = skills.getCurrentSkillLevel(STAT_MINING);
  2205.                             int lvlsGained = currentLvl - startLvl;
  2206.                             int percentToLvl = skills.getPercentToNextLevel(STAT_MINING);
  2207.                             Mouse mouse = Bot.getClient().getMouse();
  2208.                             if((mouse.x >= 481 && mouse.x < 481 + 31 && mouse.y >= 298 && mouse.y < 298 + 37) == false) {
  2209.                                 g.drawImage(goldOreI, 481, 304, 31, 27, null);
  2210.                                 g.setColor(Color.black);
  2211.                                 g.setFont(new Font("Copperplate Gothic Bold", Font.PLAIN, 14));
  2212.                                 g.drawString("" + "mined" , 484,323);
  2213.                                 g.setFont(new Font("Copperplate Gothic Bold", Font.PLAIN, 12));
  2214.                                 g.setColor(Color.white);
  2215.                                 g.drawString("" + "mined" , 485,323);
  2216.                             }else {
  2217.                                 g.setColor(gold);
  2218.                                 g.fillRoundRect(310,135,200,200,10,10);
  2219.                                 g.setFont(new Font("Copperplate Gothic Bold", Font.PLAIN, 16));
  2220.                                 g.setColor(Color.white);
  2221.                                 g.drawString("Dragonkk's" , 355, 147);
  2222.                                 g.drawString("Living Cavern Miner" , 320, 162);
  2223.                                 g.setFont(new Font("Times New Roman", Font.BOLD, 14));
  2224.                                 g.drawString("Time running: " + hours + ":" + minutes + ":" + seconds , 312, 177);
  2225.                                 g.drawString("Ores Mined: " + OresMined , 312, 193);
  2226.                                 g.drawString("Profit: " + profit , 312, 209);
  2227.                                 g.drawString("Profit per hour: " + (int)profithour , 312, 225);
  2228.                                 /*********************************************************/
  2229.                                 g.drawString("Current Level: " + currentLvl , 312, 282);
  2230.                                 g.drawString("Levels Gained: " + lvlsGained , 312, 298);
  2231.                                 g.drawString("XP Gained: " + xpGained, 312, 314);
  2232.                                 g.drawString("XP per Hour: " + (int)xphour, 312, 330);
  2233.                                 g.drawRect(335,240,150,20);
  2234.                                 g.setColor(Color.red);
  2235.                                 g.fillRect(336,241,149,19);
  2236.                                 g.setColor(Color.green);
  2237.                                 double percent = 1.49*percentToLvl;
  2238.                                 g.fillRect(336,241,(int)percent,19);
  2239.                                 g.setColor(Color.white);
  2240.                                 g.drawString("" + percentToLvl + "%", 400, 253);
  2241.                                         g.setColor(Color.yellow);
  2242.                                         g.fillRoundRect(6,460,510,15,0,0);
  2243.                                         g.setColor(Color.green);
  2244.                                         g.setFont(new Font("Arial", Font.BOLD, 12));
  2245.                                         if (RealStatus.contains("CheckingRock_"))
  2246.                                         g.drawString("Status: Checking Rock",9,471);
  2247.                                         else
  2248.                                         g.drawString("Status: "+RealStatus,9,471);
  2249.  
  2250.                             }
  2251.                         }
  2252.                     }
  2253. RSTile ActualPlace = null;
  2254. RSTile[] ActualRoute = null;  
  2255.     long delaytimetonext = System.currentTimeMillis();
  2256.     long antibannext = System.currentTimeMillis();
  2257.     long antibannext2 = System.currentTimeMillis();
  2258.     public class antiban extends Thread {
  2259.         public void CameraAlt() {
  2260.             try {
  2261.             int key = (random(0, 2) == 0) ? KeyEvent.VK_UP : KeyEvent.VK_DOWN;
  2262.             Bot.getInputManager().pressKey((char)key);
  2263.             Thread.sleep(random(1000, 1500));
  2264.             Bot.getInputManager().releaseKey((char)key);
  2265.             } catch (final InterruptedException e) {
  2266.             }
  2267.             antimiss = System.currentTimeMillis();
  2268.         }
  2269.         public void CameraRot() {
  2270.             setCameraRotation((int) (getCameraAngle() + (Math.random() * 50 > 25 ? 1 : -1) * (30 + Math.random() * 90)));
  2271.             antimiss = System.currentTimeMillis();
  2272.         }
  2273.         public void mouseoverMM() {
  2274.             moveMouse(628 + random(-30, 30), 89 + random(-30, 30));
  2275.             antimiss = System.currentTimeMillis();
  2276.         }
  2277.         public void Lookplayers() {
  2278.                 RSPlayer look = getNearestPlayerByLevel(3,139);
  2279.                 if (look == null) {
  2280.                         return;
  2281.                 }
  2282.                 final RSTile tile = look.getLocation();
  2283.                 if (!tile.isValid()) {
  2284.                         return;
  2285.                 }
  2286.                         Point screenLoc;
  2287.                         for (int i = 0; i < 20; i++) {
  2288.                                 screenLoc = look.getScreenLocation();
  2289.                                 if (!look.isValid() || !pointOnScreen(screenLoc)) {
  2290.                                         log.info("Null player/not on screen");
  2291.                                         return;
  2292.                                 }
  2293.                                 if (getMouseLocation().equals(screenLoc)) {
  2294.                                         break;
  2295.                                 }
  2296.                                 moveMouse(screenLoc);
  2297.                                
  2298.                         }
  2299.                        
  2300.                         screenLoc = look.getScreenLocation();
  2301.                         if (!getMouseLocation().equals(screenLoc)) {
  2302.                                 return;
  2303.                         }
  2304.                         final List<String> items = getMenuItems();
  2305.                         if (items.size() <= 1) {
  2306.                                 return;
  2307.                         }
  2308.                         clickMouse(screenLoc, false);
  2309.                         try {
  2310.                                 Thread.sleep((random(2000,4000)));
  2311.                         } catch (InterruptedException e) {
  2312.                                 e.printStackTrace();
  2313.                         }
  2314.             moveMouse(random(0,1000), random (0, 1000));
  2315.             antimiss = System.currentTimeMillis();
  2316.         }
  2317.         public void mouseOverMiningSkill() {
  2318.             try {
  2319.             openTab(Constants.TAB_STATS);
  2320.             // 2 interfaces, one for the pickaxe image, other for the skill text
  2321.             final RSInterfaceChild two = RSInterface.getInterface(320).getChild(7);
  2322.                 moveMouse(new Point(two.getAbsoluteX()
  2323.                         + random(2, two.getWidth() - 1), two.getAbsoluteY()
  2324.                         + random(2, two.getHeight() - 1)));
  2325.             Thread.sleep(random(750, 1000));
  2326.             } catch (final InterruptedException e) {
  2327.             }
  2328.             antimiss = System.currentTimeMillis();
  2329.         }
  2330.         public void checkFriendsList() {
  2331.             openTab(Constants.TAB_FRIENDS);
  2332.             if (random(0, 5) == 5) {
  2333.                 try {
  2334.                 moveMouse(random(573, 620), random(439, 457));
  2335.                 clickMouse(true);
  2336.                 Thread.sleep(random(750, 1000));
  2337.                 sendText("", true);
  2338.                 } catch (final InterruptedException e) {
  2339.                 }
  2340.             } else {
  2341.                 try {
  2342.                 moveMouse(random(552, 569), random(227, 420));
  2343.                 Thread.sleep(random(750, 1000));
  2344.                 Point mousel2 = getMouseLocation();
  2345.                 moveMouse(random(584, 624), mousel2.y + random(-3, 3));
  2346.                 } catch (final InterruptedException e) {
  2347.                 }
  2348.             }
  2349.             antimiss = System.currentTimeMillis();
  2350.         }
  2351.         @Override
  2352.         public void run() {
  2353.             int chance = 0;
  2354.             chance = random(1, 5);
  2355.             if (chance >= 3) {
  2356.                 return;
  2357.             }
  2358.             if ((System.currentTimeMillis() - antibannext) >= (random(25, 90) * 1000)) {
  2359.                     aboveground();
  2360.                     antibannext = System.currentTimeMillis();
  2361. //                log("Antiban performed =)");
  2362.             }
  2363.         }
  2364.         public void aboveground() {
  2365.             int gamble = 0;
  2366.             if (!getMyPlayer().isMoving()) {  
  2367.                 gamble = random(0, 14);
  2368.                 if (gamble > 14) {
  2369.                         Lookplayers();
  2370.                 }else if (gamble > 12) {
  2371.                     checkFriendsList();
  2372.                     //log("Friends Tab Opened Above");
  2373.                 } else if (gamble > 7) {
  2374.                     mouseOverMiningSkill();
  2375.                     //log("Stats Tab Opened Above");
  2376.                 } else if (gamble > 4) {
  2377.                     mouseoverMM();
  2378.                     //log("Moved Mouse over MM Below");
  2379.                 } else if (gamble > 0) {
  2380.                     moveMouseRandomly(150);
  2381.                     //log("Moved Mouse Randomly Above");
  2382.                 } else if (gamble == 0) {
  2383.                     CameraRot();
  2384.                     //log("Camera Rotated Above");
  2385.                 }
  2386.             }
  2387.         }
  2388.     }
  2389.     Thread Antiban = new antiban();
  2390.     public void onFinish() {
  2391.         stopcc = true;
  2392.         log(cache.messages.get(10)+getVersion());
  2393.         log(cache.messages.get(9));
  2394.         log("You have mined "+OresMined+" And gained " +TotalXp+" XP");
  2395.         cache.DeleteCache();
  2396.         cache = null;
  2397.     }
  2398. }