Himekp

ProFisher

Apr 18th, 2011
25,905
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 33.60 KB | None | 0 0
  1. /* ---- Made by Himekp ----
  2.  * The Current Version is V1.31
  3.  */
  4.  
  5. import org.powerbot.concurrent.Task;
  6. import org.powerbot.concurrent.strategy.Condition;
  7. import org.powerbot.concurrent.strategy.Strategy;
  8. import org.powerbot.game.api.ActiveScript;
  9. import org.powerbot.game.api.Manifest;
  10. import org.powerbot.game.api.util.Filter;
  11. import org.powerbot.game.api.util.Time;
  12. import org.powerbot.game.api.util.Random;
  13. import org.powerbot.game.api.util.Timer;
  14. import org.powerbot.game.api.methods.interactive.Players;
  15. import org.powerbot.game.api.methods.interactive.NPCs;
  16. import org.powerbot.game.api.methods.widget.Camera;
  17. import org.powerbot.game.api.methods.input.Mouse;
  18. import org.powerbot.game.api.methods.tab.Inventory;
  19. import org.powerbot.game.api.methods.Walking;
  20. import org.powerbot.game.api.methods.tab.Skills;
  21. import org.powerbot.game.api.methods.Tabs;
  22. import org.powerbot.game.api.wrappers.interactive.NPC;
  23. import org.powerbot.game.api.wrappers.node.Item;
  24. import org.powerbot.game.api.wrappers.Area;
  25. import org.powerbot.game.api.wrappers.Tile;
  26. import org.powerbot.game.bot.event.MessageEvent;
  27. import org.powerbot.game.bot.event.listener.MessageListener;
  28. import org.powerbot.game.bot.event.listener.PaintListener;
  29. import org.powerbot.game.api.methods.node.SceneEntities;
  30. import org.powerbot.game.api.methods.widget.Bank;
  31.  
  32. import java.awt.BasicStroke;
  33. import java.awt.Color;
  34. import java.awt.Container;
  35. import java.awt.Dimension;
  36. import java.awt.Font;
  37. import java.awt.Graphics;
  38. import java.awt.Graphics2D;
  39. import java.awt.Image;
  40. import java.awt.Insets;
  41. import java.awt.Point;
  42. import java.awt.Rectangle;
  43. import java.awt.event.ActionEvent;
  44. import java.awt.event.ActionListener;
  45. import java.awt.event.MouseEvent;
  46. import java.io.IOException;
  47. import java.net.URL;
  48.  
  49. import javax.imageio.ImageIO;
  50. import javax.swing.*;
  51.  
  52. @Manifest(
  53.         name = "{AIO}ProFisher by Himekp{AIO} V1.31",
  54.         description = "Fish's anything and everywhere!",
  55.         version = 1.31,
  56.         authors = {"Himekp"}, premium = false,
  57.         website = "https://www.powerbot.org/community/topic/678005-aioprofisher-by-himekpaio/")
  58.        
  59. public class ProFisher extends ActiveScript implements PaintListener, MessageListener{
  60.     //Ints
  61.     int FEATHERS = 314;
  62.     int pathtype;
  63.    
  64.     //Ints[]
  65.     int[] sharks = { 322, 313 };
  66.     int[] tuna = { 321, 312, 324 };
  67.     int[] trout = { 317, 328 };
  68.     int[] shrimp = { 320, 327, 323 };
  69.     int[] monk = { 3848, 3848 };
  70.     int[] fishingspots = { 322, 313, 321, 312, 324, 317, 328, 320, 327, 323, 3848, 3848 };
  71.     int[] fishingAnim = { 622, 623, 621, 619, 618, 620, 5108, 9980, 6708, 14723, 6711, 10617 };
  72.     int[] bankers = { 2213, 49018, 2012, 2019, 2015, 26972 };
  73.     int[] NPCBanker = { 11267, 499, 3824 };
  74.     int[] FISH_SPOT;
  75.    
  76.     //Stings
  77.     String status = "";
  78.     String FISH_TYPE = "";
  79.     String TypeofFish = "";
  80.     String Location = "";
  81.     String Banking = "";  
  82.     String type = "";
  83.     String statusmessage = "";
  84.     String method = "";
  85.    
  86.     //Booleans
  87.     boolean BANK = true;
  88.     boolean NPCBankers = false;
  89.     boolean atBankSpot;
  90.     boolean atFishingSpot;
  91.     boolean atFishingSpot2;
  92.     boolean atFishingSpot3;
  93.    
  94.     //Paths
  95.     Tile BankTile;
  96.     Tile FishTile;
  97.    
  98.     //Paint Ints
  99.     int startLevel;
  100.     int XPgained;
  101.     int XPhour;
  102.     int FishCaught = 0;
  103.     int levelsgained = 0;
  104.     int mouseSpeed;
  105.     int EXPgained = 0;
  106.     int EXPperhour = 0;
  107.     int MoneyGained = 0;
  108.     int FishCaughtperhour = 0;
  109.     int loadsCaught = 0;
  110.     int timetilllevel = 0;
  111.     int currentLevel = 0;
  112.     long startTime = System.currentTimeMillis();
  113.     long currentXP;
  114.     long startingXP;
  115.    
  116.     //GUI Stuff
  117.     JFrame gui = new ProFisherGUI();
  118.  
  119.     //Filters
  120.     private final Filter<NPC> FishFilter = new Filter<NPC>() {
  121.         public boolean accept(NPC npc) {
  122.             for (int id : FISH_SPOT) {
  123.                 if (npc.getId() == id) {
  124.                     return true;
  125.                 }
  126.             }
  127.             return false;
  128.         }
  129.     };
  130.    
  131.     //Areas
  132.     public boolean atdraynorBank() {
  133.         Area area = new Area(new Tile(3090,3239, 0), new Tile(3095, 3246, 0));
  134.         return area.contains(Players.getLocal().getLocation());
  135.     }
  136.    
  137.     public boolean atguildBank() {
  138.         Area area = new Area(new Tile(2583, 3419, 0), new Tile(2588, 3425, 0));
  139.         return area.contains(Players.getLocal().getLocation());
  140.     }
  141.    
  142.     public boolean atkaramjaBank() {
  143.         Area area = new Area(new Tile(2848, 3141, 0), new Tile(2853, 3146, 0));
  144.         return area.contains(Players.getLocal().getLocation());
  145.     }
  146.    
  147.     public boolean atbarbBank() {
  148.         Area area = new Area(new Tile(3091, 3487, 0), new Tile(3099, 3498, 0));
  149.         return area.contains(Players.getLocal().getLocation());
  150.     }
  151.    
  152.     public boolean atcatherbyBank() {
  153.         Area area = new Area(new Tile(2805, 3437, 0), new Tile(2816, 3443, 0));
  154.         return area.contains(Players.getLocal().getLocation());
  155.     }
  156.    
  157.     public boolean atcolonyBank() {
  158.         Area area = new Area(new Tile(2326,3685, 0), new Tile(2331, 3692, 0));
  159.         return area.contains(Players.getLocal().getLocation());
  160.     }
  161.    
  162.     public boolean atshiloBank() {
  163.         Area area = new Area(new Tile(2849, 2951, 0), new Tile(2856, 2958, 0));
  164.         return area.contains(Players.getLocal().getLocation());
  165.     }
  166.    
  167.     public boolean atDraynor() {
  168.         Area area = new Area(new Tile(3083,3223, 0), new Tile(3087, 3235, 0));
  169.         return area.contains(Players.getLocal().getLocation());
  170.     }
  171.  
  172.     public boolean atGuild() {
  173.         Area area = new Area(new Tile(2595,3405, 0), new Tile(2621, 3445, 0));
  174.         return area.contains(Players.getLocal().getLocation());
  175.     }
  176.    
  177.     public boolean atColony() {
  178.         Area area = new Area(new Tile(2300,3695, 0), new Tile(2355, 3711, 0));
  179.         return area.contains(Players.getLocal().getLocation());
  180.     }
  181.    
  182.     public boolean atMonk1() {
  183.         Area area = new Area(new Tile(2340,3687, 0), new Tile(2355, 3711, 0));
  184.         return area.contains(Players.getLocal().getLocation());
  185.     }
  186.    
  187.     public boolean atMonk2() {
  188.         Area area = new Area(new Tile(2321,3687, 0), new Tile(2339, 3711, 0));
  189.         return area.contains(Players.getLocal().getLocation());
  190.     }
  191.    
  192.     public boolean atMonk3() {
  193.         Area area = new Area(new Tile(2300,3687, 0), new Tile(2319, 3711, 0));
  194.         return area.contains(Players.getLocal().getLocation());
  195.     }
  196.    
  197.     public boolean atShilo1() {
  198.         Area area = new Area(new Tile(2838,2948, 0), new Tile(2878, 2984, 0));
  199.         return area.contains(Players.getLocal().getLocation());
  200.     }
  201.    
  202.     public boolean atShilo2() {
  203.         Area area = new Area(new Tile(2817,2948, 0), new Tile(2837, 2977, 0));
  204.         return area.contains(Players.getLocal().getLocation());
  205.     }
  206.    
  207.     public boolean atFishing1() {
  208.         Area area = new Area(new Tile(2592,3419, 0), new Tile(2604, 3425, 0));
  209.         return area.contains(Players.getLocal().getLocation());
  210.     }
  211.  
  212.     public boolean atFishing2() {
  213.         Area area = new Area(new Tile(2590,3405, 0), new Tile(2611, 3424, 0));
  214.         return area.contains(Players.getLocal().getLocation());
  215.     }
  216.    
  217.     public boolean atKaramja() {
  218.         Area area = new Area(new Tile(2917,3172, 0), new Tile(2928, 3183, 0));
  219.         return area.contains(Players.getLocal().getLocation());
  220.     }
  221.    
  222.     public boolean atBarb() {
  223.         Area area = new Area(new Tile(3100,3422, 0), new Tile(3109, 3434, 0));
  224.         return area.contains(Players.getLocal().getLocation());
  225.     }
  226.    
  227.     public boolean atCatherby() {
  228.         Area area = new Area(new Tile(2833, 3414, 0), new Tile(2863, 3440, 0));
  229.         return area.contains(Players.getLocal().getLocation());
  230.     }
  231.    
  232.     public boolean atShilo() {
  233.         Area area = new Area(new Tile(2817, 2966, 0), new Tile(2868, 2983, 0));
  234.         return area.contains(Players.getLocal().getLocation());
  235.     }
  236.    
  237.    
  238.     //Path Tiles
  239.     Tile gotocolonybank = new Tile(2330, 3689, 0);
  240.     Tile gotodraynorbank = new Tile(3092, 3242, 0);
  241.     Tile gotoguildbank = new Tile(2585, 3422, 0);
  242.     Tile gotokaramjabank = new Tile(2852, 3143, 0);
  243.     Tile gotobarbbank = new Tile(3092, 3490, 0);
  244.     Tile gotocatherbybank = new Tile(2809, 3441, 0);
  245.     Tile gotoshilobank = new Tile(2851, 2956, 0);
  246.    
  247.     Tile gotocolony = new Tile(2336, 3699, 0);
  248.     Tile gotodraynor = new Tile(3086, 3232, 0);
  249.     Tile gotoguild = new Tile(2600, 3421, 0);
  250.     Tile gotokaramja = new Tile(2924, 3176, 0);
  251.     Tile gotobarb = new Tile(3108, 3433, 0);
  252.     Tile gotocatherby = new Tile(2839, 3435, 0);
  253.     Tile gotoshilo = new Tile(2855, 2971, 0);  
  254.          
  255.     //Setup
  256.     @Override protected void setup() {
  257.         log.info("Welcome to Himekp's AIO ProFisher! V1.31!");
  258.         log.info("Please post how the walking goes!!");
  259.         startingXP = Skills.getExperience(Skills.FISHING);
  260.         gui.setVisible(true);
  261.         final Working working = new Working();
  262.         final Fish fish = new Fish();
  263.         final WalkBank walkbank = new WalkBank();
  264.         final BankItems bankitems = new BankItems();
  265.         final WalkSpot walkspot = new WalkSpot();
  266.         final Drop drop = new Drop();
  267.         final BankNPCBankers banknpcbankers = new BankNPCBankers();
  268.         provide(new Strategy(working, working));
  269.         provide(new Strategy(fish, fish));
  270.         provide(new Strategy(walkbank, walkbank));
  271.         provide(new Strategy(bankitems, bankitems));
  272.         provide(new Strategy(walkspot, walkspot));
  273.         provide(new Strategy(drop, drop));
  274.         provide(new Strategy(banknpcbankers, banknpcbankers));
  275.     }
  276.    
  277.     //Script!  
  278.     private class WalkBank extends Strategy implements Task, Condition {
  279.         public boolean validate() {
  280.             return Inventory.getCount() == 28 && !atBankSpot && BANK == true;
  281.         }
  282.        
  283.         public void run() {
  284.             status = "Walking to Bank!";
  285.             Walking.walk(BankTile);
  286.         }
  287.     }  
  288.    
  289.     private class WalkSpot extends Strategy implements Task {
  290.         public boolean validate() {
  291.             return Inventory.getCount() < 28 && (!atFishingSpot || !atFishingSpot2 || !atFishingSpot3) && BANK == true;
  292.         }
  293.        
  294.         public void run() {    
  295.             status = "Walking to Fishing Spot!";
  296.             Walking.walk(FishTile);
  297.  
  298.         }
  299.     }
  300.    
  301.    
  302.    
  303.     private class Fish extends Strategy implements Task, Condition {
  304.         public boolean validate() {
  305.             return Inventory.getCount() != 28 && Players.getLocal().getAnimation() == -1 && (atFishingSpot || atFishingSpot2 || atFishingSpot3);
  306.         }
  307.        
  308.         public void run() {
  309.             Tabs.INVENTORY.open();
  310.             status = "Fishing";
  311.             NPC FishSpot = NPCs.getNearest(FishFilter);
  312.             if (!FishSpot.isOnScreen()) {  
  313.                 Camera.turnTo(FishSpot);
  314.             }
  315.             if (FishSpot.getLocation().interact(FISH_TYPE)) {
  316.                 Time.sleep(5000);
  317.             }
  318.             Time.sleep(Random.nextInt(100, 300));
  319.         }    
  320.     }
  321.    
  322.     private class BankNPCBankers extends Strategy implements Task, Condition {
  323.         public boolean validate() {
  324.             return Inventory.getCount() == 28 && atBankSpot && NPCBankers == true;
  325.         }
  326.        
  327.         public void run() {
  328.             NPC NPCbanker = NPCs.getNearest(NPCBanker);
  329.             status = type + "with" + statusmessage + "!";
  330.             if (NPCbanker.isOnScreen()) {
  331.                 NPCbanker.interact(method);
  332.                 Time.sleep(Random.nextInt(1000, 2000));
  333.                 loadsCaught +=1;
  334.                 if (Location.equals("Shilo Village") || Location.equals("Fishing Colony")) {
  335.                     if(Bank.isOpen()) {
  336.                         Bank.depositInventory();
  337.                         Bank.close();
  338.                     }
  339.                 }
  340.             }
  341.             else if (!NPCbanker.isOnScreen()) {
  342.                 final Tile path = NPCbanker.getLocation();
  343.                 if (Walking.walk(path)){
  344.                     Time.sleep(50);
  345.                 }
  346.             }
  347.         }
  348.     }
  349.    
  350.     private class Drop extends Strategy implements Task, Condition {
  351.         public boolean validate() {
  352.             return Inventory.getCount() == 28 && BANK == false && NPCBankers == false;
  353.         }
  354.        
  355.         public void run() {
  356.             status = "Dropping Items";
  357.             Item[] items = Inventory.getItems();
  358.             for(Item i : items) {
  359.                 if(i != null) {
  360.                     if(i.getId() == FEATHERS) {
  361.                         i.getWidgetChild().interact("Drop");
  362.                         Time.sleep(Random.nextInt(75, 150));
  363.                         loadsCaught +=1;
  364.                     }
  365.                 }  
  366.             }
  367.         }
  368.     }
  369.    
  370.     private class BankItems extends Strategy implements Task, Condition {
  371.         public boolean validate() {
  372.             return Inventory.getCount() == 28 && atBankSpot && BANK == true && NPCBankers == false;
  373.         }
  374.        
  375.         public void run() {
  376.             status = "Banking";
  377.             if (SceneEntities.getNearest(bankers).isOnScreen()) {
  378.                 if(Bank.isOpen()) {
  379.                     Bank.depositInventory();
  380.                     Bank.close();
  381.                 } else {
  382.                     Bank.open();
  383.                     Time.sleep(2000);
  384.                 }
  385.             }
  386.             else if (!SceneEntities.getNearest(bankers).isOnScreen()) {
  387.                 final Tile path = SceneEntities.getNearest(bankers).getLocation();
  388.                 if (Walking.walk(path)){
  389.                     Time.sleep(50);
  390.                 }
  391.             }
  392.         }
  393.     }
  394.    
  395.     private class Working extends Strategy implements Task, Condition {
  396.         public boolean validate() {
  397.             return Players.getLocal().getAnimation() != -1;
  398.         }
  399.        
  400.         public void run() {
  401.             for (int i : fishingAnim) {
  402.                 final Timer wTimer = new Timer(3000);
  403.                 while (Players.getLocal().getAnimation() == i || wTimer.getRemaining() != 0) {
  404.                     int randomNumber = Random.nextInt(1, 633);
  405.                     if (randomNumber <= 20) {
  406.                         status = "Antiban";
  407.                         Time.sleep(Random.nextInt(500, 800));
  408.                         if (randomNumber == 1) {
  409.                             randomTab();
  410.                         }
  411.                         if (randomNumber == 2) {
  412.                             Camera.setPitch(Random.nextInt(0, 180));
  413.                             Time.sleep(Random.nextInt(500, 1300));
  414.                         }
  415.                         if (randomNumber == 3) {
  416.                             Time.sleep(Random.nextInt(100, 200));
  417.                             Mouse.move(Random.nextInt(50, 700), Random.nextInt(50, 450), 2, 2);
  418.                             Camera.setAngle(Random.nextInt(1, 360));
  419.                             Mouse.move(Random.nextInt(50, 700), Random.nextInt(50, 450), 2, 2);
  420.                         }
  421.                         if (randomNumber == 4) {
  422.                             Players.getLocal().hover();
  423.                         }
  424.                         if (randomNumber == 5) {
  425.                         Time.sleep(Random.nextInt(700, 14000));
  426.                         }
  427.                         if (randomNumber == 6) {
  428.                             Camera.setAngle(Random.nextInt(0, 360));
  429.                             Time.sleep(Random.nextInt(500, 1300));
  430.                         }
  431.                         if (randomNumber == 7) {  
  432.                             Time.sleep(Random.nextInt(800, 13500));
  433.                         }
  434.                         if (randomNumber == 8) {
  435.                             Mouse.move(163, 111, 150, 150);
  436.                         }
  437.                         if (randomNumber == 9) {
  438.                             Mouse.move(163, 111, 150, 150);
  439.                         }
  440.                         if (randomNumber == 10) {
  441.                             Mouse.move(702, 280, 23, 12);
  442.                             Time.sleep(Random.nextInt(1300, 5000));
  443.                         }
  444.                         if (randomNumber == 11) {  
  445.                             Camera.setAngle(Random.nextInt(0, 360));
  446.                             Time.sleep(Random.nextInt(450, 650));
  447.                         }
  448.                         if (randomNumber == 12) {
  449.                             Players.getLocal().hover();
  450.                         }
  451.                         if (randomNumber == 13) {
  452.                             Time.sleep(Random.nextInt(100, 200));
  453.                             Mouse.move(Random.nextInt(50, 700), Random.nextInt(50, 450), 2, 2);
  454.                             Camera.setPitch(Random.nextInt(1, 180));
  455.                             Mouse.move(Random.nextInt(50, 700), Random.nextInt(50, 450), 2, 2);
  456.                         }
  457.                         if (randomNumber == 14) {
  458.                             Time.sleep(Random.nextInt(100, 200));
  459.                             Mouse.move(Random.nextInt(50, 700), Random.nextInt(50, 450), 2, 2);
  460.                             Camera.setAngle(Random.nextInt(1, 360));
  461.                             Mouse.move(Random.nextInt(50, 700), Random.nextInt(50, 450), 2, 2);
  462.                         }
  463.                         if (randomNumber == 15) {  
  464.                             Time.sleep(Random.nextInt(700, 14000));
  465.                         }
  466.                         if (randomNumber == 16) {
  467.                             Camera.setAngle(Random.nextInt(0, 360));
  468.                             Time.sleep(Random.nextInt(450, 650));
  469.                         }
  470.                         if (randomNumber == 17) {
  471.                             Camera.setAngle(Random.nextInt(0, 360));
  472.                             Time.sleep(Random.nextInt(450, 650));
  473.                         }
  474.                         if (randomNumber == 18) {
  475.                             Camera.setAngle(Random.nextInt(0, 360));
  476.                             Time.sleep(Random.nextInt(450, 650));
  477.                         }
  478.                         if (randomNumber == 19) {
  479.                             Camera.setAngle(Random.nextInt(0, 360));
  480.                             Time.sleep(Random.nextInt(450, 650));
  481.                         }
  482.                         if (randomNumber == 20) {
  483.                             Camera.setAngle(Random.nextInt(0, 360));
  484.                             Time.sleep(Random.nextInt(450, 650));
  485.                         }
  486.                     }
  487.                     if (Tabs.getCurrent() != Tabs.INVENTORY) {
  488.                         Tabs.INVENTORY.open();         
  489.                     }
  490.                     if(Inventory.getItem().getId() == 24154 || Inventory.getItem().getId() == 24155) {
  491.                         Inventory.getItem().getWidgetChild().click(true);              
  492.                     }
  493.                 }
  494.             }
  495.         }
  496.        
  497.         public void randomTab() {
  498.             int randomNumber = Random.nextInt(1, 15);
  499.             if (randomNumber <= 13) {
  500.                 status = "Antiban - RandomTab";
  501.                 if (randomNumber == 1) {
  502.                     Tabs.ATTACK.open();
  503.                     Time.sleep(Random.nextInt(600, 1200));
  504.                     int random = Random.nextInt(1, 3);
  505.                     if (random == 1) {
  506.                         Mouse.move(642, 336, 90, 120);
  507.                         Time.sleep(Random.nextInt(800, 1400));
  508.                     } else {
  509.                         Time.sleep(Random.nextInt(1300, 3200));
  510.                     }
  511.                 }
  512.                 if (randomNumber == 2) {
  513.                     Tabs.EQUIPMENT.open();
  514.                     Time.sleep(Random.nextInt(600, 1200));
  515.                     int random = Random.nextInt(1, 3);
  516.                     if (random == 1) {
  517.                         Mouse.move(642, 336, 90, 120);
  518.                         Time.sleep(Random.nextInt(800, 1400));
  519.                     } else {
  520.                         Time.sleep(Random.nextInt(1300, 3200));
  521.                     }
  522.                 }
  523.                 if (randomNumber == 3) {
  524.                     Tabs.INVENTORY.open();
  525.                     Time.sleep(Random.nextInt(600, 1200));
  526.                     int random = Random.nextInt(1, 3);
  527.                     if (random == 1) {
  528.                         Mouse.move(642, 336, 90, 120);
  529.                         Time.sleep(Random.nextInt(800, 1400));
  530.                     } else {
  531.                         Time.sleep(Random.nextInt(1300, 3200));
  532.                     }
  533.                 }
  534.                 if (randomNumber == 4) {
  535.                     Tabs.MAGIC.open();
  536.                     Time.sleep(Random.nextInt(600, 1200));
  537.                     int random = Random.nextInt(1, 3);
  538.                     if (random == 1) {
  539.                         Mouse.move(642, 336, 90, 120);
  540.                         Time.sleep(Random.nextInt(800, 1400));
  541.                     } else {
  542.                         Time.sleep(Random.nextInt(1300, 3200));
  543.                     }
  544.                 }
  545.                 if (randomNumber == 5) {
  546.                     Tabs.STATS.open();
  547.                     Time.sleep(Random.nextInt(600, 1200));
  548.                     int random = Random.nextInt(1, 3);
  549.                     if (random == 1) {
  550.                         Mouse.move(642, 336, 90, 120);
  551.                         Time.sleep(Random.nextInt(800, 1400));
  552.                     } else {
  553.                         Time.sleep(Random.nextInt(1300, 3200));
  554.                     }
  555.                 }
  556.                 if (randomNumber == 6) {
  557.                     Tabs.QUESTS.open();
  558.                     Time.sleep(Random.nextInt(600, 1200));
  559.                     int random = Random.nextInt(1, 3);
  560.                     if (random == 1) {
  561.                         Mouse.move(642, 336, 90, 120);
  562.                         Time.sleep(Random.nextInt(800, 1400));
  563.                     } else {
  564.                         Time.sleep(Random.nextInt(1300, 3200));
  565.                     }
  566.                 }
  567.                 if (randomNumber == 7) {
  568.                     Tabs.PRAYER.open();
  569.                     Time.sleep(Random.nextInt(600, 1200));
  570.                     int random = Random.nextInt(1, 3);
  571.                     if (random == 1) {
  572.                         Mouse.move(642, 336, 90, 120);
  573.                         Time.sleep(Random.nextInt(800, 1400));
  574.                     } else {
  575.                         Time.sleep(Random.nextInt(1300, 3200));
  576.                     }
  577.                 }
  578.                 if (randomNumber == 8) {
  579.                     Tabs.MUSIC.open();
  580.                     Time.sleep(Random.nextInt(600, 1200));
  581.                     int random = Random.nextInt(1, 3);
  582.                     if (random == 1) {
  583.                         Mouse.move(642, 336, 90, 120);
  584.                         Time.sleep(Random.nextInt(800, 1400));
  585.                     } else {
  586.                         Time.sleep(Random.nextInt(1300, 3200));
  587.                     }
  588.                 }
  589.                 if (randomNumber == 9) {
  590.                     Tabs.TASK_LIST.open();
  591.                     Time.sleep(Random.nextInt(600, 1200));
  592.                     int random = Random.nextInt(1, 3);
  593.                     if (random == 1) {
  594.                         Mouse.move(642, 336, 90, 120);
  595.                         Time.sleep(Random.nextInt(800, 1400));
  596.                     } else {
  597.                         Time.sleep(Random.nextInt(1300, 3200));
  598.                     }
  599.                 }
  600.                 if (randomNumber == 10) {
  601.                     Tabs.FRIENDS.open();
  602.                     Time.sleep(Random.nextInt(600, 1200));
  603.                     int random = Random.nextInt(1, 3);
  604.                     if (random == 1) {
  605.                         Mouse.move(642, 336, 90, 120);
  606.                         Time.sleep(Random.nextInt(800, 1400));
  607.                     } else {
  608.                         Time.sleep(Random.nextInt(1300, 3200));
  609.                     }
  610.                 }
  611.                 if (randomNumber == 11) {
  612.                     Tabs.CLAN_CHAT.open();
  613.                     Time.sleep(Random.nextInt(600, 1200));
  614.                     int random = Random.nextInt(1, 3);
  615.                     if (random == 1) {
  616.                         Mouse.move(642, 336, 90, 120);
  617.                         Time.sleep(Random.nextInt(800, 1400));
  618.                     } else {
  619.                         Time.sleep(Random.nextInt(1300, 3200));
  620.                     }
  621.                 }
  622.                 if (randomNumber == 12) {
  623.                     Tabs.FRIENDS_CHAT.open();
  624.                     Time.sleep(Random.nextInt(600, 1200));
  625.                     int random = Random.nextInt(1, 3);
  626.                     if (random == 1) {
  627.                         Mouse.move(642, 336, 90, 120);
  628.                         Time.sleep(Random.nextInt(800, 1400));
  629.                     } else {
  630.                         Time.sleep(Random.nextInt(1300, 3200));
  631.                     }
  632.                 }
  633.                 if (randomNumber == 13) {
  634.                     Tabs.STATS.open();
  635.                     Time.sleep(Random.nextInt(600, 1200));
  636.                     int random = Random.nextInt(1, 3);
  637.                     if (random == 1) {
  638.                         Mouse.move(642, 336, 90, 120);
  639.                         Time.sleep(Random.nextInt(800, 1400));
  640.                     } else {
  641.                         Time.sleep(Random.nextInt(1300, 3200));
  642.                     }
  643.                 }
  644.             }
  645.         }  
  646.     }  
  647.  
  648.     public class ProFisherGUI extends JFrame {
  649.         private static final long serialVersionUID = 1L;
  650.         public ProFisherGUI() {
  651.             initComponents();
  652.         }
  653.  
  654.         private void button1ActionPerformed(ActionEvent e) {
  655.                 TypeofFish = FishBox.getSelectedItem().toString();
  656.                 Location = LocationBox.getSelectedItem().toString();
  657.                 Banking = BankBox.getSelectedItem().toString();
  658.                 if (TypeofFish.equals("Shark")) {
  659.                     FISH_SPOT = sharks;
  660.                     FISH_TYPE = "Harpoon";
  661.                 }
  662.                 if (TypeofFish.equals("Monkfish")) {
  663.                     FISH_SPOT = monk;
  664.                     FISH_TYPE = "Net";
  665.                 }
  666.                 if (TypeofFish.equals("Lobster")) {
  667.                     FISH_SPOT = tuna;
  668.                     FISH_TYPE = "Cage";
  669.                 }
  670.                 if (TypeofFish.equals("Tuna/Swordfish")) {
  671.                     FISH_SPOT = tuna;
  672.                     FISH_TYPE = "Harpoon";
  673.                 }
  674.                 if (TypeofFish.equals("Pike")) {
  675.                     FISH_SPOT = trout;
  676.                     FISH_TYPE = "Bait";
  677.                 }
  678.                 if (TypeofFish.equals("Salmom/Trout")) {
  679.                     FISH_SPOT = trout;
  680.                     FISH_TYPE = "Lure";
  681.                 }
  682.                 if (TypeofFish.equals("Herring/Sardine")) {
  683.                     FISH_SPOT = shrimp;
  684.                     FISH_TYPE = "Bait";
  685.                 }
  686.                 if (TypeofFish.equals("Shrimp")) {
  687.                     FISH_SPOT = shrimp;
  688.                     FISH_TYPE = "Net";
  689.                 }
  690.                 if (Location.equals("Catherby")) {
  691.                     atBankSpot = atcatherbyBank();
  692.                     atFishingSpot = atCatherby();
  693.                     BankTile = gotocatherbybank;
  694.                     FishTile = gotocatherby;
  695.                 }
  696.                 if (Location.equals("Draynor")) {
  697.                     atBankSpot = atdraynorBank();
  698.                     atFishingSpot = atDraynor();
  699.                     BankTile = gotodraynorbank;
  700.                     FishTile = gotodraynor;
  701.                 }
  702.                 if (Location.equals("Barbarian Village")) {
  703.                     atBankSpot = atbarbBank();
  704.                     atFishingSpot = atBarb();
  705.                     BankTile = gotobarbbank;
  706.                     FishTile = gotobarb;
  707.                 }
  708.                 if (Location.equals("Karamja")) {
  709.                     atBankSpot = atkaramjaBank();
  710.                     atFishingSpot = atKaramja();
  711.                     BankTile = gotokaramjabank;
  712.                     FishTile = gotokaramja;
  713.                     type = "Exchange";
  714.                     statusmessage = "Stiles";
  715.                     method = "Exchange";
  716.                 }
  717.                 if (Location.equals("Fishing Guild")) {
  718.                     atBankSpot = atguildBank();
  719.                     atFishingSpot = atFishing1();
  720.                     atFishingSpot2 = atFishing2();
  721.                     BankTile = gotoguildbank;
  722.                     FishTile = gotoguild;
  723.                 }
  724.                 if (Location.equals("Shilo Village")) {
  725.                     atBankSpot = atshiloBank();
  726.                     atFishingSpot = atShilo1();
  727.                     atFishingSpot2 = atShilo2();
  728.                     BankTile = gotoshilobank;
  729.                     FishTile = gotoshilo;
  730.                     type = "Banking";
  731.                     statusmessage = "Bankers";
  732.                     method = "Bank";
  733.                 }
  734.                 if (Location.equals("Fishing Colony")) {
  735.                     atBankSpot = atcolonyBank();
  736.                     atFishingSpot = atMonk1();
  737.                     atFishingSpot2 = atMonk2();
  738.                     atFishingSpot3 = atMonk3();
  739.                     BankTile = gotocolonybank;
  740.                     FishTile = gotocolony;
  741.                     type = "Banking";
  742.                     statusmessage = "Bankers";
  743.                     method = "Bank";
  744.                 }
  745.                 if (Banking.equals("Drop")) {
  746.                     BANK = false;
  747.                 }
  748.                 if (Location.equals("Karamja") || Location.equals("Fishing Colony") || Location.equals("Shilo Village")) {
  749.                     NPCBankers = true;
  750.                 }
  751.                 gui.setVisible(false);
  752.                 gui.dispose();
  753.         }
  754.  
  755.         private void initComponents() {
  756.             // JFormDesigner - Component initialization - DO NOT MODIFY  //GEN-BEGIN:initComponents
  757.             FishBox = new JComboBox();
  758.             LocationBox = new JComboBox();
  759.             BankBox = new JComboBox();
  760.             ProFisher = new JLabel();
  761.             Himekp = new JLabel();
  762.             panel1 = new JPanel();
  763.             label1 = new JLabel();
  764.             label2 = new JLabel();
  765.             label3 = new JLabel();
  766.             button1 = new JButton();
  767.            
  768.             //======== this ========
  769.             setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
  770.             setTitle("ProFisher by Himekp");
  771.             Container contentPane = getContentPane();
  772.             contentPane.setLayout(null);
  773.            
  774.             contentPane.add(FishBox);
  775.             FishBox.setBounds(15, 135, 120, FishBox.getPreferredSize().height);
  776.             FishBox.setModel(new DefaultComboBoxModel(new String[] {
  777.                                                 "Shrimp", "Herring/Sardine", "Salmon/Trout",
  778.                                                 "Pike", "Tuna/Swordfish", "Lobster", "Monkfish",
  779.                                                 "Shark"
  780.             }));
  781.             contentPane.add(LocationBox);
  782.             LocationBox.setBounds(15, 90, 120, LocationBox.getPreferredSize().height);
  783.             LocationBox.setModel(new DefaultComboBoxModel(new String[] {
  784.                                                 "Draynor", "Barbarian Village", "Karamja",
  785.                                                 "Catherby", "Fishing Guild", "Shilo Village",
  786.                                                 "Fishing Colony"
  787.             }));
  788.             contentPane.add(BankBox);
  789.             BankBox.setBounds(15, 180, 120, BankBox.getPreferredSize().height);
  790.             BankBox.setModel(new DefaultComboBoxModel(new String[] {
  791.                                                 "Bank", "Drop"
  792.             }));
  793.  
  794.             //---- ProFisher ----
  795.             ProFisher.setText("ProFisher");
  796.             ProFisher.setFont(new Font("Baveuse", Font.BOLD, 28));
  797.             contentPane.add(ProFisher);
  798.             ProFisher.setBounds(10, 5, 220, 55);
  799.  
  800.             //---- Himekp ----
  801.             Himekp.setText("By: Himekp");
  802.             Himekp.setFont(new Font("Baveuse", Font.BOLD, 24));
  803.             contentPane.add(Himekp);
  804.             Himekp.setBounds(new Rectangle(new Point(45, 45), Himekp.getPreferredSize()));
  805.  
  806.             //======== panel1 ========
  807.             {
  808.                 // JFormDesigner evaluation mark
  809.                 panel1.setBorder(new javax.swing.border.CompoundBorder(
  810.                     new javax.swing.border.TitledBorder(new javax.swing.border.EmptyBorder(0, 0, 0, 0),
  811.                     "JFormDesigner Evaluation", javax.swing.border.TitledBorder.CENTER,
  812.                     javax.swing.border.TitledBorder.BOTTOM, new java.awt.Font("Dialog", java.awt.Font.BOLD, 12),
  813.                     java.awt.Color.red), panel1.getBorder()));
  814.                 panel1.addPropertyChangeListener(new java.beans.PropertyChangeListener(){
  815.                     public void propertyChange(java.beans.PropertyChangeEvent e){
  816.                         if("border".equals(e.getPropertyName()))
  817.                             throw new RuntimeException();
  818.                     }
  819.                 });
  820.                 panel1.setLayout(null);
  821.  
  822.                 { // compute preferred size
  823.                     Dimension preferredSize = new Dimension();
  824.                     for(int i = 0; i < panel1.getComponentCount(); i++) {
  825.                         Rectangle bounds = panel1.getComponent(i).getBounds();
  826.                         preferredSize.width = Math.max(bounds.x + bounds.width, preferredSize.width);
  827.                         preferredSize.height = Math.max(bounds.y + bounds.height, preferredSize.height);
  828.                     }
  829.                     Insets insets = panel1.getInsets();
  830.                     preferredSize.width += insets.right;
  831.                     preferredSize.height += insets.bottom;
  832.                     panel1.setMinimumSize(preferredSize);
  833.                     panel1.setPreferredSize(preferredSize);
  834.                 }
  835.             }
  836.             contentPane.add(panel1);
  837.             panel1.setBounds(new Rectangle(new Point(0, 0), panel1.getPreferredSize()));
  838.  
  839.             //---- label1 ----
  840.             label1.setText("Location:");
  841.             contentPane.add(label1);
  842.             label1.setBounds(new Rectangle(new Point(15, 75), label1.getPreferredSize()));
  843.  
  844.             //---- label2 ----
  845.             label2.setText("Type of Fish:");
  846.             contentPane.add(label2);
  847.             label2.setBounds(new Rectangle(new Point(15, 120), label2.getPreferredSize()));
  848.  
  849.             //---- label3 ----
  850.             label3.setText("Banking:");
  851.             contentPane.add(label3);
  852.             label3.setBounds(new Rectangle(new Point(15, 165), label3.getPreferredSize()));
  853.  
  854.             //---- button1 ----
  855.             button1.setText("Start");
  856.             contentPane.add(button1);
  857.             button1.setBounds(140, 90, 75, 115);
  858.             button1.addActionListener(new ActionListener() {
  859.             public void actionPerformed(ActionEvent e) {
  860.                 button1ActionPerformed(e);
  861.             }
  862.         });
  863.         { // compute preferred size
  864.                 Dimension preferredSize = new Dimension();
  865.                 for(int i = 0; i < contentPane.getComponentCount(); i++) {
  866.                     Rectangle bounds = contentPane.getComponent(i).getBounds();
  867.                     preferredSize.width = Math.max(bounds.x + bounds.width, preferredSize.width);
  868.                     preferredSize.height = Math.max(bounds.y + bounds.height, preferredSize.height);
  869.                 }
  870.                 Insets insets = contentPane.getInsets();
  871.                 preferredSize.width += insets.right;
  872.                 preferredSize.height += insets.bottom;
  873.                 contentPane.setMinimumSize(preferredSize);
  874.                 contentPane.setPreferredSize(preferredSize);
  875.             }
  876.             pack();
  877.             setLocationRelativeTo(getOwner());
  878.             // JFormDesigner - End of component initialization  //GEN-END:initComponents
  879.         }
  880.         // JFormDesigner - Variables declaration - DO NOT MODIFY  //GEN-BEGIN:variables
  881.         private JComboBox FishBox;
  882.         private JComboBox LocationBox;
  883.         private JComboBox BankBox;
  884.         private JLabel ProFisher;
  885.         private JLabel Himekp;
  886.         private JPanel panel1;
  887.         private JLabel label1;
  888.         private JLabel label2;
  889.         private JLabel label3;
  890.         private JButton button1;
  891.         // JFormDesigner - End of variables declaration  //GEN-END:variables
  892.     }
  893.    
  894.     //Paint
  895.     private Image getImage(String url) {
  896.         try {
  897.             return ImageIO.read(new URL(url));
  898.         } catch(IOException e) {
  899.             return null;
  900.         }
  901.     }
  902.  
  903.     private final Color color1 = new Color(0, 0, 153, 137);
  904.     private final Color color2 = new Color(0, 0, 0);
  905.    
  906.     private final Color color4 = new Color(0, 0, 0);
  907.     private final Color color5 = new Color(255, 255, 255);
  908.  
  909.     private final BasicStroke stroke2 = new BasicStroke(1);
  910.  
  911.     private final Font font3 = new Font("Arial", 0, 12);
  912.     private final Font font4 = new Font("Harlow Solid Italic", 1, 32);
  913.     private final Font font5 = new Font("Harlow Solid Italic", 0, 20);
  914.  
  915.     private final Image img1 = getImage("http://img98.imageshack.us/img98/6577/banners3.jpg");
  916.     private final Image img2 = getImage("http://images.wikia.com/runescape/images/c/c3/Raw_lobster_detail.png");
  917.    
  918.     private final Font font6 = new Font("Arial", 0, 13);
  919.     private final Color color7 = new Color(0, 0, 0);
  920.  
  921.     private final BasicStroke stroke1 = new BasicStroke(1);
  922.    
  923.     Rectangle closeButton = new Rectangle(400, 7, 111, 27);
  924.     boolean showPaint = true;
  925.     Color buttonColor = new Color(0, 0, 102, 163);
  926.     Color black = new Color(0, 0, 0);
  927.    
  928.     public void onRepaint(Graphics g1) {
  929.         Graphics2D g = (Graphics2D)g1;
  930.         g.setColor(buttonColor);
  931.         g.fillRect(closeButton.x, closeButton.y, closeButton.width, closeButton.height);
  932.         g.setColor(black);
  933.         g.setStroke(stroke1);
  934.         g.drawRect(closeButton.x, closeButton.y, closeButton.width, closeButton.height);
  935.         if(showPaint){
  936.             long runTime = 0;
  937.             long seconds = 0;
  938.             long minutes = 0;
  939.             long hours = 0;
  940.             runTime = System.currentTimeMillis() - startTime;
  941.             seconds = runTime / 1000;
  942.             if (seconds >= 60) {
  943.                 minutes = seconds / 60;
  944.                 seconds -= (minutes * 60);
  945.             }
  946.             if (minutes >= 60) {
  947.                 hours = minutes / 60;
  948.                 minutes -= (hours * 60);
  949.             }
  950.             currentXP = Skills.getExperience(Skills.FISHING);
  951.             final int EXPperhour = (int) ((currentXP - startingXP) * 3600000.0 / runTime);
  952.             final int EXPgained = (int) (currentXP - startingXP);
  953.             currentLevel = Skills.getLevel(Skills.FISHING);
  954.             FishCaughtperhour = (int) ((FishCaught) * 3600000.0 / runTime);
  955.             final int percent = Skills.getExperience(Skills.FISHING);
  956.             g.drawString("Percent till next level: ", 560, 450);
  957.             g.setColor(Color.red);
  958.             g.fillRoundRect(560, 450, 100, 10, 15, 15);
  959.             g.setColor(Color.green);
  960.             g.fillRoundRect(560, 450, percent, 10, 15, 15);
  961.             g.setColor(Color.black);
  962.             g.drawString("" + percent + "%" , 603, 460);
  963.             g.setColor(color1);
  964.             g.fillRect(6, 345, 505, 128);
  965.             g.setColor(color4);
  966.             g.setStroke(stroke2);
  967.             g.drawImage(img1, 6, 346, null);
  968.             g.drawImage(img2, 9, 309, null);
  969.             g.setFont(font3);
  970.             g.setColor(color5);
  971.             g.drawString("Fish Caught : "  + FishCaught, 219, 436);
  972.             g.setColor(color2);
  973.             g.drawString("Fish Caught : "  + FishCaught, 218, 435);
  974.             g.setColor(color5);
  975.             g.drawString("Exp Gained : "  + EXPgained, 219, 399);
  976.             g.setColor(color2);
  977.             g.drawString("Exp Gained : "  + EXPgained, 218, 398);
  978.             g.setColor(color5);
  979.             g.drawString("Exp Per Hour : "  + EXPperhour, 219, 418);
  980.             g.setColor(color2);
  981.             g.drawString("Exp Per Hour : "  + EXPperhour, 218, 417);
  982.             g.setColor(color5);
  983.             g.drawString("Run Time : "  + hours + ":" + minutes + ":" + seconds, 219, 364);
  984.             g.setColor(color2);
  985.             g.drawString("Run Time : "  + hours + ":" + minutes + ":" + seconds, 218, 363);
  986.             g.setColor(color5);
  987.             g.drawString("Fish Caught / Hour : "  + FishCaughtperhour, 219, 453);
  988.             g.setColor(color2);
  989.             g.drawString("Fish Caught / Hour : "  + FishCaughtperhour, 218, 452);
  990.             g.setColor(color5);
  991.             g.drawString("Current Level : "  + currentLevel + "(" + levelsgained + ")", 219, 381);
  992.             g.setColor(color2);
  993.             g.drawString("Current Level : "  + currentLevel + "(" + levelsgained + ")", 218, 380);
  994.             g.setFont(font4);
  995.             g.setColor(color7);
  996.             g.drawString("ProFisher", 31, 379);
  997.             g.setColor(color5);
  998.             g.drawString("ProFisher", 28, 376);
  999.             g.setColor(color7);
  1000.             g.setFont(font5);
  1001.             g.drawString("By: Himekp", 104, 401);
  1002.             g.setColor(color5);
  1003.             g.drawString("By: Himekp", 101, 398);
  1004.             g.setColor(color5);
  1005.             g.setFont(font6);
  1006.             g.drawString("Show / Hide Paint", 405, 25);
  1007.             g.setColor(color5);
  1008.             g.drawString("Status : " + status, 219, 470);
  1009.             g.setColor(color2);
  1010.             g.drawString("Status : " + status, 218, 469);
  1011.             } else {
  1012.             g.setColor(color5);
  1013.             g.setFont(font6);
  1014.             g.drawString("Show / Hide Paint", 405, 25);
  1015.             }
  1016.             Point p = new Point(Mouse.getX(),Mouse.getY());
  1017.             g.setColor(Color.RED);
  1018.             g.drawLine(0, p.y, 800, p.y);
  1019.             g.drawLine(p.x, 0, p.x, 800);
  1020.             g.setColor(Color.BLUE);
  1021.     }
  1022.    
  1023.     Point p;
  1024.     public void mouseClicked(MouseEvent e){
  1025.         p = e.getPoint();
  1026.         if(closeButton.contains(p)){
  1027.         showPaint = !showPaint;
  1028.         }
  1029.     }
  1030.    
  1031.     public void messageReceived(MessageEvent message) {
  1032.         String x = message.getMessage().toString().toLowerCase();
  1033.         if (x.contains("you catch a")){
  1034.             FishCaught +=1;
  1035.         }
  1036.         if (x.contains("you catch some")){
  1037.             FishCaught +=1;
  1038.         }
  1039.         if (x.contains("two")){
  1040.             FishCaught +=2;
  1041.         }        
  1042.         if (x.contains("You've just advanced a")){
  1043.             levelsgained++;
  1044.         }
  1045.     }
  1046. }
Advertisement
Add Comment
Please, Sign In to add comment