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

Untitled

By: a guest on Sep 7th, 2012  |  syntax: None  |  size: 58.98 KB  |  hits: 10  |  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.  *LICENSE*
  4.  <This is a java script for the PowerBot platform.>
  5.     Copyright (C) 2011  Fuser scripts
  6.  
  7.     This program is free software: you can redistribute it and/or modify
  8.     it under the terms of the GNU General Public License as published by
  9.     the Free Software Foundation, either version 3 of the License, or
  10.     (at your option) any later version.
  11.  
  12.     This program is distributed in the hope that it will be useful,
  13.     but WITHOUT ANY WARRANTY; without even the implied warranty of
  14.     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  15.     GNU General Public License for more details.
  16.  *LICENSE*
  17.  
  18.  We encourage every script writer of Fuser scripts to make use of the skeleton code.
  19.  Look at this like suggested methods or recommended ways to write scripts. Don't let this hold back your creativity
  20.  in any way.
  21.  
  22.   - Ubuntu4life
  23.   - Dew
  24.   - ExoCode
  25.   - Alex
  26.  */
  27.  
  28. import java.awt.BasicStroke;
  29. import java.awt.Color;
  30. import java.awt.Container;
  31. import java.awt.Font;
  32. import java.awt.Graphics;
  33. import java.awt.Graphics2D;
  34. import java.awt.Image;
  35. import java.awt.Point;
  36. import java.awt.RenderingHints;
  37. import java.awt.event.ActionEvent;
  38. import java.awt.event.ActionListener;
  39. import java.awt.event.KeyEvent;
  40. import java.awt.event.MouseEvent;
  41. import java.awt.event.MouseListener;
  42. import java.io.IOException;
  43. import java.lang.reflect.InvocationTargetException;
  44. import java.net.URL;
  45. import java.util.LinkedList;
  46. import java.util.Random;
  47.  
  48. import javax.imageio.ImageIO;
  49. import javax.swing.DefaultComboBoxModel;
  50. import javax.swing.GroupLayout;
  51. import javax.swing.JButton;
  52. import javax.swing.JComboBox;
  53. import javax.swing.JFrame;
  54. import javax.swing.JLabel;
  55. import javax.swing.SwingUtilities;
  56.  
  57. import org.rsbot.client.RSNPC;
  58. import org.rsbot.client.RSObject;
  59. import org.rsbot.event.events.MessageEvent;
  60. import org.rsbot.event.listeners.MessageListener;
  61. import org.rsbot.event.listeners.PaintListener;
  62. import org.rsbot.script.Script;
  63. import org.rsbot.script.ScriptManifest;
  64. import org.rsbot.script.methods.Bank;
  65. import org.rsbot.script.methods.Calculations;
  66. import org.rsbot.script.methods.Camera;
  67. import org.rsbot.script.methods.Environment;
  68. import org.rsbot.script.methods.Game;
  69. import org.rsbot.script.methods.Inventory;
  70. import org.rsbot.script.methods.Keyboard;
  71. import org.rsbot.script.methods.Menu;
  72. import org.rsbot.script.methods.Mouse;
  73. import org.rsbot.script.methods.NPCs;
  74. import org.rsbot.script.methods.Objects;
  75. import org.rsbot.script.methods.Players;
  76. import org.rsbot.script.methods.Skills;
  77. import org.rsbot.script.methods.Walking;
  78. import org.rsbot.script.util.Timer;
  79. import org.rsbot.script.wrappers.Area;
  80. import org.rsbot.script.wrappers.Character;
  81. import org.rsbot.script.wrappers.GameObject;
  82. import org.rsbot.script.wrappers.NPC;
  83. import org.rsbot.script.wrappers.Path;
  84. import org.rsbot.script.wrappers.Tile;
  85. import org.rsbot.script.wrappers.TilePath;
  86.  
  87.  
  88.  
  89. @ScriptManifest(authors = { "Craze" }, name = "Fuser Fishing", keywords = { "Fuser" }, version = 1.01, description = "The new standard of fishing botting.", website = "http://www.powerbot.org/community/topic/LINK/")
  90. public class FuserFisher extends Script implements PaintListener,
  91. MessageListener, MouseListener {
  92.  
  93.    
  94.     public long experienceGained, currentExperience, startExperience,
  95.     startLevel, experiencePerHour, startTime = 0;
  96.     public MousePaint mousePaint = new MousePaint();
  97.     public Image cursorUnclicked, cursorClicked, fuserScriptsLogo, userLogo,
  98.     paintBackGround, closeButton, openButton, Avatar;
  99.     public String paintType = "null", Status = "Setting up";
  100.  
  101.     public boolean drop;
  102.    
  103.     private antiBanThread antibanthread;
  104.     private garbageCollector garbagecollector;
  105.  
  106.     int npc;
  107.     int bankID;
  108.     Tile bankTile;
  109.     Tile fishTile;
  110.     String interaction;
  111.     int fishesCaught = 0;
  112.     int[] undepositeditems = {314, 307, 309, 305, 311, 303, 13431, 301, 15263, 313};
  113.     public boolean guiIsOpen = true;
  114.     FuserFisherGUI g = new FuserFisherGUI();
  115.     boolean webWalk;
  116.     boolean LRC = false;
  117.     boolean walkBack = false;
  118.     boolean shilo = false;
  119.     int bankerID;
  120.     boolean colony = false;
  121.     int arnoldID = 3824;
  122.    
  123.     Tile[] tile;
  124.     Path path;
  125.    
  126.     /**
  127.      * Try to break up the script in as many actions as possible.
  128.      */
  129.     private enum Action {
  130.       DEATHWALK, WALKSPOT4TOSPOT1, WALKTOBANK, USEBANK, FISH, WALKTOFISH, DROP, NOTEFISH, BANKLRC, WALKBANKLRC, WALKSPOT1, WALKSPOT2, WALKSPOT3, WALKSPOT4, AVOIDCOMBAT, FISHLRC, SLEEP, UNKNOWN;
  131.     }
  132.  
  133.     /**
  134.      * Constants here.
  135.      */
  136.     public static interface Constants {
  137.       //Barb Village
  138.       int barbarianFishID = 328;
  139.       Tile barbfishtile = new Tile(3109, 3433);
  140.       Tile barbbanktile = new Tile(3094, 3490);
  141.         int barbbankid = 42373;
  142.        
  143.         //Draynor Village
  144.         int draynorFishID = 327;
  145.         Tile draynorFishTile = new Tile(3086, 3230);
  146.         Tile draynorBankTile = new Tile(3092, 3244);
  147.         int draynorBankID = 2015;
  148.        
  149.         //Lumbridge
  150.         int lumbridgeFishID = 329;
  151.         Tile lumbridgeFishTile = new Tile(3240, 3241);
  152.         Tile lumbridgeBankTile = new Tile(3296, 3168);
  153.         int lumbridgeBankID = 35647;
  154.        
  155.         //Karamja
  156.         int karamjaFishID = 324;
  157.         Tile karamjaFishTile = new Tile(2925, 3176);
  158.         Tile karamjaStilesTile = new Tile(2852, 3143);
  159.         int karamjaStilesID = 11267;
  160.        
  161.         //Fishing Guild
  162.         int guildLobsterID = 312;
  163.         int guildSharkID = 313;
  164.         Tile guildBankTile = new Tile(2585, 3422);
  165.         Tile guildFishTile = new Tile(2601, 3421);
  166.         int guildBankID = 49018;
  167.        
  168.         //Catherby
  169.         int catherbyBankID = 2213;
  170.         Tile catherbyBankTile = new Tile(2809, 3441);
  171.         Tile catherbyFishTile = new Tile(2842, 3432);
  172.         int catherbyLobsterID = 321;
  173.         int catherbySharkID = 322;
  174.         int CathebryNetID = 320;
  175.        
  176.         //LRC
  177.         int lrcBankID = 45079;
  178.         int lrcCaveFishID = 8841;
  179.         int lrcRocktailID = 8842;
  180.         Tile[] bankToSpot1 = {new Tile(3654, 5114), new Tile(3657, 5105), new Tile(3656, 5094), new Tile(3650, 5084)};
  181.         Tile[] spot1toSpot2 = {new Tile(3647, 5085), new Tile(3634, 5087), new Tile(3625, 5087)};
  182.         Tile[] spot2toSpot3 = {new Tile(3627, 5085), new Tile(3625, 5095), new Tile(3621, 5104), new Tile(3613, 5111)};
  183.         Tile[] spot2toBank = {new Tile(3628, 5087), new Tile(3639, 5092), new Tile(3647, 5095), new Tile(3658, 5102), new Tile(3654, 5114)};
  184.         Tile[] spot3toBank = {new Tile(3613, 5112),new Tile(3620, 5106),new Tile(3628, 5098),new Tile(3639, 5091),new Tile(3653, 5099),new Tile(3657, 5106),new Tile(3654, 5114),};
  185.         Tile spot1 = new Tile(3650, 5084);
  186.         Tile spot2 = new Tile(3645, 5084);
  187.         Tile spot3 = new Tile(3629, 5084);
  188.         Tile spot4 = new Tile(3619, 5089);
  189.         Area spotOne = new Area(new Tile(3647, 5087), new Tile(3656, 5083));
  190.         Area spotTwo = new Area(new Tile(3641, 5086), new Tile(3646, 5079));
  191.         Area spotThree = new Area(new Tile(3625, 5087), new Tile(3638, 5079));
  192.         Area spotFour = new Area(new Tile(3615, 5092), new Tile(3624, 5085));
  193.         Area dead = new Area(new Tile(2960, 3386), new Tile(2971, 3375));
  194.         Tile FaladorBank = new Tile(3013, 3355);
  195.         int bait = 0;
  196.         Tile dwarvenDoor = new Tile(3061, 3374);
  197.         int closedDoor = 11714;
  198.         int openDoor = 11715;
  199.         int stairs = 30944;
  200.         Tile cavernEntrance = new Tile(3014, 9831);
  201.         int entrance = 46204;
  202.        
  203.         //Shilo
  204.         Tile shilobankTile = new Tile(2852, 2955);
  205.         Tile shilofishTile = new Tile(2857, 2972);
  206.         int shiloFish = 317;
  207.        
  208.         //Fishing Colony
  209.         Tile colonyBankTile = new Tile(2331, 3689);
  210.         Tile colonyFishTile = new Tile(2343, 3701);
  211.         int colonyFish = 3848;
  212.        
  213.        
  214.     }
  215.  
  216.     /**
  217.      * Try to make as much logic as possible happen here instead of in the loop.
  218.      *
  219.      * @return Action
  220.      */
  221.     public Action getAction() {
  222.         try {
  223.             if (Game.getClientState() != 11) {
  224.                 return Action.SLEEP;
  225.             } else {
  226.               if(LRC == true){
  227.                 if(Players.getMyPlayer().isInCombat()){
  228.                   return Action.WALKBANKLRC;
  229.                 } else if(Constants.dead.contains(Players.getMyPlayer().getLocation())){
  230.                         return Action.DEATHWALK;
  231.                 }else if(atLRCBank() && Inventory.isFull()){
  232.                   return Action.BANKLRC;
  233.                 } else if(atLRCBank() && !Inventory.isFull()){
  234.                   return Action.WALKSPOT1;
  235.                 } else if(!atBank() && Inventory.isFull()){
  236.                   return Action.WALKBANKLRC;
  237.                 } else if(canFish()){
  238.                   return Action.FISHLRC;
  239.                 } else if(atSpot1()&& !canFish()){
  240.                   return Action.WALKSPOT2;
  241.                 } else if(atSpot2() && !canFish()){
  242.                   return Action.WALKSPOT3;
  243.                 } else if(atSpot3() && !canFish()){
  244.                   return Action.WALKSPOT4;
  245.                 } else if(atSpot4() && !canFish()){
  246.                   return Action.WALKSPOT4TOSPOT1;
  247.                 }
  248.               } else if(LRC == false){
  249.               if(atBank() && Inventory.isFull()){
  250.                 return Action.USEBANK;
  251.               } else if(atBank() && !Inventory.isFull()){
  252.                 return Action.WALKTOFISH;
  253.               } else if(!atBank() && Inventory.isFull() && drop == false){
  254.                 return Action.WALKTOBANK;
  255.               } else if(atSpot() && !Inventory.isFull()){
  256.                 return Action.FISH;
  257.               } else if(drop == true && Inventory.isFull()){
  258.                 return Action.DROP;
  259.               } else if(atStiles() && Inventory.isFull()){
  260.                 return Action.NOTEFISH;
  261.               } else if(atStiles() && !Inventory.isFull()){
  262.                 return Action.WALKTOFISH;
  263.               }
  264.             }
  265.             }
  266.         } catch (final Exception e) {
  267.             return Action.UNKNOWN;
  268.         }
  269.         return Action.UNKNOWN;
  270.     }
  271.    
  272.     private boolean atSpot4(){
  273.       if(Constants.spotFour.contains(Players.getMyPlayer().getLocation())){
  274.         log("At spot 4");
  275.         return true;
  276.       }
  277.       return false;
  278.     }
  279.    
  280.     private boolean atSpot3() {
  281.       if(Constants.spotThree.contains(Players.getMyPlayer().getLocation())){
  282.         log("at spot3");
  283.         return true;
  284.       }
  285.       return false;
  286.     }
  287.    
  288.     private boolean atSpot2(){
  289.       if(Constants.spotTwo.contains(Players.getMyPlayer().getLocation())){
  290.         log("At spot 2");
  291.         return true;
  292.       }
  293.       return false;
  294.     }
  295.    
  296.     private boolean atSpot1(){
  297.       if(Constants.spotOne.contains(Players.getMyPlayer().getLocation())){
  298.         log("At spot 1");
  299.         return true;
  300.       }
  301.       return false;
  302.     }
  303.  
  304.  
  305.     private boolean atLRCBank() {
  306.       if(Calculations.distanceTo(new Tile(3654, 5114)) < 5){
  307.         return true;
  308.       }
  309.       return false;
  310.     }
  311.    
  312.     private void ToBank(){
  313.      if(!atSpot1()){
  314.         Walking.walkTileMM(Constants.spot1);
  315.         sleep(3000);
  316.       } else if(atSpot1()){
  317.         path = Walking.newTilePath(Constants.bankToSpot1).reverse();
  318.         while(!atBank()){
  319.           path.traverse();
  320.           while(Players.getMyPlayer().isMoving()){
  321.           sleep(200);
  322.         }
  323.         }
  324.       }
  325.     }
  326.  
  327.     private boolean atStiles() {
  328.       NPC stiles = NPCs.getNearest(Constants.karamjaStilesID);
  329.       if(stiles != null && stiles.isOnScreen()){
  330.         return true;
  331.       }
  332.       return false;
  333.     }
  334.    
  335.     private boolean atSpot() {
  336.     NPC spot = NPCs.getNearest(npc);
  337.     if(spot != null){
  338.       if(spot.isOnScreen()){
  339.         return true;
  340.       } else {
  341.           Walking.walkTileMM(spot.getLocation());
  342.           sleep(2500);
  343.       }
  344.     }
  345.     return false;
  346.   }
  347.  
  348.   private boolean atBank() {
  349.     GameObject booth = Objects.getNearest(bankID);
  350.     NPC banker = NPCs.getNearest(bankerID);
  351.     if(booth != null && booth.isOnScreen() || banker != null && banker.isOnScreen()){
  352.       return true;
  353.     }
  354.     return false;
  355.   }
  356.  
  357.   private boolean canFish() {
  358.     NPC fish = NPCs.getNearest(npc);
  359.     if(fish != null && fish.isOnScreen())
  360.     {
  361.       return true;
  362.     }
  363.     return false;
  364.   }
  365.  
  366.   @Override
  367.     public int loop() {
  368.         try {
  369.             Mouse.setSpeed(random(4, 7));
  370.             antiBan();
  371.  
  372.             switch (getAction()) {
  373.             case WALKTOBANK:
  374.               Status = "Walking to bank";
  375.               walkToBank();
  376.               break;
  377.              
  378.             case WALKTOFISH:
  379.               Status = "Walking to spot";
  380.               walkToSpot();
  381.               break;
  382.              
  383.             case FISH:
  384.               Status = "Fishing";
  385.               fish();
  386.               break;
  387.          
  388.             case USEBANK:
  389.               Status = "Banking";
  390.               Bank();
  391.               break;
  392.              
  393.             case DROP:
  394.               Inventory.dropAllExcept(undepositeditems);
  395.               break;
  396.              
  397.             case NOTEFISH:
  398.               NPC stiles = NPCs.getNearest(Constants.karamjaStilesID);
  399.               if(stiles != null){
  400.                 stiles.interact("Exchange");
  401.                 sleep(1000);
  402.               }
  403.               break;
  404.              
  405.             case BANKLRC:
  406.             Status = "Walking to Bank";
  407.               BankLRC();
  408.               break;
  409.              
  410.             case WALKBANKLRC:
  411.               Status = "Walking to LRC Bank";
  412.               ToBank();
  413.               break;
  414.              
  415.             case FISHLRC:
  416.               Status = "Fishing in LRC";
  417.               fishLRC();
  418.               break;
  419.              
  420.             case WALKSPOT1:
  421.               Status = "Walking to First Spot";
  422.               path = Walking.newTilePath(Constants.bankToSpot1);
  423.               while(!atSpot1()){
  424.                 path.traverse();
  425.                 while(Calculations.distanceTo(Walking.getDestination()) > 4){
  426.                   sleep(500);
  427.                 }
  428.               }
  429.               break;
  430.              
  431.             case WALKSPOT2:
  432.                
  433.               Status = "Walking to spot 2";
  434.               Walking.walkTileMM(Constants.spot2, 0);
  435.               sleep(1500);
  436.               while(Players.getMyPlayer().isMoving()){
  437.                 sleep(500);
  438.               }
  439.                
  440.               break;
  441.              
  442.             case WALKSPOT3:
  443.            
  444.               Status = "Walking to spot 3";
  445.               Walking.walkTileMM(Constants.spot3, 0);
  446.               sleep(1500);
  447.               while(Players.getMyPlayer().isMoving()){
  448.                 sleep(500);
  449.               }
  450.            
  451.                break;
  452.              
  453.             case WALKSPOT4:
  454.               Status = "Walking to spot 4";
  455.               Walking.walkTileMM(Constants.spot4);
  456.               sleep(1500);
  457.               while(Players.getMyPlayer().isMoving()){
  458.                 sleep(500);
  459.               }
  460.                break;
  461.                
  462.             case WALKSPOT4TOSPOT1:
  463.               Status = "Walking back to spot 1";
  464.               while(!atSpot1()){
  465.                   Walking.walkTileMM(Constants.spot1, 0);
  466.                   sleep(3000);
  467.               }
  468.               break;
  469.              
  470.             case DEATHWALK:
  471.                 Status = "Died, Walking back!";
  472.                 while(Calculations.distanceTo(Constants.FaladorBank) > 2){
  473.                         Walking.walkTileMM(Constants.FaladorBank);
  474.                         sleep(1500);
  475.                         while(Players.getMyPlayer().isMoving()){
  476.                                 sleep(500);
  477.                         }
  478.                 }
  479.                 sleep(1500);
  480.                 GameObject booth = Objects.getNearest(Bank.BANK_BOOTHS);
  481.                 if(booth != null && booth.isOnScreen()){
  482.                         booth.interact("Use-quickly");
  483.                         sleep(2000);
  484.                         if(Bank.isOpen()){
  485.                                 Bank.withdraw(Constants.bait, 0);
  486.                                 sleep(1000);
  487.                                 Bank.close();
  488.                         } else {
  489.                                 booth.interact("Use-quickly");
  490.                                 sleep(2200);
  491.                         }
  492.                 }
  493.                 while(Calculations.distanceTo(Constants.dwarvenDoor) > 2){
  494.                         Walking.walkTileMM(Constants.dwarvenDoor);
  495.                         sleep(1500);
  496.                         while(Players.getMyPlayer().isMoving()){
  497.                                 sleep(500);
  498.                         }
  499.                 }
  500.                 GameObject closedDoor = Objects.getNearest(Constants.closedDoor);
  501.                 if(closedDoor != null && closedDoor.isOnScreen()){
  502.                         closedDoor.interact("Open");
  503.                 }
  504.                 sleep(1200);
  505.                 GameObject stairs = Objects.getNearest(Constants.stairs);
  506.                 if(stairs != null && stairs.isOnScreen()){
  507.                         stairs.click();
  508.                         sleep(2500);
  509.                 }
  510.                 while(Calculations.distanceTo(Constants.cavernEntrance) > 2){
  511.                         Walking.walkTileMM(Constants.cavernEntrance);
  512.                         while(Calculations.distanceTo(Walking.getDestination()) > 2){
  513.                                 sleep(500);
  514.                         }
  515.                 }
  516.                 GameObject entrance = Objects.getNearest(Constants.entrance);
  517.                 if(entrance != null && entrance.isOnScreen()){
  518.                         entrance.click();
  519.                         sleep(1500);
  520.                 }
  521.             }
  522.         } catch (final Exception e) {
  523.             return 25;
  524.         }
  525.         return random(180, 420);
  526.     }
  527.  
  528.     private void Bank() {
  529.         if(shilo){
  530.                 NPC booth = NPCs.getNearest(bankerID);
  531.                 if(booth != null && booth.isOnScreen()){
  532.                         booth.interact("Bank Banker");
  533.                         sleep(1800);
  534.                         if(Bank.isOpen()){
  535.                                 Bank.depositAllExcept(undepositeditems);
  536.                                 sleep(1000);
  537.                                 Bank.close();
  538.                         } else {
  539.                                 booth.interact("Bank Banker");
  540.                                 sleep(1800);
  541.                         }
  542.                 }
  543.         }
  544.         if(colony){
  545.                 NPC booth = NPCs.getNearest(arnoldID);
  546.                 if(booth != null && booth.isOnScreen()){
  547.                         booth.interact("Bank");
  548.                         sleep(1800);
  549.                         if(Bank.isOpen()){
  550.                                 Bank.depositAllExcept(undepositeditems);
  551.                                 sleep(1000);
  552.                                 Bank.close();
  553.                         } else {
  554.                                 booth.interact("Bank");
  555.                                 sleep(1800);
  556.                         }
  557.                 }
  558.         }
  559.       GameObject booth = Objects.getNearest(bankID);
  560.       if(booth != null){
  561.         booth.interact("Use-quickly");
  562.         sleep(1800);
  563.         if(Bank.isOpen()){
  564.           Bank.depositAllExcept(undepositeditems);
  565.           sleep(800);
  566.           Bank.close();
  567.         } else {
  568.           booth.interact("Use-quickly");
  569.             sleep(1800);
  570.         }
  571.       }
  572.   }
  573.    
  574.     private void BankLRC(){
  575.       GameObject booth = Objects.getNearest(bankID);
  576.       if(booth != null){
  577.         booth.interact("Deposit");
  578.         sleep(1800);
  579.         if(Bank.isDepositOpen()){
  580.           Bank.depositAllExcept(undepositeditems);
  581.           sleep(800);
  582.           Bank.close();
  583.         } else {
  584.           booth.click();
  585.           sleep(1800);
  586.         }
  587.       }
  588.     }
  589.  
  590.   private void fish() {
  591.     NPC fish = NPCs.getNearest(npc);
  592.     if(fish != null){
  593.       if(fish.isOnScreen()){
  594.         fish.interact(interaction);
  595.         Timer t = new Timer(2000);
  596.         while(t.isRunning()){
  597.           if(Players.getMyPlayer().getAnimation() != -1){
  598.             t.reset();
  599.           }
  600.         }
  601.       } else {
  602.         Walking.walkTileMM(fish.getLocation(), 0);
  603.       }
  604.     }
  605.    
  606.   }
  607.  
  608.   private void fishLRC() {
  609.     NPC fish = NPCs.getNearest(npc);
  610.     if(fish != null){
  611.       if(fish.isOnScreen()){
  612.         Point p = fish.getPoint();
  613.         Mouse.move(p);
  614.         Mouse.click(true);
  615.         Timer t = new Timer(2000);
  616.         while(t.isRunning()){
  617.           if(Players.getMyPlayer().getAnimation() != -1 && !Players.getMyPlayer().isInCombat()){
  618.             t.reset();
  619.           }
  620.         }
  621.       } else {
  622.         Camera.turnTo(fish.getLocation());
  623.       }
  624.     }
  625.   }
  626.  
  627.   private void walkToSpot() {
  628.     if(!Walking.isRunEnabled()){
  629.       Walking.setRun(true);
  630.     }
  631.     Path spot = Walking.getPath(fishTile);
  632.     if(webWalk == true){
  633.       if(Calculations.distanceTo(fishTile) > 2){
  634.         while(Calculations.distanceTo(fishTile) > 2){
  635.           spot.traverse();
  636.           sleep(3500);
  637.           while(Players.getMyPlayer().isMoving()){
  638.             sleep(200);
  639.           }
  640.           Walking.walkTileMM(fishTile, 0);
  641.         }
  642.       }
  643.     } else {
  644.       Walking.walkTileMM(fishTile, 0);
  645.       sleep(2500);
  646.     }
  647.   }
  648.  
  649.   private void walkToBank() {
  650.     if(!Walking.isRunEnabled()){
  651.       Walking.setRun(true);
  652.     }
  653.     Path Bank = Walking.getPath(bankTile);
  654.     if(webWalk == true){
  655.       if(Bank != null){
  656.         while(Calculations.distanceTo(bankTile) > 2){
  657.           Bank.traverse();
  658.           if(Calculations.distanceTo(Walking.getDestination()) > 2){
  659.             sleep(400);
  660.           }
  661.         }
  662.       }
  663.       } else {
  664.         Walking.walkTileMM(bankTile, 0);
  665.         sleep(2500);
  666.       }
  667.   }
  668.  
  669.  
  670.   public class FuserFisherGUI extends JFrame {
  671.     public FuserFisherGUI() {
  672.       initComponents();
  673.     }
  674.  
  675.     private void button1ActionPerformed(ActionEvent e) {
  676.       String loc = comboBox1.getSelectedItem().toString();
  677.       interaction = comboBox3.getSelectedItem().toString();
  678.       String fish = comboBox4.getSelectedItem().toString();
  679.      
  680.       if(loc.equals("Barbarian Village")){
  681.         webWalk = true;
  682.         bankTile = Constants.barbbanktile;
  683.         fishTile = Constants.barbfishtile;
  684.         npc = Constants.barbarianFishID;
  685.         bankID = Constants.barbbankid;
  686.         LRC = false;
  687.       } else if(loc.equals("Draynor")){
  688.         webWalk = true;
  689.         bankTile = Constants.draynorBankTile;
  690.         fishTile = Constants.draynorFishTile;
  691.         npc = Constants.draynorFishID;
  692.         bankID = Constants.draynorBankID;
  693.         LRC = false;
  694.       } else if(loc.equals("Lumbridge")){
  695.         webWalk = true;
  696.         bankTile = Constants.lumbridgeBankTile;
  697.         fishTile = Constants.lumbridgeFishTile;
  698.         npc = Constants.lumbridgeFishID;
  699.         bankID = Constants.lumbridgeBankID;
  700.         LRC = false;
  701.       } else if(loc.equals("Karamja")){
  702.         webWalk = true;
  703.         bankTile = Constants.karamjaStilesTile;
  704.         fishTile = Constants.karamjaFishTile;
  705.         npc = Constants.karamjaFishID;  
  706.         LRC = false;
  707.       } else if(loc.equals("Fishing Guild")){
  708.         LRC = false;
  709.         webWalk = false;
  710.         if(interaction.equals("Cage")){
  711.           npc = Constants.guildLobsterID;
  712.         } else if(interaction.equals("Harpoon")){
  713.           if(fish.equals("Shark")){
  714.             npc = Constants.guildSharkID;
  715.           } else {
  716.             npc = Constants.guildLobsterID;
  717.           }
  718.         } else if(interaction.equals("Net")){
  719.           npc = Constants.guildSharkID;
  720.         }
  721.         bankTile = Constants.guildBankTile;
  722.         fishTile = Constants.guildFishTile;
  723.         bankID = Constants.guildBankID;
  724.       } else if(loc.equals("Catherby")){
  725.         webWalk = true;
  726.         if(interaction.equals("Cage")){
  727.           npc = Constants.catherbyLobsterID;
  728.         } else if(interaction.equals("Harpoon")){
  729.           if(fish.equals("Shark")){
  730.             npc = Constants.catherbySharkID;
  731.           } else {
  732.             npc = Constants.catherbyLobsterID;
  733.           }
  734.         } else if(interaction.equals("Net") || interaction.equals("Bait")){
  735.           npc = Constants.CathebryNetID;
  736.         }
  737.         bankTile = Constants.catherbyBankTile;
  738.         fishTile = Constants.catherbyFishTile;
  739.         bankID = Constants.catherbyBankID;
  740.         LRC = false;
  741.       } else if(loc.equals("Living Rock Cavern")){
  742.         webWalk = false;
  743.         if(fish.equals("Cavefish")){
  744.           npc = Constants.lrcCaveFishID;
  745.         } else if(fish.equals("Rocktail")){
  746.           npc = Constants.lrcRocktailID;
  747.         }
  748.         bankID = Constants.lrcBankID;
  749.         LRC = true;
  750.       } else if(loc.equals("Shilo Village")){
  751.           shilo = true;
  752.           webWalk = false;
  753.           bankerID = 499;
  754.           bankTile = Constants.shilobankTile;
  755.           fishTile = Constants.shilofishTile;
  756.           npc = Constants.shiloFish;
  757.       } else if(loc.equals("Fishing Colony")){
  758.           colony = true;
  759.           bankTile = Constants.colonyBankTile;
  760.           fishTile = Constants.colonyFishTile;
  761.           npc = Constants.colonyFish;
  762.       }
  763.      
  764.       String method = comboBox2.getSelectedItem().toString();
  765.       if(method.equals("Drop")){
  766.         drop = true;
  767.       } else {
  768.         drop = false;
  769.       }
  770.      
  771.      
  772.       setVisible(false);
  773.       guiIsOpen = false;
  774.     }
  775.  
  776.     private void initComponents() {
  777.       // JFormDesigner - Component initialization - DO NOT MODIFY  //GEN-BEGIN:initComponents
  778.       // Generated using JFormDesigner Evaluation license - Alex Martin
  779.       label1 = new JLabel();
  780.       label2 = new JLabel();
  781.       comboBox1 = new JComboBox();
  782.       label3 = new JLabel();
  783.       comboBox2 = new JComboBox();
  784.       label4 = new JLabel();
  785.       comboBox3 = new JComboBox();
  786.       button1 = new JButton();
  787.       label5 = new JLabel();
  788.       comboBox4 = new JComboBox();
  789.  
  790.       //======== this ========
  791.       Container contentPane = getContentPane();
  792.  
  793.       //---- label1 ----
  794.       label1.setText("Fuser AIO Fishing");
  795.       label1.setFont(new Font("Tahoma", Font.PLAIN, 24));
  796.  
  797.       //---- label2 ----
  798.       label2.setText("Location: ");
  799.       label2.setFont(new Font("Tahoma", Font.PLAIN, 18));
  800.  
  801.       //---- comboBox1 ----
  802.       comboBox1.setModel(new DefaultComboBoxModel(new String[] {
  803.         "Barbarian Village",
  804.         "Draynor",
  805.         "Lumbridge",
  806.         "Karamja",
  807.         "Fishing Guild",
  808.         "Catherby",
  809.         "Living Rock Cavern",
  810.         "Shilo Village",
  811.         "Fishing Colony"
  812.       }));
  813.  
  814.       //---- label3 ----
  815.       label3.setText("Method: ");
  816.       label3.setFont(new Font("Tahoma", Font.PLAIN, 18));
  817.  
  818.       //---- comboBox2 ----
  819.       comboBox2.setModel(new DefaultComboBoxModel(new String[] {
  820.         "Drop",
  821.         "Bank"
  822.       }));
  823.  
  824.       //---- label4 ----
  825.       label4.setText("Action: ");
  826.       label4.setFont(new Font("Tahoma", Font.PLAIN, 18));
  827.  
  828.       //---- comboBox3 ----
  829.       comboBox3.setModel(new DefaultComboBoxModel(new String[] {
  830.         "Lure",
  831.         "Bait",
  832.         "Net",
  833.         "Cage",
  834.         "Harpoon"
  835.       }));
  836.  
  837.       //---- button1 ----
  838.       button1.setText("Start");
  839.       button1.addActionListener(new ActionListener() {
  840.         @Override
  841.         public void actionPerformed(ActionEvent e) {
  842.           button1ActionPerformed(e);
  843.         }
  844.       });
  845.  
  846.       //---- label5 ----
  847.       label5.setText("Fish: ");
  848.       label5.setFont(new Font("Tahoma", Font.PLAIN, 18));
  849.  
  850.       //---- comboBox4 ----
  851.       comboBox4.setModel(new DefaultComboBoxModel(new String[] {
  852.         "Shrimp",
  853.         "Anchovie",
  854.         "Trout",
  855.         "Salmon",
  856.         "Tuna",
  857.         "Lobster",
  858.         "Swordfish",
  859.         "Shark",
  860.         "Cavefish",
  861.         "Rocktail"
  862.       }));
  863.  
  864.       GroupLayout contentPaneLayout = new GroupLayout(contentPane);
  865.       contentPane.setLayout(contentPaneLayout);
  866.       contentPaneLayout.setHorizontalGroup(
  867.         contentPaneLayout.createParallelGroup()
  868.           .addGroup(contentPaneLayout.createSequentialGroup()
  869.             .addGroup(contentPaneLayout.createParallelGroup()
  870.               .addGroup(contentPaneLayout.createSequentialGroup()
  871.                 .addGap(100, 100, 100)
  872.                 .addComponent(label1))
  873.               .addGroup(contentPaneLayout.createSequentialGroup()
  874.                 .addGap(82, 82, 82)
  875.                 .addGroup(contentPaneLayout.createParallelGroup(GroupLayout.Alignment.TRAILING)
  876.                   .addComponent(label2)
  877.                   .addComponent(label3)
  878.                   .addComponent(label4)
  879.                   .addComponent(label5))
  880.                 .addGap(18, 18, 18)
  881.                 .addGroup(contentPaneLayout.createParallelGroup(GroupLayout.Alignment.LEADING, false)
  882.                   .addComponent(comboBox4, 0, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
  883.                   .addComponent(comboBox3, 0, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
  884.                   .addComponent(comboBox2, 0, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
  885.                   .addComponent(comboBox1, 0, 121, Short.MAX_VALUE)))
  886.               .addGroup(contentPaneLayout.createSequentialGroup()
  887.                 .addGap(141, 141, 141)
  888.                 .addComponent(button1, GroupLayout.PREFERRED_SIZE, 110, GroupLayout.PREFERRED_SIZE)))
  889.             .addContainerGap(93, Short.MAX_VALUE))
  890.       );
  891.       contentPaneLayout.setVerticalGroup(
  892.         contentPaneLayout.createParallelGroup()
  893.           .addGroup(contentPaneLayout.createSequentialGroup()
  894.             .addContainerGap()
  895.             .addComponent(label1)
  896.             .addGap(18, 18, 18)
  897.             .addGroup(contentPaneLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
  898.               .addComponent(comboBox1, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
  899.               .addComponent(label2, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
  900.             .addGap(18, 18, 18)
  901.             .addGroup(contentPaneLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
  902.               .addComponent(comboBox2, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
  903.               .addComponent(label3))
  904.             .addGap(18, 18, 18)
  905.             .addGroup(contentPaneLayout.createParallelGroup()
  906.               .addComponent(label4)
  907.               .addComponent(comboBox3, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
  908.             .addGap(18, 18, 18)
  909.             .addGroup(contentPaneLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
  910.               .addComponent(label5)
  911.               .addComponent(comboBox4, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
  912.             .addGap(26, 26, 26)
  913.             .addComponent(button1, GroupLayout.PREFERRED_SIZE, 41, GroupLayout.PREFERRED_SIZE)
  914.             .addGap(39, 39, 39))
  915.       );
  916.       pack();
  917.       setLocationRelativeTo(getOwner());
  918.       // JFormDesigner - End of component initialization  //GEN-END:initComponents
  919.     }
  920.  
  921.     // JFormDesigner - Variables declaration - DO NOT MODIFY  //GEN-BEGIN:variables
  922.     // Generated using JFormDesigner Evaluation license - Alex Martin
  923.     private JLabel label1;
  924.     private JLabel label2;
  925.     private JComboBox comboBox1;
  926.     private JLabel label3;
  927.     private JComboBox comboBox2;
  928.     private JLabel label4;
  929.     private JComboBox comboBox3;
  930.     private JButton button1;
  931.     private JLabel label5;
  932.     private JComboBox comboBox4;
  933.     // JFormDesigner - End of variables declaration  //GEN-END:variables
  934.   }
  935.   public boolean onStart() {
  936.         if (!Game.isLoggedIn()) {
  937.             log.severe("Start this script logged in please.");
  938.             return false;
  939.         }
  940.         if (!Game.isFixed()) {
  941.             log.severe("It's highly recommended to bot with fixed screen mode.");
  942.             return false;
  943.         }
  944.         try {
  945.             SwingUtilities.invokeAndWait(new Runnable() {
  946.                 @Override
  947.                 public void run() {
  948.                   new FuserFisherGUI().setVisible(true);
  949.                  
  950.                 }
  951.             });
  952.         } catch (InterruptedException ignored) {
  953.         } catch (InvocationTargetException ignored) {
  954.         }
  955.         // Load files from external server here.
  956.         new Thread(new Runnable() {
  957.             public void run() {
  958.                
  959.             }
  960.         }).start();
  961.         while (guiIsOpen) {
  962.             sleep(25);
  963.             Camera.setPitch(true);
  964.         }
  965.         log.info("Loading version "
  966.                 + getClass().getAnnotation(ScriptManifest.class).version());
  967.         startTime = System.currentTimeMillis();
  968.         startExperience = Skills.getExperience(Skills.FISHING);
  969.         antibanthread = new antiBanThread();
  970.         antibanthread.start();
  971.         garbagecollector = new garbageCollector();
  972.         garbagecollector.start();
  973.         return true;
  974.     }
  975.  
  976.     public void onFinish() {
  977.         for (int Tries = 0; antibanthread.isAlive(); Tries++) {
  978.             if (Tries > 2400) {
  979.                 antibanthread.interrupt();
  980.                 sleep(25);
  981.                 if (antibanthread.isInterrupted()) {
  982.                     break;
  983.                 } else if (Tries > 4800) {
  984.                     break;
  985.                 }
  986.             } else {
  987.                 antibanthread.stopThread = true;
  988.                 sleep(25);
  989.                 if (antibanthread.isInterrupted()) {
  990.                     break;
  991.                 }
  992.             }
  993.         }
  994.         Environment.saveScreenshot(true);
  995.         for (int Tries = 0; garbagecollector.isAlive(); Tries++) {
  996.             if (Tries > 2400) {
  997.                 garbagecollector.interrupt();
  998.                 sleep(25);
  999.                 if (garbagecollector.isInterrupted()) {
  1000.                     break;
  1001.                 } else if (Tries > 4800) {
  1002.                     break;
  1003.                 }
  1004.             } else {
  1005.                 garbagecollector.stopThread = true;
  1006.                 sleep(25);
  1007.                 if (garbagecollector.isInterrupted()) {
  1008.                     break;
  1009.                 }
  1010.             }
  1011.         }
  1012.         log("Thank you for using a Fuser script.");
  1013.     }
  1014.  
  1015.     @Override
  1016.     public void messageReceived(final MessageEvent serverTraffic) {
  1017.         final String serverMessage = serverTraffic.getMessage().toLowerCase();
  1018.         if (serverMessage.contains("advanced")) {
  1019.             log("Congratulations on level up !");
  1020.         }
  1021.         if (serverMessage.contains("the next runescape")) {
  1022.             log("There will be a system update soon, logged out.");
  1023.            
  1024.         }
  1025.         if(serverMessage.contains("you catch")){
  1026.           fishesCaught++;
  1027.         }
  1028.     }
  1029.  
  1030.     /**
  1031.      * Looped antiBan version 1.00
  1032.      *
  1033.      * @Author Ubuntu4life
  1034.      */
  1035.     private void antiBan() {
  1036.         // CHANGE randomInteger to tune the frequency of the antiBan.
  1037.         final int randomInteger = random(1, 11);
  1038.         switch (randomInteger) {
  1039.         case 1:
  1040.             // CHANGE this random integer generator to tune the relative
  1041.             // distribution of antiBan actions.
  1042.             if (random(1, 17) != 1) {
  1043.                 break;
  1044.             } else {
  1045.                 Mouse.move(random(10, 750), random(10, 495));
  1046.                 if (random(1, 7) == 1) {
  1047.                     Mouse.move(random(10, 750), random(10, 495));
  1048.                 }
  1049.             }
  1050.             break;
  1051.         case 2:
  1052.             if (random(1, 12) != 1) {
  1053.                 break;
  1054.             } else {
  1055.                 Mouse.moveSlightly();
  1056.             }
  1057.             break;
  1058.         case 3:
  1059.             if (random(1, 18) != 1) {
  1060.                 break;
  1061.             } else {
  1062.                 if (random(1, 11) == 1) {
  1063.                     Camera.setPitch(true);
  1064.                 }
  1065.                 int angle = Camera.getAngle() + random(-45, 45);
  1066.                 if (angle < 0) {
  1067.                     angle = random(0, 10);
  1068.                 }
  1069.                 if (angle > 359) {
  1070.                     angle = random(0, 10);
  1071.                 }
  1072.                 char Direction = 37;
  1073.                 if (random(0, 100) < 50) {
  1074.                     Direction = 39;
  1075.                 }
  1076.                 Keyboard.pressKey(Direction);
  1077.                 sleep(random(100, 700));
  1078.                 Keyboard.releaseKey(Direction);
  1079.             }
  1080.             break;
  1081.         default:
  1082.             return;
  1083.         }
  1084.     }
  1085.  
  1086.     /**
  1087.      * Multi-threaded antiBan version 1.00
  1088.      *
  1089.      * @Author Ubuntu4life
  1090.      */
  1091.     class antiBanThread extends Thread {
  1092.         private volatile boolean stopThread = false;
  1093.         Random javaUtilRandom = new Random();
  1094.  
  1095.         @Override
  1096.         public void run() {
  1097.             try {
  1098.                 while (!stopThread && !isPaused()
  1099.                         && Game.isLoggedIn()) {
  1100.                     // CHANGE this integer to tune the frequency of the antiBan
  1101.                     if (javaUtilRandom.nextInt(Math.abs(0 - 21)) == 1) {
  1102.                         final char[] leftRight = new char[] { KeyEvent.VK_LEFT,
  1103.                                 KeyEvent.VK_RIGHT };
  1104.                         final char[] upDown = new char[] { KeyEvent.VK_DOWN,
  1105.                                 KeyEvent.VK_UP };
  1106.                         final char[] leftRightUpDown = new char[] {
  1107.                                 KeyEvent.VK_LEFT, KeyEvent.VK_RIGHT,
  1108.                                 KeyEvent.VK_UP, KeyEvent.VK_UP };
  1109.                         final int random1 = javaUtilRandom.nextInt(Math
  1110.                                 .abs(2 - 0));
  1111.                         final int random2 = javaUtilRandom.nextInt(Math
  1112.                                 .abs(2 - 0));
  1113.                         final int random3 = javaUtilRandom.nextInt(Math
  1114.                                 .abs(4 - 0));
  1115.                         boolean didLeftRight = false;
  1116.                         if (javaUtilRandom.nextInt(Math.abs(3 - 0)) == 1) {
  1117.                             if (random(0, 5) != 1) {
  1118.                                 Keyboard.pressKey(leftRight[random1]);
  1119.                                 Thread.sleep(javaUtilRandom.nextInt(Math
  1120.                                         .abs(101 - 402)));
  1121.                                 didLeftRight = true;
  1122.                             }
  1123.                             Keyboard.pressKey(upDown[random2]);
  1124.                             Thread.sleep(javaUtilRandom.nextInt(Math
  1125.                                     .abs(301 - 601)));
  1126.                             Keyboard.releaseKey(upDown[random2]);
  1127.                             Thread.sleep(javaUtilRandom.nextInt(Math
  1128.                                     .abs(99 - 399)));
  1129.                             if (didLeftRight) {
  1130.                                 Keyboard.releaseKey(leftRight[random1]);
  1131.                             }
  1132.                         } else {
  1133.                             Keyboard.pressKey(leftRightUpDown[random3]);
  1134.                             if (random3 > 1) {
  1135.                                 Thread.sleep(javaUtilRandom.nextInt(Math
  1136.                                         .abs(601 - 298)));
  1137.                             } else {
  1138.                                 Thread.sleep(javaUtilRandom.nextInt(Math
  1139.                                         .abs(903 - 501)));
  1140.                             }
  1141.                             Keyboard.releaseKey(leftRightUpDown[random3]);
  1142.                         }
  1143.                     } else {
  1144.                         Thread.sleep(javaUtilRandom.nextInt(Math
  1145.                                 .abs(2004 - 198)));
  1146.                     }
  1147.                 }
  1148.             } catch (final Exception e) {
  1149.             }
  1150.         }
  1151.     }
  1152.  
  1153.     /**
  1154.      * Multi-threaded Java garbage collector. Removes un-used GameObjects loaded in
  1155.      * the RAM. version 1.00
  1156.      *
  1157.      * @Author Ubuntu4life
  1158.      */
  1159.     class garbageCollector extends Thread {
  1160.         private volatile boolean stopThread = false;
  1161.  
  1162.         @Override
  1163.         public void run() {
  1164.             while (!stopThread && Game.isLoggedIn()) {
  1165.                 try {
  1166.                     if (random(0, 450) == 1) {
  1167.                         final Runtime runtime = Runtime.getRuntime();
  1168.                         runtime.gc();
  1169.                     }
  1170.                     Thread.sleep(random(1000, 1500));
  1171.                 } catch (final InterruptedException e) {
  1172.                 }
  1173.             }
  1174.         }
  1175.     }
  1176.  
  1177.    
  1178.  
  1179.     private final RenderingHints renderHints = new RenderingHints(
  1180.             RenderingHints.KEY_TEXT_ANTIALIASING,
  1181.             RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
  1182.  
  1183.     private final Color color1 = new Color(0, 0, 0, 205);
  1184.     private final Color color2 = new Color(0, 255, 255);
  1185.     private final Color color3 = new Color(0, 255, 255, 230);
  1186.  
  1187.     private final BasicStroke stroke1 = new BasicStroke(1);
  1188.  
  1189.     private final Font font1 = new Font("Arial", 0, 20);
  1190.     private final Font font2 = new Font("Arial", 0, 14);
  1191.  
  1192.  
  1193.     @Override
  1194.     public void onRepaint(Graphics g) {
  1195.      
  1196.       long millis = System.currentTimeMillis() - startTime;
  1197.       long hours = millis / (1000 * 60 * 60);
  1198.       millis -= hours * (1000 * 60 * 60);
  1199.       long minutes = millis / (1000 * 60);
  1200.       millis -= minutes * (1000 * 60);
  1201.       long seconds = millis / 1000;
  1202.      
  1203.       experienceGained = Skills.getExperience(Skills.FISHING) - startExperience;
  1204.      
  1205.       float xpsec = 0;
  1206.       if (minutes > 0 || hours > 0 || seconds > 0 && experienceGained > 0){
  1207.       xpsec = ((float) experienceGained /(float)(seconds + (minutes * 60) + (hours * 60 * 60)));
  1208.       }
  1209.       float xpmin = xpsec * 60;
  1210.       float xphour = xpmin * 60;
  1211.      
  1212.       float timeTNLhour = 0;
  1213.       timeTNLhour = (float) Skills.getExperienceToLevel(Skills.FISHING + 1)/(float)xphour;
  1214.  
  1215.       float timeTNLmin = timeTNLhour*60;
  1216.       float timeTNLsec = timeTNLmin*60;
  1217.  
  1218.       float estimatedHour = timeTNLsec/3600;
  1219.       float tempminutes = timeTNLsec%3600;
  1220.       float estimatedMinutes = tempminutes/60;
  1221.       float estimatedSeconds = tempminutes%60;
  1222.      
  1223.         Graphics2D g2 = (Graphics2D) g;
  1224.         g2.setRenderingHints(renderHints);
  1225.         g.setColor(color1);
  1226.         g.fillRoundRect(6, 344, 509, 129, 16, 16);
  1227.         g.setColor(color2);
  1228.         ((Graphics2D) g).setStroke(stroke1);
  1229.         g.drawRoundRect(6, 344, 509, 129, 16, 16);
  1230.         g.setFont(font1);
  1231.         g.setColor(color3);
  1232.         g.drawString("Fuser AIO Fisher", 175, 371);
  1233.         g.setFont(font2);
  1234.         g.drawString("Run Time: " + hours + ":" + minutes + ":" + seconds, 18, 391);
  1235.         g.drawString("Time To Level: " + (int) estimatedHour + ":" + (int) estimatedMinutes + " :" + (int) estimatedSeconds, 18, 417);
  1236.         g.drawString("Status: " + Status, 18, 442);
  1237.         g.drawString("Experience Gained: " + (int) experienceGained, 267, 391);
  1238.         g.drawString("Experience Per/Hr: " + (int) xphour, 267, 417);
  1239.         g.drawString("Fish Caught: " + fishesCaught, 267, 442);
  1240.         MousePaint.Draw(g2);
  1241.     }
  1242.  
  1243.     public void MouseClicked(MouseEvent MouseEvent) {
  1244.        
  1245.     }
  1246.  
  1247.     public void sendToURL(String url) {
  1248.         try {
  1249.             java.awt.Desktop.getDesktop().browse(java.net.URI.create(url));
  1250.         } catch (Exception exception) {
  1251.             log("Error:" + exception.getLocalizedMessage());
  1252.         }
  1253.     }
  1254.  
  1255.     public void MouseEntered(MouseEvent e) {
  1256.     }
  1257.  
  1258.     public void MouseExited(MouseEvent e) {
  1259.     }
  1260.  
  1261.     public void MousePressed(MouseEvent e) {
  1262.     }
  1263.  
  1264.     public void MouseReleased(MouseEvent e) {
  1265.     }
  1266.  
  1267.     /**
  1268.      * Official Mouse paint. Version 1.00
  1269.      *
  1270.      * @author ExoCode
  1271.      *
  1272.      */
  1273.     public class MousePaint {
  1274.  
  1275.         public int waveSize = 0;
  1276.  
  1277.         @SuppressWarnings({ "serial" })
  1278.         public class MousePathPoint extends Point {
  1279.  
  1280.             private long finishTime;
  1281.             private double lastingTime;
  1282.  
  1283.             public MousePathPoint(int x, int y, int lastingTime) {
  1284.                 super(x, y);
  1285.                 this.lastingTime = lastingTime;
  1286.                 finishTime = System.currentTimeMillis() + lastingTime;
  1287.             }
  1288.  
  1289.             public boolean isUp() {
  1290.                 return System.currentTimeMillis() > finishTime;
  1291.             }
  1292.         }
  1293.  
  1294.         public double getRot(int ticks) {
  1295.             return (System.currentTimeMillis() % (360 * ticks)) / ticks;
  1296.         }
  1297.  
  1298.         public LinkedList<MousePathPoint> MousePath = new LinkedList<MousePathPoint>();
  1299.  
  1300.         public void drawTrail(Graphics g) {
  1301.             Graphics2D g2 = (Graphics2D) g;
  1302.             g2.setStroke(new BasicStroke(1));
  1303.             while (!MousePath.isEmpty() && MousePath.peek().isUp()) {
  1304.                 MousePath.remove();
  1305.             }
  1306.             Point clientCursor = Mouse.getLocation();
  1307.             MousePathPoint mpp = new MousePathPoint(clientCursor.x,
  1308.                     clientCursor.y, 250);
  1309.             if (MousePath.isEmpty() || !MousePath.getLast().equals(mpp)) {
  1310.                 MousePath.add(mpp);
  1311.             }
  1312.             MousePathPoint lastPoint = null;
  1313.             for (MousePathPoint a : MousePath) {
  1314.                 if (lastPoint != null) {
  1315.                     long mpt = System.currentTimeMillis()
  1316.                             - Mouse.getPressTime();
  1317.                     if (Mouse.getPressTime() == -1 || mpt >= 250) {
  1318.                         g2.setColor(Color.GREEN);
  1319.                     }
  1320.                     if (mpt < 250) {
  1321.                         g2.setColor(Color.RED);
  1322.                     }
  1323.                     g2.drawLine(a.x, a.y, lastPoint.x, lastPoint.y);
  1324.                 }
  1325.                 lastPoint = a;
  1326.             }
  1327.         }
  1328.  
  1329.         public void drawMouse(Graphics g) {
  1330.             Graphics2D g2 = (Graphics2D) g;
  1331.             g2.setRenderingHints(new RenderingHints(
  1332.                     RenderingHints.KEY_ANTIALIASING,
  1333.                     RenderingHints.VALUE_ANTIALIAS_ON));
  1334.             g2.setStroke(new BasicStroke(3));
  1335.             g2.setColor(Color.BLACK);
  1336.             g2.drawOval(Mouse.getLocation().x - 13, Mouse.getLocation().y - 13,
  1337.                     25, 25);
  1338.             g2.setStroke(new BasicStroke(1));
  1339.             g2.setColor(new Color(0, 0, 0, 114));
  1340.             g2.fillOval(Mouse.getLocation().x - 13, Mouse.getLocation().y - 13,
  1341.                     25, 25);
  1342.             Point MouseLocation = Mouse.getLocation();
  1343.             long mpt = System.currentTimeMillis() - Mouse.getPressTime();
  1344.             g2.rotate(Math.toRadians(getRot(5)), Mouse.getLocation().x,
  1345.                     Mouse.getLocation().y);
  1346.             if (Mouse.getPressTime() == -1 || mpt >= 250) {
  1347.                 g2.setColor(Color.GREEN);
  1348.                 g2.drawLine(MouseLocation.x - 5, MouseLocation.y,
  1349.                         MouseLocation.x + 5, MouseLocation.y);
  1350.                 g2.drawLine(MouseLocation.x, MouseLocation.y - 5,
  1351.                         MouseLocation.x, MouseLocation.y + 5);
  1352.             }
  1353.             if (mpt < 250) {
  1354.                 g2.setColor(Color.RED);
  1355.                 g2.drawLine(MouseLocation.x - 5, MouseLocation.y,
  1356.                         MouseLocation.x + 5, MouseLocation.y);
  1357.                 g2.drawLine(MouseLocation.x, MouseLocation.y - 5,
  1358.                         MouseLocation.x, MouseLocation.y + 5);
  1359.             }
  1360.         }
  1361.  
  1362.         public void drawWave(Graphics g, Color color) {
  1363.             Graphics2D g2 = (Graphics2D) g;
  1364.             Point MouseLoc = Mouse.getPressLocation();
  1365.             long mpt = System.currentTimeMillis() - Mouse.getPressTime();
  1366.             g2.setRenderingHints(new RenderingHints(
  1367.                     RenderingHints.KEY_ANTIALIASING,
  1368.                     RenderingHints.VALUE_ANTIALIAS_ON));
  1369.             g2.setColor(color);
  1370.             if (mpt < 1000) {
  1371.                 waveSize = (int) (mpt / 7.5);
  1372.             } else {
  1373.                 waveSize = 0;
  1374.             }
  1375.             g2.setStroke(new BasicStroke(3));
  1376.             g2.drawOval(MouseLoc.x - (waveSize / 2), MouseLoc.y
  1377.                     - (waveSize / 2), waveSize, waveSize);
  1378.             g2.drawOval(MouseLoc.x - ((waveSize / 2) / 2), MouseLoc.y
  1379.                     - ((waveSize / 2) / 2), waveSize / 2, waveSize / 2);
  1380.         }
  1381.  
  1382.         public void Draw(Graphics g) {
  1383.             Graphics2D g2 = (Graphics2D) g;
  1384.             g2.setRenderingHints(new RenderingHints(
  1385.                     RenderingHints.KEY_ANTIALIASING,
  1386.                     RenderingHints.VALUE_ANTIALIAS_ON));
  1387.             drawWave(g2, Color.BLACK);
  1388.             drawTrail(g2);
  1389.             drawMouse(g2);
  1390.         }
  1391.     }
  1392.  
  1393.     public interface Condition {
  1394.         public boolean isTrue();
  1395.     }
  1396.  
  1397.     /**
  1398.      * Advanced sleeping method with no Walking involved.
  1399.      *
  1400.      * @Author Ubuntu4life
  1401.      *
  1402.      * @param condition
  1403.      *            The condition under which the script has to sleep.
  1404.      * @param Threshold
  1405.      *            The maximum amount of milliseconds to wait /while/ something
  1406.      *            is not going the way it's supposed to.
  1407.      * @return True when everything went fine.
  1408.      */
  1409.     private boolean sleepWhile(final Condition condition, final int Threshold) {
  1410.         final int Irritations = Threshold / 25;
  1411.         for (int i = 0; i < Irritations && condition.isTrue(); i++) {
  1412.             if (Game.getClientState() != 11) {
  1413.                 i = 0;
  1414.             }
  1415.             sleep(random(20, 30));
  1416.         }
  1417.         return condition.isTrue();
  1418.     }
  1419.  
  1420.     /**
  1421.      * Advanced sleeping method with NPC interaction.
  1422.      *
  1423.      * @Author Ubuntu4life
  1424.      *
  1425.      * @param condition
  1426.      *            The condition under which the script has to sleep. Walking has
  1427.      *            already been included.
  1428.      * @param targetNPC
  1429.      *            The NPC to interact with.
  1430.      * @param Threshold
  1431.      *            The maximum amount of milliseconds to wait /while/ something
  1432.      *            is not going the way it's supposed to.
  1433.      * @return True when everything went fine.
  1434.      */
  1435.     private boolean sleepWhile(final Condition condition,
  1436.             final NPC targetNPC, final int Threshold) {
  1437.         final int Irritations = Threshold / 25;
  1438.         if (!Players.getMyPlayer().isMoving()
  1439.                 && Calculations.distanceTo(targetNPC) >= 2) {
  1440.             final long endTime = System.currentTimeMillis()
  1441.                     + random(1500, 2000);
  1442.             while (System.currentTimeMillis() < endTime) {
  1443.                 if (Players.getMyPlayer().isMoving()) {
  1444.                     break;
  1445.                 }
  1446.                 sleep(random(20, 30));
  1447.             }
  1448.             if (!Players.getMyPlayer().isMoving()) {
  1449.                 return false;
  1450.             }
  1451.         }
  1452.         for (int i = 0; i < Irritations && condition.isTrue(); i++) {
  1453.             if (Players.getMyPlayer().isMoving() || Game.getClientState() != 11) {
  1454.                 i = 0;
  1455.             }
  1456.             sleep(random(20, 30));
  1457.         }
  1458.         return condition.isTrue();
  1459.     }
  1460.  
  1461.     /**
  1462.      * Advanced sleeping method with NPC interaction.
  1463.      *
  1464.      * @Author Ubuntu4life
  1465.      *
  1466.      * @param condition
  1467.      *            The condition under which the script has to sleep. Walking has
  1468.      *            already been included.
  1469.      * @param targetGameObject
  1470.      *            The GameObject to interact with.
  1471.      * @param Threshold
  1472.      *            The maximum amount of milliseconds to wait /while/ something
  1473.      *            is not going the way it's supposed to.
  1474.      * @return True when everything went fine.
  1475.      */
  1476.     private boolean sleepWhile(final Condition condition,
  1477.             final GameObject targetGameObject, final int Threshold) {
  1478.         final int Irritations = Threshold / 25;
  1479.         final int minimalSleepTillMove = 1500;
  1480.         final int MaximalSleepTillMove = 2000;
  1481.         if (!Players.getMyPlayer().isMoving()
  1482.                 && Threshold < (minimalSleepTillMove + MaximalSleepTillMove) / 2) {
  1483.             if (targetGameObject != null) {
  1484.                 if (Calculations.distanceTo(targetGameObject) >= Calculations
  1485.                         .distanceTo(targetGameObject) + 1) {
  1486.                     final long endTime = System.currentTimeMillis()
  1487.                             + random(minimalSleepTillMove, MaximalSleepTillMove);
  1488.                     while (System.currentTimeMillis() < endTime) {
  1489.                         if (Players.getMyPlayer().isMoving()) {
  1490.                             break;
  1491.                         }
  1492.                         sleep(random(20, 30));
  1493.                     }
  1494.                     if (!Players.getMyPlayer().isMoving()) {
  1495.                         return false;
  1496.                     }
  1497.                 }
  1498.             } else {
  1499.                 return false;
  1500.             }
  1501.         }
  1502.         for (int i = 0; i < Irritations && condition.isTrue(); i++) {
  1503.             if (Players.getMyPlayer().isMoving() || Game.getClientState() != 11) {
  1504.                 i = 0;
  1505.             }
  1506.             sleep(random(20, 30));
  1507.         }
  1508.         return condition.isTrue();
  1509.     }
  1510.  
  1511.    
  1512.  
  1513.     /**
  1514.      * Walks to the given tile using the minimap with given randomness. Version
  1515.      * 1.00
  1516.      *
  1517.      * @param Tile
  1518.      *            The tile to walk to.
  1519.      * @param xDeviation
  1520.      *            The maximum deviation in the X dimension from Tile to allow.
  1521.      * @param yDeviation
  1522.      *            The maximum deviation in the Y dimension from Tile to allow.
  1523.      * @return <tt>true</tt> if the tile was clicked; otherwise <tt>false</tt>.
  1524.      *
  1525.      * @Author Ubuntu4life
  1526.      */
  1527.     private boolean walkTile(final Tile Tile, final int xDeviation,
  1528.             final int yDeviation) {
  1529.         final Tile destinationTile = new Tile(Tile.getX()
  1530.                 + random(0, xDeviation), Tile.getY() + random(0, yDeviation));
  1531.         Point targetPoint = Calculations.tileToMinimap(destinationTile);
  1532.         while (!Mouse.getLocation().equals(targetPoint)) {
  1533.             targetPoint = Calculations.tileToMinimap(destinationTile);
  1534.             if (targetPoint.x == -1 || targetPoint.y == -1) {
  1535.                 return false;
  1536.             }
  1537.             moveMouse(20, targetPoint);
  1538.         }
  1539.         Mouse.click(true);
  1540.         return true;
  1541.     }
  1542.  
  1543.     /**
  1544.      * Performs the specified action on a given NPC. Version 1.00
  1545.      *
  1546.      * @param NPC
  1547.      *            The NPC to perform an action on.
  1548.      * @param Action
  1549.      *            the menu item to search and click.
  1550.      * @return returns true if clicked.
  1551.      *
  1552.      * @Author Ubuntu4life
  1553.      */
  1554.     private boolean clickNPC(final NPC NPC, final String Action) {
  1555.         try {
  1556.             Point targetPoint;
  1557.             for (int i = 0; i < 25; i++) {
  1558.                 while (!Menu.contains(Action)) {
  1559.                     if (Players.getMyPlayer().isMoving()) {
  1560.                         targetPoint = NPC.getModel().getCentralPoint();
  1561.                     } else {
  1562.                         targetPoint = NPC.getModel().getPoint();
  1563.                     }
  1564.                     if (!NPC.isOnScreen() || Bank.isOpen()) {
  1565.                         return false;
  1566.                     }
  1567.                     moveMouse(getDelay(targetPoint), targetPoint);
  1568.                 }
  1569.                 if (Menu.contains(Action)) {
  1570.                     Mouse.setSpeed(random(5, 8));
  1571.                     Mouse.click(false);
  1572.                     for (int x = 0; x < 4; x++) {
  1573.                         if (Menu.doAction(Action)) {
  1574.                             return true;
  1575.                         }
  1576.                     }
  1577.                 }
  1578.                 if (Menu.isOpen() && !Menu.contains(Action)) {
  1579.                     do {
  1580.                         Mouse.moveRandomly(random(180, 310));
  1581.                     } while (Menu.isOpen());
  1582.                     i = 0;
  1583.                 }
  1584.             }
  1585.         } catch (final Exception e) {
  1586.         }
  1587.         return false;
  1588.     }
  1589.  
  1590.     /**
  1591.      * Performs the specified action on a given GameObject. Version 1.00
  1592.      *
  1593.      * @param GameObject
  1594.      *            The GameObject to perform an action on.
  1595.      * @param Action
  1596.      *            the menu item to search and click.
  1597.      * @return returns true if clicked.
  1598.      *
  1599.      * @Author Ubuntu4life
  1600.      */
  1601.     private boolean clickGameObject(final GameObject GameObject, final String action) {
  1602.         try {
  1603.             Point targetPoint;
  1604.             for (int i = 0; i < 25; i++) {
  1605.                 while (!Menu.contains(action)) {
  1606.                     if (Players.getMyPlayer().isMoving()) {
  1607.                         targetPoint = GameObject.getModel().getCentralPoint();
  1608.                     } else {
  1609.                         targetPoint = GameObject.getModel().getPoint();
  1610.                     }
  1611.                     if (!GameObject.isOnScreen() || Bank.isOpen()) {
  1612.                         return false;
  1613.                     }
  1614.                     moveMouse(getDelay(targetPoint), targetPoint);
  1615.                 }
  1616.                 final String[] MenuItems = Menu.getItems();
  1617.                 if (MenuItems.length > 0
  1618.                         && MenuItems[0].toLowerCase().startsWith(
  1619.                                 action.toLowerCase())) {
  1620.                     Mouse.click(true);
  1621.                     return true;
  1622.                 } else if (Menu.contains(action)) {
  1623.                     Mouse.setSpeed(random(5, 8));
  1624.                     Mouse.click(false);
  1625.                     for (int x = 0; x < 4; x++) {
  1626.                         if (Menu.doAction(action)) {
  1627.                             return true;
  1628.                         }
  1629.                     }
  1630.                 }
  1631.                 if (!Menu.contains(action) && Menu.isOpen()) {
  1632.                     do {
  1633.                         Mouse.moveRandomly(random(180, 310));
  1634.                     } while (Menu.isOpen());
  1635.                     i = 0;
  1636.                 }
  1637.             }
  1638.         } catch (final Exception e) {
  1639.         }
  1640.         return false;
  1641.     }
  1642.  
  1643.     private double getDelay(final Point p) {
  1644.         final double Distance = Calculations.distanceBetween(Mouse.getLocation(), p);
  1645.         if (Distance > 150) {
  1646.             return 60;
  1647.         } else {
  1648.             if (Distance >= 40) {
  1649.                 return Distance / 4;
  1650.             } else {
  1651.                 return 20;
  1652.             }
  1653.         }
  1654.     }
  1655.  
  1656.     private void moveMouse(final double time, final Point p) {
  1657.         final double endTime = System.currentTimeMillis() + time;
  1658.         while (System.currentTimeMillis() < endTime) {
  1659.             Mouse.move(p, 0, 0);
  1660.         }
  1661.     }
  1662.     /**
  1663.      * @author Alex
  1664.      *
  1665.      * Attacks an npc with the ID you input, will walk if npc isnt in combat and will only attack
  1666.      * if npc isn't already in combat.
  1667.      *
  1668.      * @param npc
  1669.      *       The ID of the npc you wish to attack.
  1670.      */
  1671.     private void attack(int npc){
  1672.       NPC i = NPCs.getNearest(npc);
  1673.       if(i != null){
  1674.         if(i.isOnScreen()){
  1675.           if(!i.isInCombat()){
  1676.             i.interact("Attack");
  1677.             sleep(1200);
  1678.             while(Players.getMyPlayer().isInCombat() || Players.getMyPlayer().isMoving()){
  1679.               sleep(500);
  1680.             }
  1681.           }
  1682.         } else {
  1683.           Walking.walkTileMM(i.getLocation());
  1684.         }
  1685.       }
  1686.     }
  1687.  
  1688.     /**
  1689.      * Extracts images from an external server.
  1690.      *
  1691.      * @return The image.
  1692.      */
  1693.     private Image getImage(final String url) {
  1694.         try {
  1695.             return ImageIO.read(new URL(url));
  1696.         } catch (final IOException e) {
  1697.             return null;
  1698.         }
  1699.     }
  1700.  
  1701.         @Override
  1702.         public void mouseClicked(MouseEvent arg0) {
  1703.                 // TODO Auto-generated method stub
  1704.                
  1705.         }
  1706.  
  1707.         @Override
  1708.         public void mouseEntered(MouseEvent arg0) {
  1709.                 // TODO Auto-generated method stub
  1710.                
  1711.         }
  1712.  
  1713.         @Override
  1714.         public void mouseExited(MouseEvent arg0) {
  1715.                 // TODO Auto-generated method stub
  1716.                
  1717.         }
  1718.  
  1719.         @Override
  1720.         public void mousePressed(MouseEvent arg0) {
  1721.                 // TODO Auto-generated method stub
  1722.                
  1723.         }
  1724.  
  1725.         @Override
  1726.         public void mouseReleased(MouseEvent arg0) {
  1727.                 // TODO Auto-generated method stub
  1728.                
  1729.         }
  1730. }