PageRenderTime 58ms CodeModel.GetById 15ms RepoModel.GetById 1ms app.codeStats 0ms

/scripts/ZombieFisher.java

http://d-linked.googlecode.com/
Java | 1760 lines | 1413 code | 274 blank | 73 comment | 310 complexity | 14c2f8f50d8b5babaacdfeffb7b061ea MD5 | raw file
Possible License(s): GPL-3.0

Large files files are truncated, but you can click here to view the full file

  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. import java.awt.event.*;
  12. import java.io.*;
  13. import java.net.*;
  14. import java.awt.Color;
  15. import java.awt.Graphics;
  16. import java.io.IOException;
  17. import java.lang.reflect.Method;
  18. import java.util.Map;
  19. import javax.swing.JOptionPane;
  20. import org.rsbot.util.ScreenshotUtil;
  21. import org.rsbot.bot.Bot;
  22. import org.rsbot.script.ScriptManifest;
  23. import org.rsbot.event.events.ServerMessageEvent;
  24. import org.rsbot.event.listeners.PaintListener;
  25. import org.rsbot.event.listeners.ServerMessageListener;
  26. import org.rsbot.script.wrappers.RSInterface;
  27. import org.rsbot.script.wrappers.RSItemTile;
  28. import org.rsbot.script.wrappers.RSNPC;
  29. import org.rsbot.script.wrappers.RSObject;
  30. import org.rsbot.script.wrappers.RSPlayer;
  31. import org.rsbot.script.wrappers.RSTile;
  32. import org.rsbot.script.*;
  33. @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 ZombieKnight_RSBot@hotmail.com</b></font></center></td></tr><tr><td colspan='2'><hr></td></tr><tr><td><tr><td><b>Location: </b></td><td><center><select name='locationName'><option>Al-Kharid<option>Barb Village(EV)<option>Catherby<option>Draynor<option>Fishing Guild<option>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>")
  34. public class ZombieFisher extends Script implements ServerMessageListener, PaintListener {
  35. int randomInt;
  36. int GambleInt;
  37. // State constants:
  38. public final int S_WALKTO_BANK = 100;
  39. public final int S_WALKTO_SPOT = 200;
  40. public final int S_FISH = 300;
  41. public final int S_TUNA = 400;
  42. public final int S_THROW_TUNAS = 500;
  43. public final int S_DROP_ALL = 600;
  44. public final int S_USE_BANK = 700;
  45. public final int S_DEPOSIT = 800;
  46. public final int S_WITHDRAW = 900;
  47. // Bait constants:
  48. public final int BAIT_NONE = -1;
  49. public final int BAIT_BAIT = 313;
  50. public final int BAIT_FEATHERS = 314;
  51. public final int BAIT_STRIPY = 10087;
  52. // Gear constants:
  53. public final int GEAR_NET = 303;
  54. public final int GEAR_ROD = 307;
  55. public final int GEAR_FLYROD = 309;
  56. public final int GEAR_CAGE = 301;
  57. public final int GEAR_CHARPOON = 14109;
  58. public final int GEAR_HARPOON = 311;
  59. public final int GEAR_BIGNET = 305;
  60. public final int GEAR_BARB = 10129;
  61. public final int GEAR_NONE = -1;
  62. // Paths and tiles:
  63. public RSTile[ ] toBank;
  64. public RSTile[ ] toArea;
  65. RSTile[] lostTiles = new RSTile[] { new RSTile(2860, 3428), new RSTile(2863, 2978), new RSTile(2835, 2975) };
  66. RSTile[] recoverTiles = new RSTile[] { new RSTile(2849, 3430), new RSTile(2855, 2971), new RSTile(2850, 2970) };
  67. // Runtime configuration.
  68. public int currentGear;
  69. public int currentBait;
  70. public String currentCommand;
  71. public int fishingSpotID;
  72. public int bankID;
  73. public int shopID;
  74. public boolean usesNPCBanking;
  75. // Script configuration.
  76. public String locationName;
  77. public String catchName;
  78. public String pColor;
  79. public boolean barbarianMode;
  80. public boolean powerFishing;
  81. public boolean antiTunas;
  82. public boolean usePaint;
  83. public boolean Sound;
  84. public boolean isPvP;
  85. public boolean hasEquipped;
  86. public long oldCatches = 0;
  87. public long catches = 0;
  88. // Misc variables.
  89. public int currentFails = 0;
  90. public int randomRunEnergy;
  91. public int state = S_FISH;
  92. public boolean runningFromCombat;
  93. public long scriptStartTime;
  94. public int playerStartXP;
  95. public int numberOfCatches;
  96. public long lastCheck;
  97. public long checkTime;
  98. public int countToNext = 0;
  99. public int timesAvoidedCombat;
  100. public int whirlpoolsAvoided;
  101. public int timesRecoveredGear;
  102. public int startLevel;
  103. public int lastExp;
  104. public int xpPerCatch = 0;
  105. public int oldExp;
  106. public int updateCheck = 0;
  107. public RSPlayer PvPPlayer;
  108. public int sCB;
  109. public int startExp;
  110. public boolean sRM;
  111. public boolean StartedY;
  112. public int[] whirlpools = new int[] {
  113. 403, 404, 406, 406 };
  114. int[] equipItems = {10129, 14109 };
  115. int[] itemIDs = {10129, 14109 };
  116. public void turnCamera() {
  117. char[] LR = new char[] { KeyEvent.VK_LEFT, KeyEvent.VK_RIGHT };
  118. char[] UD = new char[] { KeyEvent.VK_DOWN, KeyEvent.VK_UP };
  119. char[] LRUD = new char[] { KeyEvent.VK_LEFT, KeyEvent.VK_RIGHT,
  120. KeyEvent.VK_UP, KeyEvent.VK_DOWN };
  121. int random2 = random(0,2);
  122. int random1 = random(0,2);
  123. int random4 = random(0,4);
  124. if(random(0,2) == 2) {
  125. Bot.getInputManager().pressKey(LR[random1]);
  126. try { Thread.sleep(random(100, 400)); } catch (Exception e) {}
  127. Bot.getInputManager().pressKey(UD[random2]);
  128. try { Thread.sleep(random(300, 600)); } catch (Exception e) {}
  129. Bot.getInputManager().releaseKey(UD[random2]);
  130. try { Thread.sleep(random(100, 400)); } catch (Exception e) {}
  131. Bot.getInputManager().releaseKey(LR[random1]);
  132. } else {
  133. Bot.getInputManager().pressKey(LRUD[random4]);
  134. if(random4>1) {
  135. try { Thread.sleep(random(300, 600)); } catch (Exception e) {}
  136. } else {
  137. try { Thread.sleep(random(500, 900)); } catch (Exception e) {}
  138. }
  139. Bot.getInputManager().releaseKey(LRUD[random4]);
  140. }
  141. }
  142. /*
  143. * Pre-runtime configuration takes place within this method.
  144. */
  145. public boolean onStart( final Map<String, String> args) {
  146. final int welcome = JOptionPane
  147. .showConfirmDialog(
  148. null,
  149. "Before using my script, would you like to thank me\nby clicking some adverts?",
  150. "Welcome", JOptionPane.YES_NO_OPTION);
  151. if (welcome == 0) {
  152. final String message = "<html><h1>Thank you for your support!</h1><br/>"
  153. + "<p>You will now be redirected to my adverts page. <br/>"
  154. + "Click the adverts on the page few times a day if you can.</p>"
  155. + "</html>";
  156. JOptionPane.showMessageDialog(null, message);
  157. openURL("http://a2ea4421.linkbucks.com");
  158. }
  159. Reset( );
  160. //checkupdate();
  161. // Set script start time
  162. scriptStartTime = System.currentTimeMillis( );
  163. // Load script configuration from arguements.
  164. locationName = args.get("locationName");
  165. catchName = args.get("catchName");
  166. pColor = args.get("pColor");
  167. barbarianMode = args.get("barbarianMode") != null ? true : false;
  168. powerFishing = args.get("powerFishing") != null ? true : false;
  169. antiTunas = args.get("antiTunas") != null ? true : false;
  170. usePaint = args.get("usePaint") != null ? true : false;
  171. isPvP = args.get("PvPWorld") != null ? true : false;
  172. Sound = args.get("wSound") != null ? true : false;
  173. if ( catchName.equals("Trout/Salmon") ) {
  174. log("Please buy your feathers for the lowest price in the Grand Exchange.");
  175. log("I thank you for doing that, the current price for feathers is too high.");
  176. log("So, please help us out in the quest of bringing it down.");
  177. }
  178. // Al Kharid locations:
  179. if ( locationName.equals("Al-Kharid") ) {
  180. log("Setting Mummyfied paths for Al-Kharid.");
  181. log("[Reminder]Pls start in the bank or at the fishing spots.");
  182. toBank = new RSTile[ ] { new RSTile(3271,3144 ),new RSTile(3276,3157 ),new RSTile(3270,3167 ) };
  183. toArea = reversePath( toBank );
  184. usesNPCBanking = true;
  185. if ( catchName.equals("Shrimp/Anchovies") ) {
  186. currentGear = GEAR_NET;
  187. currentBait = BAIT_NONE;
  188. fishingSpotID = 330;
  189. currentCommand = "Net";
  190. bankID = 496;
  191. return true;
  192. }
  193. if ( catchName.equals("Herring/Sardines") ) {
  194. currentGear = GEAR_ROD;
  195. currentBait = BAIT_BAIT;
  196. fishingSpotID = 330;
  197. currentCommand = "Bait";
  198. bankID = 496;
  199. return true;
  200. }
  201. }
  202. // Barbarian Village locations:
  203. if ( locationName.equals("Barb Village(EV)") ) {
  204. log("Setting Mummyfied paths for Barbarian Village(EV).");
  205. log("[Reminder]Pls start in the bank or at the fishing spots.");
  206. toBank = new RSTile[] {
  207. new RSTile(3102, 3426), new RSTile(3098, 3436), new RSTile(3091, 3448), new RSTile(3087, 3461),
  208. new RSTile(3080, 3473), new RSTile(3081, 3484), new RSTile(3094, 3492) }; //bank
  209. toArea = reversePath( toBank );
  210. usesNPCBanking = true;
  211. if ( catchName.equals("Pike") ) {
  212. currentGear = GEAR_ROD;
  213. currentBait = BAIT_BAIT;
  214. fishingSpotID = 328;
  215. currentCommand = "Bait";
  216. bankID = 5912;
  217. return true;
  218. }
  219. if ( catchName.equals("Trout/Salmon") ) {
  220. currentGear = GEAR_FLYROD;
  221. currentBait = BAIT_FEATHERS;
  222. fishingSpotID = 328;
  223. currentCommand = "Lure";
  224. bankID = 5912;
  225. return true;
  226. }
  227. if ( catchName.equals("Rainbow Fish") ) {
  228. currentGear = GEAR_FLYROD;
  229. currentBait = BAIT_STRIPY;
  230. fishingSpotID = 328;
  231. currentCommand = "Lure";
  232. bankID = 5912;
  233. return true;
  234. }
  235. }
  236. // Catherby locations:
  237. if ( locationName.equals("Catherby") ) {
  238. log("Setting Mummyfied paths for Catherby.");
  239. log("[Reminder]Pls start in the bank or at the fishing spots.");
  240. toBank = new RSTile[] {new RSTile(2843,3431), new RSTile(2835,3435), new RSTile(2824,3436), new RSTile(2810,3441)};
  241. toArea = new RSTile[] {new RSTile(2817,3438), new RSTile(2829,3438), new RSTile(2842,3432)};
  242. usesNPCBanking = true;
  243. if ( catchName.equals("Bass/Cod/Mackerel") ) {
  244. currentGear = GEAR_BIGNET;
  245. currentBait = BAIT_NONE;
  246. fishingSpotID = 322;
  247. currentCommand = "Net";
  248. bankID = 495;
  249. return true;
  250. }
  251. if ( catchName.equals("Shrimp/Anchovies") ) {
  252. currentGear = GEAR_NET;
  253. currentBait = BAIT_NONE;
  254. fishingSpotID = 320;
  255. currentCommand = "Net";
  256. bankID = 495;
  257. return true;
  258. }
  259. if ( catchName.equals("Herring/Sardines") ) {
  260. currentGear = GEAR_ROD;
  261. currentBait = BAIT_BAIT;
  262. fishingSpotID = 320;
  263. currentCommand = "Bait";
  264. bankID = 495;
  265. return true;
  266. }
  267. if ( catchName.equals("Lobsters") ) {
  268. currentGear = GEAR_CAGE;
  269. currentBait = BAIT_NONE;
  270. fishingSpotID = 321;
  271. currentCommand = "Cage";
  272. bankID = 495;
  273. return true;
  274. }
  275. if ( catchName.equals("Tuna/Swordfish") ) {
  276. currentGear = GEAR_HARPOON;
  277. currentBait = BAIT_NONE;
  278. fishingSpotID = 321;
  279. currentCommand = "Harpoon";
  280. bankID = 495;
  281. return true;
  282. }
  283. if ( catchName.equals("Tuna/Swordfish(CHARPOON") ) {
  284. currentGear = GEAR_CHARPOON;
  285. currentBait = BAIT_NONE;
  286. fishingSpotID = 321;
  287. currentCommand = "Harpoon";
  288. bankID = 495;
  289. return true;
  290. }
  291. if ( catchName.equals("Sharks") ) {
  292. currentGear = GEAR_HARPOON;
  293. currentBait = BAIT_NONE;
  294. fishingSpotID = 322;
  295. currentCommand = "Harpoon";
  296. bankID = 495;
  297. return true;
  298. }
  299. if ( catchName.equals("Sharks(CHARPOON") ) {
  300. currentGear = GEAR_CHARPOON;
  301. currentBait = BAIT_NONE;
  302. fishingSpotID = 322;
  303. currentCommand = "Harpoon";
  304. bankID = 495;
  305. return true;
  306. }
  307. }
  308. // Draynor locations.
  309. if ( locationName.equals("Draynor") ) {
  310. // Setup draynor paths.
  311. log("Setting Mummyfied paths for Draynor.");
  312. log("[Reminder]Pls start in the bank or at the fishing spots.");
  313. toBank = new RSTile[] {new RSTile(3086, 3232),new RSTile(3093,3242) };
  314. toArea = reversePath( toBank );
  315. usesNPCBanking = true;
  316. if ( catchName.equals("Shrimp/Anchovies") ) {
  317. currentGear = GEAR_NET;
  318. currentBait = BAIT_NONE;
  319. fishingSpotID = 327;
  320. currentCommand = "Net";
  321. bankID = 495;
  322. return true;
  323. }
  324. if ( catchName.equals("Herring/Sardines") ) {
  325. currentGear = GEAR_ROD;
  326. currentBait = BAIT_BAIT;
  327. fishingSpotID = 327;
  328. currentCommand = "Bait";
  329. bankID = 495;
  330. return true;
  331. }
  332. }
  333. if ( locationName.equals("Fishing Guild") ) {
  334. log("Setting Mummyfied paths for the Fishing Guild.");
  335. log("[Reminder]Pls start in the bank or at the fishing spots.");
  336. toBank = new RSTile[] {new RSTile(2594,3415), new RSTile(2588,3420)};
  337. toArea = new RSTile[] {new RSTile(2597,3420)};
  338. usesNPCBanking = true;
  339. if ( catchName.equals("Bass/Cod/Mackerel") ) {
  340. currentGear = GEAR_BIGNET;
  341. currentBait = BAIT_NONE;
  342. fishingSpotID = 313;
  343. currentCommand = "Net";
  344. bankID = 494;
  345. return true;
  346. }
  347. if ( catchName.equals("Lobsters") ) {
  348. currentGear = GEAR_CAGE;
  349. currentBait = BAIT_NONE;
  350. fishingSpotID = 312;
  351. currentCommand = "Cage";
  352. bankID = 494;
  353. return true;
  354. }
  355. if ( catchName.equals("Tuna/Swordfish") ) {
  356. currentGear = GEAR_HARPOON;
  357. currentBait = BAIT_NONE;
  358. fishingSpotID = 312;
  359. currentCommand = "Harpoon";
  360. bankID = 494;
  361. return true;
  362. }
  363. if ( catchName.equals("Tuna/Swordfish(CHARPOON)") ) {
  364. currentGear = GEAR_CHARPOON;
  365. currentBait = BAIT_NONE;
  366. fishingSpotID = 312;
  367. currentCommand = "Harpoon";
  368. bankID = 494;
  369. return true;
  370. }
  371. if ( catchName.equals("Sharks") ) {
  372. currentGear = GEAR_HARPOON;
  373. currentBait = BAIT_NONE;
  374. fishingSpotID = 313;
  375. currentCommand = "Harpoon";
  376. bankID = 494;
  377. return true;
  378. }
  379. if ( catchName.equals("Sharks(CHARPOON)") ) {
  380. currentGear = GEAR_CHARPOON;
  381. currentBait = BAIT_NONE;
  382. fishingSpotID = 313;
  383. currentCommand = "Harpoon";
  384. bankID = 494;
  385. return true;
  386. }
  387. }
  388. if ( locationName.equals("Karamja") ) {
  389. log("Setting Mummyfied paths for Karamja");
  390. log("[Reminder]Pls start in the bank or at the fishing spots.");
  391. toBank = new RSTile[] { new RSTile(2925,3177 ), new RSTile(2924, 3166), new RSTile(2929, 3152),
  392. new RSTile(2942, 3146),
  393. /*new RSTile(2954, 3146), new RSTile(3032, 3217),*/
  394. new RSTile(3029, 3217), new RSTile(3027, 3222), new RSTile(3027, 3230),
  395. new RSTile(3041, 3238), new RSTile(3051, 3246), new RSTile(3068, 3248),
  396. new RSTile(3080, 3250), new RSTile(3092, 3243)};//PortSarim
  397. toArea = reversePath( toBank );
  398. toArea = reversePath( toBank );
  399. usesNPCBanking = true;
  400. if ( catchName.equals("Shrimp/Anchovies") ) {
  401. currentGear = GEAR_NET;
  402. currentBait = BAIT_NONE;
  403. fishingSpotID = 323;
  404. currentCommand = "Net";
  405. bankID = 495;
  406. return true;
  407. }
  408. if ( catchName.equals("Herring/Sardines") ) {
  409. currentGear = GEAR_ROD;
  410. currentBait = BAIT_BAIT;
  411. fishingSpotID = 323;
  412. currentCommand = "Bait";
  413. bankID = 495;
  414. return true;
  415. }
  416. if ( catchName.equals("Lobsters") ) {
  417. currentGear = GEAR_CAGE;
  418. currentBait = BAIT_NONE;
  419. fishingSpotID = 324;
  420. currentCommand = "Cage";
  421. bankID = 495;
  422. return true;
  423. }
  424. if ( catchName.equals("Tuna/Swordfish") ) {
  425. currentGear = GEAR_HARPOON;
  426. currentBait = BAIT_NONE;
  427. fishingSpotID = 324;
  428. currentCommand = "Harpoon";
  429. bankID = 495;
  430. return true;
  431. }
  432. }
  433. if ( locationName.equals("[Sell]Karamja") ) {
  434. log("Setting Mummyfied paths for Karamja");
  435. toBank = new RSTile[] { new RSTile(2923,3170), new RSTile(2918,3159), new RSTile(2909,3151),
  436. new RSTile(2905,3145)};
  437. toArea = reversePath( toBank );
  438. usesNPCBanking = true;
  439. if ( catchName.equals("Shrimp/Anchovies") ) {
  440. currentGear = GEAR_NET;
  441. currentBait = BAIT_NONE;
  442. fishingSpotID = 323;
  443. currentCommand = "Net";
  444. shopID = 532;
  445. return true;
  446. }
  447. if ( catchName.equals("Herring/Sardines") ) {
  448. currentGear = GEAR_ROD;
  449. currentBait = BAIT_BAIT;
  450. fishingSpotID = 323;
  451. currentCommand = "Bait";
  452. shopID = 532;
  453. return true;
  454. }
  455. if ( catchName.equals("Lobsters") ) {
  456. currentGear = GEAR_CAGE;
  457. currentBait = BAIT_NONE;
  458. fishingSpotID = 324;
  459. currentCommand = "Cage";
  460. shopID = 532;
  461. return true;
  462. }
  463. if ( catchName.equals("Tuna/Swordfish") ) {
  464. currentGear = GEAR_HARPOON;
  465. currentBait = BAIT_NONE;
  466. fishingSpotID = 324;
  467. currentCommand = "Harpoon";
  468. shopID = 532;
  469. return true;
  470. }
  471. }
  472. if ( locationName.equals("Shilo") ) {
  473. log("Setting Mummyfied paths for Shilo.");
  474. log("[Reminder]Pls start in the bank or at the fishing spots.");
  475. toBank = new RSTile[ ] { new RSTile(2864, 2971),
  476. new RSTile(2850, 2967), new RSTile(2852, 2953) };
  477. toArea = reversePath( toBank );
  478. usesNPCBanking = true;
  479. if ( catchName.equals("Trout/Salmon") ) {
  480. currentGear = GEAR_FLYROD;
  481. currentBait = BAIT_FEATHERS;
  482. fishingSpotID = 317;
  483. currentCommand = "Lure";
  484. bankID = 499;
  485. return true;
  486. }
  487. if ( catchName.equals("Pike") ) {
  488. currentGear = GEAR_ROD;
  489. currentBait = BAIT_BAIT;
  490. fishingSpotID = 317;
  491. currentCommand = "Bait";
  492. bankID = 499;
  493. return true;
  494. }
  495. }
  496. if ( locationName.equals("Piscatoris") ) {
  497. log("Setting Mummyfied paths for Piscatoris");
  498. log("[Reminder]Pls start in the bank or at the fishing spots.");
  499. toBank = new RSTile[ ] { new RSTile(2339,3697 ),new RSTile(2322,3696 ),new RSTile(2331,3689 )};
  500. toArea = new RSTile[ ] { new RSTile(2339,3697 )};
  501. usesNPCBanking = true;
  502. if ( catchName.equals("Monkfish") ) {
  503. currentGear = GEAR_NET;
  504. currentBait = BAIT_NONE;
  505. fishingSpotID = 3848;
  506. currentCommand = "Net";
  507. bankID = 3824;
  508. return true;
  509. }
  510. if ( catchName.equals("Tuna/Swordfish") ) {
  511. currentGear = GEAR_HARPOON;
  512. currentBait = BAIT_NONE;
  513. fishingSpotID = 3848;
  514. currentCommand = "Harpoon";
  515. bankID = 3824;
  516. return true;
  517. }
  518. if ( catchName.equals("Tuna/Swordfish(BARB)") ) {
  519. currentGear = GEAR_NONE;
  520. currentBait = BAIT_NONE;
  521. fishingSpotID = 3848;
  522. currentCommand = "Harpoon";
  523. bankID = 3824;
  524. return true;
  525. }
  526. if ( catchName.equals("Tuna/Swordfish(CHARPOON)") ) {
  527. currentGear = GEAR_CHARPOON;
  528. currentBait = BAIT_NONE;
  529. fishingSpotID = 3848;
  530. currentCommand = "Harpoon";
  531. bankID = 3824;
  532. return true;
  533. }
  534. }
  535. log("Unable to start script: Invalid combination of parameters.");
  536. return false;
  537. }
  538. public void onFinish( ) {
  539. // Takes a screen shot when u stop the script.
  540. ScreenshotUtil.takeScreenshot(true);
  541. // Remove listeners.
  542. Bot.getEventManager( ).removeListener(PaintListener.class, this);
  543. Bot.getEventManager( ).removeListener(ServerMessageListener.class, this);
  544. }
  545. final ScriptManifest props = getClass().getAnnotation(
  546. ScriptManifest.class);
  547. public void checkupdate() {
  548. double curV = getOVersion();
  549. if(curV > props.version()) {
  550. log("Please update your ZombieFisher to v" + curV);
  551. return;
  552. } else {
  553. log("You've got latest ZombieFisher");
  554. }
  555. return;
  556. }
  557. public void checkupdate2() {
  558. double curV = getOVersion();
  559. if(curV > props.version()) {
  560. log("A new update was just released! Pls refer to the thread for more details.");
  561. beep(5);
  562. return;
  563. }
  564. return;
  565. }
  566. //If the URL doesnt work, try this http://zombiebboi12.webs.com/Version
  567. public static double getOVersion() {
  568. try {
  569. URL url = new URL("http://preview8.awardspace.com/zombiebboi12.co.cc/");
  570. BufferedReader br = new BufferedReader(new InputStreamReader(
  571. new BufferedInputStream(url.openConnection().getInputStream())));
  572. double ver = Double.parseDouble(br.readLine().trim());
  573. br.close();
  574. return ver;
  575. } catch (IOException e) {
  576. throw new RuntimeException(e);
  577. }
  578. }
  579. public void Reset( ) {
  580. StartedY = false;
  581. currentFails = 0;
  582. }
  583. public void openURL(final String url) { // Credits to Dave who gave credits
  584. // to
  585. // some guy who made this.
  586. final String osName = System.getProperty("os.name");
  587. try {
  588. if (osName.startsWith("Mac OS")) {
  589. final Class<?> fileMgr = Class
  590. .forName("com.apple.eio.FileManager");
  591. final Method openURL = fileMgr.getDeclaredMethod("openURL",
  592. new Class[] { String.class });
  593. openURL.invoke(null, new Object[] { url });
  594. } else if (osName.startsWith("Windows")) {
  595. Runtime.getRuntime().exec(
  596. "rundll32 url.dll,FileProtocolHandler " + url);
  597. } else { // assume Unix or Linux
  598. final String[] browsers = { "firefox", "opera", "konqueror",
  599. "epiphany", "mozilla", "netscape" };
  600. String browser = null;
  601. for (int count = 0; count < browsers.length && browser == null; count++) {
  602. if (Runtime.getRuntime().exec(
  603. new String[] { "which", browsers[count] })
  604. .waitFor() == 0) {
  605. browser = browsers[count];
  606. }
  607. }
  608. if (browser == null) {
  609. throw new Exception("Could not find web browser");
  610. } else {
  611. Runtime.getRuntime().exec(new String[] { browser, url });
  612. }
  613. }
  614. } catch (final Exception e) {
  615. }
  616. }
  617. public int loop() {
  618. randomInt = random(1, 17);
  619. GambleInt = random(1, 17);
  620. if (GambleInt == 1) {
  621. turnCamera();
  622. }
  623. if (!isLoggedIn() || isWelcomeButton() || !StartedY) {
  624. StartedY = true;
  625. wait(1000);
  626. return random(250, 500);
  627. }
  628. if ( barbarianMode && currentGear != GEAR_NONE ) {
  629. }
  630. if ( barbarianMode && currentGear != GEAR_NONE ) {
  631. }
  632. if ( currentFails >= 1000 ) {
  633. log("The script failed 100 times, and will now stop as a failsafe.");
  634. ScreenshotUtil.takeScreenshot(isLoggedIn());
  635. if(checkForLogout()) stopScript();
  636. }
  637. switch ( state ) {
  638. case S_WALKTO_BANK:
  639. return walkToBank( );
  640. case S_THROW_TUNAS:
  641. return throwTunas( );
  642. case S_WALKTO_SPOT:
  643. return walkToSpots( );
  644. case S_FISH:
  645. if (antiTunas == true)
  646. return stateTuna( );
  647. else
  648. return stateFish( );
  649. case S_DROP_ALL:
  650. return dropAll( );
  651. case S_USE_BANK:
  652. if ( usesNPCBanking )
  653. if ( locationName.equals("[Sell]Karamja") )
  654. return useShopNPCKaramja( );
  655. else
  656. if ( locationName.equals("Piscatoris") )
  657. return useBankNPCPiscatoris( );
  658. else
  659. return useBankNPC( );
  660. else
  661. return useBank( );
  662. case S_DEPOSIT:
  663. if ( locationName.equals("[Sell]Karamja") )
  664. return sellAllKaramja( );
  665. else
  666. if ( locationName.equals("Karamja") )
  667. return depositAllKaramja( );
  668. else
  669. return depositAllRest( );
  670. case S_WITHDRAW:
  671. stopScript();
  672. ScreenshotUtil.takeScreenshot(isLoggedIn());
  673. }
  674. return random(500, 1000);
  675. }
  676. int antiBan() {
  677. int GambleInt = random(1, 6);
  678. switch (GambleInt) {
  679. case 1:
  680. wait(random(2000, 2500));
  681. break;
  682. case 2:
  683. if ( random(1, 4) == 1 ) {
  684. int x = random(0, 750);
  685. int y = random(0, 500);
  686. moveMouse(0, 0, x, y);
  687. }
  688. return random(1300, 1600);
  689. case 3:
  690. // Is the current tab the inventory?
  691. if (getCurrentTab() != TAB_INVENTORY) {
  692. // No, so switch to the inventory tab.
  693. openTab(TAB_INVENTORY);
  694. return random(500, 750);
  695. } else {
  696. // No, so return
  697. return random(500, 750);
  698. }
  699. case 4:
  700. // If the player is moving, then abort.
  701. if (getMyPlayer().isMoving()) {
  702. return random(750, 1000);
  703. }
  704. if (System.currentTimeMillis() - lastCheck >= checkTime) {
  705. lastCheck = System.currentTimeMillis();
  706. checkTime = random(60000, 180000);
  707. if (getCurrentTab() != Constants.TAB_STATS) {
  708. openTab(Constants.TAB_STATS);
  709. }
  710. moveMouse(663, 292, 50, 28);
  711. return random(5000, 8000);
  712. }
  713. case 5:
  714. if (random(1, 8) == 2) {
  715. int angle = getCameraAngle() + random(-90, 90);
  716. if (angle < 0) {
  717. angle = 0;
  718. }
  719. if (angle > 359) {
  720. angle = 0;
  721. }
  722. setCameraRotation(angle);
  723. }
  724. return random(500, 750);
  725. }
  726. return random(500, 1000);
  727. }
  728. public int useShopNPCKaramja( ) {
  729. RSNPC Shopkeeper = getNearestNPCByID( shopID );
  730. if ( getMyPlayer( ).isMoving( ) )
  731. return random(250, 500);
  732. if ( runningFromCombat ) {
  733. state = S_WALKTO_SPOT;
  734. return random(500, 750);
  735. }
  736. if (RSInterface.getInterface(620).isValid()) {
  737. state = S_DEPOSIT;
  738. return 500;
  739. }
  740. if ( Shopkeeper != null ) {
  741. if ( atNPC(Shopkeeper, "trade") ) {
  742. log("Accessed shop.");
  743. state = S_DEPOSIT;
  744. currentFails = 0;
  745. return random(500, 1000);
  746. }
  747. else {
  748. log("Misclicked shopkeeper, trying again.");
  749. currentFails++;
  750. return random(500, 750);
  751. }
  752. }
  753. return random(500, 1000);
  754. }
  755. public int useBankNPCPiscatoris( ) {
  756. RSNPC banker = getNearestNPCByID( bankID );
  757. if ( getMyPlayer( ).isMoving( ) )
  758. return random(250, 500);
  759. if ( runningFromCombat ) {
  760. state = S_WALKTO_SPOT;
  761. return random(500, 750);
  762. }
  763. if(RSInterface.getInterface(INTERFACE_BANK).isValid()) {
  764. state = S_DEPOSIT;
  765. return 500;
  766. }
  767. if ( banker != null ) {
  768. if ( atNPC(banker, "bank") ) {
  769. log("Accessed bank account.");
  770. state = S_DEPOSIT;
  771. currentFails = 0;
  772. return random(500, 1000);
  773. }
  774. else {
  775. log("Misclicked bank, trying again.");
  776. currentFails++;
  777. return random(500, 750);
  778. }
  779. }
  780. else {
  781. log("Unable to find bankbooth");
  782. currentFails++;
  783. return random(500, 750);
  784. }
  785. }
  786. public int useBankNPC( ) {
  787. RSNPC banker = getNearestNPCByID( bankID );
  788. if ( getMyPlayer( ).isMoving( ) )
  789. return random(250, 500);
  790. if ( runningFromCombat ) {
  791. state = S_WALKTO_SPOT;
  792. return random(500, 750);
  793. }
  794. if(RSInterface.getInterface(INTERFACE_BANK).isValid()) {
  795. state = S_DEPOSIT;
  796. return 500;
  797. }
  798. if ( banker != null ) {
  799. if ( atNPC(banker, "bank banker") ) {
  800. log("Accessed bank account.");
  801. state = S_DEPOSIT;
  802. currentFails = 0;
  803. return random(500, 1000);
  804. }
  805. else {
  806. log("Misclicked bank, trying again.");
  807. currentFails++;
  808. return random(500, 750);
  809. }
  810. }
  811. else {
  812. log("Unable to find bankbooth");
  813. currentFails++;
  814. return random(500, 750);
  815. }
  816. }
  817. @SuppressWarnings("deprecation")
  818. public int useBank( ) {
  819. RSObject bankBooth = findObject( bankID );
  820. if ( getMyPlayer( ).isMoving( ) )
  821. return random(250, 500);
  822. if ( runningFromCombat ) {
  823. state = S_WALKTO_SPOT;
  824. return random(500, 750);
  825. }
  826. if(RSInterface.getInterface(INTERFACE_BANK).isValid()) {
  827. state = S_DEPOSIT;
  828. return 500;
  829. }
  830. if ( bankBooth != null ) {
  831. turnToObject(bankBooth, 40);
  832. if (atObject(bankBooth, "Use-quickly") ) {
  833. log("Accessed bank account.");
  834. state = S_DEPOSIT;
  835. currentFails = 0;
  836. return random(500, 1000);
  837. }
  838. else {
  839. setCameraRotation(getCameraAngle() + random(-90,90));
  840. log("Misclicked bank, trying again.");
  841. currentFails++;
  842. return random(500, 750);
  843. }
  844. }
  845. else {
  846. log("Unable to find bankbooth");
  847. currentFails++;
  848. return random(500, 750);
  849. }
  850. }
  851. public int walkToSpots( ) {
  852. if ( takeBoatToKaramja( ) )
  853. return random(2000, 2500);
  854. if ( randomRunEnergy <= getEnergy( ) && !isRunning( ) ) {
  855. setRun( true );
  856. randomRunEnergy = random(20, 60);
  857. return random(750, 1000);
  858. }
  859. if ( distanceTo(toArea[toArea.length - 1]) <= 3 ) {
  860. log("Arriving at fishing spots, continuing to fish.");
  861. state = S_FISH;
  862. currentFails = 0;
  863. return random(250, 750);
  864. }
  865. if ( !getMyPlayer( ).isMoving( ) )
  866. walkPathMM(randomizePath(toArea, 2, 2), 20);
  867. return random(50, 150);
  868. }
  869. public int walkToBank( ) {
  870. if ( takeBoatFromKaramja( ) )
  871. return random(2000, 2500);
  872. // TODO: bug fix.
  873. /*if ( distanceTo(new RSTile(2953, 3147)) <= 4 )
  874. return random(250, 500);*/
  875. if ( randomRunEnergy <= getEnergy( ) && !isRunning( ) ) {
  876. setRun( true );
  877. randomRunEnergy = random(20, 60);
  878. return random(750, 1000);
  879. }
  880. if ( runningFromCombat && !getMyPlayer( ).isInCombat( ) ) {
  881. log("No longer in combat, heading back to fishing spots.");
  882. state = S_WALKTO_SPOT;
  883. runningFromCombat = false;
  884. return random(250, 750);
  885. }
  886. if ( distanceTo(toBank[toBank.length - 1]) <= 4 ) {
  887. log("Arriving at bank, Accessing account.");
  888. state = S_USE_BANK;
  889. return random(750, 1500);
  890. }
  891. if ( !getMyPlayer( ).isMoving( ) || (getDestination() != null && distanceTo(getDestination()) < 3))
  892. walkPathMM(randomizePath(toBank, 2, 2), 20);
  893. return random(50, 150);
  894. }
  895. public int dropAll( ) {
  896. // Make an array of items to keep.
  897. int[ ] thingsToKeep = new int[ ] { currentGear, currentBait, 995 };
  898. // Drop all, twice to make sure nothing is missed.
  899. dropAllExcept( thingsToKeep );
  900. dropAllExcept( thingsToKeep );
  901. dropAllExcept( thingsToKeep );
  902. dropAllExcept( thingsToKeep );
  903. state = S_FISH;
  904. return random(500, 750);
  905. }
  906. public int throwTunas( ) {
  907. // Make an array of items to keep.
  908. int[ ] thingsToKeep = new int[ ] { currentGear, currentBait, 995, 331, 335, 317, 321, 377, 371, 383, 14664, 7944, 363, 341, 353, 327, 345, 349 };
  909. // Drop all, twice to make sure nothing is missed.
  910. dropAllExcept( thingsToKeep );
  911. dropAllExcept( thingsToKeep );
  912. dropAllExcept( thingsToKeep );
  913. dropAllExcept( thingsToKeep );
  914. state = S_FISH;
  915. return random(500, 750);
  916. }
  917. public int sellAllKaramja( ) {
  918. // Make an array of items to keep.
  919. @SuppressWarnings("unused")
  920. int[ ] thingsToKeep = new int[ ] { currentGear, currentBait, 995 };
  921. if (RSInterface.getInterface(620).isValid()) {
  922. state = S_USE_BANK;
  923. return 500;
  924. }
  925. // sell all.
  926. if ( catchName.equals("Shrimp/Anchovies") ) {
  927. wait(1000);
  928. atInventoryItem(321, "Sell 50");
  929. atInventoryItem(321, "Sell 50");
  930. wait(1000);
  931. atInventoryItem(317, "Sell 50");
  932. atInventoryItem(317, "Sell 50");
  933. }
  934. if ( catchName.equals("Herring/Sardines") ) {
  935. wait(1000);
  936. atInventoryItem(345, "Sell 50");
  937. atInventoryItem(345, "Sell 50");
  938. wait(1000);
  939. atInventoryItem(327, "Sell 50");
  940. atInventoryItem(327, "Sell 50");
  941. }
  942. if ( catchName.equals("Lobsters") ) {
  943. wait(1000);
  944. atInventoryItem(377, "Sell 50");
  945. atInventoryItem(377, "Sell 50");
  946. }
  947. if ( catchName.equals("Tuna/Swordfish") ) {
  948. wait(1000);
  949. atInventoryItem(359, "Sell 50");
  950. atInventoryItem(359, "Sell 50");
  951. wait(1000);
  952. atInventoryItem(371, "Sell 50");
  953. atInventoryItem(371, "Sell 50");
  954. }
  955. // Only switch states if the deposit was successfull.
  956. if ( !isInventoryFull( ) )
  957. state = S_DEPOSIT;
  958. else
  959. state = S_WALKTO_SPOT;
  960. return random(500, 750);
  961. }
  962. public int depositAllKaramja( ) {
  963. // Make an array of items to keep.
  964. int[ ] thingsToKeep = new int[ ] { currentGear, currentBait, 995 };
  965. if(!RSInterface.getInterface(INTERFACE_BANK).isValid()) {
  966. state = S_USE_BANK;
  967. return 500;
  968. }
  969. // Deposit all.
  970. bank.depositAllExcept( thingsToKeep );
  971. // Only switch states if thet deposit was successfull.
  972. if ( !isInventoryFull( ) )
  973. state = S_WALKTO_SPOT;
  974. else
  975. state = S_USE_BANK;
  976. return random(500, 750);
  977. }
  978. public int depositAllRest( ) {
  979. // Make an array of items to keep.
  980. int[ ] thingsToKeep = new int[ ] { currentGear, currentBait };
  981. if(!RSInterface.getInterface(INTERFACE_BANK).isValid()) {
  982. state = S_USE_BANK;
  983. return 500;
  984. }
  985. // Deposit all.
  986. bank.depositAllExcept( thingsToKeep );
  987. // Only switch states if thet deposit was successfull.
  988. if ( !isInventoryFull( ) )
  989. state = S_WALKTO_SPOT;
  990. else
  991. state = S_USE_BANK;
  992. return random(500, 750);
  993. }
  994. public int stateFish( ) {
  995. // Find fishing spot.
  996. RSNPC fishingSpot = getNearestNPCByID( fishingSpotID );
  997. //
  998. if ( currentBait != BAIT_NONE && getInventoryCount(currentBait) == 0 ) {
  999. log("No bait for current mode.");
  1000. log("Please buy your feathers for the lowest price in the Grand Exchange.");
  1001. log("I thank you for doing that, the current price for feathers is too high.");
  1002. log("So, please help us out in the quest of bringing it down.");
  1003. currentFails += 5;
  1004. return random(250, 500);
  1005. }
  1006. //
  1007. if ( checkAndRecoverGear( ) )
  1008. return random(1000, 1500);
  1009. if ( currentGear != GEAR_NONE && getInventoryCount(currentGear) == 0 && !barbarianMode ) {
  1010. log("No gear for the current mode.");
  1011. currentFails += 5;
  1012. return random(250, 500);
  1013. }
  1014. // Is the player currently in combat?
  1015. if ( getMyPlayer( ).isInCombat( ) ) {
  1016. log("Running from combat.");
  1017. runningFromCombat = true;
  1018. state = S_WALKTO_BANK;
  1019. timesAvoidedCombat++;
  1020. return random(250, 500);
  1021. }
  1022. // Is the player's inventory full?
  1023. if ( isInventoryFull( ) ) {
  1024. openTab( TAB_INVENTORY );
  1025. log("The inventory is full, " + (powerFishing == true ? "dropping all catches." : "heading to the bank."));
  1026. state = (powerFishing == true) ? S_DROP_ALL : S_WALKTO_BANK;
  1027. return random(250, 500);
  1028. }
  1029. // Is the player current busy? If so, do antiban.
  1030. if (getMyPlayer().getAnimation() != -1 && !checkAndAvoidWhirlpools()
  1031. || getMyPlayer().isMoving())
  1032. return antiBan();
  1033. if ( fishingSpot == null ) {
  1034. if ( checkLostAndRecover( ) )
  1035. return random(500, 750);
  1036. if (distanceTo(toBank[toBank.length - 1]) <= 3 ) {
  1037. state = S_WALKTO_SPOT;
  1038. return random(750, 1500);
  1039. }
  1040. currentFails++;
  1041. log("Unable to find fishing spot.");
  1042. return random(250, 500);
  1043. }
  1044. else {
  1045. if ( tileOnScreen(fishingSpot.getLocation( )) ) {
  1046. if(!atNPC(fishingSpot, currentCommand)) setCameraRotation(random(1,359));
  1047. currentFails = 0;
  1048. return random(2150, 2350);
  1049. }
  1050. else {
  1051. RSTile destination = randomizeTile(fishingSpot.getLocation( ), 2, 2);
  1052. walkTileMM( destination );
  1053. return random(500, 1000);
  1054. }
  1055. }
  1056. }
  1057. public int stateTuna( ) {
  1058. // Find fishing spot.
  1059. RSNPC fishingSpot = getNearestNPCByID( fishingSpotID );
  1060. //
  1061. if ( currentBait != BAIT_NONE && getInventoryCount(currentBait) == 0 ) {
  1062. log("No bait for current mode.");
  1063. log("Please buy your feathers for the lowest price in the Grand Exchange.");
  1064. log("I thank you for doing that, the current price for feathers is too high.");
  1065. log("So, please help us out in the quest of bringing it down.");
  1066. currentFails += 5;
  1067. return random(250, 500);
  1068. }
  1069. //
  1070. if ( checkAndRecoverGear( ) )
  1071. return random(1000, 1500);
  1072. if ( currentGear != GEAR_NONE && getInventoryCount(currentGear) == 0 && !barbarianMode ) {
  1073. log("No gear for the current mode.");
  1074. currentFails += 5;
  1075. return random(250, 500);
  1076. }
  1077. // Is the player currently in combat?
  1078. if ( getMyPlayer( ).isInCombat( ) ) {
  1079. log("Running from combat.");
  1080. runningFromCombat = true;
  1081. state = S_WALKTO_BANK;
  1082. timesAvoidedCombat++;
  1083. return random(250, 500);
  1084. }
  1085. // Is the player's inventory full?
  1086. // Is the player's inventory full?
  1087. if ( !isInventoryFull( ) ) {
  1088. state = S_THROW_TUNAS;
  1089. }else{
  1090. state = S_WALKTO_BANK;
  1091. log("The inventory is full, dropping all Tunas.");
  1092. return random(250, 500);
  1093. }
  1094. // Is the player current busy? If so, do antiban.
  1095. if (getMyPlayer().getAnimation() != -1 && !checkAndAvoidWhirlpools()
  1096. || getMyPlayer().isMoving())
  1097. return antiBan();
  1098. if ( fishingSpot == null ) {
  1099. if ( checkLostAndRecover( ) )
  1100. return random(500, 750);
  1101. if (distanceTo(toBank[toBank.length - 1]) <= 3 ) {
  1102. state = S_WALKTO_SPOT;
  1103. return random(750, 1500);
  1104. }
  1105. currentFails++;
  1106. log("Unable to find fishing spot.");
  1107. return random(250, 500);
  1108. }
  1109. else {
  1110. if ( tileOnScreen(fishingSpot.getLocation( )) ) {
  1111. if(!atNPC(fishingSpot, currentCommand)) setCameraRotation(random(1,359));
  1112. currentFails = 0;
  1113. return random(1500, 1700);
  1114. }
  1115. else {
  1116. RSTile destination = randomizeTile(fishingSpot.getLocation( ), 2, 2);
  1117. walkTileMM( destination );
  1118. return random(500, 1000);
  1119. }
  1120. }
  1121. }
  1122. @SuppressWarnings("deprecation")
  1123. public boolean hasEquipped(int GEAR_BARB) {
  1124. int[] equipItems = RSInterface.getInterface(387).getChild(29)
  1125. .getInventory();
  1126. for (int j = 0; j < itemIDs.length; j++) {
  1127. for (int i = 0; i < equipItems.length; i++)
  1128. if (i == j)
  1129. return true;
  1130. }
  1131. return false;
  1132. }
  1133. public boolean checkAndAvoidWhirlpools( ) {
  1134. RSTile playerLocation = getMyPlayer( ).getLocation( );
  1135. RSTile tileToTest1 = new RSTile(playerLocation.getX( ) + 1, playerLocation.getY( ));
  1136. RSTile tileToTest2 = new RSTile(playerLocation.getX( ) - 1, playerLocation.getY( ));
  1137. RSTile tileToTest3 = new RSTile(playerLocation.getX( ), playerLocation.getY( ) + 1);
  1138. RSTile tileToTest4 = new RSTile(playerLocation.getX( ), playerLocation.getY( ) - 1);
  1139. for ( int id : whirlpools ) {
  1140. RSNPC whirlpool = getNearestNPCByID( id );
  1141. if ( whirlpool == null ) continue;
  1142. if ( whirlpool.getLocation( ).equals(tileToTest1) || whirlpool.getLocation( ).equals(tileToTest2) ||
  1143. whirlpool.getLocation( ).equals(tileToTest3) || whirlpool.getLocation( ).equals(tileToTest4) ) {
  1144. whirlpoolsAvoided++;
  1145. log("Found whirlpool");
  1146. return true;
  1147. }
  1148. }
  1149. return false;
  1150. }
  1151. public boolean checkLostAndRecover( ) {
  1152. int index = 0;
  1153. for ( RSTile lost : lostTiles ) {
  1154. if ( distanceTo(lost) <= 2 ) {
  1155. RSTile destination = randomizeTile(recoverTiles[index], 2, 2);
  1156. log("Lost at " + lost.getX( ) + ", " + lost.getY( ) + ", recovering.");
  1157. walkTileMM( destination );
  1158. return true;
  1159. }
  1160. index++;
  1161. }
  1162. return false;
  1163. }
  1164. public boolean checkAndRecoverGear( ) {
  1165. RSItemTile itemTile = getGroundItemByID(currentGear);
  1166. if ( barbarianMode ) return false;
  1167. if (getInventoryCount(currentGear) == 0 && itemTile != null) {
  1168. if (tileOnScreen(itemTile)) {
  1169. timesRecoveredGear++;
  1170. log("Recovered gear.");
  1171. atTile(itemTile, "Take");
  1172. return true;
  1173. } else {
  1174. log("Walking to gear location.");
  1175. walkTileMM(itemTile);
  1176. return true;
  1177. }
  1178. }
  1179. else {
  1180. return false;
  1181. }
  1182. }
  1183. @SuppressWarnings("deprecation")
  1184. public boolean takeBoatFromKaramja( ) {
  1185. RSNPC customsOfficer = getNearestNPCByID( 380 );
  1186. @SuppressWarnings("unused")
  1187. RSObject plank = findObject(242);
  1188. RSTile location = new RSTile(3031, 3217);
  1189. if ( !locationName.equals("Karamja") )
  1190. return false;
  1191. if ( getInventoryCount(995) < 30 ) {
  1192. log("Not enough GP for a boat ride.");
  1193. }
  1194. if ( distanceTo(location) <= 20 && !getMyPlayer( ).getLocation( ).equals(new RSTile(3029, 3217)) ) {
  1195. if ( tileOnScreen(location) ) {
  1196. atTile(location, "Cross");
  1197. log("Arriving at Port Sarim.");
  1198. return true;

Large files files are truncated, but you can click here to view the full file