Advertisement
Guest User

zombiefish

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