Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 2nd, 2012  |  syntax: None  |  size: 51.80 KB  |  hits: 16  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1.  
  2. /*
  3. * ZombieFisherEXTREME V7.52
  4. *
  5. * Credits:
  6. * BamBino/cronshaw1234/Zorlix - Updaters
  7. * Carmera Spin/Harpoon update - Lone Spartan
  8. * Welcome - Ruski
  9. * TBT and Aelin for scripting this.
  10. * The Immortal for letting me use his paint thingy :D
  11. */
  12.  
  13. import java.awt.event.*;
  14. import java.io.*;
  15. import java.net.*;
  16. import java.awt.Color;
  17. import java.awt.Graphics;
  18. import java.io.IOException;
  19. import java.lang.reflect.Method;
  20. import java.util.Map;
  21. import javax.swing.JOptionPane;
  22.  
  23. import org.rsbot.util.ScreenshotUtil;
  24. import org.rsbot.bot.Bot;
  25. import org.rsbot.script.ScriptManifest;
  26. import org.rsbot.event.events.ServerMessageEvent;
  27. import org.rsbot.event.listeners.PaintListener;
  28. import org.rsbot.event.listeners.ServerMessageListener;
  29. import org.rsbot.script.wrappers.RSInterface;
  30. import org.rsbot.script.wrappers.RSItemTile;
  31. import org.rsbot.script.wrappers.RSNPC;
  32. import org.rsbot.script.wrappers.RSObject;
  33. import org.rsbot.script.wrappers.RSPlayer;
  34. import org.rsbot.script.wrappers.RSTile;
  35. import org.rsbot.script.*;
  36.  
  37.  
  38. @ScriptManifest(authors = {"ZombieKnight"}, category = "Fishing", name = "ZombieFisherEXTREME", version = 7.52, description = "<html><head><style type='text/css'> hr {color: white} p {margin-left: 20px}</style></head><body><center><b><font size='4' color='Blue'>ZombieFisherEXTREME v7.52</font></b><br></center><center><table border='0'><tr><td colspan='2'><center><font size='4'><b>:: Script Settings ::</b></font></center></td></tr><tr><td colspan='2'><hr></td></tr><tr><td><center><table border='0'><tr><td colspan='2'><center><font size='4'><b>Contact me at ZombieKnight_RSBot@hotmail.com</b></font></center></td></tr><tr><td colspan='2'><hr></td></tr><tr><td><tr><td><b>Location: </b></td><td><center><select name='locationName'><option>Al-Kharid<option>Barb Village(EV)<option>Catherby<option>Draynor<option>Fishing Guild<option>Otto-Grotto<option>Shilo<option>Piscatoris</select></center></td></tr><tr><td><b>Catch: </b></td><td><center><select name='catchName'><option>Pike<option>Bass/Cod/Mackerel<option>Shrimp/Anchovies<option>Herring/Sardines<option>Leaping<option>Trout/Salmon<option>Tuna/Swordfish<option>Tuna/Swordfish(CHARPOON)<option>Lobsters<option>Sharks<option>Sharks(CHARPOON)<option>Rainbow Fish<option>Monkfish</select></center></td></tr><tr><td><b>Paint Color: </b></td><td><center><select name='pColor'><option>PinkPanther<option>SunKist<option>ClearSky<option>Monochrome<option>Nightmare<option>BloodShed</select></center></td></tr><tr><td><b>ZombieWalking:</b></td><td><center><input type=\"checkbox\" name=\"zombieWalking\" value=\"true\"><B>Yes</b></center></td></tr><tr><td><b>AntiTunas:</b></td><td><center><input type=\"checkbox\" name=\"antiTunas\" value=\"true\"><B>Yes</b></center></td></tr><tr><td><b>Powerfishing Mode:</b></td><td><center><input type='checkbox' name='powerFishing' value='true'><B>Yes</b></center></td></tr><tr><td><b>Wield Equipment:</b></td><td><center><input type='checkbox' name='barbarianMode' value='true'><B>Yes</b></center></td></tr><tr><td><b>Paint Report:</b></td><td><center><input type='checkbox' name='usePaint' checked='true' value='true'><B>Yes</b></center></td></tr></table><center><p>For Support/Comments, Pls click <a href='http://www.rsbot.org/vb/showthread.php?t=52649'>HERE</a></p><center><center><p>For Suggestions/Requests/Bug reports, Pls click <a href='http://www.rsbot.org/vb/showthread.php?t=48599'>HERE</a></p><center></center></body></html>")
  39. public class ZombieFisher extends Script implements ServerMessageListener, PaintListener {
  40.         int randomInt;
  41.         int GambleInt;
  42.        
  43.         @Override
  44.         protected int getMouseSpeed() {
  45.            if (powerFishing)
  46.                 return random(8, 10);
  47.            else
  48.                 return random(3, 5);
  49.         }
  50.  
  51.  
  52.         // State constants:
  53.         public final int S_WALKTO_BANK = 100;
  54.         public final int S_WALKTO_SPOT = 200;
  55.         public final int S_FISH = 300;
  56.         public final int S_TUNA = 400;
  57.         public final int S_THROW_TUNAS = 500;
  58.         public final int S_DROP_ALL = 600;
  59.         public final int S_USE_BANK = 700;
  60.         public final int S_DEPOSIT = 800;
  61.         public final int S_WITHDRAW = 900;
  62.  
  63.  
  64.         // Bait constants:
  65.         public final int BAIT_NONE = -1;
  66.         public final int BAIT_BAIT = 313;
  67.         public final int BAIT_FEATHERS = 314;
  68.         public final int BAIT_STRIPY = 10087;
  69.  
  70.         // Gear constants:
  71.         public final int GEAR_NET = 303;
  72.         public final int GEAR_ROD = 307;
  73.         public final int GEAR_FLYROD = 309;
  74.         public final int GEAR_HEAVYROD = 11323;
  75.         public final int GEAR_CAGE = 301;
  76.         public final int GEAR_CHARPOON = 14109;
  77.         public final int GEAR_HARPOON = 311;
  78.         public final int GEAR_BIGNET = 305;
  79.         public final int GEAR_BARB = 10129;
  80.         public final int GEAR_NONE = -1;
  81.  
  82.         // Paths and tiles:
  83.         public RSTile[] toBank;
  84.         public RSTile[] toArea;
  85.         RSTile[] lostTiles = new RSTile[]{new RSTile(2860, 3428), new RSTile(2863, 2978), new RSTile(2835, 2975)};
  86.         RSTile[] recoverTiles = new RSTile[]{new RSTile(2849, 3430), new RSTile(2855, 2971), new RSTile(2850, 2970)};
  87.  
  88.         // Runtime configuration.
  89.         public int currentGear;
  90.         public int currentBait;
  91.         public String currentCommand;
  92.         public int fishingSpotID;
  93.         public int bankID;
  94.         public int shopID;
  95.         public boolean usesNPCBanking;
  96.  
  97.         // Script configuration.
  98.         public String locationName;
  99.         public String catchName;
  100.         public String pColor;
  101.         public boolean barbarianMode;
  102.         public boolean powerFishing;
  103.         public boolean antiTunas;
  104.         public boolean zombieWalking;
  105.         public boolean usePaint;
  106.         public boolean Sound;
  107.         public boolean isPvP;
  108.         public boolean hasEquipped;
  109.         public long oldCatches = 0;
  110.         public long catches = 0;
  111.  
  112.         // Misc variables.
  113.         public int currentFails = 0;
  114.         public int randomRunEnergy;
  115.         public int state = S_FISH;
  116.         public boolean runningFromCombat;
  117.         public long scriptStartTime;
  118.         public int playerStartXP;
  119.         public int numberOfCatches;
  120.         public long lastCheck;
  121.         public long checkTime;
  122.         public int countToNext = 0;
  123.         public int timesAvoidedCombat;
  124.         public int whirlpoolsAvoided;
  125.         public int timesRecoveredGear;
  126.         public int startLevel;
  127.         public int lastExp;
  128.         public int xpPerCatch = 0;
  129.         public int oldExp;
  130.         public int updateCheck = 0;
  131.         public RSPlayer PvPPlayer;
  132.         public int sCB;
  133.         public int startExp;
  134.         public boolean sRM;
  135.         public boolean StartedY;
  136.  
  137.  
  138.         public int[] whirlpools = new int[]{
  139.                         403, 404, 406, 406};
  140.  
  141.         int[] equipItems = {10129, 14109};
  142.  
  143.         int[] itemIDs = {10129, 14109};
  144.  
  145.         public void turnCamera() {
  146.                 char[] LR = new char[]{KeyEvent.VK_LEFT, KeyEvent.VK_RIGHT};
  147.                 char[] UD = new char[]{KeyEvent.VK_DOWN, KeyEvent.VK_UP};
  148.                 char[] LRUD = new char[]{KeyEvent.VK_LEFT, KeyEvent.VK_RIGHT,
  149.                                 KeyEvent.VK_UP, KeyEvent.VK_DOWN};
  150.                 int random2 = random(0, 4);
  151.                 int random1 = random(0, 4);
  152.                 int random4 = random(0, 4);
  153.  
  154.                 if (random(0, 2) == 2) {
  155.                         Bot.getInputManager().pressKey(LR[random1]);
  156.                         try {
  157.                                 Thread.sleep(random(100, 400));
  158.                         } catch (Exception e) {
  159.                         }
  160.                         Bot.getInputManager().pressKey(UD[random2]);
  161.                         try {
  162.                                 Thread.sleep(random(300, 600));
  163.                         } catch (Exception e) {
  164.                         }
  165.                         Bot.getInputManager().releaseKey(UD[random2]);
  166.                         try {
  167.                                 Thread.sleep(random(100, 400));
  168.                         } catch (Exception e) {
  169.                         }
  170.                         Bot.getInputManager().releaseKey(LR[random1]);
  171.                 } else {
  172.                         Bot.getInputManager().pressKey(LRUD[random4]);
  173.                         if (random4 > 1) {
  174.                                 try {
  175.                                         Thread.sleep(random(300, 600));
  176.                                 } catch (Exception e) {
  177.                                 }
  178.                         } else {
  179.                                 try {
  180.                                         Thread.sleep(random(500, 900));
  181.                                 } catch (Exception e) {
  182.                                 }
  183.                         }
  184.                         Bot.getInputManager().releaseKey(LRUD[random4]);
  185.                 }
  186.         }
  187.  
  188.         /*
  189.                  * Pre-runtime configuration takes place within this method.
  190.                  */
  191.         public boolean onStart(final Map<String, String> args) {
  192.  
  193.                 final int welcome = JOptionPane
  194.                                 .showConfirmDialog(
  195.                                                 null,
  196.                                                 "Before using my script, would you like to thank me\nby clicking some adverts?",
  197.                                                 "Welcome", JOptionPane.YES_NO_OPTION);
  198.                 if (welcome == 0) {
  199.                         final String message = "<html><h1>Thank you for your support!</h1><br/>"
  200.                                         + "<p>You will now be redirected to my adverts page. <br/>"
  201.                                         + "Click the adverts on the page few times a day if you can.</p>"
  202.                                         + "</html>";
  203.                         JOptionPane.showMessageDialog(null, message);
  204.                         openURL("http://49237d3d.tinybucks.net");
  205.                 }
  206.                 Reset();
  207.                 checkupdate();
  208.                 // Set script start time
  209.                 scriptStartTime = System.currentTimeMillis();
  210.                 // Load script configuration from arguements.
  211.                 locationName = args.get("locationName");
  212.                 catchName = args.get("catchName");
  213.                 pColor = args.get("pColor");
  214.                 barbarianMode = args.get("barbarianMode") != null ? true : false;
  215.                 powerFishing = args.get("powerFishing") != null ? true : false;
  216.                 antiTunas = args.get("antiTunas") != null ? true : false;
  217.                 usePaint = args.get("usePaint") != null ? true : false;
  218.                 isPvP = args.get("PvPWorld") != null ? true : false;
  219.                 Sound = args.get("wSound") != null ? true : false;
  220.                 zombieWalking = args.get("zombieWalking") != null ? true : false;
  221.  
  222.                 if (catchName.equals("Trout/Salmon")) {
  223.                         log.severe("Please buy your feathers for the lowest price in the Grand Exchange.");
  224.                         log.severe("I thank you for doing that, the current price for feathers is too high.");
  225.                         log.severe("So, please help us out in the quest of bringing it down.");
  226.  
  227.                 }
  228.                  
  229.                 // Al Kharid locations:
  230.                 if (locationName.equals("Al-Kharid")) {
  231.                         log("Setting Mummyfied paths for Al-Kharid.");
  232.                         log("[Reminder]Pls start in the bank or at the fishing spots.");
  233.                         toBank = new RSTile[]{new RSTile(3271, 3144), new RSTile(3276, 3157), new RSTile(3270, 3167)};
  234.                         toArea = reversePath(toBank);
  235.                         usesNPCBanking = true;
  236.  
  237.                         if (catchName.equals("Shrimp/Anchovies")) {
  238.                                 currentGear = GEAR_NET;
  239.                                 currentBait = BAIT_NONE;
  240.                                 fishingSpotID = 330;
  241.                                 currentCommand = "Net";
  242.                                 bankID = 35647;
  243.                                 return true;
  244.                         }
  245.  
  246.                         if (catchName.equals("Herring/Sardines")) {
  247.                                 currentGear = GEAR_ROD;
  248.                                 currentBait = BAIT_BAIT;
  249.                                 fishingSpotID = 330;
  250.                                 currentCommand = "Bait";
  251.                                 bankID = 35647;
  252.                                 return true;
  253.                         }
  254.                 }
  255.  
  256.                
  257.                 if (locationName.equals("Otto-Grotto")) {
  258.                         log("[Reminder]Pls start at the fishing spots.");
  259.                         toBank = new RSTile[]{ new RSTile(3101,3432), new RSTile(3097,3438), new RSTile(3091,3444), new RSTile(3090,3455), new RSTile(3087,3463), new RSTile(3081,3467), new RSTile(3079,3476), new RSTile(3080,3483), new RSTile(3085,3488), new RSTile(3093,3490)};
  260.                         toArea = reversePath(toBank);
  261.                         usesNPCBanking = true;
  262.  
  263.  
  264.                         if (catchName.equals("Leaping")) {
  265.                                 currentGear = GEAR_HEAVYROD;
  266.                                 currentBait = BAIT_FEATHERS;
  267.                                 fishingSpotID = 2722;
  268.                                 currentCommand = "Use-rod";
  269.                                 bankID = 26972;
  270.                                 return true;
  271.                         }
  272.  
  273.                 }
  274.  
  275.                 // Barbarian Village locations:
  276.                 if (locationName.equals("Barb Village(EV)")) {
  277.                         log("Setting Mummyfied paths for Barbarian Village(EV).");
  278.                         log("[Reminder]Pls start in the bank or at the fishing spots.");
  279.                         toBank = new RSTile[]{ new RSTile(3101,3432), new RSTile(3097,3438), new RSTile(3091,3444), new RSTile(3090,3455), new RSTile(3087,3463), new RSTile(3081,3467), new RSTile(3079,3476), new RSTile(3080,3483), new RSTile(3085,3488), new RSTile(3092,3492)};
  280.                         toArea = reversePath(toBank);
  281.                         usesNPCBanking = true;
  282.  
  283.  
  284.                         if (catchName.equals("Pike")) {
  285.                                 currentGear = GEAR_ROD;
  286.                                 currentBait = BAIT_BAIT;
  287.                                 fishingSpotID = 328;
  288.                                 currentCommand = "Bait";
  289.                                 bankID = 26972;
  290.                                 return true;
  291.                         }
  292.  
  293.                         if (catchName.equals("Trout/Salmon")) {
  294.                                 currentGear = GEAR_FLYROD;
  295.                                 currentBait = BAIT_FEATHERS;
  296.                                 fishingSpotID = 328;
  297.                                 currentCommand = "Lure";
  298.                                 bankID = 26972;
  299.                                 return true;
  300.                         }
  301.  
  302.                         if (catchName.equals("Rainbow Fish")) {
  303.                                 currentGear = GEAR_FLYROD;
  304.                                 currentBait = BAIT_STRIPY;
  305.                                 fishingSpotID = 328;
  306.                                 currentCommand = "Lure";
  307.                                 bankID = 26972;
  308.                                 return true;
  309.                         }
  310.                 }
  311.  
  312.                 // Catherby locations:
  313.                 if (locationName.equals("Catherby")) {
  314.                         log("Setting Mummyfied paths for Catherby.");
  315.                         log("[Reminder]Pls start in the bank or at the fishing spots.");
  316.                         toBank = new RSTile[]{new RSTile(2852,3430), new RSTile(2839,3434), new RSTile(2830,3437), new RSTile(2820,3438), new RSTile(2809,3440)};
  317.                         toArea = reversePath(toBank);
  318.                         usesNPCBanking = true;
  319.  
  320.  
  321.                         if (catchName.equals("Bass/Cod/Mackerel")) {
  322.                                 currentGear = GEAR_BIGNET;
  323.                                 currentBait = BAIT_NONE;
  324.                                 fishingSpotID = 322;
  325.                                 currentCommand = "Net";
  326.                                 bankID = 2213;
  327.                                 return true;
  328.                         }
  329.  
  330.                         if (catchName.equals("Shrimp/Anchovies")) {
  331.                                 currentGear = GEAR_NET;
  332.                                 currentBait = BAIT_NONE;
  333.                                 fishingSpotID = 320;
  334.                                 currentCommand = "Net";
  335.                                 bankID = 2213;
  336.                                 return true;
  337.                         }
  338.  
  339.                         if (catchName.equals("Herring/Sardines")) {
  340.                                 currentGear = GEAR_ROD;
  341.                                 currentBait = BAIT_BAIT;
  342.                                 fishingSpotID = 320;
  343.                                 currentCommand = "Bait";
  344.                                 bankID = 2213;
  345.                                 return true;
  346.                         }
  347.  
  348.                         if (catchName.equals("Lobsters")) {
  349.                                 currentGear = GEAR_CAGE;
  350.                                 currentBait = BAIT_NONE;
  351.                                 fishingSpotID = 321;
  352.                                 currentCommand = "Cage";
  353.                                 bankID = 2213;
  354.                                 return true;
  355.                         }
  356.  
  357.                         if (catchName.equals("Tuna/Swordfish")) {
  358.                                 currentGear = GEAR_HARPOON;
  359.                                 currentBait = BAIT_NONE;
  360.                                 fishingSpotID = 321;
  361.                                 currentCommand = "Harpoon";
  362.                                 bankID = 2213;
  363.                                 return true;
  364.                         }
  365.  
  366.  
  367.                         if (catchName.equals("Tuna/Swordfish(CHARPOON")) {
  368.                                 currentGear = GEAR_CHARPOON;
  369.                                 currentBait = BAIT_NONE;
  370.                                 fishingSpotID = 321;
  371.                                 currentCommand = "Harpoon";
  372.                                 bankID = 2213;
  373.                                 return true;
  374.                         }
  375.  
  376.                         if (catchName.equals("Sharks")) {
  377.                                 currentGear = GEAR_HARPOON;
  378.                                 currentBait = BAIT_NONE;
  379.                                 fishingSpotID = 322;
  380.                                 currentCommand = "Harpoon";
  381.                                 bankID = 2213;
  382.                                 return true;
  383.                         }
  384.  
  385.  
  386.                         if (catchName.equals("Sharks(CHARPOON")) {
  387.                                 currentGear = GEAR_CHARPOON;
  388.                                 currentBait = BAIT_NONE;
  389.                                 fishingSpotID = 322;
  390.                                 currentCommand = "Harpoon";
  391.                                 bankID = 2213;
  392.                                 return true;
  393.                         }
  394.  
  395.                 }
  396.  
  397.  
  398.                 // Draynor locations.
  399.                 if (locationName.equals("Draynor")) {
  400.                         // Setup draynor paths.
  401.                         log("Setting Mummyfied paths for Draynor.");
  402.                         log("[Reminder]Pls start in the bank or at the fishing spots.");
  403.                         toBank = new RSTile[]{new RSTile(3086, 3232), new RSTile(3093, 3242)};
  404.                         toArea = reversePath(toBank);
  405.                         usesNPCBanking = true;
  406.  
  407.                         if (catchName.equals("Shrimp/Anchovies")) {
  408.                                 currentGear = GEAR_NET;
  409.                                 currentBait = BAIT_NONE;
  410.                                 fishingSpotID = 327;
  411.                                 currentCommand = "Net";
  412.                                 bankID = 2213;
  413.                                 return true;
  414.                         }
  415.  
  416.                         if (catchName.equals("Herring/Sardines")) {
  417.                                 currentGear = GEAR_ROD;
  418.                                 currentBait = BAIT_BAIT;
  419.                                 fishingSpotID = 327;
  420.                                 currentCommand = "Bait";
  421.                                 bankID = 2213;
  422.                                 return true;
  423.                         }
  424.                 }
  425.  
  426.                 if (locationName.equals("Fishing Guild")) {
  427.                         log("Setting Mummyfied paths for the Fishing Guild.");
  428.                         log("[Reminder]Pls start in the bank or at the fishing spots.");
  429.  
  430.                         toBank = new RSTile[]{new RSTile(2595, 3416), new RSTile(2586, 3422)};
  431.                         toArea = new RSTile[]{new RSTile(2597, 3420)};
  432.                         usesNPCBanking = true;
  433.  
  434.                         if (catchName.equals("Bass/Cod/Mackerel")) {
  435.                                 currentGear = GEAR_BIGNET;
  436.                                 currentBait = BAIT_NONE;
  437.                                 fishingSpotID = 313;
  438.                                 currentCommand = "Net";
  439.                                 bankID = 49018;
  440.                                 return true;
  441.                         }
  442.                         if (catchName.equals("Lobsters")) {
  443.                                 currentGear = GEAR_CAGE;
  444.                                 currentBait = BAIT_NONE;
  445.                                 fishingSpotID = 312;
  446.                                 currentCommand = "Cage";
  447.                                 bankID = 49018;
  448.                                 return true;
  449.                         }
  450.  
  451.                         if (catchName.equals("Tuna/Swordfish")) {
  452.                                 currentGear = GEAR_HARPOON;
  453.                                 currentBait = BAIT_NONE;
  454.                                 fishingSpotID = 312;
  455.                                 currentCommand = "Harpoon";
  456.                                 bankID = 49018;
  457.                                 return true;
  458.                         }
  459.  
  460.                         if (catchName.equals("Tuna/Swordfish(CHARPOON)")) {
  461.                                 currentGear = GEAR_CHARPOON;
  462.                                 currentBait = BAIT_NONE;
  463.                                 fishingSpotID = 312;
  464.                                 currentCommand = "Harpoon";
  465.                                 bankID = 49018;
  466.                                 return true;
  467.                         }
  468.                         if (catchName.equals("Sharks")) {
  469.                                 currentGear = GEAR_HARPOON;
  470.                                 currentBait = BAIT_NONE;
  471.                                 fishingSpotID = 313;
  472.                                 currentCommand = "Harpoon";
  473.                                 bankID = 49018;
  474.                                 return true;
  475.                         }
  476.  
  477.                         if (catchName.equals("Sharks(CHARPOON)")) {
  478.                                 currentGear = GEAR_CHARPOON;
  479.                                 currentBait = BAIT_NONE;
  480.                                 fishingSpotID = 313;
  481.                                 currentCommand = "Harpoon";
  482.                                 bankID = 49018;
  483.                                 return true;
  484.                         }
  485.                 }
  486.  
  487.  
  488.  
  489.                 if (locationName.equals("Karamja")) {
  490.                         log("Setting Mummyfied paths for Karamja");
  491.                         log("[Reminder]Pls start in the bank or at the fishing spots.");
  492.                         toBank = new RSTile[]{new RSTile(2925, 3177), new RSTile(2924, 3166), new RSTile(2929, 3152),
  493.                                         new RSTile(2942, 3146),
  494.  
  495.                                         /*new RSTile(2954, 3146), new RSTile(3032, 3217),*/
  496.  
  497.                                         new RSTile(3029, 3217), new RSTile(3027, 3222), new RSTile(3027, 3230),
  498.                                         new RSTile(3041, 3238), new RSTile(3051, 3246), new RSTile(3068, 3248),
  499.                                         new RSTile(3080, 3250), new RSTile(3092, 3243)};//PortSarim
  500.  
  501.  
  502.                         toArea = reversePath(toBank);
  503.                         toArea = reversePath(toBank);
  504.                         usesNPCBanking = true;
  505.  
  506.                         if (catchName.equals("Shrimp/Anchovies")) {
  507.                                 currentGear = GEAR_NET;
  508.                                 currentBait = BAIT_NONE;
  509.                                 fishingSpotID = 323;
  510.                                 currentCommand = "Net";
  511.                                 bankID = 495;
  512.                                 return true;
  513.                         }
  514.  
  515.                         if (catchName.equals("Herring/Sardines")) {
  516.                                 currentGear = GEAR_ROD;
  517.                                 currentBait = BAIT_BAIT;
  518.                                 fishingSpotID = 323;
  519.                                 currentCommand = "Bait";
  520.                                 bankID = 495;
  521.                                 return true;
  522.                         }
  523.  
  524.                         if (catchName.equals("Lobsters")) {
  525.                                 currentGear = GEAR_CAGE;
  526.                                 currentBait = BAIT_NONE;
  527.                                 fishingSpotID = 324;
  528.                                 currentCommand = "Cage";
  529.                                 bankID = 495;
  530.                                 return true;
  531.                         }
  532.  
  533.                         if (catchName.equals("Tuna/Swordfish")) {
  534.                                 currentGear = GEAR_HARPOON;
  535.                                 currentBait = BAIT_NONE;
  536.                                 fishingSpotID = 324;
  537.                                 currentCommand = "Harpoon";
  538.                                 bankID = 495;
  539.                                 return true;
  540.                         }
  541.  
  542.                 }
  543.  
  544.  
  545.                 if (locationName.equals("Shilo")) {
  546.                         log("Setting Mummyfied paths for Shilo.");
  547.                         log("[Reminder]Pls start in the bank or at the fishing spots.");
  548.                         toBank = new RSTile[]{new RSTile(2864, 2971),
  549.                                         new RSTile(2850, 2967), new RSTile(2852, 2953)};
  550.  
  551.                         toArea = reversePath(toBank);
  552.                         usesNPCBanking = true;
  553.  
  554.                         if (catchName.equals("Trout/Salmon")) {
  555.                                 currentGear = GEAR_FLYROD;
  556.                                 currentBait = BAIT_FEATHERS;
  557.                                 fishingSpotID = 317;
  558.                                 currentCommand = "Lure";
  559.                                 bankID = 499;
  560.                                 return true;
  561.                         }
  562.  
  563.                         if (catchName.equals("Pike")) {
  564.                                 currentGear = GEAR_ROD;
  565.                                 currentBait = BAIT_BAIT;
  566.                                 fishingSpotID = 317;
  567.                                 currentCommand = "Bait";
  568.                                 bankID = 499;
  569.                                 return true;
  570.                         }
  571.                 }
  572.  
  573.                 if (locationName.equals("Piscatoris")) {
  574.                         log("Setting Mummyfied paths for Piscatoris");
  575.                         log("[Reminder]Pls start in the bank or at the fishing spots.");
  576.                         toBank = new RSTile[]{new RSTile(2339, 3697), new RSTile(2322, 3696), new RSTile(2331, 3689)};
  577.                         toArea = new RSTile[]{new RSTile(2339, 3697)};
  578.                         usesNPCBanking = true;
  579.  
  580.                         if (catchName.equals("Monkfish")) {
  581.                                 currentGear = GEAR_NET;
  582.                                 currentBait = BAIT_NONE;
  583.                                 fishingSpotID = 3848;
  584.                                 currentCommand = "Net";
  585.                                 bankID = 3824;
  586.                                 return true;
  587.                         }
  588.  
  589.                         if (catchName.equals("Tuna/Swordfish")) {
  590.                                 currentGear = GEAR_HARPOON;
  591.                                 currentBait = BAIT_NONE;
  592.                                 fishingSpotID = 3848;
  593.                                 currentCommand = "Harpoon";
  594.                                 bankID = 3824;
  595.                                 return true;
  596.                         }
  597.                         if (catchName.equals("Tuna/Swordfish(BARB)")) {
  598.                                 currentGear = GEAR_NONE;
  599.                                 currentBait = BAIT_NONE;
  600.                                 fishingSpotID = 3848;
  601.                                 currentCommand = "Harpoon";
  602.                                 bankID = 3824;
  603.                                 return true;
  604.                         }
  605.                         if (catchName.equals("Tuna/Swordfish(CHARPOON)")) {
  606.                                 currentGear = GEAR_CHARPOON;
  607.                                 currentBait = BAIT_NONE;
  608.                                 fishingSpotID = 3848;
  609.                                 currentCommand = "Harpoon";
  610.                                 bankID = 3824;
  611.                                 return true;
  612.                         }
  613.  
  614.  
  615.                 }
  616.  
  617.                 log("Unable to start script: Invalid combination of parameters.");
  618.                 return false;
  619.         }
  620.  
  621.  
  622.         public void onFinish() {
  623.                 // Takes a screen shot when u stop the script.
  624.                 ScreenshotUtil.takeScreenshot(true);
  625.  
  626.                 // Remove listeners.
  627.                 Bot.getEventManager().removeListener(PaintListener.class, this);
  628.                 Bot.getEventManager().removeListener(ServerMessageListener.class, this);
  629.         }
  630.  
  631.  
  632.         final ScriptManifest props = getClass().getAnnotation(
  633.                         ScriptManifest.class);
  634.  
  635.         public void checkupdate() {
  636.                 double curV = getOVersion();
  637.                 if (curV > props.version()) {
  638.                         log.severe("Please update your ZombieFisher to v" + curV);
  639.                         return;
  640.                 } else {
  641.                         log("You've got latest ZombieFisher");
  642.                 }
  643.                 return;
  644.         }
  645.  
  646.         public void checkupdate2() {
  647.                 double curV = getOVersion();
  648.                 if (curV > props.version()) {
  649.                         log.severe("A new update was just released! Pls refer to the thread for more details.");
  650.                         beep(5);
  651.                         return;
  652.                 }
  653.                 return;
  654.         }
  655.  
  656.         //If the URL doesnt work, try this http://zombiebboi12.webs.com/Version
  657.         public static double getOVersion() {
  658.                 try {
  659.                         URL url = new URL("http://preview8.awardspace.com/zombiebboi12.co.cc/");
  660.                         BufferedReader br = new BufferedReader(new InputStreamReader(
  661.                                         new BufferedInputStream(url.openConnection().getInputStream())));
  662.                         double ver = Double.parseDouble(br.readLine().trim());
  663.                         br.close();
  664.                         return ver;
  665.                 } catch (IOException e) {
  666.                         throw new RuntimeException(e);
  667.                 }
  668.         }
  669.  
  670.         public void Reset() {
  671.                 StartedY = false;
  672.                 currentFails = 0;
  673.         }
  674.  
  675.         public void openURL(final String url) { // Credits to Dave who gave credits
  676.                 // to
  677.                 // some guy who made this.
  678.                 final String osName = System.getProperty("os.name");
  679.                 try {
  680.                         if (osName.startsWith("Mac OS")) {
  681.                                 final Class<?> fileMgr = Class
  682.                                                 .forName("com.apple.eio.FileManager");
  683.                                 final Method openURL = fileMgr.getDeclaredMethod("openURL",
  684.                                                 new Class[]{String.class});
  685.                                 openURL.invoke(null, new Object[]{url});
  686.                         } else if (osName.startsWith("Windows")) {
  687.                                 Runtime.getRuntime().exec(
  688.                                                 "rundll32 url.dll,FileProtocolHandler " + url);
  689.                         } else { // assume Unix or Linux
  690.                                 final String[] browsers = {"firefox", "opera", "konqueror",
  691.                                                 "epiphany", "mozilla", "netscape"};
  692.                                 String browser = null;
  693.                                 for (int count = 0; count < browsers.length && browser == null; count++) {
  694.                                         if (Runtime.getRuntime().exec(
  695.                                                         new String[]{"which", browsers[count]})
  696.                                                         .waitFor() == 0) {
  697.                                                 browser = browsers[count];
  698.                                         }
  699.                                 }
  700.                                 if (browser == null) {
  701.                                         throw new Exception("Could not find web browser");
  702.                                 } else {
  703.                                         Runtime.getRuntime().exec(new String[]{browser, url});
  704.                                 }
  705.                         }
  706.                 } catch (final Exception e) {
  707.                 }
  708.         }
  709.  
  710.  
  711.         public int loop() {
  712.  
  713.                 randomInt = random(1, 17);
  714.                 GambleInt = random(1, 17);
  715.                 if (GambleInt == 1) {
  716.                         turnCamera();
  717.                 }
  718.  
  719.                 if (!isLoggedIn() || isWelcomeButton() || !StartedY) {
  720.                         StartedY = true;
  721.                         wait(1000);
  722.                         return random(250, 500);
  723.                 }
  724.                 if (barbarianMode && currentGear != GEAR_NONE) {
  725.  
  726.  
  727.                 }
  728.                 if (barbarianMode && currentGear != GEAR_NONE) {
  729.  
  730.  
  731.                 }
  732.  
  733.                 if (currentFails >= 1000) {
  734.                         log.severe("The script failed 100 times, and will now stop as a failsafe.");
  735.                         ScreenshotUtil.takeScreenshot(isLoggedIn());
  736.                         if (checkForLogout()) stopScript();
  737.                 }
  738.  
  739.  
  740.                 switch (state) {
  741.                         case S_WALKTO_BANK:
  742.  
  743.                                if (zombieWalking)
  744.                                 return zombieWalkBank();
  745.                            else
  746.                                 return walkToBank();
  747.  
  748.                         case S_THROW_TUNAS:
  749.                                 return throwTunas();
  750.  
  751.                         case S_WALKTO_SPOT:
  752.  
  753.                                 if (zombieWalking)
  754.                                 return zombieWalkSpots();
  755.                            else
  756.                                 return walkToSpots();
  757.  
  758.                         case S_FISH:
  759.                                 if (antiTunas)
  760.                                         return stateTuna();
  761.                                 else
  762.                                         return stateFish();
  763.  
  764.                         case S_DROP_ALL:
  765.                                 return dropAll();
  766.  
  767.                         case S_USE_BANK:
  768.                                 if (usesNPCBanking)
  769.                                   if (locationName.equals("[STILES]Karamja"))
  770.                                         return tradeAllKaramja();
  771.                                 else if (locationName.equals("Piscatoris"))
  772.                                                 return useBankNPCPiscatoris();
  773.                                 else if (locationName.equals("Shilo"))
  774.                                                 return useBankNPCShilo();
  775.                                         else
  776.                                                 return useBank();
  777.                                 else
  778.                                                 return useBankNPC();
  779.  
  780.                         case S_DEPOSIT:
  781.                                
  782.                                  if (locationName.equals("Karamja"))
  783.                                         return depositAllKaramja();
  784.                                 else
  785.                                         return depositAllRest();
  786.  
  787.                         case S_WITHDRAW:
  788.                                 stopScript();
  789.                                 ScreenshotUtil.takeScreenshot(isLoggedIn());
  790.                 }
  791.  
  792.                 return random(500, 1000);
  793.         }
  794.  
  795.         int antiBan() {
  796.                 int GambleInt = random(1, 6);
  797.                 switch (GambleInt) {
  798.                         case 1:
  799.                                 wait(random(2000, 2500));
  800.                                 break;
  801.                         case 2:
  802.                                 if (random(1, 4) == 1) {
  803.                                         int x = random(0, 750);
  804.                                         int y = random(0, 500);
  805.                                         moveMouse(0, 0, x, y);
  806.  
  807.                                 }
  808.                                 return random(1300, 1600);
  809.                         case 3:
  810.                                 // Is the current tab the inventory?
  811.                                 if (getCurrentTab() != TAB_INVENTORY) {
  812.                                         // No, so switch to the inventory tab.
  813.                                         openTab(TAB_INVENTORY);
  814.                                         return random(500, 750);
  815.                                 } else {
  816.                                         // No, so return
  817.                                         return random(500, 750);
  818.                                 }
  819.                         case 4:
  820.                                 // If the player is moving, then abort.
  821.                                 if (getMyPlayer().isMoving()) {
  822.                                         return random(750, 1000);
  823.                                 }
  824.  
  825.                                 if (System.currentTimeMillis() - lastCheck >= checkTime) {
  826.                                         lastCheck = System.currentTimeMillis();
  827.                                         checkTime = random(60000, 180000);
  828.  
  829.                                         if (getCurrentTab() != Constants.TAB_STATS) {
  830.                                                 openTab(Constants.TAB_STATS);
  831.                                         }
  832.                                         moveMouse(693, 273, 28, 10);
  833.                                         return random(2000, 4000);
  834.                                 }
  835.  
  836.  
  837.                         case 5:
  838.                                 if (random(1, 8) == 2) {
  839.                                         int angle = getCameraAngle() + random(-90, 90);
  840.                                         if (angle < 0) {
  841.                                                 angle = 0;
  842.                                         }
  843.                                         if (angle > 359) {
  844.                                                 angle = 0;
  845.  
  846.                                         }
  847.                                         setCameraRotation(angle);
  848.                                 }
  849.                                 return random(500, 750);
  850.                 }
  851.                 return random(500, 1000);
  852.         }
  853.  
  854.         public int useShopNPCKaramja() {
  855.                 RSNPC Shopkeeper = getNearestNPCByID(shopID);
  856.  
  857.                 if (getMyPlayer().isMoving())
  858.                         return random(250, 500);
  859.  
  860.                 if (runningFromCombat) {
  861.                         state = S_WALKTO_SPOT;
  862.                         return random(500, 750);
  863.                 }
  864.  
  865.                 if (RSInterface.getInterface(620).isValid()) {
  866.                         state = S_DEPOSIT;
  867.                         return 500;
  868.                 }
  869.  
  870.                 if (Shopkeeper != null) {
  871.                         if (atNPC(Shopkeeper, "trade")) {
  872.                                 log("Accessed shop.");
  873.                                 state = S_DEPOSIT;
  874.                                 currentFails = 0;
  875.                                 return random(500, 1000);
  876.                         } else {
  877.                                 log("Misclicked shopkeeper, trying again.");
  878.                                 currentFails++;
  879.                                 return random(500, 750);
  880.                         }
  881.                 }
  882.                 return random(500, 1000);
  883.         }
  884.      
  885.         public int useBankNPCShilo() {
  886.                 RSNPC banker = getNearestNPCByID(bankID);
  887.  
  888.                 if (getMyPlayer().isMoving())
  889.                         return random(250, 500);
  890.  
  891.                 if (runningFromCombat) {
  892.                         state = S_WALKTO_SPOT;
  893.                         return random(500, 750);
  894.                 }
  895.  
  896.                 if (RSInterface.getInterface(INTERFACE_BANK).isValid()) {
  897.                         state = S_DEPOSIT;
  898.                         return 500;
  899.                 }
  900.  
  901.                 if (banker != null) {
  902.                         if (atNPC(banker, "bank banker")) {
  903.                                 log("Accessed bank account.");
  904.                                 state = S_DEPOSIT;
  905.                                 currentFails = 0;
  906.                                 return random(500, 1000);
  907.                         } else {
  908.                                 log("Misclicked bank, trying again.");
  909.                                 currentFails++;
  910.                                 return random(500, 750);
  911.                         }
  912.                 } else {
  913.                         log("Unable to find bankbooth");
  914.                         currentFails++;
  915.                         return random(500, 750);
  916.                 }
  917.  
  918.         }
  919.  
  920.  
  921.         public int useBankNPCPiscatoris() {
  922.                 RSNPC banker = getNearestNPCByID(bankID);
  923.  
  924.                 if (getMyPlayer().isMoving())
  925.                         return random(250, 500);
  926.  
  927.                 if (runningFromCombat) {
  928.                         state = S_WALKTO_SPOT;
  929.                         return random(500, 750);
  930.                 }
  931.  
  932.                 if (RSInterface.getInterface(INTERFACE_BANK).isValid()) {
  933.                         state = S_DEPOSIT;
  934.                         return 500;
  935.                 }
  936.  
  937.                 if (banker != null) {
  938.                         if (atNPC(banker, "bank")) {
  939.                                 log("Accessed bank account.");
  940.                                 state = S_DEPOSIT;
  941.                                 currentFails = 0;
  942.                                 return random(500, 1000);
  943.                         } else {
  944.                                 log("Misclicked bank, trying again.");
  945.                                 currentFails++;
  946.                                 return random(500, 750);
  947.                         }
  948.                 } else {
  949.                         log("Unable to find bankbooth");
  950.                         currentFails++;
  951.                         return random(500, 750);
  952.                 }
  953.  
  954.         }
  955.  
  956.         public int useBankNPC() {
  957.                 RSNPC banker = getNearestNPCByID(bankID);
  958.  
  959.                 if (getMyPlayer().isMoving())
  960.                         return random(250, 500);
  961.  
  962.                 if (runningFromCombat) {
  963.                         state = S_WALKTO_SPOT;
  964.                         return random(500, 750);
  965.                 }
  966.  
  967.                 if (RSInterface.getInterface(INTERFACE_BANK).isValid()) {
  968.                         state = S_DEPOSIT;
  969.                         return 500;
  970.                 }
  971.  
  972.                 if (banker != null) {
  973.                         if (atNPC(banker, "bank banker")) {
  974.                                 log("Accessed bank account.");
  975.                                 state = S_DEPOSIT;
  976.                                 currentFails = 0;
  977.                                 return random(500, 1000);
  978.                         } else {
  979.                                 log("Misclicked bank, trying again.");
  980.                                 currentFails++;
  981.                                 return random(500, 750);
  982.                         }
  983.                 } else {
  984.                         log("Unable to find bankbooth");
  985.                         currentFails++;
  986.                         return random(500, 750);
  987.                 }
  988.  
  989.         }
  990.  
  991.         @SuppressWarnings("deprecation")
  992.         public int useBank() {
  993.                 RSObject bankBooth = findObject(bankID);
  994.  
  995.                 if (getMyPlayer().isMoving())
  996.                         return random(250, 500);
  997.  
  998.                 if (runningFromCombat) {
  999.                         state = S_WALKTO_SPOT;
  1000.                         return random(500, 750);
  1001.                 }
  1002.  
  1003.                 if (RSInterface.getInterface(INTERFACE_BANK).isValid()) {
  1004.                         state = S_DEPOSIT;
  1005.                         return 500;
  1006.                 }
  1007.  
  1008.                 if (bankBooth != null) {
  1009.                         turnToObject(bankBooth, 40);
  1010.                         if (atObject(bankBooth, "Use-quickly")) {
  1011.                                 log("Accessed bank account.");
  1012.                                 state = S_DEPOSIT;
  1013.                                 currentFails = 0;
  1014.                                 return random(500, 1000);
  1015.                         } else {
  1016.                                 setCameraRotation(getCameraAngle() + random(-90, 90));
  1017.                                 log("Misclicked bank, trying again.");
  1018.                                 currentFails++;
  1019.                                 return random(500, 750);
  1020.                         }
  1021.                 } else {
  1022.                         log("Unable to find bankbooth");
  1023.                         currentFails++;
  1024.                         return random(500, 750);
  1025.                 }
  1026.         }
  1027.  
  1028.         public int walkToSpots() {
  1029.                 if (takeBoatToKaramja())
  1030.                         return random(2000, 2500);
  1031.  
  1032.                 if (randomRunEnergy <= getEnergy() && !isRunning()) {
  1033.                         setRun(true);
  1034.                         randomRunEnergy = random(20, 60);
  1035.                         return random(750, 1000);
  1036.                 }
  1037.  
  1038.                 if (distanceTo(toArea[toArea.length - 1]) <= 3) {
  1039.                         log("Arriving at fishing spots, continuing to fish.");
  1040.                         state = S_FISH;
  1041.                         currentFails = 0;
  1042.                         return random(250, 750);
  1043.                 }
  1044.                
  1045.  
  1046.                 if (!getMyPlayer().isMoving() || (getDestination() != null && distanceTo(getDestination()) < 10))
  1047.                         walkPathMM(randomizePath(toArea, 2, 2), 15);
  1048.                 return random(50, 150);
  1049.         }
  1050.                
  1051.  
  1052.         public int walkToBank() {
  1053.                 if (takeBoatFromKaramja())
  1054.                         return random(2000, 2500);
  1055.  
  1056.                 // TODO: bug fix.
  1057.                 /*if ( distanceTo(new RSTile(2953, 3147)) <= 4 )
  1058.                                         return random(250, 500);*/
  1059.  
  1060.                 if (randomRunEnergy <= getEnergy() && !isRunning()) {
  1061.                         setRun(true);
  1062.                         randomRunEnergy = random(20, 60);
  1063.                         return random(750, 1000);
  1064.                 }
  1065.  
  1066.                 if (runningFromCombat && !getMyPlayer().isInCombat()) {
  1067.                         log("No longer in combat, heading back to fishing spots.");
  1068.                         state = S_WALKTO_SPOT;
  1069.                         runningFromCombat = false;
  1070.                         return random(250, 750);
  1071.                 }
  1072.  
  1073.                 if (distanceTo(toBank[toBank.length - 1]) <= 4) {
  1074.  
  1075.                         log("Arriving at bank, Accessing account.");
  1076.                         state = S_USE_BANK;
  1077.                         return random(750, 1500);
  1078.                 }
  1079.  
  1080.                 if (!getMyPlayer().isMoving() || (getDestination() != null && distanceTo(getDestination()) < 10))
  1081.                         walkPathMM(randomizePath(toBank, 2, 2), 15);
  1082.  
  1083.                 return random(50, 150);
  1084.         }
  1085.          
  1086.         public int zombieWalkSpots() {
  1087.                 if (takeBoatToKaramja())
  1088.                         return random(2000, 2500);
  1089.  
  1090.                 if (randomRunEnergy <= getEnergy() && !isRunning()) {
  1091.                         setRun(true);
  1092.                         randomRunEnergy = random(20, 60);
  1093.                         return random(750, 1000);
  1094.                 }
  1095.  
  1096.                 if (distanceTo(toArea[toArea.length - 1]) <= 3) {
  1097.                         log("Arriving at fishing spots, continuing to fish.");
  1098.                         state = S_FISH;
  1099.                         currentFails = 0;
  1100.                         return random(250, 750);
  1101.                 }
  1102.  
  1103.               if (!getMyPlayer().isMoving() || (getDestination() != null && distanceTo(getDestination()) > 4))
  1104.                         walkPathMM(randomizePath(toArea, 2, 2), 15);
  1105.  
  1106.                 return random(50, 150);
  1107.         }
  1108.            
  1109.         public int zombieWalkBank() {
  1110.                 if (takeBoatFromKaramja())
  1111.                         return random(2000, 2500);
  1112.  
  1113.                 // TODO: bug fix.
  1114.                 /*if ( distanceTo(new RSTile(2953, 3147)) <= 4 )
  1115.                                         return random(250, 500);*/
  1116.  
  1117.                 if (randomRunEnergy <= getEnergy() && !isRunning()) {
  1118.                         setRun(true);
  1119.                         randomRunEnergy = random(20, 60);
  1120.                         return random(750, 1000);
  1121.                 }
  1122.  
  1123.                 if (runningFromCombat && !getMyPlayer().isInCombat()) {
  1124.                         log("No longer in combat, heading back to fishing spots.");
  1125.                         state = S_WALKTO_SPOT;
  1126.                         runningFromCombat = false;
  1127.                         return random(250, 750);
  1128.                 }
  1129.  
  1130.                 if (distanceTo(toBank[toBank.length - 1]) <= 4) {
  1131.  
  1132.                         log("Arriving at bank, Accessing account.");
  1133.                         state = S_USE_BANK;
  1134.                         return random(750, 1500);
  1135.                 }
  1136.  
  1137.             if (!getMyPlayer().isMoving() || (getDestination() != null && distanceTo(getDestination()) > 4))
  1138.                         walkPathMM(randomizePath(toBank, 2, 2), 15);
  1139.  
  1140.                 return random(50, 150);
  1141.         }
  1142.  
  1143.         public int dropAll() {
  1144.                 // Make an array of items to keep.
  1145.                 int[] thingsToKeep = new int[]{currentGear, currentBait, 995};
  1146.  
  1147.                 // Drop all, twice to make sure nothing is missed.
  1148.                 dropAllExcept(thingsToKeep);
  1149.                 dropAllExcept(thingsToKeep);
  1150.                 dropAllExcept(thingsToKeep);
  1151.                 dropAllExcept(thingsToKeep);
  1152.  
  1153.                 state = S_FISH;
  1154.  
  1155.                 return random(500, 750);
  1156.         }
  1157.  
  1158.         public int throwTunas() {
  1159.                 // Make an array of items to keep.
  1160.                 int[] thingsToKeep = new int[]{currentGear, currentBait, 995, 331, 335, 317, 321, 377, 371, 383, 14664, 7944, 363, 341, 353, 327, 345, 349};
  1161.  
  1162.                 // Drop all, twice to make sure nothing is missed.
  1163.                 dropAllExcept(thingsToKeep);
  1164.                 dropAllExcept(thingsToKeep);
  1165.                 dropAllExcept(thingsToKeep);
  1166.                 dropAllExcept(thingsToKeep);
  1167.  
  1168.                 state = S_FISH;
  1169.  
  1170.                 return random(500, 750);
  1171.         }
  1172.  
  1173.         public int tradeAllKaramja() {
  1174.                RSNPC stiles = getNearestNPCByID(11267);
  1175.                RSNPC fishingSpot = getNearestNPCByID(fishingSpotID);
  1176.  
  1177.                 if (getMyPlayer().isMoving())
  1178.                         return random(250, 500);
  1179.  
  1180.                 if (runningFromCombat) {
  1181.                         state = S_WALKTO_SPOT;
  1182.                         return random(500, 750);
  1183.                 }
  1184.  
  1185.  
  1186.                 if (stiles != null) {
  1187.                         if (atNPC(stiles, "exchange")) {
  1188.                                 wait(random(500, 2500));
  1189.                                 log("Clicked Stiles.");
  1190.                                 state = S_WALKTO_SPOT;
  1191.              
  1192.                               if (distanceTo(toArea[toArea.length - 1]) <= 3) {
  1193.                         log("Arriving at fishing spots, continuing to fish.");
  1194.                         state = S_FISH;
  1195.                         currentFails = 0;
  1196.                         return random(250, 750);
  1197.                 }
  1198.                                 currentFails = 0;
  1199.                                 return random(500, 1000);
  1200.                         } else {
  1201.                                 log("Misclicked stiles, trying again.");
  1202.                                 currentFails++;
  1203.                                 return random(500, 750);
  1204.                         }
  1205.                 } else {
  1206.                         log("Unable to find stiles");
  1207.                         currentFails++;
  1208.                         return random(500, 750);
  1209.                 }
  1210.  
  1211.         }
  1212.  
  1213.  
  1214.         public int depositAllKaramja() {
  1215.  
  1216.                 // Make an array of items to keep.
  1217.                 int[] thingsToKeep = new int[]{currentGear, currentBait, 995};
  1218.  
  1219.                 if (!RSInterface.getInterface(INTERFACE_BANK).isValid()) {
  1220.                         state = S_USE_BANK;
  1221.                         return 500;
  1222.                 }
  1223.                 // Deposit all.
  1224.                 bank.depositAllExcept(thingsToKeep);
  1225.  
  1226.                 // Only switch states if thet deposit was successfull.
  1227.                 if (!isInventoryFull())
  1228.                         state = S_WALKTO_SPOT;
  1229.                 else
  1230.                         state = S_USE_BANK;
  1231.  
  1232.                 return random(500, 750);
  1233.         }
  1234.  
  1235.         public int depositAllRest() {
  1236.  
  1237.                 // Make an array of items to keep.
  1238.                 int[] thingsToKeep = new int[]{currentGear, currentBait};
  1239.  
  1240.                 if (!RSInterface.getInterface(INTERFACE_BANK).isValid()) {
  1241.                         state = S_USE_BANK;
  1242.                         return 500;
  1243.                 }
  1244.                 // Deposit all.
  1245.                 bank.depositAllExcept(thingsToKeep);
  1246.  
  1247.                 // Only switch states if thet deposit was successfull.
  1248.                 if (!isInventoryFull())
  1249.                         state = S_WALKTO_SPOT;
  1250.                 else
  1251.                         state = S_USE_BANK;
  1252.  
  1253.                 return random(500, 750);
  1254.         }
  1255.  
  1256.         public int stateFish() {
  1257.                 // Find fishing spot.
  1258.                 RSNPC fishingSpot = getNearestNPCByID(fishingSpotID);
  1259.                 //
  1260.                 if (currentBait != BAIT_NONE && getInventoryCount(currentBait) == 0) {
  1261.                         log.severe("No bait for current mode.");
  1262.                         log.severe("Please buy your feathers for the lowest price in the Grand Exchange.");
  1263.                         log.severe("I thank you for doing that, the current price for feathers is too high.");
  1264.                         log.severe("So, please help us out in the quest of bringing it down.");
  1265.  
  1266.                         currentFails += 5;
  1267.                         return random(250, 500);
  1268.                 }
  1269.  
  1270.                 //
  1271.                 if (checkAndRecoverGear())
  1272.                         return random(1000, 1500);
  1273.  
  1274.                 if (currentGear != GEAR_NONE && getInventoryCount(currentGear) == 0 && !barbarianMode) {
  1275.                         log("No gear for the current mode.");
  1276.                         currentFails += 5;
  1277.                         return random(250, 500);
  1278.                 }
  1279.  
  1280.                 // Is the player currently in combat?
  1281.                 if (getMyPlayer().isInCombat()) {
  1282.                         log("Running from combat.");
  1283.                         runningFromCombat = true;
  1284.                         state = S_WALKTO_BANK;
  1285.                         timesAvoidedCombat++;
  1286.                         return random(250, 500);
  1287.                 }
  1288.  
  1289.                 // Is the player's inventory full?
  1290.                 if (isInventoryFull()) {
  1291.                         openTab(TAB_INVENTORY);
  1292.                         log("The inventory is full, " + (powerFishing == true ? "dropping all catches." : "heading to the bank."));
  1293.                         state = (powerFishing == true) ? S_DROP_ALL : S_WALKTO_BANK;
  1294.                         return random(250, 500);
  1295.  
  1296.                 }
  1297.  
  1298.  
  1299.                 // Is the player current busy? If so, do antiban.
  1300.                 if (getMyPlayer().getAnimation() != -1 && !checkAndAvoidWhirlpools()
  1301.                                 || getMyPlayer().isMoving())
  1302.                         return antiBan();
  1303.  
  1304.  
  1305.                 if (fishingSpot == null) {
  1306.                         if (checkLostAndRecover())
  1307.                                 return random(500, 750);
  1308.                         if (distanceTo(toBank[toBank.length - 1]) <= 3) {
  1309.                                 state = S_WALKTO_SPOT;
  1310.                                 return random(750, 1500);
  1311.                         }
  1312.  
  1313.                         currentFails++;
  1314.                         log("Unable to find fishing spot.");
  1315.                         return random(250, 500);
  1316.                 } else {
  1317.                         if (tileOnScreen(fishingSpot.getLocation())) {
  1318.                                 if (!atNPC(fishingSpot, currentCommand)) setCameraRotation(random(1, 359));
  1319.                                 currentFails = 0;
  1320.                                 return random(2150, 2350);
  1321.                         } else {
  1322.                                 RSTile destination = randomizeTile(fishingSpot.getLocation(), 2, 2);
  1323.                                 walkTileMM(destination);
  1324.                                 return random(500, 1000);
  1325.                         }
  1326.                 }
  1327.         }
  1328.  
  1329.         public int stateTuna() {
  1330. // Find fishing spot.
  1331.                 RSNPC fishingSpot = getNearestNPCByID(fishingSpotID);
  1332.                 //
  1333.                 if (currentBait != BAIT_NONE && getInventoryCount(currentBait) == 0) {
  1334.                         log("No bait for current mode.");
  1335.                         log.severe("Please buy your feathers for the lowest price in the Grand Exchange.");
  1336.                         log.severe("I thank you for doing that, the current price for feathers is too high.");
  1337.                         log.severe("So, please help us out in the quest of bringing it down.");
  1338.  
  1339.                         currentFails += 5;
  1340.                         return random(250, 500);
  1341.                 }
  1342.  
  1343.                 //
  1344.                 if (checkAndRecoverGear())
  1345.                         return random(1000, 1500);
  1346.  
  1347.                 if (currentGear != GEAR_NONE && getInventoryCount(currentGear) == 0 && !barbarianMode) {
  1348.                         log("No gear for the current mode.");
  1349.                         currentFails += 5;
  1350.                         return random(250, 500);
  1351.                 }
  1352.  
  1353.                 // Is the player currently in combat?
  1354.                 if (getMyPlayer().isInCombat()) {
  1355.                         log("Running from combat.");
  1356.                         runningFromCombat = true;
  1357.                         state = S_WALKTO_BANK;
  1358.                         timesAvoidedCombat++;
  1359.                         return random(250, 500);
  1360.                 }
  1361.  
  1362.                 // Is the player's inventory full?
  1363.  
  1364.                 // Is the player's inventory full?
  1365.                 if (!isInventoryFull()) {
  1366.                         state = S_THROW_TUNAS;
  1367.                 } else {
  1368.                         state = S_WALKTO_BANK;
  1369.                         log("The inventory is full, dropping all Tunas.");
  1370.                         return random(250, 500);
  1371.                 }
  1372.  
  1373.  
  1374.                 // Is the player current busy? If so, do antiban.
  1375.                 if (getMyPlayer().getAnimation() != -1 && !checkAndAvoidWhirlpools()
  1376.                                 || getMyPlayer().isMoving())
  1377.                         return antiBan();
  1378.  
  1379.  
  1380.                 if (fishingSpot == null) {
  1381.                         if (checkLostAndRecover())
  1382.                                 return random(500, 750);
  1383.                         if (distanceTo(toBank[toBank.length - 1]) <= 3) {
  1384.                                 state = S_WALKTO_SPOT;
  1385.                                 return random(750, 1500);
  1386.                         }
  1387.  
  1388.                         currentFails++;
  1389.                         log("Unable to find fishing spot.");
  1390.                         return random(250, 500);
  1391.                 } else {
  1392.                         if (tileOnScreen(fishingSpot.getLocation())) {
  1393.                                 if (!atNPC(fishingSpot, currentCommand)) setCameraRotation(random(1, 359));
  1394.                                 currentFails = 0;
  1395.                                 return random(1500, 1700);
  1396.                         } else {
  1397.                                 RSTile destination = randomizeTile(fishingSpot.getLocation(), 2, 2);
  1398.                                 walkTileMM(destination);
  1399.                                 return random(500, 1000);
  1400.                         }
  1401.                 }
  1402.         }
  1403.  
  1404.  
  1405.         @SuppressWarnings("deprecation")
  1406.         public boolean hasEquipped(int GEAR_BARB) {
  1407.                 int[] equipItems = RSInterface.getInterface(387).getChild(29)
  1408.                                 .getInventory();
  1409.                 for (int j = 0; j < itemIDs.length; j++) {
  1410.                         for (int i = 0; i < equipItems.length; i++)
  1411.                                 if (i == j)
  1412.                                         return true;
  1413.                 }
  1414.                 return false;
  1415.         }
  1416.  
  1417.  
  1418.         public boolean checkAndAvoidWhirlpools() {
  1419.                 RSTile playerLocation = getMyPlayer().getLocation();
  1420.                 RSTile tileToTest1 = new RSTile(playerLocation.getX() + 1, playerLocation.getY());
  1421.                 RSTile tileToTest2 = new RSTile(playerLocation.getX() - 1, playerLocation.getY());
  1422.                 RSTile tileToTest3 = new RSTile(playerLocation.getX(), playerLocation.getY() + 1);
  1423.                 RSTile tileToTest4 = new RSTile(playerLocation.getX(), playerLocation.getY() - 1);
  1424.  
  1425.                 for (int id : whirlpools) {
  1426.                         RSNPC whirlpool = getNearestNPCByID(id);
  1427.  
  1428.                         if (whirlpool == null) continue;
  1429.  
  1430.                         if (whirlpool.getLocation().equals(tileToTest1) || whirlpool.getLocation().equals(tileToTest2) ||
  1431.                                         whirlpool.getLocation().equals(tileToTest3) || whirlpool.getLocation().equals(tileToTest4)) {
  1432.                                 whirlpoolsAvoided++;
  1433.                                 log("Found whirlpool");
  1434.                                 return true;
  1435.                         }
  1436.                 }
  1437.  
  1438.                 return false;
  1439.         }
  1440.  
  1441.  
  1442.         public boolean checkLostAndRecover() {
  1443.                 int index = 0;
  1444.                 for (RSTile lost : lostTiles) {
  1445.                         if (distanceTo(lost) <= 2) {
  1446.                                 RSTile destination = randomizeTile(recoverTiles[index], 2, 2);
  1447.                                 log("Lost at " + lost.getX() + ", " + lost.getY() + ", recovering.");
  1448.                                 walkTileMM(destination);
  1449.                                 return true;
  1450.                         }
  1451.  
  1452.                         index++;
  1453.                 }
  1454.  
  1455.                 return false;
  1456.  
  1457.         }
  1458.  
  1459.  
  1460.         public boolean checkAndRecoverGear() {
  1461.                 RSItemTile itemTile = getGroundItemByID(currentGear);
  1462.  
  1463.                 if (barbarianMode) return false;
  1464.  
  1465.                 if (getInventoryCount(currentGear) == 0 && itemTile != null) {
  1466.                         if (tileOnScreen(itemTile)) {
  1467.                                 timesRecoveredGear++;
  1468.                                 log("Recovered gear.");
  1469.                                 atTile(itemTile, "Take");
  1470.                                 return true;
  1471.                         } else {
  1472.                                 log("Walking to gear location.");
  1473.                                 walkTileMM(itemTile);
  1474.                                 return true;
  1475.                         }
  1476.                 } else {
  1477.                         return false;
  1478.                 }
  1479.         }
  1480.  
  1481.  
  1482.         @SuppressWarnings("deprecation")
  1483.         public boolean takeBoatFromKaramja() {
  1484.                 RSNPC customsOfficer = getNearestNPCByID(380);
  1485.                 @SuppressWarnings("unused")
  1486.                 RSObject plank = findObject(242);
  1487.                 RSTile location = new RSTile(3031, 3217);
  1488.  
  1489.  
  1490.                 if (!locationName.equals("Karamja"))
  1491.                         return false;
  1492.  
  1493.                 if (getInventoryCount(995) < 30) {
  1494.                         log("Not enough GP for a boat ride.");
  1495.                 }
  1496.  
  1497.                 if (distanceTo(location) <= 20 && !getMyPlayer().getLocation().equals(new RSTile(3029, 3217))) {
  1498.                         if (tileOnScreen(location)) {
  1499.                                 atTile(location, "Cross");
  1500.                                 log("Arriving at Port Sarim.");
  1501.                                 return true;
  1502.                         }
  1503.  
  1504.  
  1505.                 }
  1506.  
  1507.                 if (RSInterface.getInterface(228).isValid()) {
  1508.                         atInterface(RSInterface.getInterface(228).getChild(2));
  1509.                         return true;
  1510.                 }
  1511.                 if (RSInterface.getInterface(242).isValid()) {
  1512.                         atInterface(RSInterface.getInterface(242).getChild(6));
  1513.                         return true;
  1514.                 }
  1515.  
  1516.                 if (RSInterface.getInterface(230).isValid()) {
  1517.                         atInterface(RSInterface.getInterface(230).getChild(3));
  1518.                         return true;
  1519.                 }
  1520.  
  1521.                 if (RSInterface.getInterface(241).isValid()) {
  1522.                         atInterface(RSInterface.getInterface(241).getChild(5));
  1523.                         return true;
  1524.                 }
  1525.  
  1526.                 if (RSInterface.getInterface(64).isValid()) {
  1527.                         atInterface(RSInterface.getInterface(64).getChild(5));
  1528.                         return true;
  1529.                 }
  1530.  
  1531.                 if (RSInterface.getInterface(228).isValid()) {
  1532.                         atInterface(RSInterface.getInterface(228).getChild(2));
  1533.                         return false;
  1534.                 }
  1535.  
  1536.                 if (RSInterface.getInterface(241).isValid()) {
  1537.                         atInterface(RSInterface.getInterface(241).getChild(5));
  1538.                         return false;
  1539.                 }
  1540.  
  1541.                 if (customsOfficer != null) {
  1542.                         if (tileOnScreen(customsOfficer.getLocation())) {
  1543.                                 atNPC(customsOfficer, "Pay-Fare");
  1544.                                 return true;
  1545.                         } else {
  1546.                                 walkTileMM(randomizeTile(customsOfficer.getLocation(), 2, 2));
  1547.                                 return true;
  1548.                         }
  1549.  
  1550.                 }
  1551.  
  1552.                 return false;
  1553.         }
  1554.  
  1555.         @SuppressWarnings("deprecation")
  1556.         public boolean takeBoatToKaramja() {
  1557.                 int[] seamanIDs = new int[]{376, 377, 378}; // Pay-fare
  1558.                 RSNPC seaman = getNearestNPCByID(seamanIDs);
  1559.                 RSObject plank = findObject(2082);
  1560.  
  1561.                 if (!locationName.equals("Karamja"))
  1562.                         return false;
  1563.  
  1564.                 if (getInventoryCount(995) < 30) {
  1565.                         log("Not enough GP for a boat ride.");
  1566.                 }
  1567.  
  1568.                 if (plank != null) {
  1569.                         log("Arriving at Karamja.");
  1570.                         atObject(plank, "Cross");
  1571.                         return true;
  1572.                 }
  1573.  
  1574.                 if (RSInterface.getInterface(64).isValid()) {
  1575.                         atInterface(RSInterface.getInterface(64).getChild(5));
  1576.                         return true;
  1577.                 }
  1578.  
  1579.                 if (RSInterface.getInterface(228).isValid()) {
  1580.                         atInterface(RSInterface.getInterface(228).getChild(2));
  1581.                         return true;
  1582.                 }
  1583.  
  1584.                 if (RSInterface.getInterface(241).isValid()) {
  1585.                         atInterface(RSInterface.getInterface(241).getChild(5));
  1586.                         return true;
  1587.                 }
  1588.                 if (seaman != null) {
  1589.                         if (tileOnScreen(seaman.getLocation())) {
  1590.                                 atNPC(seaman, "Pay-fare");
  1591.                                 return true;
  1592.                         } else {
  1593.                                 walkTileMM(randomizeTile(seaman.getLocation(), 2, 2));
  1594.                                 return true;
  1595.                         }
  1596.                 }
  1597.  
  1598.                 return false;
  1599.         }
  1600.  
  1601.         public boolean checkForLogout() {
  1602.                 for (int failed = 0; failed < 3; failed++) {
  1603.                         logout();
  1604.                         beep(3);
  1605.                         wait(500);
  1606.                         if (!isLoggedIn()) {
  1607.                                 return true;
  1608.                         }
  1609.                 }
  1610.                 return false;
  1611.         }
  1612.  
  1613.  
  1614.         public void onRepaint(Graphics g) {
  1615.  
  1616.                 long runTime = 0;
  1617.                 long seconds = 0;
  1618.                 long minutes = 0;
  1619.                 long hours = 0;
  1620.                 int index = Skills.getStatIndex("Fishing");
  1621.                 @SuppressWarnings("unused")
  1622.                 long untilhour = 0, untilmin = 0, untilsec = 0;
  1623.                 int exp = 0;
  1624.                 int expGained = 0;
  1625.                 int levelsGained;
  1626.  
  1627.                 //
  1628.                 if (lastExp == 0)
  1629.                         lastExp = skills.getCurrentSkillExp(STAT_FISHING);
  1630.  
  1631.                 if (skills.getCurrentSkillExp(STAT_FISHING) > lastExp) {
  1632.                         lastExp = skills.getCurrentSkillExp(STAT_FISHING);
  1633.                         numberOfCatches++;
  1634.                 }
  1635.  
  1636.                 if (countToNext == 0) {
  1637.                         untilsec = 0;
  1638.                         untilhour = 0;
  1639.                         untilmin = 0;
  1640.                 }
  1641.  
  1642.                 // Return if paint is disabled.
  1643.                 if (!usePaint) return;
  1644.  
  1645.                 //
  1646.                 if (playerStartXP == 0)
  1647.                         playerStartXP = skills.getCurrentSkillExp(STAT_FISHING);
  1648.  
  1649.                 if (startLevel == 0)
  1650.                         startLevel = skills.getCurrentSkillLevel(STAT_FISHING);
  1651.  
  1652.                 // Calculate current runtime.
  1653.                 runTime = System.currentTimeMillis() - scriptStartTime;
  1654.                 seconds = runTime / 1000;
  1655.                 if (seconds >= 60) {
  1656.                         minutes = seconds / 60;
  1657.                         seconds -= (minutes * 60);
  1658.                 }
  1659.                 if (minutes >= 60) {
  1660.                         hours = minutes / 60;
  1661.                         minutes -= (hours * 60);
  1662.                 }
  1663.                 exp = skills.getCurrentSkillExp(index) - startExp;
  1664.                 if (exp > oldExp) {
  1665.                         xpPerCatch = exp - oldExp;
  1666.                         oldExp = exp;
  1667.                         catches++;
  1668.                         countToNext = skills.getXPToNextLevel(STAT_FISHING) / xpPerCatch
  1669.                                         + 1;
  1670.                 }
  1671.  
  1672.  
  1673.                 // Calculate experience gained.
  1674.                 expGained = skills.getCurrentSkillExp(STAT_FISHING) - playerStartXP;
  1675.                 if (pColor.equals("SunKist")) {
  1676.                         g.setColor(new Color(253, 196, 0, 100));
  1677.                 }
  1678.                 if (pColor.equals("PinkPanther")) {
  1679.                         g.setColor(new Color(255, 100, 255, 53));
  1680.                 }
  1681.                 if (pColor.equals("ClearSky")) {
  1682.                         g.setColor(new Color(60, 155, 159, 50));
  1683.                 }
  1684.                 if (pColor.equals("Monochrome")) {
  1685.                         g.setColor(new Color(0, 0, 0, 175));
  1686.                 }
  1687.                 if (pColor.equals("BloodShed")) {
  1688.                         g.setColor(new Color(255, 0, 0, 50));
  1689.                 }
  1690.                 if (pColor.equals("Nightmare")) {
  1691.                         g.setColor(new Color(0, 0, 0, 175));
  1692.                 }
  1693.  
  1694.                 int[][] paint = new int[][]{new int[]{136, 152, 168, 184, 200, 216, 232, 248, 264, 280, 296, 312, 328}, new int[]{152, 186}};
  1695.                 if (barbarianMode) {
  1696.                         paint[1][0] -= 16;
  1697.                         paint[1][1] += 16;
  1698.                 }
  1699.                 if (powerFishing) {
  1700.                         paint[1][0] -= 16;
  1701.                         paint[1][1] += 16;
  1702.                 }
  1703.                 g.fillRoundRect(4, paint[1][0], 200, paint[1][1], 45, 45);
  1704.  
  1705.                 // Calculate levels gained
  1706.                 levelsGained = skills.getCurrentSkillLevel(STAT_FISHING) - startLevel;
  1707.                 if (pColor.equals("SunKist")) {
  1708.                         g.setColor(Color.WHITE);
  1709.                 }
  1710.                 if (pColor.equals("PinkPanther")) {
  1711.                         g.setColor(Color.BLACK);
  1712.                 }
  1713.                 if (pColor.equals("ClearSky")) {
  1714.                         g.setColor(Color.BLACK);
  1715.                 }
  1716.                 if (pColor.equals("Monochrome")) {
  1717.                         g.setColor(Color.WHITE);
  1718.                 }
  1719.                 if (pColor.equals("BloodShed")) {
  1720.                         g.setColor(Color.BLACK);
  1721.                 }
  1722.                 if (pColor.equals("Nightmare")) {
  1723.                         g.setColor(Color.GREEN);
  1724.                 }
  1725.                 final ScriptManifest props = getClass().getAnnotation(
  1726.                                 ScriptManifest.class);
  1727.                 if (barbarianMode || powerFishing) {
  1728.                         if (powerFishing && !barbarianMode) {
  1729.                                 g.drawString(props.name() + " v" + props.version(), 12, paint[0][1]);
  1730.                                 g.drawString("Fishing location: " + locationName, 12, paint[0][2]);
  1731.                                 g.drawString("Fishing for: " + catchName, 12, paint[0][3]);
  1732.                                 g.drawString("Powerfishing Mode Active", 12, paint[0][4]);
  1733.                                 g.drawString("Run time: " + hours + ":" + minutes + ":" + seconds, 12, paint[0][5]);
  1734.                                 g.drawString("Catches: " + numberOfCatches, 12, paint[0][6]);
  1735.                                 g.drawString("Catches to next level: " + countToNext, 12, paint[0][7]);
  1736.                                 g.drawString("XP Gained: " + expGained, 12, paint[0][8]);
  1737.                                 g.drawString("Levels Gained: " + levelsGained, 12, paint[0][9]);
  1738.                                 g.drawString("Percent to next level: " + skills.getPercentToNextLevel(STAT_FISHING), 12, paint[0][10]);
  1739.                                 g.drawString("Times Avoided Combat: " + timesAvoidedCombat, 12, paint[0][11]);
  1740.  
  1741.                         }
  1742.                         if (!powerFishing && barbarianMode) {
  1743.                                 g.drawString(props.name() + " v" + props.version(), 12, paint[0][1]);
  1744.                                 g.drawString("Fishing location: " + locationName, 12, paint[0][2]);
  1745.                                 g.drawString("Fishing for: " + catchName, 12, paint[0][3]);
  1746.                                 g.drawString("Barbarian Mode Active", 12, paint[0][4]);
  1747.                                 g.drawString("Run time: " + hours + ":" + minutes + ":" + seconds, 12, paint[0][5]);
  1748.                                 g.drawString("Catches: " + numberOfCatches, 12, paint[0][6]);
  1749.                                 g.drawString("Catches to next level: " + countToNext, 12, paint[0][7]);
  1750.                                 g.drawString("XP Gained: " + expGained, 12, paint[0][8]);
  1751.                                 g.drawString("Levels Gained: " + levelsGained, 12, paint[0][9]);
  1752.                                 g.drawString("Percent to next level: " + skills.getPercentToNextLevel(STAT_FISHING), 12, paint[0][10]);
  1753.                                 g.drawString("Times Avoided Combat: " + timesAvoidedCombat, 12, paint[0][11]);
  1754.  
  1755.                         }
  1756.                         if (powerFishing && barbarianMode) {
  1757.                                 g.drawString(props.name() + " v" + props.version(), 12, paint[0][0]);
  1758.                                 g.drawString("Fishing location: " + locationName, 12, paint[0][1]);
  1759.                                 g.drawString("Fishing for: " + catchName, 12, paint[0][2]);
  1760.                                 g.drawString("Powerfishing Mode Active", 12, paint[0][3]);
  1761.                                 g.drawString("Barbarian Mode Active", 12, paint[0][4]);
  1762.                                 g.drawString("Run time: " + hours + ":" + minutes + ":" + seconds, 12, paint[0][5]);
  1763.                                 g.drawString("Catches: " + numberOfCatches, 12, paint[0][6]);
  1764.                                 g.drawString("Catches to next level: " + countToNext, 12, paint[0][7]);
  1765.                                 g.drawString("XP Gained: " + expGained, 12, paint[0][8]);
  1766.                                 g.drawString("Levels Gained: " + levelsGained, 12, paint[0][9]);
  1767.                                 g.drawString("Percent to next level: " + skills.getPercentToNextLevel(STAT_FISHING), 12, paint[0][10]);
  1768.                                 g.drawString("Times Avoided Combat: " + timesAvoidedCombat, 12, paint[0][11]);
  1769.  
  1770.                         }
  1771.                 } else {
  1772.                         g.drawString(props.name() + " v" + props.version(), 12, paint[0][2]);
  1773.                         g.drawString("Fishing location: " + locationName, 12, paint[0][3]);
  1774.                         g.drawString("Fishing for: " + catchName, 12, paint[0][4]);
  1775.                         g.drawString("Run time: " + hours + ":" + minutes + ":" + seconds, 12, paint[0][5]);
  1776.                         g.drawString("Catches: " + numberOfCatches, 12, paint[0][6]);
  1777.                         g.drawString("Catches to next level: " + countToNext, 12, paint[0][7]);
  1778.                         g.drawString("XP Gained: " + expGained, 12, paint[0][8]);
  1779.                         g.drawString("Levels Gained: " + levelsGained, 12, paint[0][9]);
  1780.                         g.drawString("Percent to next level: " + skills.getPercentToNextLevel(STAT_FISHING), 12, paint[0][10]);
  1781.                         g.drawString("Times Avoided Combat: " + timesAvoidedCombat, 12, paint[0][11]);
  1782.  
  1783.                 }
  1784.         }
  1785.  
  1786.  
  1787.         public boolean clickcontinue() {
  1788.                 if (getContinueChildInterface() != null) {
  1789.                         if (getContinueChildInterface().getText().contains("to continue")) {
  1790.                                 return atInterface(getContinueChildInterface());
  1791.                         }
  1792.                 }
  1793.                 return false;
  1794.         }
  1795.  
  1796.         public void beep(int count) {
  1797.                 if (!Sound) return;
  1798.                 for (int i = 0; i < count; i++) {
  1799.                         java.awt.Toolkit.getDefaultToolkit().beep();
  1800.                         wait(250);
  1801.                 }
  1802.                 wait(random(100, 500));
  1803.                 return;
  1804.         }
  1805.  
  1806.  
  1807.         public boolean isWelcomeButton() {
  1808.                 RSInterface welcomeInterface = RSInterface.getInterface(378);
  1809.                 if (welcomeInterface.getChild(45).getAbsoluteX() > 20 || (!welcomeInterface.getChild(117).getText().equals("10.1120.190") && !welcomeInterface.getChild(117).getText().equals(""))) {
  1810.                         log("We still are in Welcome Screen");
  1811.                         return true;
  1812.                 } else {
  1813.                         return false;
  1814.                 }
  1815.         }
  1816.  
  1817.  
  1818.         public void serverMessageRecieved(ServerMessageEvent arg0) {
  1819.                 String serverString = arg0.getMessage();
  1820.                 if (serverString.contains("You've just advanced")) {
  1821.                         log.severe("Another lvl by ZombieFisher");
  1822.                         beep(1);
  1823.                         clickcontinue();
  1824.                 }
  1825.                 if (serverString.contains("Oh dear")) {
  1826.                         log.severe("Oh crap u were killed");
  1827.                         beep(5);
  1828.                 }
  1829.         }
  1830. }