Guest User

New fisher

a guest
Feb 17th, 2012
73
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import java.awt.BasicStroke;
  2. import java.awt.Color;
  3. import java.awt.Container;
  4. import java.awt.Dimension;
  5. import java.awt.Font;
  6. import java.awt.Graphics;
  7. import java.awt.Graphics2D;
  8. import java.awt.Image;
  9. import java.awt.Insets;
  10. import java.awt.Point;
  11. import java.awt.Rectangle;
  12. import java.awt.RenderingHints;
  13. import java.awt.event.KeyEvent;
  14. import java.io.IOException;
  15. import java.lang.reflect.InvocationTargetException;
  16. import java.net.URL;
  17. import javax.imageio.ImageIO;
  18. import javax.swing.*;
  19.  
  20. import com.rarebot.event.events.MessageEvent;
  21. import com.rarebot.event.listeners.MessageListener;
  22. import com.rarebot.event.listeners.PaintListener;
  23. import com.rarebot.script.Script;
  24. import com.rarebot.script.ScriptManifest;
  25. import com.rarebot.script.methods.Equipment;
  26. import com.rarebot.script.methods.Skills;
  27. import com.rarebot.script.util.Timer;
  28. import com.rarebot.script.util.WindowUtil;
  29. import com.rarebot.script.wrappers.RSArea;
  30. import com.rarebot.script.wrappers.RSComponent;
  31. import com.rarebot.script.wrappers.RSItem;
  32. import com.rarebot.script.wrappers.RSNPC;
  33. import com.rarebot.script.wrappers.RSObject;
  34. import com.rarebot.script.wrappers.RSPlayer;
  35. import com.rarebot.script.wrappers.RSTile;
  36. import java.text.NumberFormat;
  37.  
  38. @SuppressWarnings("deprecation")
  39.  
  40. @ScriptManifest(authors = "Patyfatycake", name = "patyFisherBeta",description ="Fixed GUI version + Urn release", version = 4.2, website = "http://www.powerbot.org/vb/showthread.php?t=656864")
  41. public class patyFisherBeta extends Script implements PaintListener,MessageListener {
  42.  
  43. /*************************************************************************************
  44. * *
  45. * Fishing section *
  46. * *
  47. *************************************************************************************/
  48. final NumberFormat nf = NumberFormat.getInstance();
  49. long currentXP;
  50. long startingXP;
  51. int startingLevel;
  52. int currentLevel;
  53. int levelsgained;
  54. int currentStrLevel;
  55. int fishesCaught = 0;
  56. int runEnergy=100;
  57. String Status = "Waiting for GUI";
  58. String Bank = "";
  59. boolean doneGUI = false;
  60. Timer antiBanTimer = new Timer(random(60000,100000));
  61. private static int[] xpTable = { 0, 0, 83, 174, 276, 388, 512, 650, 801, 969, 1154, 1358, 1584,
  62. 1833, 2107, 2411, 2746, 3115, 3523, 3973, 4470, 5018, 5624, 6291, 7028, 7842, 8740, 9730,
  63. 10824, 12031, 13363, 14833, 16456, 18247, 20224, 22406, 24815, 27473, 30408, 33648, 37224,
  64. 41171, 45529, 50339, 55649, 61512, 67983, 75127, 83014, 91721, 101333, 111945, 123660,
  65. 136594, 150872, 166636, 184040, 203254, 224466, 247886, 273742, 302288, 333804, 368599,
  66. 407015, 449428, 496254, 547953, 605032, 668051, 737627, 814445, 899257, 992895, 1096278,
  67. 1210421, 1336443, 1475581, 1629200, 1798808, 1986068, 2192818, 2421087, 2673114, 2951373,
  68. 3258594, 3597792, 3972294, 4385776, 4842295, 5346332, 5902831, 6517253, 7195629, 7944614,
  69. 8771558, 9684577, 10692629, 11805606, 13034431 };
  70. private static int[] gamesNeck = {3867,3865,3863,3861,3859,3857,3855,3853};
  71. // Locations
  72.  
  73. private static RSTile draynorFishingSpot = new RSTile(3086,3233);
  74. private static RSTile barbarianVillageFishingSpot = new RSTile(3098,3436);
  75. private static RSTile karamjaFishingSpot = new RSTile(2924,3180);
  76. private static RSTile shiloVillageFishingSpot = new RSTile(2857,2971);
  77. private static RSTile catherbyFishingSpot = new RSTile(2839,3433);
  78. private static RSTile livingRockFishingSpot = new RSTile(3612,5112);
  79. private static RSTile lumbridgeFishingSpot = new RSTile(3242,3241);
  80. private static RSTile livingRockCavernFishingSpot = new RSTile(3649,5086);
  81. private static RSTile crayfishFishingSpot = new RSTile(3258,3205);
  82. private static RSTile ottosFishingSpot = new RSTile(2499,3506);
  83. private static RSTile piscariousFishingSpot = new RSTile(2338,3700);
  84. private static RSTile stilesTile = new RSTile(2851, 3142);
  85. private static RSTile fishingGuildFishingSpot = new RSTile(2599,3421);
  86. private static RSTile rasoloFishingSpot = new RSTile(2533,3413);
  87. RSTile closestBank;
  88.  
  89.  
  90.  
  91.  
  92. private static RSTile[] toRasolo = new RSTile[]{new RSTile(2538,3408),new RSTile(2539,3417),new RSTile(2534,3421),
  93. new RSTile(2533,3428),new RSTile(2534,3433),new RSTile(2536,3440)};
  94.  
  95. private static RSTile[] rasoloToFishingSpot = new RSTile[]{new RSTile(2535,3431),new RSTile(2535,3423),
  96. new RSTile(2535,3415)};
  97.  
  98. private static RSTile[] lumbridgeBankGroundFloor = new RSTile[]{ new RSTile(3242,3241),
  99. new RSTile (3247,3233), new RSTile(3242,3226), new RSTile(3232,3220), new RSTile(3221,3219),
  100. new RSTile(3215,3216), new RSTile(3207,3210)
  101. };
  102. private static RSTile[] lumbridgeFishingSpotPath = new RSTile[]{new RSTile(3207,3210),
  103. new RSTile(3215,3216), new RSTile(3221,3219),new RSTile(3232,3220),
  104. new RSTile(3242,3226),new RSTile (3247,3233) ,new RSTile(3243,3240)
  105. };
  106. private static RSTile[] karamjaStiles = new RSTile[]{new RSTile(2921,3173),new RSTile(2912,3172), new RSTile(2901,3168),
  107. new RSTile(2899,3159), new RSTile(2893,3153), new RSTile(2886,3146), new RSTile(2876,3144),
  108. new RSTile(2868,3148), new RSTile(2858,3145), new RSTile(2851,3142)};
  109. private static RSTile[] karamjaStilesSafePath = new RSTile[]{
  110. new RSTile(2919, 3176), new RSTile(2911, 3172),
  111. new RSTile(2899, 3165), new RSTile(2894, 3154),
  112. new RSTile(2885, 3146), new RSTile(2873, 3147),
  113. new RSTile(2861, 3146), new RSTile(2851, 3142)};
  114.  
  115. private static RSTile[] stilesKaramja = new RSTile[]{new RSTile(2851,3142),new RSTile(2858,3145),new RSTile(2868,3148),
  116. new RSTile(2876,3144),new RSTile(2886,3146),new RSTile(2893,3153),new RSTile(2899,3159),
  117. new RSTile(2901,3168),new RSTile(2912,3172),new RSTile(2921,3173)};
  118. private static RSTile[] draynorToShip = new RSTile[]{new RSTile(3086,3249),new RSTile(3077,3253), new RSTile(3073,3264),
  119. new RSTile(3072,3272), new RSTile(3062,3272), new RSTile(3058,3264), new RSTile(3054,3253),
  120. new RSTile(3045,3246), new RSTile(3042,3236), new RSTile(3032,3236),new RSTile(3028,3227),
  121. new RSTile(3028,3220)};
  122. private static RSTile[] shipToKaramjaFishingSpot = new RSTile[]{new RSTile(2946,3146),new RSTile(2936,3147),
  123. new RSTile(2923,3152), new RSTile(2917,3152), new RSTile(2920,3163), new RSTile(2924,3169),
  124. new RSTile(2925,3178)};
  125. private static RSTile[] shipToDraynorBank = new RSTile[]{new RSTile(3028,3220),new RSTile(3028,3227),new RSTile(3032,3236),
  126. new RSTile(3032,3236),new RSTile(3042,3236),new RSTile(3045,3246),new RSTile(3054,3253),new RSTile(3058,3264),
  127. new RSTile(3062,3272), new RSTile(3072,3272),new RSTile(3073,3264),new RSTile(3077,3253),new RSTile(3086,3249),
  128. new RSTile(3093,3243)};
  129. private static RSTile[] karamjaFishingSpotToShip = new RSTile[]{new RSTile(2925,3178),new RSTile(2924,3169),
  130. new RSTile(2920,3163),new RSTile(2917,3152),new RSTile(2923,3152),new RSTile(2936,3147),
  131. new RSTile(2946,3146),new RSTile(2952,3146)};
  132. private static RSTile[] exitCabbages = new RSTile[]{new RSTile(3053,3286), new RSTile(3058,3278)
  133. };
  134.  
  135. private static RSTile[] catherbyToFishingSpot = new RSTile[]{new RSTile(2812,3435), new RSTile(2819,3437),
  136. new RSTile(2829,3438), new RSTile(2841,3435), new RSTile(2848,3431), new RSTile(2850,3430)};
  137. private static RSTile[] catherbyFishingSpotToBank = new RSTile[]{new RSTile(2854,3429), new RSTile(2845,3432),
  138. new RSTile(2835,3434), new RSTile(2825,3437), new RSTile(2815,3437), new RSTile(2809,3440)};
  139. private static RSTile[] draynorToFishingSpot = new RSTile[]{new RSTile(3086,3241), new RSTile(3085,3234)};
  140. private static RSTile[] fishingSpotToDraynorBank = new RSTile[]{new RSTile(3083,3236), new RSTile(3087,3244),
  141. new RSTile(3093,3243)};
  142.  
  143. private static RSTile[] edgevilleToBarbarianVillage = new RSTile[]{new RSTile(3095,3485), new RSTile(3100,3478),
  144. new RSTile(3099,3471), new RSTile(3094,3465), new RSTile(3087,3465), new RSTile(3089,3457),
  145. new RSTile(3091,3448), new RSTile(3093,3440), new RSTile(3098,3436), new RSTile(3104,3433)};
  146. private static RSTile[] barbarianVillageToEdgeville = new RSTile[]{new RSTile(3101,3434), new RSTile(3093,3440),
  147. new RSTile(3091,3447), new RSTile(3090,3458), new RSTile(3091,3465), new RSTile(3099,3476),
  148. new RSTile(3094,3485), new RSTile(3094,3491)};
  149. private static RSTile[] piscariousToFishingSpot = new RSTile[]{new RSTile(2333,3698), new RSTile(2340,3697)};
  150. private static RSTile[] fishingSpotToPicarious = new RSTile[]{new RSTile(2340,3696), new RSTile(2331,3698)};
  151.  
  152. private static RSTile[] fishingGuildToBank = new RSTile[]{new RSTile(2598,3412), new RSTile(2594,3421),
  153. new RSTile(2586,3422)};
  154. private static RSTile[] banktoFishingGuild = new RSTile[]{new RSTile(2594,3420), new RSTile(2602,3420)};
  155. private static RSTile[] shiloToBank = new RSTile[]{ new RSTile(2858,2980), new RSTile(2845,2978), new RSTile(2834,2977),
  156. new RSTile(2833,2968), new RSTile(2840,2966), new RSTile(2855,2970), new RSTile(2849,2961), new RSTile(2851,2955)};
  157. private static RSTile[] bankToShilo = new RSTile[]{new RSTile(2850,2961), new RSTile(2851,2970)};
  158.  
  159. private static RSTile[] piscariousWest = new RSTile[]{new RSTile(2317,3698), new RSTile(2327,3697),
  160. new RSTile(2330,3689)
  161. };
  162. private static RSTile[] piscariousEast = new RSTile[]{new RSTile(2343,3696), new RSTile(2337,3691),
  163. new RSTile(2329,3690)
  164. };
  165.  
  166. private static RSArea cabbageArea = new RSArea(new RSTile(3043, 3286), new RSTile(3056, 3279));
  167. private static RSArea draynorBankArea = new RSArea(new RSTile(3092,3240), new RSTile(3097,3246));
  168. private static RSArea lumbridgeBankArea = new RSArea(new RSTile(3207,3215), new RSTile(3210,3220));
  169. private static RSArea edgevilleBankArea = new RSArea(new RSTile(3091,3488), new RSTile(3098,3498));
  170. private static RSArea piscariousBankArea = new RSArea(new RSTile(2328,3686) , new RSTile(2332,23693));
  171. private static RSArea shiloBankArea = new RSArea(new RSTile(2849,2951), new RSTile(2854,2957));
  172. private static RSArea fishingGuildBankArea = new RSArea(new RSTile(2585,3420), new RSTile(2587,3424));
  173. private static RSArea fishingGuildFirstPlatform = new RSArea(new RSTile(2597,3419), new RSTile(2605,3426));
  174. private static RSArea fishingGuildSecondPlatform = new RSArea(new RSTile(2062,3407), new RSTile(2612,3416));
  175. private static RSArea catherbyBankArea = new RSArea(new RSTile(2806,3438), new RSTile(2812,3441));
  176.  
  177. private static RSArea gameRoomBelow = new RSArea(new RSTile(2200,4936), new RSTile(2215,4943));
  178. private static RSArea gameRoom = new RSArea(new RSTile(2893,3559), new RSTile(2907,3575));
  179. private static RSArea roguePub = new RSArea(new RSTile(2905,3536), new RSTile(2915,3543));
  180. private static RSArea burthrope = new RSArea(new RSTile(2884,3528),new RSTile(2930,3578));
  181. public static RSArea inRogues = new RSArea(new RSTile(3039,4061), new RSTile(3064,4985));
  182.  
  183.  
  184. // Spot Ids
  185. private static int[] fishingSpotNet = {320,322,323,325,327,3848};
  186. private static int[] fishingSpotBait = {310,317,320,323,327,328,329,};
  187. private static int[] fishingSpotCage = {312,321,324};
  188. private static int[] fishingSpotCrayfish = {6267};
  189. private static int[] fishingSpotHarpoon = {312,321,324};
  190. private static int[] fishingSpotHarpoonShark = {313,322,3848};
  191. private static int[] fishingSpotRockShoal = {8841,8842};
  192. private static int[] fishingSpotBarbarian = {2722};
  193. private static int[] fishingSpotRockTail = {8842};
  194. private static int[] fishingSpotCaveShoal = {8841};
  195.  
  196. private static int[] portSarimBoatPeople = {376,377,378};
  197.  
  198. private static String fishingTypeNet = "Net";
  199. private static String fishingTypeBait = "Bait";
  200. private static String fishingTypeLure = "Lure";
  201. private static String fishingTypeCrayfish ="Cage";
  202. private static String fishingTypeCage = "Cage";
  203. private static String fishingTypeHarpoon = "Harpoon";
  204. private static String fishingTypeBarbarian = "Use-rod";
  205.  
  206. int StripyFeathers = 10087;
  207. int RedFeathers = 10088;
  208. int BlueFeathers = 10089;
  209. int YellowFeathers =10090;
  210. int OrangeFeathers = 10091;
  211.  
  212. private static RSTile karamjaOnBoat = new RSTile(2956,3143);
  213. private static RSTile portSarimOnBoat = new RSTile(3032,3217);
  214. private static RSTile fishingGuildFirstTile = new RSTile(2594,3420);
  215. private static RSTile fishingGuildSecondTile = new RSTile(2603,3406);
  216.  
  217. int fragileUrnID = 20328;
  218. int fragileUrnStartedID = 20329;
  219. int fragileUrnDoneID = 20330;
  220.  
  221. int crackedUrnID = 20322;
  222. int crackedUrnStartedID = 20323;
  223. int crackedUrnDoneID = 20324;
  224.  
  225. int regularCookingUrnID = 20334;
  226. int regularCookingUrnStartedID = 20335;
  227. int regularUrnDoneID = 20336;
  228.  
  229. int decoratedDoneID = 20346;
  230. int decoratedStartedID = 20347;
  231. int decoratedUrnID = 20348;
  232.  
  233. int strongUrnDoneID = 20340;
  234. int strongUrnStartedID = 20341;
  235. int strongUrn = 20342;
  236.  
  237. int urnID = 0;
  238. int urnStartedID = 0;
  239. int urnDoneID = 0;
  240. boolean urnDone = false;
  241. boolean useUrn = false;
  242.  
  243. //Modes, Locations && Types
  244. String fishingType ;
  245. int fishingSecondary = 0;
  246. int fishingMain = 0;
  247. int[] fishingSpot;
  248. boolean powerFish = true;
  249. boolean stiles = false;
  250. boolean f1d1 = false;
  251. boolean dropTuna = false;
  252.  
  253. RSArea bankArea;
  254. RSTile fishingSpotTile;
  255. RSTile[] bankPath;
  256. RSTile[] fishingPath;
  257. String location = "Not set";
  258. boolean handFishing = false;
  259. boolean useRing = false;
  260.  
  261. long startTime = System.currentTimeMillis();
  262. long seconds = 0;
  263. long minutes = 0;
  264. long hours = 0;
  265.  
  266. private static int lumbridgeFloorTwoLadderID = 36775;
  267. private static int lumbridgeFloorOneLadderID = 36774;
  268. private static int lumbridgeFloorZeroLadderID = 36773;
  269.  
  270. private static RSTile floorTwoLadder = new RSTile(3205,3209);
  271. private static RSTile bankTile = new RSTile(3208,3219);
  272.  
  273. //GUI
  274. private javax.swing.JButton BTN_Start;
  275. private javax.swing.JComboBox JCB_CookLocation;
  276. private javax.swing.JComboBox JCB_CookingType;
  277. private javax.swing.JComboBox JCB_FishingType;
  278. private javax.swing.JComboBox JCB_Location;
  279. private javax.swing.JComboBox JCB_Mode;
  280. private javax.swing.JCheckBox JCK_Cooking;
  281. private javax.swing.JCheckBox JCK_DropTuna;
  282. private javax.swing.JCheckBox JCK_UseFire;
  283. private javax.swing.JRadioButton JRB_Fish;
  284. private javax.swing.JRadioButton JRB_Time;
  285. private javax.swing.JTextField JTF_Higher;
  286. private javax.swing.JTextField JTF_Lower;
  287. private javax.swing.JLabel LBL_FishingType;
  288. private javax.swing.JLabel LBL_Location;
  289. private javax.swing.JLabel LBL_Mode;
  290. private javax.swing.JLabel LBL_Title;
  291. private javax.swing.JComboBox JCB_UrnType;
  292. private javax.swing.JLabel LBL_UrnType;
  293.  
  294. @Override
  295. public int loop() {
  296. String returnText = interfaces.get(906)
  297. .getComponent(221)
  298. .getText().toLowerCase();
  299. if (!game.isLoggedIn() || game.isWelcomeScreen() || ( returnText != null && returnText.equals("Logging In - Please Wait")))
  300. {
  301. sleep(1000,1500);
  302. return random(6000,7000);
  303. }
  304. if (game.isLoggedIn()) {
  305.  
  306. if(useUrn){
  307. RSItem item = inventory.getItem(urnDoneID);
  308. if(item != null){
  309. item.doClick(true);
  310. }
  311. }
  312.  
  313.  
  314. if (inventory.isFull() || (!inventory.contains(fishingMain) && !handFishing)
  315. || (fishingSecondary != 0 && !inventory.contains(fishingSecondary))){
  316. if(stiles){
  317. if(inventory.contains(359) && dropTuna){
  318. dropTuna();
  319. }else{
  320. exchangeStiles();
  321. }
  322. }else if(location.equals("Rasolo") && JCB_Mode.getSelectedItem().toString().equals("Sell"))
  323. {
  324. RSNPC rasolo = npcs.getNearest(1972);
  325. RSComponent tradeInterface = interfaces.getComponent(620,0);
  326. if(tradeInterface != null && tradeInterface.isValid())
  327. {
  328. for(int i=0; i < 28 ;i++)
  329. {
  330. RSItem item = inventory.getItemAt(i);
  331. if(item != null && item.getID() != -1 && item.getID() != fishingMain && item.getID() != fishingSecondary &&
  332. item.getID() != 314 && item.getID() != 313 && item.getID() != 995)
  333. {
  334. item.interact("Sell 50");
  335. sleep(1000,1200);
  336. }
  337. }
  338. }else{
  339. if(rasolo != null && rasolo.isOnScreen())
  340. {
  341. Status = "Exchanging fish";
  342. rasolo.interact("Trade");
  343. sleep(1000,1600);
  344. waitUntilNotMoving();
  345. }
  346. else
  347. {
  348. runEnergy();
  349. if(rasolo != null)
  350. {
  351. walking.walkTileMM(rasolo.getLocation());
  352. sleep(800,1000);
  353. waitUntilNotMoving();
  354. }
  355. else
  356. {
  357. runEnergy();
  358. walkPath(toRasolo);
  359. if(getMyPlayer().isMoving())
  360. sleep(random(600,800));
  361. }
  362. }
  363. }
  364.  
  365. }else{
  366. if(inventory.contains(359) && dropTuna)
  367. {
  368. dropTuna();
  369. }
  370. else
  371. {
  372. Status = "Banking";
  373. bank();
  374. }
  375. }
  376. }else{
  377. fish();
  378. }
  379.  
  380. }
  381. return 0;
  382. }
  383.  
  384.  
  385.  
  386. public void exchangeStiles(){
  387. RSNPC Stiles = getClosestNPC(new int[]{11267});
  388. if(Stiles != null && Stiles.isOnScreen()){
  389. Status = "Exchanging fish";
  390. Stiles.doAction("Exchange");
  391. sleep(1000,1600);
  392. waitUntilNotMoving();
  393. }else{
  394. runEnergy();
  395. RSComponent hp = interfaces.getComponent(748,8);
  396. if(hp != null && hp.isValid() && 200 < Integer.parseInt(hp.getText())){
  397. walkPath(karamjaStilesSafePath );
  398. }else{
  399. walkPath(karamjaStiles);
  400. }
  401. if(getMyPlayer().isMoving())
  402. sleep(random(600,800));
  403. }
  404. }
  405.  
  406. public void dropTuna(){
  407. RSItem[] tunas =inventory.getItems(359);
  408. if(tunas != null){
  409. for(RSItem tuna: tunas){
  410. tuna.doAction("Drop");
  411. sleep(200,300);
  412. Timer dropTimer = new Timer(random(1500,2000));
  413. while(dropTimer.isRunning() && tuna != null){
  414. sleep(100,150);
  415. }
  416. }
  417. }
  418.  
  419. }
  420.  
  421. public void fish(){
  422. openInventory();
  423. checkSecondaries();
  424.  
  425. RSNPC fishingNPC = null;
  426.  
  427. if(location.equals("Fishing Guild")){
  428. fishingNPC = getClosestNPCFishingGuild();
  429. }else{
  430. fishingNPC = getClosestNPC(fishingSpot);
  431. }
  432.  
  433. if(fishingNPC == null){
  434. walkToFish();
  435. return;
  436. }
  437.  
  438. if(!fishingNPC.isOnScreen()){
  439. walkTile(fishingNPC.getLocation());
  440. }
  441. if(fishingNPC.isOnScreen()){
  442.  
  443. if(f1d1 == true && inventory.getItemAt(0) != null){
  444. dropFishF1D1();
  445. }else{
  446. if(getMyPlayer().getAnimation() == -1){
  447. if(fishingSpot == fishingSpotHarpoonShark){
  448. exactFishing("Harpoon","Net", fishingNPC);
  449. }else if(fishingNPC.getScreenLocation().x == -1 || fishingNPC.getScreenLocation() == null){
  450. mouse.move(calc.tileToScreen(fishingNPC.getLocation()));
  451. if(menu.getActions() != null && menu.getActions()[0].equals(fishingType)){
  452. mouse.click(calc.tileToScreen(fishingNPC.getLocation()),true);
  453. }else{
  454. if(!menu.isOpen()){
  455. mouse.click(calc.tileToScreen(fishingNPC.getLocation()),false);
  456. sleep(100,150);
  457. }
  458. if(menu.isOpen()){
  459. if(menu.contains(fishingType)){
  460. menu.doAction(fishingType);
  461. waitUntilMoving();
  462. waitUntilNotMoving();
  463. }else{
  464. double x = mouse.getLocation().getX();
  465. double y = mouse.getLocation().getY();
  466. mouse.move((int)random(x-60,x+60),(int)random(y-60,y+60));
  467. }
  468. sleep(300,450);
  469. }
  470. }
  471. }else{
  472. if(fishingNPC.interact(fishingType)){
  473. waitUntilMoving();
  474. waitUntilNotMoving();
  475. }
  476. }
  477. }else{
  478. doAntiBan();
  479. Status = "Fishing";
  480. sleep(random(2000,2500));
  481. }
  482. }
  483. }
  484.  
  485.  
  486. }
  487.  
  488.  
  489. public void doAntiBan(){
  490. if(getMyPlayer().getAnimation() != -1){
  491. if(!antiBanTimer.isRunning()){
  492. antiBan();
  493. antiBanTimer = new Timer(random(60000,100000));
  494. }
  495. }
  496. }
  497.  
  498. public void openInventory(){
  499. if(game.getCurrentTab() != game.TAB_INVENTORY){
  500. log("Opening Inventory");
  501. keyboard.pressKey((char) KeyEvent.VK_F1);
  502. sleep(random(50,200));
  503. keyboard.releaseKey((char) KeyEvent.VK_F1);
  504. sleep(500,600);
  505. }
  506. }
  507.  
  508. public void checkSecondaries(){
  509. if(fishingSecondary != 0 && !inventory.contains(fishingSecondary)){
  510. log("Starting failsafe check for secondarys");
  511. Timer failSafeTimer = new Timer(random(4000,6000));
  512. while(failSafeTimer.isRunning() && !inventory.contains(fishingSecondary)){
  513. if(game.getCurrentTab() != game.TAB_INVENTORY)
  514. {
  515. keyboard.pressKey((char) KeyEvent.VK_F1);
  516. sleep(random(50,200));
  517. keyboard.releaseKey((char) KeyEvent.VK_F1);
  518. sleep(200,400);
  519. }
  520. }
  521. if(!inventory.contains(fishingSecondary)){
  522. log("Detected no secondaries");
  523. game.logout(false);
  524. log("Out of supplies");
  525. stopScript();
  526. }
  527. }
  528. }
  529.  
  530. public void exactFishing(String targetAction, String actionAbove, RSNPC fishingNPC){
  531. mouse.click(fishingNPC.getScreenLocation().getLocation(), false);
  532. sleep(500,600);
  533. if(menu.isOpen()){
  534. String[] menuItems = menu.getItems();
  535. for(int i = 0;i < menuItems.length ; i++){
  536. if(menuItems[i].contains(targetAction)){
  537. if(menuItems[i-1].contains(actionAbove)){
  538. menu.clickIndex(i);
  539. break;
  540. }
  541. }
  542. }
  543. }
  544. }
  545.  
  546.  
  547. public void walkToFish(){
  548. if(location.equals("Lumbridge")){
  549. lumbridgeWalkToFish();
  550. }
  551. else if(location.equals("Karamja")) {
  552. if(stiles){
  553. runEnergy();
  554. walkPath(stilesKaramja);
  555. if(getMyPlayer().isMoving())
  556. sleep(random(600,800));
  557. }
  558. else{
  559. walkToKaramja();
  560. }
  561. }
  562. else{
  563. runEnergy();
  564. walkPath(fishingPath);
  565. }
  566. }
  567.  
  568. public void walkTile(RSTile tile){
  569. if (!getMyPlayer().isMoving() || calc.distanceTo(walking.getDestination()) < 4) {
  570. if(calc.tileOnMap(tile)){
  571. walking.walkTileMM(tile);
  572. }
  573. else{
  574. walking.walkTo(tile);
  575. }
  576. }
  577. }
  578.  
  579.  
  580. public void runEnergy(){
  581. if(walking.getEnergy() > runEnergy && walking.isRunEnabled() == false)
  582. {
  583. walking.setRun(true);
  584. sleep(1200,1500);
  585. runEnergy = random(30,60);
  586. }
  587. }
  588.  
  589. public void lumbridgeBanking(){
  590. if(game.getPlane() == 0)
  591. {
  592. if(calc.distanceTo(walking.getDestination()) < 5)
  593. {
  594. RSObject ladder = objects.getNearest(lumbridgeFloorZeroLadderID);
  595. if(ladder != null)
  596. {
  597. log("I see the ladder");
  598. if(ladder.isOnScreen() && calc.distanceTo(ladder.getLocation()) < 4)
  599. {
  600. ladder.doClick(false);
  601. sleep(500,600);
  602. if(menu.doAction("Climb-up"))
  603. {
  604. Timer failSafe = new Timer(2000);
  605. while(failSafe.isRunning() && game.getPlane() != 2)
  606. {
  607. sleep(100,150);
  608. }
  609. }
  610. sleep(500,600);
  611. while(getMyPlayer().isMoving())
  612. {
  613. sleep(100,150);
  614. }
  615. }
  616. else
  617. {
  618. runEnergy();
  619. walkPath(lumbridgeBankGroundFloor);
  620. sleep(600,700);
  621. while(getMyPlayer().isMoving())
  622. {
  623. sleep(100,150);
  624. }
  625. }
  626. }
  627. else
  628. {
  629. runEnergy();
  630. walkPath(lumbridgeBankGroundFloor);
  631. sleep(600,700);
  632. while(getMyPlayer().isMoving())
  633. {
  634. sleep(100,150);
  635. }
  636. }
  637. }
  638.  
  639. }
  640. else if(game.getPlane() == 1)
  641. {
  642. RSObject ladder = objects.getNearest(lumbridgeFloorOneLadderID);
  643. if(ladder != null)
  644. {
  645. if(ladder.isOnScreen() && calc.distanceTo(ladder.getLocation()) < 4)
  646. {
  647. ladder.doClick(false);
  648. sleep(500,600);
  649. if(menu.doAction("Climb-up"))
  650. {
  651. Timer failSafe = new Timer(2000);
  652. while(failSafe.isRunning() && game.getPlane() != 2)
  653. {
  654. sleep(100,150);
  655. }
  656. }
  657. sleep(500,600);
  658. while(getMyPlayer().isMoving())
  659. {
  660. sleep(100,150);
  661. }
  662. }
  663. else
  664. {
  665. log("Cant see ladder");
  666. walking.walkTo(floorTwoLadder);
  667. sleep(600,700);
  668. while(getMyPlayer().isMoving())
  669. {
  670. sleep(100,150);
  671. }
  672. }
  673. }
  674. }
  675. else if(game.getPlane() == 2)
  676. {
  677. if(lumbridgeBankArea.contains(getMyPlayer().getLocation()))
  678. {
  679. bank.open();
  680. }
  681. else
  682. {
  683. walking.walkTo(new RSTile(random(3207,3209),random(3218,3220)));
  684. sleep(random(600,700));
  685. while(getMyPlayer().isMoving())
  686. {
  687. sleep(random(100,150));
  688. }
  689. }
  690. }
  691. }
  692.  
  693. public void lumbridgeWalkToFish()
  694. {
  695. if(game.getPlane() == 0)
  696. {
  697. if(calc.distanceTo(walking.getDestination()) < 5)
  698. {
  699. runEnergy();
  700. walkPath(lumbridgeFishingSpotPath);
  701. sleep(500,600);
  702. }
  703. }
  704. else if(game.getPlane() == 1)
  705. {
  706. RSObject ladder = objects.getNearest(lumbridgeFloorOneLadderID);
  707.  
  708. if(ladder != null)
  709. {
  710. if(ladder.isOnScreen() && calc.distanceTo(ladder.getLocation()) < 4)
  711. {
  712. ladder.doClick(false);
  713. sleep(500,600);
  714. if(menu.doAction("Climb-down"))
  715. {
  716. Timer failSafe = new Timer(2000);
  717. while(failSafe.isRunning() && game.getPlane() != 2)
  718. {
  719. sleep(100,150);
  720. }
  721. }
  722. sleep(500,600);
  723. while(getMyPlayer().isMoving())
  724. {
  725. sleep(100,150);
  726. }
  727. }
  728. else
  729. {
  730. walking.walkTo(floorTwoLadder);
  731. sleep(600,700);
  732. while(getMyPlayer().isMoving())
  733. {
  734. sleep(100,150);
  735. }
  736. }
  737. }
  738. }
  739. else if(game.getPlane() == 2)
  740. {
  741. RSObject ladder = objects.getNearest(lumbridgeFloorTwoLadderID);
  742.  
  743. if(ladder != null)
  744. {
  745. if(ladder.isOnScreen())
  746. {
  747. if(ladder.doClick(true))
  748. {
  749. Timer failSafe = new Timer(2000);
  750. while(failSafe.isRunning() && game.getPlane() != 1)
  751. {
  752. sleep(100,150);
  753. }
  754. }
  755. sleep(500,600);
  756. while(getMyPlayer().isMoving())
  757. {
  758. sleep(100,150);
  759. }
  760. }
  761. else
  762. {
  763. walking.walkTo(floorTwoLadder);
  764. sleep(500,600);
  765. while(getMyPlayer().isMoving())
  766. {
  767. sleep(100,150);
  768. }
  769. }
  770. }
  771. }
  772. }
  773.  
  774. public void cabbageArea()
  775. {
  776. if(cabbageArea.contains(getMyPlayer().getLocation()))
  777. {
  778. RSObject gate = objects.getNearest(7049,7050);
  779. if(gate != null)
  780. {
  781. if(gate.isOnScreen())
  782. {
  783. gate.doAction("Open");
  784. sleep(1000,1500);
  785. waitUntilNotMoving();
  786. }
  787. else
  788. {
  789. walking.walkTo(gate.getLocation());
  790. sleep(500,700);
  791. waitUntilNotMoving();
  792. }
  793. }
  794. else
  795. {
  796. runEnergy();
  797. walkPath(exitCabbages);
  798. sleep(random(600,800));
  799. }
  800.  
  801. }
  802. }
  803.  
  804.  
  805. public void walkToKaramja()
  806. {
  807. if(getMyPlayer().getLocation().getY() > 3200)
  808. {
  809. RSComponent yesPlease = interfaces.getComponent(228, 2);
  810. if(interfaces.canContinue() || yesPlease.isValid())
  811. {
  812. if(yesPlease.isValid())
  813. {
  814. yesPlease.doClick();
  815. sleep(600,800);
  816. }
  817. else if(interfaces.canContinue())
  818. {
  819. interfaces.clickContinue();
  820. sleep(600,900);
  821. }
  822. }
  823. else
  824. {
  825. RSNPC boatPerson = npcs.getNearest(portSarimBoatPeople);
  826. if(boatPerson != null && boatPerson.isOnScreen())
  827. {
  828. boatPerson.doAction("Pay-Fare");
  829. sleep(1000,1200);
  830. waitUntilNotMoving();
  831. sleep(600);
  832. }
  833. else
  834.  
  835. {
  836. runEnergy();
  837. walkPath(draynorToShip);
  838. sleep(500,600);
  839. }
  840. }
  841.  
  842. }
  843. else
  844. {
  845.  
  846. RSObject karamjaPlank = objects.getNearest(2082);
  847. if(karamjaPlank != null)
  848. {
  849. if(karamjaPlank.isOnScreen())
  850. {
  851. karamjaPlank.doAction("Cross");
  852. sleep(1500,2000);
  853. }
  854. else
  855. {
  856. walking.walkTo(karamjaPlank.getLocation());
  857. waitUntilNotMoving();
  858. }
  859. }
  860. else
  861. {
  862. runEnergy();
  863. walkPath(shipToKaramjaFishingSpot);
  864. sleep(random(600,800));
  865. }
  866. }
  867. }
  868.  
  869. @SuppressWarnings("static-access")
  870. public void walkToBankKaramja()
  871. {
  872. if(getMyPlayer().getLocation().getY() > 3200)
  873. {
  874. RSObject karamjaPlank = objects.getNearest(2084);
  875. if(karamjaPlank != null)
  876. {
  877. if(karamjaPlank.isOnScreen())
  878. {
  879. karamjaPlank.doAction("Cross");
  880. sleep(1500,2000);
  881. }
  882. else
  883. {
  884. walking.walkTo(karamjaPlank.getLocation());
  885. waitUntilNotMoving();
  886. }
  887. }
  888. else
  889. {
  890. if(cabbageArea.contains(getMyPlayer().getLocation()))
  891. {
  892. cabbageArea();
  893. }
  894. else
  895. {
  896. runEnergy();
  897. walkPath(shipToDraynorBank);
  898. sleep(random(600,800));
  899. bank.open();
  900. }
  901. }
  902. }
  903. else
  904. {
  905. if(useRing == true)
  906. {
  907.  
  908. if(game.getCurrentTab() != game.TAB_EQUIPMENT)
  909. {
  910. game.openTab(game.TAB_EQUIPMENT);
  911. sleep(500,600);
  912. }
  913.  
  914. interfaces.get(Equipment.INTERFACE_EQUIPMENT)
  915. .getComponent(Equipment.RING).doAction(
  916. "Cabbage-port");
  917. sleep(1000,1500);
  918. Timer failsafeTimer = new Timer(random(5000,6000));
  919. while(getMyPlayer().getAnimation() == 9984 && failsafeTimer.isRunning())
  920. {
  921. sleep(100,150);
  922. }
  923. sleep(1500,2000);
  924. Timer failsafeTimer2 = new Timer(random(4000,6000) );
  925. while(getMyPlayer().getAnimation() == 9986 && failsafeTimer2.isRunning())
  926. {
  927. sleep(100,150);
  928. }
  929. }
  930. else
  931. {
  932. RSComponent yesPlease = interfaces.getComponent(228, 2);
  933. RSComponent okClick = interfaces.getComponent(228, 3);
  934. RSComponent searchAway = interfaces.getComponent(230, 3);
  935. if(interfaces.canContinue() || yesPlease.isValid() || searchAway.isValid() || okClick.isValid())
  936. {
  937. if(yesPlease.isValid())
  938. {
  939. yesPlease.doClick();
  940. sleep(600,800);
  941. }
  942. else if(searchAway.isValid())
  943. {
  944. searchAway.doClick();
  945. sleep(600,800);
  946. }
  947. else if(okClick.isValid())
  948. {
  949. okClick.doClick();
  950. sleep(600,800);
  951. }
  952. else
  953. {
  954. interfaces.clickContinue();
  955. sleep(600,900);
  956. }
  957. }
  958. else
  959. {
  960. RSNPC customOfficer = npcs.getNearest(380);
  961. if(customOfficer != null)
  962. {
  963. if(customOfficer.isOnScreen())
  964. {
  965. customOfficer.doAction("Pay-Fare");
  966. sleep(500,600);
  967. waitUntilNotMoving();
  968. }
  969. else
  970. {
  971. if(getMyPlayer().getLocation().getX() > 2948 )
  972. {
  973. camera.turnTo(customOfficer.getLocation());
  974. }
  975. else
  976. {
  977. runEnergy();
  978. walkPath(karamjaFishingSpotToShip);
  979. sleep(random(600,800));
  980. }
  981. }
  982. }
  983. else
  984. {
  985. runEnergy();
  986. walkPath(karamjaFishingSpotToShip);
  987. sleep(random(600,800));
  988. }
  989. }
  990.  
  991. }
  992.  
  993. }
  994. }
  995.  
  996. public boolean onFirstPlatform(RSTile tile)
  997. {
  998. if(fishingGuildFirstPlatform.contains(tile))
  999. {
  1000. return true;
  1001. }
  1002.  
  1003. return false;
  1004. }
  1005.  
  1006. public boolean onSecondPlatform(RSTile tile)
  1007. {
  1008. return (fishingGuildSecondPlatform.contains(tile));
  1009. }
  1010.  
  1011. public RSNPC getClosestNPC()
  1012. {
  1013.  
  1014. double closestDistance=9999;
  1015. RSNPC closestNPC = null;
  1016. for(RSNPC npc : npcs.getAll())
  1017. {
  1018. for(int npcID : fishingSpot)
  1019. {
  1020. double npcDistance = 10000;
  1021. if(npc.getID() == npcID)
  1022. {
  1023. npcDistance = calc.distanceTo(npc);
  1024. }
  1025. if(npcDistance < closestDistance)
  1026. {
  1027. closestNPC = npc;
  1028. closestDistance = npcDistance;
  1029. }
  1030. }
  1031. }
  1032. return closestNPC;
  1033. }
  1034.  
  1035. public RSNPC getClosestNPCFishingGuild()
  1036. {
  1037.  
  1038. double closestDistance=9999;
  1039. RSNPC closestNPC = null;
  1040. for(RSNPC npc : npcs.getAll())
  1041. {
  1042. for(int npcID : fishingSpot)
  1043. {
  1044. if(npc.getID() == npcID)
  1045. {
  1046. double npcDistance = 10000;
  1047. if((onFirstPlatform(getMyPlayer().getLocation()) && onFirstPlatform(npc.getLocation()))
  1048. || onSecondPlatform(getMyPlayer().getLocation()) && onSecondPlatform(npc.getLocation()))
  1049. {
  1050. npcDistance = calc.distanceTo(npc.getLocation());
  1051. }
  1052. else if((onFirstPlatform(getMyPlayer().getLocation()) && !onFirstPlatform(npc.getLocation())))
  1053. {
  1054. npcDistance = calc.distanceTo(fishingGuildFirstTile)
  1055. + calc.distanceBetween(fishingGuildFirstTile, fishingGuildSecondTile)
  1056. + calc.distanceBetween(fishingGuildSecondTile, npc.getLocation());
  1057. }
  1058. else if(onSecondPlatform(getMyPlayer().getLocation()) && !onSecondPlatform(npc.getLocation()))
  1059. {
  1060. npcDistance = calc.distanceTo(fishingGuildSecondTile)
  1061. + calc.distanceBetween(fishingGuildSecondTile, fishingGuildFirstTile)
  1062. + calc.distanceBetween(fishingGuildFirstTile, npc.getLocation());
  1063. }
  1064.  
  1065. if(npcDistance < closestDistance)
  1066. {
  1067. closestNPC = npc;
  1068. closestDistance = npcDistance;
  1069. }
  1070. }
  1071. }
  1072.  
  1073. }
  1074. return closestNPC;
  1075. }
  1076.  
  1077. GUI gui;
  1078.  
  1079. @SuppressWarnings("static-access")
  1080. public boolean onStart()
  1081. {
  1082. Status = "Setting up script";
  1083. try {
  1084. try {
  1085. SwingUtilities.invokeAndWait(new Runnable() {
  1086. @Override
  1087. public void run() {
  1088. gui = new GUI();
  1089. WindowUtil.position(gui);
  1090. gui.setVisible(true);
  1091. }
  1092. });
  1093. } catch (InvocationTargetException ex) {
  1094. }
  1095. } catch (InterruptedException e) {
  1096. }
  1097. while (gui.isVisible()) {
  1098. sleep(50);
  1099. }
  1100. gui.dispose();
  1101.  
  1102.  
  1103. runEnergy = random(30,100);
  1104.  
  1105. Status = "Starting up GUI";
  1106.  
  1107. scriptSetup();
  1108. setupUrns();
  1109. usageThread.start();
  1110.  
  1111.  
  1112. return true;
  1113. }
  1114.  
  1115. public void scriptSetup()
  1116. {
  1117. if(JCB_Location.getSelectedItem().toString().equals("Barbarian Village"))
  1118. {
  1119. fishingSpotTile = barbarianVillageFishingSpot;
  1120. bankPath = barbarianVillageToEdgeville;
  1121. bankArea = edgevilleBankArea;
  1122. fishingPath = edgevilleToBarbarianVillage;
  1123. }
  1124. else if(JCB_Location.getSelectedItem().toString().equals("Draynor Village"))
  1125. {
  1126. fishingSpotTile = draynorFishingSpot;
  1127. bankArea = draynorBankArea;
  1128. fishingPath = draynorToFishingSpot;
  1129. bankPath = fishingSpotToDraynorBank;
  1130. }
  1131. else if(JCB_Location.getSelectedItem().toString().equals("Catherby"))
  1132. {
  1133. bankArea = catherbyBankArea;
  1134. fishingSpotTile = catherbyFishingSpot;
  1135. bankPath = catherbyFishingSpotToBank;
  1136. fishingPath = catherbyToFishingSpot;
  1137. }
  1138. else if(JCB_Location.getSelectedItem().toString().equals("Fishing Guild"))
  1139. {
  1140. bankArea = fishingGuildBankArea;
  1141. fishingSpotTile = fishingGuildFishingSpot;
  1142. bankPath = fishingGuildToBank;
  1143. fishingPath = banktoFishingGuild;
  1144. }
  1145. else if(JCB_Location.getSelectedItem().toString().equals("Karamja"))
  1146. {
  1147. fishingSpotTile = karamjaFishingSpot;
  1148. bankArea = draynorBankArea;
  1149. }
  1150. else if(JCB_Location.getSelectedItem().toString().equals("Living Rock Cavern"))
  1151. {
  1152. fishingSpotTile=livingRockCavernFishingSpot;
  1153. }
  1154. else if(JCB_Location.getSelectedItem().toString().equals("Lumbridge"))
  1155. {
  1156. fishingSpotTile = crayfishFishingSpot;
  1157. bankArea = lumbridgeBankArea;
  1158. }
  1159. else if(JCB_Location.getSelectedItem().toString().equals("Ottos"))
  1160. {
  1161. }
  1162. else if(JCB_Location.getSelectedItem().toString().equals("Shilo Village"))
  1163. {
  1164. fishingPath = bankToShilo;
  1165. bankPath = shiloToBank;
  1166. bankArea = shiloBankArea;
  1167. }
  1168. else if (JCB_Location.getSelectedItem().toString().equals("Piscarious"))
  1169. {
  1170. bankPath = fishingSpotToPicarious;
  1171. fishingPath = rasoloToFishingSpot;
  1172. }
  1173. else if (JCB_Location.getSelectedItem().toString().equals("Rasolo"))
  1174. {
  1175. bankPath = toRasolo;
  1176. fishingPath = rasoloToFishingSpot;
  1177. bankArea = piscariousBankArea;
  1178. }
  1179. if(JCB_FishingType.getSelectedItem().toString().equals("Net"))
  1180. {
  1181. fishingType = fishingTypeNet;
  1182. fishingMain = 303;
  1183. fishingSpot = fishingSpotNet;
  1184. }
  1185. else if(JCB_FishingType.getSelectedItem().toString().equals("Barbarian fishing"))
  1186. {
  1187. fishingType = fishingTypeBarbarian;
  1188. fishingMain = 11323;
  1189. fishingSpot = fishingSpotBarbarian;
  1190. if(inventory.getItem(313) != null && inventory.getItem(313).getStackSize() > 0)
  1191. {
  1192. fishingSecondary = 313;
  1193. log("Using fishing bait");
  1194. }
  1195. else if(inventory.contains(StripyFeathers) && inventory.getItem(StripyFeathers).getStackSize() > 0)
  1196. {
  1197. fishingSecondary = StripyFeathers;
  1198. log("Using stripy feathers");
  1199. }
  1200. else if(inventory.contains(RedFeathers) && inventory.getItem(RedFeathers).getStackSize() > 0)
  1201. {
  1202. fishingSecondary = RedFeathers;
  1203. log("Using red feathers");
  1204. }
  1205. else if(inventory.contains(BlueFeathers) && inventory.getItem(BlueFeathers).getStackSize() > 0)
  1206. {
  1207. fishingSecondary = BlueFeathers;
  1208. log("Using blue feathers");
  1209. }
  1210. else if(inventory.contains(YellowFeathers) && inventory.getItem(YellowFeathers).getStackSize() > 0)
  1211. {
  1212. fishingSecondary = YellowFeathers;
  1213. log("Using yellow feathers");
  1214. }
  1215. else if(inventory.contains(OrangeFeathers) && inventory.getItem(OrangeFeathers).getStackSize() > 0)
  1216. {
  1217. fishingSecondary = OrangeFeathers;
  1218. log("Using orange feathers");
  1219. }
  1220. else
  1221. {
  1222. fishingSecondary = 314;
  1223. log("Using feathers");
  1224. }
  1225. }
  1226. else if(JCB_FishingType.getSelectedItem().toString().equals("Big Net"))
  1227. {
  1228. fishingType = fishingTypeNet;
  1229. fishingMain = 305;
  1230. fishingSpot = fishingSpotHarpoonShark;
  1231. }
  1232. else if(JCB_FishingType.getSelectedItem().toString().equals("Crayfish cage"))
  1233. {
  1234. fishingType = fishingTypeCrayfish;
  1235. fishingMain = 13431;
  1236. fishingSpot = fishingSpotCrayfish;
  1237. }
  1238. else if(JCB_FishingType.getSelectedItem().toString().equals("Fishing Rod"))
  1239. {
  1240. fishingMain = 307;
  1241.  
  1242. if(JCB_Location.getSelectedItem().toString().equals("Living Rock Cavern"))
  1243. {
  1244. if(inventory.getItem(313).getStackSize() > 0)
  1245. {
  1246. fishingSpot=fishingSpotCaveShoal;
  1247. fishingSecondary = 313;
  1248. fishingType = "Bait Cavefish";
  1249. }
  1250. else if(inventory.getItem(15263).getStackSize() > 0)
  1251. {
  1252. fishingSecondary = 15263;
  1253. fishingSpot=fishingSpotRockTail;
  1254. fishingType = "Bait Rocktail";
  1255. }
  1256. }
  1257. else
  1258. {
  1259. fishingType = fishingTypeBait;
  1260. fishingSecondary = 313;
  1261. fishingSpot = fishingSpotBait;
  1262. }
  1263. }
  1264. else if(JCB_FishingType.getSelectedItem().toString().equals("Fly Fishing Rod"))
  1265. {
  1266. fishingType = fishingTypeLure;
  1267. fishingMain = 309;
  1268. configureFeathers();
  1269. fishingSpot = fishingSpotBait;
  1270. if(JCB_Location.getSelectedItem().toString().equals("Lumbridge"))
  1271. {
  1272. fishingSpotTile = lumbridgeFishingSpot;
  1273. }
  1274. }
  1275. else if(JCB_FishingType.getSelectedItem().toString().equals("Harpoon"))
  1276. {
  1277. fishingType = fishingTypeHarpoon;
  1278. fishingMain = 311;
  1279. fishingSpot = fishingSpotCage;
  1280. configuringSettings();
  1281. }
  1282. else if(JCB_FishingType.getSelectedItem().toString().equals("Lobster Pot"))
  1283. {
  1284. fishingType = fishingTypeCage;
  1285. fishingMain = 301;
  1286. fishingSpot = fishingSpotCage;
  1287. }
  1288. else if(JCB_FishingType.getSelectedItem().toString().equals("Harpoon(Shark)"))
  1289. {
  1290. fishingType = fishingTypeHarpoon;
  1291. fishingMain = 311;
  1292. fishingSpot = fishingSpotHarpoonShark;
  1293. configuringSettings();
  1294. }
  1295. if(JCB_Mode.getSelectedItem().toString().equals("Bank"))
  1296. {
  1297. powerFish = false;
  1298.  
  1299. }
  1300. else if(JCB_Mode.getSelectedItem().toString().equals("Powerfish"))
  1301. {
  1302. powerFish = true;
  1303. }
  1304. else if(JCB_Mode.getSelectedItem().toString().equals("Stiles"))
  1305. {
  1306. powerFish = false;
  1307. stiles = true;
  1308. }
  1309. else if(JCB_Mode.getSelectedItem().toString().equals("F1D1"))
  1310. {
  1311. f1d1 = true;
  1312. }
  1313.  
  1314. if(JCK_DropTuna.isSelected())
  1315. {
  1316. dropTuna=true;
  1317. }
  1318.  
  1319. if(location.equals("Karamja"))
  1320. {
  1321. if(equipment.getItem(equipment.RING).getID() == 13562)
  1322. {
  1323. useRing = true;
  1324. log("Using explorers ring.");
  1325. }
  1326. }
  1327.  
  1328. location = JCB_Location.getSelectedItem().toString();
  1329. log("Fishing at " + JCB_Location.getSelectedItem().toString());
  1330. log(JCB_FishingType.getSelectedItem().toString());
  1331. log("Method: " + JCB_Mode.getSelectedItem().toString());
  1332. }
  1333.  
  1334. private RSNPC getClosestNPC(int[] NPCID)
  1335. {
  1336. int closestDistance=9999;
  1337. RSNPC closestNPC = null;
  1338.  
  1339. for(RSNPC npc : npcs.getAll())
  1340. {
  1341. for(int i : NPCID)
  1342. {
  1343. if(npc.getID() == i)
  1344. {
  1345. double npcDistance = calc.distanceTo(npc.getLocation());
  1346. if(location.equals("Shilo Village"))
  1347. {
  1348. if(onNorthSideShiloNPC(npc) && !onNorthSideShiloPlayer())
  1349. {
  1350. npcDistance = calc.distanceTo(new RSTile(2832,2969))
  1351. +calc.distanceBetween(new RSTile(2832,2969),new RSTile(2832,2977))
  1352. +calc.distanceBetween(new RSTile(2832,2977),npc.getLocation());
  1353. }
  1354. else if(!onNorthSideShiloNPC(npc) && onNorthSideShiloPlayer())
  1355. {
  1356. npcDistance = calc.distanceTo(new RSTile(2832,2977))
  1357. +calc.distanceBetween(new RSTile(2832,2969),new RSTile(2832,2977))
  1358. +calc.distanceBetween(new RSTile(2832,2969),npc.getLocation());
  1359. }
  1360. }
  1361.  
  1362. if(npcDistance < closestDistance)
  1363. {
  1364. closestNPC = npc;
  1365. closestDistance = (int) npcDistance;
  1366. }
  1367. else if(npcDistance == closestDistance)
  1368. {
  1369. if(npc.getLocation().getX() == getMyPlayer().getLocation().getX() &&
  1370. (npc.getLocation().getY() == getMyPlayer().getLocation().getY()+1 ||
  1371. npc.getLocation().getY() == getMyPlayer().getLocation().getY()-1)
  1372. ||
  1373. npc.getLocation().getY() == getMyPlayer().getLocation().getY() &&
  1374. (npc.getLocation().getX() == getMyPlayer().getLocation().getX()+1 ||
  1375. npc.getLocation().getX() == getMyPlayer().getLocation().getX()-1))
  1376. {
  1377. closestNPC = npc;
  1378. closestDistance = (int)(npcDistance);
  1379. }
  1380. }
  1381. }
  1382. }
  1383. }
  1384. return closestNPC;
  1385. }
  1386.  
  1387. public boolean onNorthSideShiloPlayer()
  1388. {
  1389. if(getMyPlayer().getLocation().getY() > 2973)
  1390. {
  1391. return true;
  1392. }
  1393. return false;
  1394. }
  1395.  
  1396. public boolean onNorthSideShiloNPC(RSNPC npc)
  1397. {
  1398. if(npc.getLocation() != new RSTile(2855,29740) && npc.getLocation().getY() > 2973)
  1399. {
  1400. return true;
  1401. }
  1402. return false;
  1403. }
  1404.  
  1405. public void dropAllExcept(int[] notToDrop)
  1406. {
  1407. for (int c = 0; c < 4; c++)
  1408. {
  1409. for (int r = 0; r < 7; r++)
  1410. {
  1411. boolean match = false;
  1412. RSItem item = inventory.getItemAt(c+r*4);
  1413.  
  1414. for(int itemID : notToDrop)
  1415. {
  1416. if(item.getID() == itemID )
  1417. {
  1418. match = true;
  1419. }
  1420. }
  1421. if(!match && item != null && item.getID() != -1)
  1422. {
  1423. item.doAction("Drop");
  1424. sleep(125,175);
  1425. }
  1426.  
  1427. }
  1428. }
  1429. }
  1430.  
  1431.  
  1432. public RSPlayer getClosestPlayer()
  1433. {
  1434. int closestDistance=9999;
  1435. RSPlayer closestNPC = null;
  1436. for (RSPlayer npc : players.getAll())
  1437. {
  1438. double npcDistance = calc.distanceTo(getMyPlayer().getLocation());
  1439. if(npcDistance < closestDistance)
  1440. {
  1441. closestNPC = npc;
  1442. closestDistance = (int) npcDistance;
  1443. }
  1444. }
  1445. return closestNPC;
  1446. }
  1447.  
  1448. public void bank()
  1449. {
  1450. if(game.getCurrentTab() != game.TAB_INVENTORY)
  1451. {
  1452. log("Opening Inventory");
  1453. keyboard.pressKey((char) KeyEvent.VK_F1);
  1454. sleep(random(50,200));
  1455. keyboard.releaseKey((char) KeyEvent.VK_F1);
  1456. }
  1457. if(powerFish)
  1458. {
  1459. int speed = mouse.getSpeed();
  1460. mouse.setSpeed(random(4,6));
  1461. if(useUrn){
  1462. inventory.dropAllExcept(fishingMain,fishingSecondary,20340,urnDoneID,urnStartedID,urnID);
  1463. }else{
  1464. inventory.dropAllExcept(fishingMain,fishingSecondary,20340);
  1465. }
  1466. mouse.setSpeed(random(speed-1,speed+1));
  1467. }
  1468. else if(f1d1)
  1469. {
  1470. //dropFishF1D1();
  1471. }
  1472. else
  1473. {
  1474. Status = "Banking";
  1475. if(bank.isOpen())
  1476. {
  1477. if(location.equals("Karamja"))
  1478. {
  1479. Status = "Withdrawing coins";
  1480. while(inventory.getCount(true , 995) < 60)
  1481. {
  1482. bank.withdraw(995, (1000-(inventory.getCount(true, 617)+ (inventory.getCount(true, 995)+(inventory.getCount(true, 8890)) ))));
  1483. }
  1484. }
  1485. Status = "Depositing fish";
  1486. if(fishingMain == 0)
  1487. {
  1488. bank.depositAll();
  1489. }
  1490. else
  1491. {
  1492. if (!handFishing && !inventory.contains(fishingMain))
  1493. {
  1494. if(bank.getItem(fishingMain) != null && bank.getItem(fishingMain).getStackSize() > 0)
  1495. bank.withdraw(fishingMain,1);
  1496. else
  1497. {
  1498. log("No fishing mains?");
  1499. game.logout(true);
  1500. stopScript();
  1501. }
  1502. }
  1503. if (fishingSecondary == 0)
  1504. {
  1505. if(location.equals("Karamja"))
  1506. {
  1507. if(useUrn){
  1508. bank.depositAllExcept(new int[]{fishingMain,995,20340,urnID,urnStartedID});
  1509. }else{
  1510. bank.depositAllExcept(fishingMain,995,20340);
  1511. }
  1512. }
  1513. else
  1514. {
  1515. if(useUrn){
  1516. bank.depositAllExcept(fishingMain,20340,urnID,urnStartedID);
  1517. }else{
  1518. bank.depositAllExcept(fishingMain,20340);
  1519. }
  1520. }
  1521. }
  1522. else
  1523. {
  1524. if(!inventory.contains(fishingSecondary) && bank.getItem(fishingSecondary) != null && bank.getItem(fishingSecondary).getStackSize() > 0)
  1525. bank.withdraw(fishingSecondary,0);
  1526.  
  1527. if(location.equals("Karamja"))
  1528. {
  1529. if(useUrn){
  1530. bank.depositAllExcept(new int[]{fishingSecondary,fishingMain,995,20340,urnID,urnStartedID});
  1531. }else{
  1532. bank.depositAllExcept(new int[]{fishingSecondary,fishingMain,995,20340});
  1533. }
  1534. }
  1535. else
  1536. {
  1537. if(useUrn){
  1538. bank.depositAllExcept(new int[]{fishingSecondary,fishingMain,20340,urnID,urnStartedID});
  1539. }else{
  1540. bank.depositAllExcept(new int[]{fishingSecondary,fishingMain,20340});
  1541. }
  1542. }
  1543. }
  1544. if(useUrn && !inventory.containsOneOf(urnID,urnStartedID)){
  1545. if(bank.getItem(urnID) != null){
  1546.  
  1547. if(bank.withdraw(urnID, 1)){
  1548. sleep(500);
  1549. }
  1550. }else{
  1551. log("Out of urns please restock");
  1552. useUrn=false;
  1553. }
  1554.  
  1555.  
  1556. }
  1557. bank.close();
  1558. sleep(500,800);
  1559. }
  1560. }
  1561. else if(!bank.isOpen())
  1562. {
  1563. Status = "Walking to bank area";
  1564. runEnergy();
  1565. if(location.equals("Lumbridge"))
  1566. {
  1567. lumbridgeBanking();
  1568. }
  1569. else if(location.equals("Karamja"))
  1570. {
  1571. walkToBankKaramja();
  1572. }
  1573. else
  1574. {
  1575. if(bankArea.contains(getMyPlayer().getLocation()) || (walking.getDestination() != null && bankArea.contains(walking.getDestination())))
  1576. {
  1577. Status = "Opening bank";
  1578. bank.open();
  1579. sleep(1000,1500);
  1580. }
  1581.  
  1582. else
  1583. {
  1584. Status = "Walking to bank";
  1585. if(calc.distanceTo(walking.getDestination()) < 5)
  1586. {
  1587. runEnergy();
  1588. if(location.equals("Piscarious"))
  1589. {
  1590. if(getMyPlayer().getLocation().getX() < 3234)
  1591. {
  1592. walkPath(piscariousWest);
  1593. }
  1594. else
  1595. {
  1596. walkPath(piscariousEast);
  1597. }
  1598. }
  1599. else
  1600. {
  1601. walkPath(bankPath);
  1602. }
  1603. }
  1604. }
  1605. }
  1606. }
  1607. }
  1608. }
  1609.  
  1610.  
  1611. Thread usageThread = new Thread() {
  1612. @Override
  1613. public void run() {
  1614. setPriority(9);
  1615. while (isRunning()) {
  1616. try {
  1617. if (!isRunning()) {
  1618. usageThread.interrupt();
  1619. log("Shutting down AntiBan thread.");
  1620. }
  1621.  
  1622. long total = Runtime.getRuntime().totalMemory();
  1623. long used = Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory();
  1624. log("Used: " + ((used/1024)/1024) + "/" + ((total/1024)/1024));
  1625. System.gc();
  1626. total = Runtime.getRuntime().totalMemory();
  1627. used = Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory();
  1628. log("After GC: " + ((used/1024)/1024) + "/" + ((total/1024)/1024));
  1629. sleep(3600000);
  1630. } catch (Exception e) {
  1631. e.printStackTrace();
  1632. }
  1633.  
  1634. }
  1635. if (!isRunning()) {
  1636. log("Shutting down AntiBan thread.");
  1637. usageThread.interrupt();
  1638. }
  1639. }
  1640. };
  1641.  
  1642. public void onFinish()
  1643. {
  1644. final int fishpExpHr = (int) ((currentXP-startingXP) * 3600000D / (System.currentTimeMillis() - startTime));
  1645.  
  1646. log("Thanks for using patyFisher");
  1647. log("Levels Gained: " + levelsgained);
  1648. log("Fishies Caught: " + fishesCaught);
  1649. log("Time running:" + hours + ":" + minutes + ":"+ seconds);
  1650. log("Experience Gained: " + (currentXP-startingXP) +" (P/H " + fishpExpHr +" )");
  1651.  
  1652. }
  1653.  
  1654. public void configureFeathers()
  1655. {
  1656. if(inventory.contains(StripyFeathers))
  1657. {
  1658. log("Using stripy feathers");
  1659. fishingSecondary = StripyFeathers;
  1660. }
  1661. else if(inventory.contains(RedFeathers))
  1662. {
  1663. log("Using red feathers");
  1664. fishingSecondary = RedFeathers;
  1665. }
  1666. else if(inventory.contains(BlueFeathers))
  1667. {
  1668. log("Using blue feathers");
  1669. fishingSecondary = BlueFeathers;
  1670. }
  1671. else if(inventory.contains(YellowFeathers))
  1672. {
  1673. log("Using yellow feathers");
  1674. fishingSecondary = YellowFeathers;
  1675. }
  1676. else if(inventory.contains(OrangeFeathers))
  1677. {
  1678. log("Using oranage feathers");
  1679. fishingSecondary = OrangeFeathers;
  1680. }
  1681. else
  1682. {
  1683. log("Using feathers");
  1684. fishingSecondary = 314;
  1685. }
  1686. }
  1687.  
  1688. public void configuringSettings()
  1689. {
  1690. if(inventory.getCount(10129) > 0)
  1691. {
  1692. fishingMain = 10129;
  1693. log("Using " + fishingMain);
  1694. }
  1695. else if(equipment.containsOneOf(10129))
  1696. {
  1697. fishingMain = 0;
  1698. handFishing = true;
  1699. log("Using barb tailed harpoon equipped");
  1700. }
  1701. else if(inventory.getCount(14101) > 0|| equipment.containsOneOf(14101))
  1702. {
  1703. fishingMain = 14101;
  1704. log("Using " + fishingMain);
  1705. }
  1706. else if(inventory.getCount(14109) > 0|| equipment.containsOneOf(14109))
  1707. {
  1708. fishingMain = 14109;
  1709. log("Using " + fishingMain);
  1710. }
  1711. else if(inventory.getCount(311) > 0)
  1712. {
  1713. fishingMain = 311;
  1714. log("Using " + fishingMain);
  1715.  
  1716. }
  1717. else
  1718. {
  1719. if(fishingSpot == fishingSpotCage && currentLevel >= 55 && skills.getCurrentLevel(skills.STRENGTH) >= 34)
  1720. {
  1721. fishingMain = 0;
  1722. handFishing = true;
  1723. log("Using Barbarian hand fishing");
  1724. }
  1725. else if(fishingSpot == fishingSpotHarpoonShark && currentLevel >= 96 && skills.getCurrentLevel(skills.STRENGTH) >= 76)
  1726. {
  1727. fishingMain = 0;
  1728. handFishing = true;
  1729. log("Using Barbarian hand fishing");
  1730. }
  1731. else
  1732. {
  1733. log("You don't have the requirements to barbarian hand fish");
  1734. if(!inventory.contains(fishingSecondary))
  1735. {
  1736. Timer failSafeTimer = new Timer(random(4000,6000));
  1737. while(failSafeTimer.isRunning() && !inventory.contains(fishingSecondary))
  1738. {
  1739. if(game.getCurrentTab() != game.TAB_INVENTORY)
  1740. {
  1741. keyboard.pressKey((char) KeyEvent.VK_F1);
  1742. sleep(random(50,200));
  1743. keyboard.releaseKey((char) KeyEvent.VK_F1);
  1744. sleep(200,400);
  1745. }
  1746. }
  1747. if(!inventory.contains(fishingSecondary))
  1748. {
  1749. game.logout(false);
  1750. log("Out of supplies");
  1751. stopScript();
  1752. }
  1753.  
  1754. }
  1755. sleep(5000,6000);
  1756. }
  1757. }
  1758. }
  1759.  
  1760. public void setupUrns(){
  1761. String text = JCB_UrnType.getSelectedItem().toString();
  1762. if(text.equals("Cracked")){
  1763. useUrn = true;
  1764. urnID = crackedUrnID;
  1765. urnStartedID = crackedUrnStartedID;
  1766. urnDoneID = crackedUrnDoneID;
  1767. }else if(text.equals("Fragile")){
  1768. useUrn = true;
  1769. urnID = fragileUrnID;
  1770. urnStartedID = fragileUrnStartedID;
  1771. urnDoneID = fragileUrnDoneID;
  1772.  
  1773. }else if(text.equals("Regular")){
  1774. useUrn = true;
  1775. urnID = regularCookingUrnID;
  1776. urnStartedID = regularCookingUrnStartedID;
  1777. urnDoneID = regularUrnDoneID;
  1778. }else if (text.equals("Strong")) {
  1779. useUrn = true;
  1780. urnID = strongUrn;
  1781. urnStartedID = strongUrnStartedID;
  1782. urnDoneID = strongUrnDoneID;
  1783. }else if (text.equals("Decorated")) {
  1784. useUrn = true;
  1785. urnID = decoratedUrnID;
  1786. urnStartedID = decoratedStartedID;
  1787. urnDoneID = decoratedDoneID;
  1788. }
  1789. }
  1790.  
  1791. public void antiBan()
  1792. {
  1793. if(getMyPlayer().getAnimation() != -1 && !getMyPlayer().isMoving())
  1794. {
  1795. try {
  1796. switch (random(1,10))
  1797. {
  1798.  
  1799. case 1:
  1800. log("[Antiban] Changing camera pitch");
  1801. int startingPitch = camera.getPitch();
  1802. camera.setPitch(random(20, 100));
  1803. log("Changed pitch from " + startingPitch + " to " + camera.getPitch());
  1804.  
  1805. break;
  1806.  
  1807. case 2:
  1808. log("[Antiban] Changing camera angle");
  1809. int starting = camera.getAngle();
  1810. camera.setAngle(random(camera.getAngle()-10,camera.getAngle()+10));
  1811. log("Changed camera angle from " + starting + " to " + camera.getAngle());
  1812. break;
  1813.  
  1814. case 3:
  1815. log("[Antiban] Changing camera pitch");
  1816. int startingPitch2 = camera.getPitch();
  1817. camera.setPitch(random(camera.getPitch()-15, camera.getPitch()+25));
  1818. log("Changed pitch from " + startingPitch2 + " to " + camera.getPitch());
  1819.  
  1820. break;
  1821.  
  1822. case 4:
  1823. log("[Antiban] Moving camera randomly");
  1824. camera.moveRandomly(3000);
  1825. break;
  1826.  
  1827. case 5:
  1828. log("[Antiban] Changing camera angle (Single direction)");
  1829. sleep(200, 300);
  1830. int startingAngle = camera.getAngle();
  1831. int randomAntiban = random(1,4);
  1832. if(randomAntiban == 1)
  1833. {
  1834. keyboard.pressKey((char) KeyEvent.VK_LEFT);
  1835. sleep(random(400,1100));
  1836. keyboard.releaseKey((char) KeyEvent.VK_LEFT);
  1837. }
  1838. else if(randomAntiban == 2)
  1839. {
  1840. keyboard.pressKey((char) KeyEvent.VK_RIGHT);
  1841. sleep(random(400,1100));
  1842. keyboard.releaseKey((char) KeyEvent.VK_RIGHT);
  1843. }
  1844. else if(randomAntiban == 3)
  1845. {
  1846. keyboard.pressKey((char) KeyEvent.VK_UP);
  1847. sleep(random(400,1100));
  1848. keyboard.releaseKey((char) KeyEvent.VK_UP);
  1849. }
  1850. else if(randomAntiban == 4)
  1851. {
  1852. keyboard.pressKey((char) KeyEvent.VK_DOWN);
  1853. sleep(random(400,1100));
  1854. keyboard.releaseKey((char) KeyEvent.VK_DOWN);
  1855. }
  1856. log("Changed camera angle from " + startingAngle + " to " + camera.getAngle());
  1857. break;
  1858.  
  1859. case 6:
  1860. log("[Antiban] Moving mouse slightly");
  1861. Point mouseLocation = mouse.getLocation();
  1862. mouse.moveSlightly();
  1863. log("Moved mouse from " + "(" + mouseLocation.x +"," + mouseLocation.y + ") to" +
  1864. "(" + mouse.getLocation().x +"," + mouse.getLocation().y + ")");
  1865. break;
  1866.  
  1867. case 7:
  1868. log("[Antiban] Moving mouse offscreen");
  1869. mouse.moveOffScreen();
  1870. break;
  1871.  
  1872. case 8:
  1873. log("[Antiban] Checking fishing experience");
  1874. if(game.getCurrentTab() != game.TAB_STATS)
  1875. {
  1876. log("Opening Stats tab");
  1877. game.openTab(game.TAB_STATS);
  1878. }
  1879. mouse.move(new Point(random(678,727),random(266,316)));
  1880. sleep(800,4000);
  1881.  
  1882. break;
  1883. case 9:
  1884. log("[Antiban] Opening friends list");
  1885. game.openTab(game.TAB_FRIENDS);
  1886. sleep(500,600);
  1887. break;
  1888.  
  1889. case 10:
  1890. log("[Antiban] Changing camera angle (Multi direction)");
  1891. sleep(200, 300);
  1892. int startingAngle2 = camera.getAngle();
  1893. int randomAntiban2 = random(1,4);
  1894. int random2nd = random(1,2);
  1895. if(randomAntiban2 == 1)
  1896. {
  1897. keyboard.pressKey((char) KeyEvent.VK_LEFT);
  1898. if(random2nd==1)
  1899. {
  1900. keyboard.pressKey((char) KeyEvent.VK_DOWN);
  1901. }
  1902. else
  1903. {
  1904. keyboard.pressKey((char) KeyEvent.VK_UP);
  1905. }
  1906. sleep(random(400,1000));
  1907. keyboard.releaseKey((char) KeyEvent.VK_LEFT);
  1908. if(random2nd==1)
  1909. {
  1910. keyboard.releaseKey((char) KeyEvent.VK_DOWN);
  1911. }
  1912. else
  1913. {
  1914. keyboard.releaseKey((char) KeyEvent.VK_UP);
  1915. }
  1916. }
  1917. else if(randomAntiban2 == 2)
  1918. {
  1919. keyboard.pressKey((char) KeyEvent.VK_RIGHT);
  1920. if(random2nd==1)
  1921. {
  1922. keyboard.pressKey((char) KeyEvent.VK_DOWN);
  1923. }
  1924. else
  1925. {
  1926. keyboard.pressKey((char) KeyEvent.VK_UP);
  1927. }
  1928. sleep(random(500,1100));
  1929. keyboard.releaseKey((char) KeyEvent.VK_RIGHT);
  1930. if(random2nd==1)
  1931. {
  1932. keyboard.releaseKey((char) KeyEvent.VK_DOWN);
  1933. }
  1934. else
  1935. {
  1936. keyboard.releaseKey((char) KeyEvent.VK_UP);
  1937. }
  1938. }
  1939. log("Changed camera angle from " + startingAngle2 + " to " + camera.getAngle());
  1940. break;
  1941. }
  1942.  
  1943.  
  1944. } catch (Exception e) {
  1945. e.printStackTrace();
  1946. }
  1947. }
  1948. }
  1949.  
  1950. public void dropFishF1D1()
  1951. {
  1952. RSNPC fishingNPC = npcs.getNearest(fishingSpot);
  1953.  
  1954. if(location.equals("Fishing Guild"))
  1955. {
  1956. fishingNPC = getClosestNPCFishingGuild();
  1957. }
  1958. int[] items = (new int[]{fishingSecondary,fishingMain});
  1959. int isID = inventory.getItemAt(0).getID();
  1960. if(inventory.getItemAt(0).getID() != -1 && (isID == items[0] || isID == items[1] || isID == 314 || isID == 20340))
  1961. {
  1962. if(inventory.getItemAt(27).getID() != -1 && (isID != items[0]|| isID != items[1] || isID != 314 || isID != 20340))
  1963. {
  1964. mouse.click(random(570,580),random(216,240), true);
  1965. mouse.drag(663, 443);
  1966. }
  1967. else
  1968. {
  1969. mouse.click(random(570,580),random(216,240), true);
  1970. mouse.drag(703, 444);
  1971. }
  1972. }
  1973. else
  1974. {
  1975. if(inventory.getItemAt(0) != null && inventory.getItemAt(0).getID() != -1 && (isID != items[0] && isID != items[1] && isID != 314 && isID != 20340))
  1976. {
  1977. inventory.getItemAt(0).interact("Drop");
  1978. sleep(50,100);
  1979. }
  1980. if(fishingNPC != null)
  1981. {
  1982. if(fishingNPC.isOnScreen())
  1983. {
  1984. if(fishingNPC.getActions() == null)
  1985. {
  1986. mouse.move(fishingNPC.getLocation().getX(),fishingNPC.getLocation().getY());
  1987. if(menu.getActions() != null && menu.getActions()[0].equals(fishingType))
  1988. {
  1989. mouse.click(fishingNPC.getLocation().getX(),fishingNPC.getLocation().getY(),true);
  1990. sleep(600,800);
  1991. }
  1992. else
  1993. {
  1994. if(!menu.isOpen())
  1995. {
  1996. mouse.click(fishingNPC.getLocation().getX(),fishingNPC.getLocation().getY(),false);
  1997. sleep(600,800);
  1998. }
  1999. if(menu.isOpen())
  2000. {
  2001. menu.doAction(fishingType);
  2002. sleep(600,800);
  2003. }
  2004. }
  2005. sleep(400,500);
  2006.  
  2007. }
  2008. else
  2009. {
  2010.  
  2011. fishingNPC.doAction(fishingType);
  2012. }
  2013. }
  2014. else
  2015. {
  2016. if(calc.tileOnMap(fishingNPC.getLocation()))
  2017. {
  2018. walking.walkTileMM(fishingNPC.getLocation());
  2019. }
  2020. else
  2021. {
  2022. walking.walkTo(fishingNPC.getLocation());
  2023. }
  2024. sleep(500,600);
  2025. waitUntilNotMoving();
  2026. }
  2027. }
  2028. sleep(1000,1500);
  2029. if(mouse.getLocation().getX() > 566 && mouse.getLocation().getX() < 590
  2030. && mouse.getLocation().getY() > 217 && mouse.getLocation().getY()< 238)
  2031. {
  2032.  
  2033. }
  2034. else
  2035. {
  2036. mouse.move(random(566,590),random(217,238));
  2037. Timer t = new Timer(3000);
  2038. while(getMyPlayer().getAnimation() == -1 && !t.isRunning())
  2039. {
  2040. sleep(300,400);
  2041. }
  2042. }
  2043. while(getMyPlayer().getAnimation() != -1 && inventory.getItemAt(0) != null && inventory.getItemAt(0).getID() == -1)
  2044. {
  2045. if(!antiBanTimer.isRunning())
  2046. {
  2047. antiBan();
  2048. antiBanTimer.setEndIn(random(60000,100000));
  2049. }
  2050. Status = "Fishing";
  2051. sleep(100,200);
  2052. }
  2053. sleep(200,300);
  2054. }
  2055.  
  2056.  
  2057. }
  2058.  
  2059. private final Color color1 = new Color(0, 0, 255, 122);
  2060. private final Color color2 = new Color(0, 0, 0, 16);
  2061. private final Color color3 = new Color(204, 0, 0);
  2062. private final Color color4 = new Color(0, 153, 0);
  2063. private final Color color5 = new Color(102, 102, 255);
  2064. private final Color color6 = new Color(0, 0, 0);
  2065. Color fishingSpotColor = new Color(50, 205, 50, 75);
  2066. private final Font font1 = new Font("Palatino Linotype", 1, 13);
  2067. private final Font font2 = new Font("Palatino Linotype", 1, 12);
  2068. private final BasicStroke stroke1 = new BasicStroke(1);
  2069. private final Image img1 = getImage("http://img716.imageshack.us/img716/6219/9170e523.png");
  2070.  
  2071. private final int getXPTL(int currentLevel, long currentXP2) {
  2072. return (int) (xpTable[currentLevel + 1] - currentXP2);
  2073. }
  2074.  
  2075.  
  2076. private final int getXPTTL(int currentLevel) {
  2077. return xpTable[currentLevel + 1] - xpTable[currentLevel];
  2078. }
  2079.  
  2080. private final RenderingHints antialiasing = new RenderingHints(
  2081. RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
  2082.  
  2083. private Image getImage(String url) {
  2084. try {
  2085. return ImageIO.read(new URL(url));
  2086. } catch(IOException e) {
  2087. return null;
  2088. }
  2089. }
  2090.  
  2091. public RSTile nextTile(RSTile[] path)
  2092. {
  2093. RSTile returnTile = null;
  2094. for(int i = 0; i < path.length; i++)
  2095. {
  2096. RSTile tile = path[i];
  2097. if(calc.tileOnMap(tile))
  2098. {
  2099. returnTile = tile;
  2100. }
  2101. }
  2102. return returnTile;
  2103. }
  2104.  
  2105. private void walkPath(RSTile[] path) {
  2106. if (!getMyPlayer().isMoving() || calc.distanceTo(walking.getDestination()) < 4) {
  2107. RSTile tile= nextTile(path);
  2108. if(tile == null)
  2109. return;
  2110. tile = tile.randomize(2,2);
  2111. if(walking.walkTileMM(tile)){
  2112. sleep(500,600);
  2113. }
  2114. }else{
  2115. if(!walking.isRunEnabled() && walking.getEnergy() > runEnergy){
  2116. walking.setRun(true);
  2117. sleep(600,800);
  2118. runEnergy = random(40,64);
  2119. }
  2120.  
  2121. }
  2122. }
  2123.  
  2124. public void waitUntilNotMoving()
  2125. {
  2126. Timer sleepTimer = new Timer(random(1500,2000));
  2127. while(getMyPlayer().isMoving() && sleepTimer.isRunning())
  2128. {
  2129. sleep(100,150);
  2130. }
  2131. }
  2132.  
  2133. public void waitUntilMoving()
  2134. {
  2135. Timer sleepTimer = new Timer(random(1500,2000));
  2136. while(!getMyPlayer().isMoving() && sleepTimer.isRunning())
  2137. {
  2138. sleep(100,150);
  2139. }
  2140. }
  2141.  
  2142. @SuppressWarnings("serial")
  2143. public class GUI extends javax.swing.JFrame {
  2144.  
  2145. /** Creates new form GUIForFisher */
  2146. public GUI() {
  2147. initComponents();
  2148. }
  2149.  
  2150. /** This method is called from within the constructor to
  2151. * initialize the form.
  2152. * WARNING: Do NOT modify this code. The content of this method is
  2153. * always regenerated by the Form Editor.
  2154. */
  2155. private void initComponents() {
  2156.  
  2157. // JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents
  2158. LBL_Location = new JLabel();
  2159. LBL_FishingType = new JLabel();
  2160. LBL_Mode = new JLabel();
  2161. LBL_UrnType = new JLabel();
  2162. JCB_Location = new JComboBox();
  2163. JCB_FishingType = new JComboBox();
  2164. JCB_Mode = new JComboBox();
  2165. JCB_UrnType = new JComboBox();
  2166. JCK_DropTuna = new JCheckBox();
  2167. LBL_Title = new JLabel();
  2168. BTN_Start = new JButton();
  2169.  
  2170. //======== this ========
  2171. setTitle("Paty Fisher");
  2172. Container contentPane = getContentPane();
  2173. contentPane.setLayout(null);
  2174.  
  2175. //---- LBL_Location ----
  2176. LBL_Location.setText("Location: ");
  2177. contentPane.add(LBL_Location);
  2178. LBL_Location.setBounds(new Rectangle(new Point(20, 50), LBL_Location.getPreferredSize()));
  2179.  
  2180. //---- LBL_FishingType ----
  2181. LBL_FishingType.setText("Type of fish: ");
  2182. contentPane.add(LBL_FishingType);
  2183. LBL_FishingType.setBounds(new Rectangle(new Point(5, 75), LBL_FishingType.getPreferredSize()));
  2184.  
  2185. //---- LBL_Mode ----
  2186. LBL_Mode.setText("Fishing type: ");
  2187. contentPane.add(LBL_Mode);
  2188. LBL_Mode.setBounds(new Rectangle(new Point(5, 100), LBL_Mode.getPreferredSize()));
  2189.  
  2190. //---- LBL_UrnType ----
  2191. LBL_UrnType.setText("Type of urn:");
  2192. contentPane.add(LBL_UrnType);
  2193. LBL_UrnType.setBounds(new Rectangle(new Point(10, 125), LBL_UrnType.getPreferredSize()));
  2194.  
  2195. //---- JCB_Location ----
  2196. JCB_Location.setModel(new DefaultComboBoxModel(new String[] {
  2197. "Barbarian Village",
  2198. "Catherby",
  2199. "Draynor Village ",
  2200. "Fishing Guild",
  2201. "Karamja",
  2202. "Lumbridge",
  2203. "Ottos",
  2204. "Piscarious",
  2205. "Rasolo",
  2206. "Shilo Village"
  2207. }));
  2208. contentPane.add(JCB_Location);
  2209. JCB_Location.setBounds(new Rectangle(new Point(75, 45), JCB_Location.getPreferredSize()));
  2210.  
  2211. //---- JCB_UrnType ----
  2212. JCB_UrnType.setModel(new DefaultComboBoxModel(new String[] {
  2213. "None",
  2214. "Cracked",
  2215. "Fragile",
  2216. "Regular",
  2217. "Decorated",
  2218. "Strong"
  2219. }));
  2220. contentPane.add(JCB_UrnType);
  2221. JCB_UrnType.setBounds(75, 120, JCB_UrnType.getPreferredSize().width, 20);
  2222.  
  2223. //---- JCB_FishingType ----
  2224. JCB_FishingType.setModel(new DefaultComboBoxModel(new String[] {
  2225. "Fly Fishing Rod",
  2226. "Fishing Rod"
  2227. }));
  2228. JCB_Location.addItemListener(new java.awt.event.ItemListener() {
  2229. public void itemStateChanged(java.awt.event.ItemEvent evt) {
  2230. JCB_LocationItemStateChanged(evt);
  2231. }
  2232. });
  2233.  
  2234. contentPane.add(JCB_FishingType);
  2235. JCB_FishingType.setBounds(new Rectangle(new Point(75, 70), JCB_FishingType.getPreferredSize()));
  2236.  
  2237. //---- JCB_Mode ----
  2238. JCB_Mode.setModel(new DefaultComboBoxModel(new String[] {
  2239. "Bank",
  2240. "F1D1",
  2241. "Powerfish"
  2242. }));
  2243. contentPane.add(JCB_Mode);
  2244. JCB_Mode.setBounds(new Rectangle(new Point(75, 95), JCB_Mode.getPreferredSize()));
  2245. contentPane.add(JCB_UrnType);
  2246. JCB_UrnType.setBounds(75, 120, JCB_UrnType.getPreferredSize().width, 20);
  2247.  
  2248. //---- JCK_DropTuna ----
  2249. JCK_DropTuna.setText("Drop Tuna: ");
  2250. JCK_DropTuna.setHorizontalAlignment(SwingConstants.CENTER);
  2251. contentPane.add(JCK_DropTuna);
  2252. JCK_DropTuna.setBounds(0, 140, 185, 30);
  2253.  
  2254. //---- LBL_Title ----
  2255. LBL_Title.setText("Paty Fisher");
  2256. LBL_Title.setFont(new Font("Calibri", Font.BOLD, 18));
  2257. LBL_Title.setHorizontalAlignment(SwingConstants.CENTER);
  2258. contentPane.add(LBL_Title);
  2259. LBL_Title.setBounds(0, 0, 185, 35);
  2260.  
  2261. //---- BTN_Start ----
  2262. BTN_Start.setText("Start");
  2263. contentPane.add(BTN_Start);
  2264. BTN_Start.setBounds(45, 170, 85, BTN_Start.getPreferredSize().height);
  2265. BTN_Start.addActionListener(new java.awt.event.ActionListener() {
  2266. public void actionPerformed(java.awt.event.ActionEvent evt) {
  2267. BTN_StartActionPerformed(evt);
  2268. }
  2269. });
  2270. { // compute preferred size
  2271. Dimension preferredSize = new Dimension();
  2272. for(int i = 0; i < contentPane.getComponentCount(); i++) {
  2273. Rectangle bounds = contentPane.getComponent(i).getBounds();
  2274. preferredSize.width = Math.max(bounds.x + bounds.width, preferredSize.width);
  2275. preferredSize.height = Math.max(bounds.y + bounds.height, preferredSize.height);
  2276. }
  2277. Insets insets = contentPane.getInsets();
  2278. preferredSize.width += insets.right;
  2279. preferredSize.height += insets.bottom;
  2280. contentPane.setMinimumSize(preferredSize);
  2281. contentPane.setPreferredSize(preferredSize);
  2282. }
  2283. pack();
  2284. setLocationRelativeTo(getOwner());
  2285. // JFormDesigner - End of component initialization //GEN-END:initComponents
  2286. }
  2287.  
  2288. private void BTN_StartActionPerformed(java.awt.event.ActionEvent evt) {
  2289. this.setVisible(false);
  2290. }
  2291.  
  2292. private void JCB_LocationItemStateChanged(java.awt.event.ItemEvent evt) {
  2293. JCB_FishingType.removeAllItems();
  2294. JCB_Mode.removeAllItems();
  2295. JCB_Mode.addItem("Bank");
  2296. JCB_Mode.addItem("Powerfish");
  2297. JCB_Mode.addItem("F1D1");
  2298. if(JCB_Location.getSelectedItem().toString().equals("Barbarian Village"))
  2299. {
  2300. JCB_FishingType.setModel(new javax.swing.DefaultComboBoxModel(new String[] {"Fishing Rod","Fly Fishing Rod"}));
  2301.  
  2302. }
  2303. else if(JCB_Location.getSelectedItem().toString().equals("Catherby"))
  2304. {
  2305. JCB_FishingType.setModel(new javax.swing.DefaultComboBoxModel(new String[] {"Net","Big Net","Fishing Rod","Fly Fishing Rod","Harpoon","Lobster Pot","Harpoon(Shark)"}));
  2306. }
  2307. else if(JCB_Location.getSelectedItem().toString().equals("Draynor Village"))
  2308. {
  2309. JCB_FishingType.addItem("Net");
  2310. JCB_FishingType.addItem("Fishing Rod");
  2311. }
  2312. else if(JCB_Location.getSelectedItem().toString().equals("Fishing Guild"))
  2313. {
  2314.  
  2315. JCB_FishingType.addItem("Net");
  2316. JCB_FishingType.addItem("Fishing Rod");
  2317. JCB_FishingType.addItem("Fly Fishing Rod");
  2318. JCB_FishingType.addItem("Big Net");
  2319. JCB_FishingType.addItem("Harpoon");
  2320. JCB_FishingType.addItem("Lobster Pot");
  2321. JCB_FishingType.addItem("Harpoon(Shark)");
  2322. }
  2323. else if(JCB_Location.getSelectedItem().toString().equals("Karamja"))
  2324. {
  2325. JCB_FishingType.setModel(new javax.swing.DefaultComboBoxModel(new String[] {"Net","Fishing Rod","Harpoon","Lobster Pot"}));
  2326. JCB_Mode.addItem("Stiles");
  2327. }
  2328. else if(JCB_Location.getSelectedItem().toString().equals("Lumbridge"))
  2329. {
  2330. JCB_FishingType.addItem("Fishing Rod");
  2331. JCB_FishingType.addItem("Fly Fishing Rod");
  2332. JCB_FishingType.addItem("Crayfish cage");
  2333. }
  2334. else if(JCB_Location.getSelectedItem().toString().equals("Living Rock Cavern"))
  2335. {
  2336. JCB_FishingType.addItem("Fishing Rod");
  2337. }
  2338. else if(JCB_Location.getSelectedItem().toString().equals("Piscarious"))
  2339. {
  2340. JCB_FishingType.addItem("Net");
  2341. }
  2342. else if(JCB_Location.getSelectedItem().toString().equals("Shilo Village"))
  2343. {
  2344. JCB_FishingType.addItem("Fishing Rod");
  2345. JCB_FishingType.addItem("Fly Fishing Rod");
  2346. }
  2347. else if(JCB_Location.getSelectedItem().toString().equals("Ottos"))
  2348. {
  2349. JCB_FishingType.addItem("Barbarian fishing");
  2350. }
  2351. else if(JCB_Location.getSelectedItem().toString().equals("Rasolo"))
  2352. {
  2353. JCB_Mode.addItem("Sell");
  2354. JCB_Mode.removeItem("Bank");
  2355. JCB_FishingType.setModel(new javax.swing.DefaultComboBoxModel(new String[] {"Fishing Rod","Fly Fishing Rod"}));
  2356. }
  2357. }
  2358.  
  2359. private void JCK_CookingActionPerformed(java.awt.event.ActionEvent evt) {
  2360. if(JCK_Cooking.isSelected())
  2361. {
  2362. JCB_CookLocation.setEnabled(true);
  2363. JCB_CookingType.setEnabled(true);
  2364. JCK_UseFire.setEnabled(true);
  2365. JRB_Fish.setEnabled(true);
  2366. JRB_Time.setEnabled(true);
  2367. JTF_Lower.setEnabled(true);
  2368. JTF_Higher.setEnabled(true);
  2369. }
  2370. else
  2371. {
  2372. JCB_CookLocation.setEnabled(false);
  2373. JCB_CookingType.setEnabled(false);
  2374. JCK_UseFire.setEnabled(false);
  2375. JRB_Fish.setEnabled(false);
  2376. JRB_Time.setEnabled(false);
  2377. JTF_Lower.setEnabled(false);
  2378. JTF_Higher.setEnabled(false);
  2379. }
  2380. }
  2381.  
  2382. private void JRB_TimeActionPerformed(java.awt.event.ActionEvent evt) {
  2383. if(JRB_Time.isSelected())
  2384. {
  2385. JRB_Fish.setSelected(false);
  2386. }
  2387. else
  2388. {
  2389. JRB_Fish.setSelected(true);
  2390. }
  2391. }
  2392.  
  2393. private void JRB_FishActionPerformed(java.awt.event.ActionEvent evt) {
  2394. if(JRB_Fish.isSelected())
  2395. {
  2396. JRB_Time.setSelected(false);
  2397. }
  2398. else
  2399. {
  2400. JRB_Time.setSelected(true);
  2401. }
  2402. }
  2403.  
  2404. }
  2405.  
  2406. public String TimeToLevel(int TTL)
  2407. {
  2408. final long t_seconds = TTL / 1000;
  2409. final long t_minutes = t_seconds / 60;
  2410. final long t_hours = t_minutes / 60;
  2411. final long seconds1 = t_seconds % 60;
  2412. final long minutes1 = t_minutes % 60;
  2413. final long hours1 = t_hours;
  2414. return (nf.format(hours1) + ":" + nf.format(minutes1) + ":" + nf.format(seconds1));
  2415. }
  2416.  
  2417.  
  2418. @Override
  2419. public void onRepaint(Graphics g) {
  2420.  
  2421. long millis = System.currentTimeMillis() - startTime;
  2422. hours = millis / (1000 * 60 * 60);
  2423. millis -= hours * (1000 * 60 * 60);
  2424. minutes = millis / (1000 * 60);
  2425. millis -= minutes * (1000 * 60);
  2426. seconds = millis / 1000;
  2427.  
  2428. if(currentLevel == 0){
  2429. startingLevel = skills.getCurrentLevel(Skills.FISHING);
  2430. startingXP = skills.getCurrentExp(Skills.FISHING);
  2431. }
  2432.  
  2433. currentLevel = skills.getCurrentLevel(Skills.FISHING);
  2434. currentXP = skills.getCurrentExp(Skills.FISHING);
  2435.  
  2436. final int fishpExpHr = (int) ((currentXP-startingXP) * 3600000D / (System.currentTimeMillis() - startTime));
  2437.  
  2438.  
  2439. ((Graphics2D) g).setRenderingHints(antialiasing);
  2440.  
  2441. g.setColor(color1);
  2442. g.fillRoundRect(224, 208, 292, 128, 16, 16);
  2443. g.setColor(color2);
  2444. ((Graphics2D) g).setStroke(stroke1);
  2445. g.drawRoundRect(224, 208, 292, 128, 16, 16);
  2446. g.setColor(color6);
  2447. ((Graphics2D) g).setStroke(stroke1);
  2448. g.drawImage(img1, 468, 285, null);
  2449. g.setFont(font1);
  2450. g.setColor(color3);
  2451. g.drawString("Paty Fisher " + 4.2, 392, 221);
  2452. g.setFont(font2);
  2453. g.setColor(color4);
  2454. g.drawString("Author: Patyfatycake ©", 239, 221);
  2455. g.drawString("Status: " + Status, 239, 236);
  2456. g.drawString("Location: " + location, 239, 251);
  2457. g.drawString("Levels Gained: " + levelsgained, 359, 266 );
  2458. g.drawString("Fishies Caught: " + fishesCaught, 239, 266);
  2459. g.drawString("Time running:" + hours + ":" + minutes + ":"+ seconds, 239, 281);
  2460. g.drawString("Experience Gained: " + (currentXP-startingXP) +" (P/H " + fishpExpHr +" )", 239, 296);
  2461. g.setColor(color5);
  2462. g.fillRoundRect(239, 311, 150, 16, 9, 9);
  2463. g.setColor(Color.green.darker());
  2464. g.fillRoundRect(239, 311, (int) ((1.00f - ((float) getXPTL(currentLevel,
  2465. currentXP) / (float) getXPTTL(currentLevel))) * 150), 16,
  2466. 9, 9);
  2467. g.setColor(color1);
  2468. g.drawString((int) ((1.00f - ((float) getXPTL(currentLevel,
  2469. currentXP) / (float) getXPTTL(currentLevel))) * 100)
  2470. + "% to "+(currentLevel+1), 280, 324);
  2471. }
  2472.  
  2473. @Override
  2474. public void messageReceived(MessageEvent e) {
  2475. String word = e.getMessage();
  2476.  
  2477. if (word.contains("You catch"))
  2478. {
  2479. fishesCaught++;
  2480. }
  2481. else if (word.contains("catch two"))
  2482. {
  2483. fishesCaught++;
  2484. fishesCaught++;
  2485. }
  2486. else if (word.contains("just advanced a Fishing"))
  2487. {
  2488. levelsgained++;
  2489. }else if(useUrn && word.contains("urn is full")){
  2490. urnDone = true;
  2491. }
  2492. }
  2493. }
RAW Paste Data