Recent Posts
None | 23 sec ago
Python | 55 sec ago
Java | 1 min ago
None | 1 min ago
None | 1 min ago
None | 2 min ago
None | 2 min ago
None | 2 min ago
None | 2 min ago
C | 2 min ago
Sitereport
Find cool info about any domain on the internet?
visit sitereport
Free Subdomains
Want a pastebin.com sub-domain for your community?
learn more...
What is pastebin?
Pastebin is a website that hosts all your text & code on dedicated servers for easy sharing.
learn more...
Learn a little bit about the new Pastebin.com on our help page. hide message
By Wazzu on the 4th of Jul 2009 07:06:19 AM Download | Raw | Embed | Report
  1. import java.awt.Color;
  2. import java.awt.Graphics;
  3. import java.util.Map;
  4. import java.awt.Point;
  5. import java.util.ArrayList;
  6. import java.util.List;
  7.  
  8. import com.speljohan.rsbot.bot.Bot;
  9. import com.speljohan.rsbot.script.wrappers.RSTile;
  10. import com.speljohan.rsbot.script.Script;
  11. import com.speljohan.rsbot.script.wrappers.RSInterface;
  12. import com.speljohan.rsbot.script.wrappers.RSInterfaceChild;
  13. import com.speljohan.rsbot.script.wrappers.RSInterfaceComponent;
  14. import com.speljohan.rsbot.script.Calculations;
  15. import com.speljohan.rsbot.script.Constants;
  16. import com.speljohan.rsbot.script.wrappers.RSObject;
  17. import com.speljohan.rsbot.script.wrappers.RSItemTile;
  18. import com.speljohan.rsbot.script.wrappers.RSCharacter;
  19. import com.speljohan.rsbot.event.listeners.PaintListener;
  20. import com.speljohan.rsbot.accessors.Character;
  21. import com.speljohan.rsbot.script.Bank;
  22. import com.speljohan.rsbot.script.wrappers.RSNPC;
  23. import com.speljohan.rsbot.accessors.Item;
  24. import com.speljohan.rsbot.script.wrappers.RSItem;
  25. import com.speljohan.rsbot.script.wrappers.RSArea;
  26. import com.speljohan.rsbot.script.wrappers.RSPlayer;
  27. import com.speljohan.rsbot.accessors.NPC;
  28.  
  29.  
  30. public class WazzuStronghold extends Script implements PaintListener{
  31.  
  32. @Override
  33.         public String getAuthor() {
  34.  
  35.                 return "Wazzu";
  36.  
  37.         }
  38.  
  39. @Override
  40.         public String getName() {
  41.  
  42.                 return "Stronghold of Security";
  43.  
  44.         }
  45.  
  46. @Override
  47.         public String getScriptCategory() {
  48.                 return "Combat";
  49.         }
  50.        
  51.  
  52. public static final int [] minotaur = new int [] {4404, 4406};
  53. public static final int [] goblin = new int [] {4407, 4408, 4409, 4410, 4411, 4412};
  54. public static final int [] fleshCrawler = new int [] {4391, 4390};
  55. public static final int [] zombie = new int [] {5377, 5378, 5393, 4394, 5379, 5380};
  56. public static final int [] fleshZombie = new int [] {4391, 4390, 5377, 5378, 5393, 4394, 5379, 5380};
  57. public int [] enemy;
  58.  
  59. public boolean foodIsTrout;
  60. public boolean foodIsSalmon;
  61. public boolean foodIsLobster;
  62. public boolean foodIsMonkfish;
  63. public boolean foodIsSwordfish;
  64. public boolean foodIsTuna;
  65. public boolean foodIsCake;
  66. public boolean foodIsChocCake;
  67.  
  68. public long lastArrowPick;
  69. public long lastCharmPick;
  70. public long lastGemPick;
  71. public long lastItemPick;
  72. public long lastPick;
  73. public long lastAttack;
  74. public long lastLog;
  75.  
  76. public boolean cave1;
  77. public boolean cave2;
  78. public boolean cave4;
  79. public boolean cave5;
  80. public boolean cave6;
  81.  
  82. public RSTile northEast1 = new RSTile(1865,5244);
  83. public RSTile southWest1 = new RSTile(1858,5239);
  84.  
  85. public RSTile northEast2 = new RSTile(1859,5238);
  86. public RSTile southWest2 = new RSTile(1858,5236);
  87.  
  88. public RSTile northEast3 = new RSTile(1866,5235);
  89. public RSTile southWest3 = new RSTile(1858,5213);
  90.  
  91. public RSTile northEast4 = new RSTile(1869,5218);
  92. public RSTile southWest4 = new RSTile(1867,5217);
  93.  
  94. public RSTile northEast5 = new RSTile(1881,5222);
  95. public RSTile southWest5 = new RSTile(1870,5208);
  96.  
  97.  
  98. public RSTile northEast6 = new RSTile(1915,5230);
  99. public RSTile southWest6 = new RSTile(1901,5210);
  100.  
  101. public RSTile northEast7 = new RSTile(1905,5233);
  102. public RSTile southWest7 = new RSTile(1904,5231);
  103.  
  104. public RSTile northEast8A = new RSTile(1914,5240);
  105. public RSTile southWest8A = new RSTile(1904,5234);
  106. public RSTile northEast8B = new RSTile(1914,5244);
  107. public RSTile southWest8B = new RSTile(1908,5240);
  108.  
  109. public RSTile northEast9 = new RSTile(1907,5243);
  110. public RSTile southWest9 = new RSTile(1904,5242);
  111.  
  112. public RSTile northEast10 = new RSTile(1903,5245);
  113. public RSTile southWest10 = new RSTile(1887,5218);
  114.  
  115. public RSTile northEast11 = new RSTile(1888,5236);
  116. public RSTile southWest11 = new RSTile(1886,5235);
  117.  
  118. public RSTile northEast12 = new RSTile(1885,5236);
  119. public RSTile southWest12 = new RSTile(1878,5226);
  120.  
  121.  
  122. public RSTile northEast13 = new RSTile(2046,5246);
  123. public RSTile southWest13 = new RSTile(2040,5239);
  124.  
  125. public RSTile northEast14 = new RSTile(2031,5228);
  126. public RSTile southWest14 = new RSTile(2009,5208);
  127.  
  128. public RSTile northEast15 = new RSTile(2008,5216);
  129. public RSTile southWest15 = new RSTile(2006,5215);
  130.  
  131. public RSTile northEast16 = new RSTile(2005,5220);
  132. public RSTile southWest16 = new RSTile(2000,5209);
  133.  
  134. public RSTile northEast17 = new RSTile(2008,5208);
  135. public RSTile southWest17 = new RSTile(2001,5195);
  136.  
  137.  
  138. public RSTile northEast18 = new RSTile(2018,5228);
  139. public RSTile southWest18 = new RSTile(2016,5227);
  140.  
  141. public RSTile northEast19 = new RSTile(2015,5234);
  142. public RSTile southWest19 = new RSTile(2004,5223);
  143.  
  144. public RSTile northEast20 = new RSTile(2006,5237);
  145. public RSTile southWest20 = new RSTile(2005,5235);
  146.  
  147. public RSTile northEast21 = new RSTile(2010,5244);
  148. public RSTile southWest21 = new RSTile(1997,5238);
  149.  
  150. public RSTile northEast22 = new RSTile(1996,5244);
  151. public RSTile southWest22 = new RSTile(1988,5228);
  152.  
  153.  
  154. public RSTile northEast23 = new RSTile(2026,5214);
  155. public RSTile southWest23 = new RSTile(2014,5203);
  156.  
  157. public RSTile northEast24 = new RSTile(2021,5202);
  158. public RSTile southWest24 = new RSTile(2020,5200);
  159.  
  160. public RSTile northEast25 = new RSTile(2020,5199);
  161. public RSTile southWest25 = new RSTile(2008,5185);
  162.  
  163. public RSTile northEast26 = new RSTile(2033,5199);
  164. public RSTile southWest26 = new RSTile(2021,5185);
  165.  
  166. public RSTile northEast27 = new RSTile(2036,5186);
  167. public RSTile southWest27 = new RSTile(2034,5185);
  168.  
  169. public RSTile northEast28 = new RSTile(2046,5191);
  170. public RSTile southWest28 = new RSTile(2037,5185);
  171.  
  172. public RSTile northEast29 = new RSTile(2046,5194);
  173. public RSTile southWest29 = new RSTile(2036,5189);
  174.  
  175.  
  176.  
  177. public int skill;
  178. public String skillName;
  179. public int xpChange;
  180. public int lvlChange;
  181. public int startLevel;
  182. public String doing = "Start";
  183.  
  184. public int fireRune = 554;
  185. public int airRune = 556;
  186. public int lawRune = 563;
  187.  
  188. public int [] noDeposit = {554, 556, 563};
  189.  
  190. public int foodTrout = 333;
  191. public int foodSalmon = 329;
  192. public int foodLobster = 379;
  193. public int foodSwordfish = 373;
  194. public int foodMonkfish = 7946;
  195. public int foodTuna = 361;
  196. public int chocCake1 = 1901;
  197. public int chocCake2 = 1899;
  198. public int chocCake3 = 1897;
  199. public int cake1 = 1895;
  200. public int cake2 = 1893;
  201. public int cake3 = 1891;
  202.  
  203. public int [] arrowID;
  204. public int [] gemID;
  205. public int [] charmID;
  206. public int [] customID;
  207.  
  208. public boolean takeArrow;
  209. public boolean takeCharm;
  210. public boolean takeGem;
  211. public boolean takeCustom;
  212.  
  213. public int food;
  214. public int hole = 16154;
  215. public int [] booth = {26972, 11402};
  216. public int eatHP;
  217. public int eatHP2;
  218. public int currentHP;
  219.  
  220. public char n;
  221. public char s;
  222. public char w;
  223. public char e;
  224.  
  225. public long startTime = System.currentTimeMillis();
  226. public int startLevelAttack = 0;
  227. public int startXPAttack = 0;
  228. public int startLevelDefense = 0;
  229. public int startXPDefense = 0;
  230. public int startLevelStrength = 0;
  231. public int startXPStrength = 0;
  232. public int startLevelHP = 0;
  233. public int startXPHP = 0;
  234. public int startLevelRange = 0;
  235. public int startXPRange = 0;
  236.  
  237. RSTile [] bankToHole = new RSTile[] { new RSTile(3094,3491), new RSTile(3086,3485),
  238.                                                                          new RSTile(3081,3476), new RSTile(3080,3467),
  239.                                                                          new RSTile(3087,3460), new RSTile(3087,3450),
  240.                                                                          new RSTile(3087,3440), new RSTile(3080,3433),
  241.                                                                          new RSTile(3080,3423)
  242.                                                                         };
  243. RSTile [] holeToBank = reversePath(bankToHole);
  244. RSTile [] fountainToBank = new RSTile [] {new RSTile(3212,3424), new RSTile(3205,3428),
  245.                                                                                         new RSTile(3196, 3429), new RSTile(3189,3435)
  246.                                                                                 };
  247. RSTile [] varrockToHole = new RSTile [] {new RSTile(3189,3435), new RSTile(3180, 3430),
  248.                                                                                         new RSTile(3170,3427), new RSTile(3162,3421),
  249.                                                                                         new RSTile(3153,3417), new RSTile(3143,3417),
  250.                                                                                         new RSTile(3133,3416), new RSTile(3123,3415),
  251.                                                                                         new RSTile(3114,3420), new RSTile(3104,3420),
  252.                                                                                         new RSTile(3094,3420), new RSTile(3084,3421),
  253.                                                                                 };
  254. RSTile [] door2To3 = new RSTile [] { new RSTile(1859,5235), new RSTile(1862,5226), new RSTile(1866,5217)
  255.                                                                         };
  256. RSTile [] door3To2 = reversePath(door2To3);
  257. RSTile [] cave5Path = new RSTile [] {new RSTile(1996, 5216), new RSTile(1989, 5223),
  258.                                                                                 new RSTile(1989, 5233)
  259.                                                                         };
  260. RSTile [] cave5Reverse = reversePath(cave5Path);
  261.  
  262. public RSTile DOOR_1 = new RSTile(1859, 5238);
  263. public RSTile DOOR_2 = new RSTile(1859, 5235);
  264. public RSTile DOOR_3 = new RSTile(1867, 5217);
  265. public RSTile DOOR_4 = new RSTile(1870, 5217);
  266. public RSTile NEXT_TO_LADDER1 = new RSTile(1859, 5243);
  267.  
  268. public RSTile doorTile;
  269. public RSTile teleTile1 = new RSTile(1914, 5222);
  270. public RSTile wrongPlace1 = new RSTile(1878, 5224);
  271. public RSTile wrongPlace2 = new RSTile(1875, 5206);
  272. public RSTile wrongPlace3 = new RSTile(1845, 5243);
  273. public RSTile wrongPlace4 = new RSTile(1887, 5236);
  274. public RSTile wrongDoor1 = new RSTile(1878, 5222);
  275. public RSTile wrongDoor2 = new RSTile(1874, 5207);
  276. public RSTile wrongDoor3 = new RSTile(1887, 5243);
  277. public RSTile wrongDoor4 = new RSTile(1889, 5236);
  278.  
  279. public RSTile area14Tile = new RSTile(2021, 5217);
  280. public RSTile area16Tile = new RSTile(2003, 5210);
  281. public RSTile area17Tile = new RSTile(2005, 5205);
  282. public RSTile area21Tile = new RSTile(2000, 5243);
  283. public RSTile area22Tile = new RSTile(1994, 5241);
  284. public RSTile area23Tile = new RSTile(2021, 5210);
  285. public RSTile area25Tile = new RSTile(2019, 5193);
  286. public RSTile area26Tile = new RSTile(2023, 5193);
  287.  
  288. public RSTile door5 = new RSTile(1905, 5230);
  289. public RSTile door6 = new RSTile(1905, 5233);
  290. public RSTile door7 = new RSTile(1908, 5242);
  291. public RSTile door8 = new RSTile(1904, 5242);
  292. public RSTile door9 = new RSTile(1889, 5236);
  293. public RSTile door10 = new RSTile(1886, 5236);
  294.  
  295. public RSTile door11 = new RSTile(2008, 5216);
  296. public RSTile door12 = new RSTile(2006, 5216);
  297.  
  298. public RSTile door13 = new RSTile(2018, 5228);
  299. public RSTile door14 = new RSTile(2016, 5228);
  300. public RSTile door15 = new RSTile(2005, 5235);
  301. public RSTile door16 = new RSTile(2005, 5237);
  302.  
  303. public RSTile door17 = new RSTile(2020, 5202);
  304. public RSTile door18 = new RSTile(2020, 5200);
  305. public RSTile door19 = new RSTile(2034, 5186);
  306. public RSTile door20 = new RSTile(2036, 5186);
  307.  
  308. public RSTile portal1 = new RSTile(1863, 5238);
  309. public RSTile portal2 = new RSTile(2039, 5240);
  310. public RSTile ladder1Tile = new RSTile(1859, 5244);
  311. public RSTile ladder1bTile = new RSTile(1913, 5226);
  312. public RSTile ladder2Tile = new RSTile(1902, 5222);
  313. public RSTile ladder3Tile = new RSTile(2042, 5246);
  314. public RSTile chain1Tile = new RSTile(1881, 5232);
  315. public RSTile chain2Tile = new RSTile(2017, 5210);
  316. public RSTile chain3Tile = new RSTile(2031,5189);
  317.  
  318. @Override
  319.         public String getScriptDescription() {
  320.  
  321.                 String html = "";
  322.  
  323.                 html += "<html>\n";
  324.                 html += "<head>\n";
  325.                 html += "</head>\n";
  326.                 html += "<body bgcolor=\"#CC033C\">\n";
  327.                 html += "<font color=\"black\">\n";
  328.                 html += "<center><font size=\"8\"><b>Stronghold Of Security</b></font>\n<br>";
  329.                 html += "<font size=\"3\"><b>Version 1.6</b></font></center><br><br>";
  330.                 html += "<b>Select Cave </b>";
  331.                 html += "<select name='cave'>";
  332.                 html += "<option>Cave 1";
  333.                 html += "<option>Cave 2";
  334.                 html += "<option>Cave 4";
  335.                 html += "<option>Cave 5";
  336.                 html += "<option>Cave 6";
  337.                 html += "<br><b>Select NPC To Fight </b>";
  338.                 html += "<select name='Enemy'>";
  339.                 html += "<option>Minotaur";
  340.                 html += "<option>Goblin";
  341.                 html += "<option>Flesh Crawler";
  342.                 html += "<option>Zombie";
  343.                 html += "<option>Flesh Crawler And Zombie";
  344.                 html += "<br><b>Select Food </b>";
  345.                 html += "<select name='Food'>";
  346.                 html += "<option>Trout";
  347.                 html += "<option>Salmon";
  348.                 html += "<option>Tuna";
  349.                 html += "<option>Lobster";
  350.                 html += "<option>Monkfish";
  351.                 html += "<option>Swordfish";
  352.                 html += "<option>Cake";
  353.                 html += "<option>Chocolate Cake";
  354.                 html += "<br><b>HP To Eat At (If Not In Combat) </b>";
  355.                 html += "<input type=\"text\" size=\"3\" name=\"eatHP\">";
  356.                 html += "<br><b>HP To Eat At (No Matter What) </b>";
  357.                 html += "<input type=\"text\" size=\"3\" name=\"eatHP2\">";
  358.                 html += "<br><b>Select Arrow Pickup </b>";
  359.                 html += "<select name='arrow'>";
  360.                 html += "<option>None";
  361.                 html += "<option>Bronze";
  362.                 html += "<option>Iron";
  363.                 html += "<option>Steel";
  364.                 html += "<option>All";
  365.                 html += "<br><b>Pickup Gems </b>";
  366.                 html += "<input type=\"checkbox\" name=\"Gems\" value=\"true\">";
  367.                 html += "<br><b>Pickup Charms </b>";
  368.                 html += "<input type=\"checkbox\" name=\"Charms\" value=\"true\">";
  369.                 html += "<br><b>Other Item ID's </b>";
  370.                 html += "<input type=\"text\" name=\"item\">";
  371.                 html += "<br>(Separate w/comma)";
  372.                 html += "</font>\n";
  373.                 html += "</body>\n";
  374.                 html += "</html>\n";
  375.  
  376.                 return html;
  377.         }
  378.        
  379.         public boolean onStart(Map<String, String> args) {
  380.                 if (args.get("Enemy").equals("Minotaur")) {
  381.                                 enemy = minotaur;
  382.                         }
  383.                 if (args.get("Enemy").equals("Goblin")) {
  384.                                 enemy = goblin;
  385.                         }
  386.                 if (args.get("Enemy").equals("Flesh Crawler")) {
  387.                                 enemy = fleshCrawler;
  388.                         }
  389.                 if (args.get("Enemy").equals("Zombie")) {
  390.                                 enemy = zombie;
  391.                         }
  392.                 if (args.get("Enemy").equals("Flesh Crawler And Zombie")) {
  393.                                 enemy = fleshZombie;
  394.                         }
  395.                 cave1 = (args.get("cave").equals("Cave 1"));
  396.                 cave2 = (args.get("cave").equals("Cave 2"));
  397.                 cave4 = (args.get("cave").equals("Cave 4"));
  398.                 cave5 = (args.get("cave").equals("Cave 5"));
  399.                 cave6 = (args.get("cave").equals("Cave 6"));
  400.                 foodIsSalmon = (args.get("Food").equals("Salmon"));
  401.                 foodIsTrout = (args.get("Food").equals("Trout"));
  402.                 foodIsLobster = (args.get("Food").equals("Lobter"));
  403.                 foodIsMonkfish = (args.get("Food").equals("Monkfish"));
  404.                 foodIsSwordfish = (args.get("Food").equals("Swordfish"));
  405.                 foodIsTuna = (args.get("Food").equals("Tuna"));
  406.                 foodIsChocCake = (args.get("Food").equals("Chocolate Cake"));
  407.                 foodIsCake = (args.get("Food").equals("Cake"));
  408.                 if (args.get("Food").equals("Trout")) {
  409.                                 food = foodTrout;
  410.                         }
  411.                 if (args.get("Food").equals("Salmon")) {
  412.                                 food = foodSalmon;
  413.                         }
  414.                 if (args.get("Food").equals("Lobster")) {
  415.                                 food = foodLobster;
  416.                         }
  417.                 if (args.get("Food").equals("Monkfish")) {
  418.                                 food = foodMonkfish;
  419.                         }
  420.                 if (args.get("Food").equals("Swordfish")) {
  421.                                 food = foodSwordfish;
  422.                         }
  423.                 if (args.get("Food").equals("Tuna")) {
  424.                                 food = foodTuna;
  425.                         }
  426.                 if (args.get("Food").equals("Chocolate Cake")) {
  427.                                 food = chocCake3;
  428.                         }
  429.                 if (args.get("Food").equals("Cake")) {
  430.                                 food = cake3;
  431.                         }
  432.                 eatHP = Integer.parseInt(args.get("eatHP"));
  433.                 eatHP2 = Integer.parseInt(args.get("eatHP2"));
  434.                 if (args.get("arrow").equals("None")) {
  435.                         arrowID = new int [] {1};
  436.                         takeArrow = false;
  437.                 }
  438.                 if (args.get("arrow").equals("Bronze")) {
  439.                         arrowID = new int [] {882};
  440.                         takeArrow = true;
  441.                 }
  442.                 if (args.get("arrow").equals("Iron")) {
  443.                         arrowID = new int [] {884};
  444.                         takeArrow = true;
  445.                 }
  446.                 if (args.get("arrow").equals("Steel")) {
  447.                         arrowID = new int [] {886};
  448.                         takeArrow = true;
  449.                 }
  450.                 if (args.get("arrow").equals("All")) {
  451.                         arrowID = new int [] {882, 884, 886};
  452.                         takeArrow = true;
  453.                 }
  454.                 if (args.get("Charms") != null) {
  455.                         charmID = new int [] {12158, 12159, 12160, 12163};
  456.                         takeCharm = true;
  457.                 }
  458.                 if (args.get("Charms") == null) {
  459.                         charmID = new int [] {1};
  460.                         takeCharm = false;
  461.                 }
  462.                 if (args.get("Gems") != null) {
  463.                         gemID = new int [] {1617, 1619, 1621, 1623};
  464.                         takeGem = true;
  465.                 }
  466.                 if (args.get("Gems") == null) {
  467.                 gemID = new int [] {1};
  468.                         takeGem = false;
  469.                 }
  470.                 String itemCus = args.get("item");
  471.                 if(itemCus.length() < 1) {
  472.                         customID = new int [] {1};
  473.                         takeCustom = false;
  474.                 }
  475.                 else {
  476.                         String[] itemCust = itemCus.split(",");
  477.                         customID = new int[itemCust.length];
  478.                         for(int i = 0; i < itemCust.length; i++) {
  479.                                 itemCust[i] = itemCust[i].trim();
  480.                                 customID[i] = Integer.parseInt(itemCust[i]);
  481.             }
  482.                         takeCustom = true;
  483.                 }
  484.                 log("Time To Fight, Bitch");
  485.                
  486.                 startTime = System.currentTimeMillis();
  487.                 if (isLoggedIn()) {
  488.                         startLevelAttack = skills.getRealSkillLevel(0);
  489.                         startXPAttack = skills.getCurrentSkillExp(0);
  490.                         startLevelDefense = skills.getRealSkillLevel(1);
  491.                         startXPDefense = skills.getCurrentSkillExp(1);
  492.                         startLevelStrength = skills.getRealSkillLevel(2);
  493.                         startXPStrength = skills.getCurrentSkillExp(2);
  494.                         startLevelHP = skills.getRealSkillLevel(3);
  495.                         startXPHP = skills.getCurrentSkillExp(3);
  496.                         startLevelRange = skills.getRealSkillLevel(4);
  497.                         startXPRange = skills.getCurrentSkillExp(4);
  498.                 }
  499.                
  500.         return true;
  501.         }
  502.        
  503.         public int loop () {
  504.  
  505.                 RSObject bankBooth = findObject(booth);
  506.                 RSNPC theNPC = getNearestFreeNPCByID(enemy);
  507.  
  508.                 if(!inventoryContains(food)) {
  509.                         goBank();
  510.                 }
  511.        
  512.                 if(!inventoryContains(food) && bankBooth != null) {
  513.                         if(distanceTo(bankBooth.getLocation()) < 5) {
  514.                                 bank();
  515.                         }
  516.                 }
  517.                
  518.                 if(inventoryContains(food)) {
  519.                         if(theNPC == null || !canReach(theNPC, false)) {
  520.                                 goFight();
  521.                         }
  522.                 }
  523.                
  524.                 if(inventoryContains(food) && theNPC != null  && canReach(theNPC.getLocation(), false)) {
  525.                         fight();
  526.                 }
  527.                
  528.                 return(random(50,100));
  529.         }
  530.        
  531.         public int fight() {
  532.         currentHP = skills.getCurrentSkillLevel(Constants.STAT_HITPOINTS);
  533.         if(currentHP < eatHP2) {
  534.                 eat();
  535.                 return(random(10,20));
  536.         }
  537.         if(isUnderAttack()) {
  538.                 return(random(2,5));
  539.         }
  540.         if(System.currentTimeMillis() - lastPick < 500) {
  541.                 return(random(2,5));
  542.         }
  543.         if(System.currentTimeMillis() - lastAttack < 500) {
  544.                 return(random(2,5));
  545.         }
  546.         if(getMyPlayer().getInteracting() != null) {
  547.                 return(random(2,5));
  548.         }
  549.         if(getMyPlayer().isMoving()) {
  550.                 return(random(2,5));
  551.         }
  552.         else {
  553.                 RSItemTile pickArrow = getGroundItemByID(6, arrowID);
  554.                 RSItemTile pickCharm = getGroundItemByID(6, charmID);
  555.                 RSItemTile pickGem = getGroundItemByID(6, gemID);
  556.                 RSItemTile pickItem = getGroundItemByID(6, customID);
  557.                 RSNPC theNPC = getNearestFreeNPCByID(enemy);
  558.                 if(System.currentTimeMillis() - lastArrowPick > 3000) {
  559.                         if(canReach(pickArrow, false)) {
  560.                                 if(takeArrow == true && getMyPlayer().isIdle() && getMyPlayer().getInteracting() == null && inventoryContains(arrowID) || getInventoryCount() < 28) {
  561.                                         pickUpArrow();
  562.                                         return(random(10,20));
  563.                                 }
  564.                         }
  565.                 }
  566.                 if(System.currentTimeMillis() - lastCharmPick > 3000) {
  567.                         if(canReach(pickCharm, false)) {
  568.                                 if(takeCharm == true && getMyPlayer().isIdle() && getMyPlayer().getInteracting() == null && getInventoryCount() < 28) {
  569.                                         pickUpCharm();
  570.                                         return(random(10,20));
  571.                                 }
  572.                         }
  573.                 }
  574.                 if(System.currentTimeMillis() - lastGemPick > 3000) {
  575.                         if(canReach(pickGem, false)) {
  576.                                 if(takeGem == true && getMyPlayer().isIdle() && getMyPlayer().getInteracting() == null && getInventoryCount() < 28) {
  577.                                         pickUpGem();
  578.                                         return(random(10,20));
  579.                                 }
  580.                         }
  581.                 }
  582.                 if(System.currentTimeMillis() - lastItemPick > 3000) {
  583.                         if(canReach(pickItem, false)) {
  584.                                 if(takeCustom == true && getMyPlayer().isIdle() && getMyPlayer().getInteracting() == null && getInventoryCount() < 28) {
  585.                                         pickUpCustomItem();
  586.                                         return(random(10,20));
  587.                                 }
  588.                         }
  589.                 }
  590.        
  591.                
  592.                 if(currentHP <= eatHP) {
  593.                         eat();
  594.                         return(random(10,20));
  595.                 }
  596.                 else {
  597.                         if(getEnergy() > random(25,100)) {
  598.                         setRun(true);
  599.                         wait(random(10,20));
  600.                         }
  601.                         if(theNPC != null) {
  602.                                 if(getMyPlayer().getInteracting() == null && !getMyPlayer().isMoving()) {
  603.                                         if(!clickNPC(theNPC, "Attack")) {
  604.                                                 return(random(750,1000));
  605.                                         }
  606.                                         else {
  607.                                                 return(random(2,5));
  608.                                         }
  609.                                 }
  610.                         }
  611.                         else {
  612.                                 return(random(50,100));
  613.                         }
  614.                 }
  615.                 return(random(50,100));
  616.         }
  617. }
  618.  
  619.         public int eat() {
  620.                 if(!foodIsChocCake && !foodIsCake) {
  621.                                 atInventoryItemCustom(food, "Eat");
  622.                                 return(random(10,20));
  623.                         }
  624.                         if(foodIsChocCake) {
  625.                                 if(inventoryContains(chocCake1)) {
  626.                                         atInventoryItemCustom(chocCake1, "Eat");
  627.                                         return(random(10, 20));
  628.                                 }
  629.                                 if(inventoryContains(chocCake2)) {
  630.                                         atInventoryItemCustom(chocCake2, "Eat");
  631.                                         return(random(10, 20));
  632.                                 }
  633.                                 if(inventoryContains(chocCake3)) {
  634.                                         atInventoryItemCustom(chocCake3, "Eat");
  635.                                         return(random(10, 20));
  636.                                 }
  637.                         }
  638.                         if(foodIsCake) {
  639.                                 if(inventoryContains(cake1)) {
  640.                                         atInventoryItemCustom(cake1, "Eat");
  641.                                         return(random(10, 20));
  642.                                 }
  643.                                 if(inventoryContains(cake2)) {
  644.                                         atInventoryItemCustom(cake2, "Eat");
  645.                                         return(random(10, 20));
  646.                                 }
  647.                                 if(inventoryContains(cake3)) {
  648.                                         atInventoryItemCustom(cake3, "Eat");
  649.                                         return(random(10, 20));
  650.                                 }
  651.                         }
  652.                         return(random(10,20));
  653.                 }
  654.        
  655.         public int pickUpArrow() {
  656.                 RSItemTile pickArrow = getGroundItemByID(6, arrowID);
  657.                 if(canReach(pickArrow, false)) {
  658.                         RSItemTile [] allArrows = getGroundItemsAt(pickArrow);
  659.                         int listPosition = 0;
  660.                                 for (int i = 0; i < allArrows.length; i++) {
  661.                                         int currentArrow = allArrows[i].getItem().getID();
  662.                                         for (int itemArrow : arrowID) {
  663.                                                 if (itemArrow == currentArrow) {
  664.                                                         listPosition = (allArrows.length - i);
  665.                                                 break;
  666.                                                 }
  667.                                         }
  668.                                 }
  669.                                 rightClickTile(pickArrow);
  670.                                 wait(random(200,300));
  671.                                 if(!getMenuActions().contains("Take")) {
  672.                                         atMenu("Cancel");
  673.                                         lastArrowPick = System.currentTimeMillis();
  674.                                 }
  675.                                
  676.                                 int menuPosition = 0;
  677.                                 int i = 0;
  678.                                 for (String menuItem : getMenuActions()) {
  679.                                         if (menuItem.contains("Take")) {
  680.                                                 menuPosition = i;
  681.                                         break;
  682.                                         }
  683.                                 i++;
  684.                                 }
  685.                         if(isMenuOpen()) {
  686.                                 atMenuItemCustom(menuPosition + listPosition);
  687.                                 lastArrowPick = System.currentTimeMillis();
  688.                                 lastPick = System.currentTimeMillis();
  689.                                 return(random(1000,1500));
  690.                         }
  691.                         return(random(2,5));
  692.                 }
  693.                 return(random(2,5));
  694.         }
  695.        
  696.         public int pickUpCharm() {
  697.                 RSItemTile pickCharm = getGroundItemByID(6, charmID);
  698.                 if(canReach(pickCharm, false)) {
  699.                         RSItemTile [] allCharms = getGroundItemsAt(pickCharm);
  700.                         int listPosition = 0;
  701.                                 for (int i = 0; i < allCharms.length; i++) {
  702.                                         int currentCharm = allCharms[i].getItem().getID();
  703.                                         for (int itemCharm : charmID) {
  704.                                                 if (itemCharm == currentCharm) {
  705.                                                         listPosition = (allCharms.length - i);
  706.                                                 break;
  707.                                                 }
  708.                                         }
  709.                                 }
  710.                                 rightClickTile(pickCharm);
  711.                                 wait(random(200,300));
  712.                                 if(!getMenuActions().contains("Take")) {
  713.                                         atMenu("Cancel");
  714.                                         lastCharmPick = System.currentTimeMillis();
  715.                                 }
  716.                                
  717.                                 int menuPosition = 0;
  718.                                 int i = 0;
  719.                                 for (String menuItem : getMenuActions()) {
  720.                                         if (menuItem.contains("Take")) {
  721.                                                 menuPosition = i;
  722.                                         break;
  723.                                         }
  724.                                 i++;
  725.                                 }
  726.                         if(isMenuOpen()) {
  727.                                 atMenuItemCustom(menuPosition + listPosition);
  728.                                 lastCharmPick = System.currentTimeMillis();
  729.                                 lastPick = System.currentTimeMillis();
  730.                                 return(random(1000,1500));
  731.                         }
  732.                         return(random(2,5));
  733.                 }
  734.                 return(random(2,5));
  735.         }
  736.        
  737.         public int pickUpGem() {
  738.                 RSItemTile pickGem = getGroundItemByID(6, gemID);
  739.                 if(canReach(pickGem, false)) {
  740.                         RSItemTile [] allGems = getGroundItemsAt(pickGem);
  741.                         int listPosition = 0;
  742.                                 for (int i = 0; i < allGems.length; i++) {
  743.                                         int currentGem = allGems[i].getItem().getID();
  744.                                         for (int itemGem : gemID) {
  745.                                                 if (itemGem == currentGem) {
  746.                                                         listPosition = (allGems.length - i);
  747.                                                 break;
  748.                                                 }
  749.                                         }
  750.                                 }
  751.                                 rightClickTile(pickGem);
  752.                                 wait(random(200,300));
  753.                                 if(!getMenuActions().contains("Take")) {
  754.                                         atMenu("Cancel");
  755.                                         lastGemPick = System.currentTimeMillis();
  756.                                 }
  757.                                
  758.                                 int menuPosition = 0;
  759.                                 int i = 0;
  760.                                 for (String menuItem : getMenuActions()) {
  761.                                         if (menuItem.contains("Take")) {
  762.                                                 menuPosition = i;
  763.                                         break;
  764.                                         }
  765.                                 i++;
  766.                                 }
  767.                         if(isMenuOpen()) {
  768.                                 atMenuItemCustom(menuPosition + listPosition);
  769.                                 lastGemPick = System.currentTimeMillis();
  770.                                 lastPick = System.currentTimeMillis();
  771.                                 return(random(1000,1500));
  772.                         }
  773.                         return(random(2,5));
  774.                 }
  775.                 return(random(2,5));
  776.         }
  777.        
  778.         public int pickUpCustomItem() {
  779.                 RSItemTile pickItem = getGroundItemByID(6, customID);
  780.                 if(canReach(pickItem, false)) {
  781.                         RSItemTile [] allItems = getGroundItemsAt(pickItem);
  782.                         int listPosition = 0;
  783.                                 for (int i = 0; i < allItems.length; i++) {
  784.                                         int currentItem = allItems[i].getItem().getID();
  785.                                         for (int itemCustom : customID) {
  786.                                                 if (itemCustom == currentItem) {
  787.                                                         listPosition = (allItems.length - i);
  788.                                                 break;
  789.                                                 }
  790.                                         }
  791.                                 }
  792.                                 rightClickTile(pickItem);
  793.                                 wait(random(200,300));
  794.                                 if(!getMenuActions().contains("Take")) {
  795.                                         atMenu("Cancel");
  796.                                         lastItemPick = System.currentTimeMillis();
  797.                                 }
  798.                                
  799.                                 int menuPosition = 0;
  800.                                 int i = 0;
  801.                                 for (String menuItem : getMenuActions()) {
  802.                                         if (menuItem.contains("Take")) {
  803.                                                 menuPosition = i;
  804.                                         break;
  805.                                         }
  806.                                 i++;
  807.                                 }
  808.                         if(isMenuOpen()) {
  809.                                 atMenuItemCustom(menuPosition + listPosition);
  810.                                 lastItemPick = System.currentTimeMillis();
  811.                                 lastPick = System.currentTimeMillis();
  812.                                 return(random(1000,1500));
  813.                         }
  814.                         return(random(2,5));
  815.                 }
  816.                 return(random(2,5));
  817.         }
  818.        
  819.        
  820.         public boolean onPath(RSTile[] t){
  821.                 for(int i = 0; i < t.length; i++ ){
  822.                         if(distanceTo(t[i]) < 13){
  823.                                 return true;
  824.                         }
  825.                 }
  826.                 return false;
  827.         }
  828.        
  829.         public void bank() {
  830.                 RSObject bankBooth = findObject(booth);
  831.                
  832.                 if(bankBooth != null) {
  833.                         atObject(bankBooth, "Use-quickly");
  834.                        
  835.                         if(interfaceExists(Constants.INTERFACE_BANK)) {
  836.                                 bank.depositAllExcept(noDeposit);
  837.                                 wait(random(1000,2000));
  838.                                         clickMouse(83,309,5,5,true);
  839.                                         wait(random(1000,2000));
  840.                                         if(foodIsTrout) {
  841.                                                 sendText("trout", false);
  842.                                         }
  843.                                         if(foodIsSalmon) {
  844.                                                 sendText("salmon", false);
  845.                                         }
  846.                                         if(foodIsLobster) {
  847.                                                 sendText("lobster", false);
  848.                                         }
  849.                                         if(foodIsMonkfish) {
  850.                                                 sendText("monkfish", false);
  851.                                         }
  852.                                         if(foodIsSwordfish) {
  853.                                                 sendText("swordfish", false);
  854.                                         }
  855.                                         if(foodIsTuna) {
  856.                                                 sendText("tuna", false);
  857.                                         }
  858.                                         if(foodIsChocCake) {
  859.                                                 sendText("chocolate cake", false);
  860.                                         }
  861.                         wait(random(2000,3000));
  862.                         clickMouse(53,112,5,5,false);
  863.                         atMenu("Withdraw-All");
  864.                         wait(random(1000,2000));
  865.                                 if(inventoryContains(food)) {
  866.                                         bank.close();
  867.                                 }
  868.                         }
  869.                 }
  870.  
  871.         }
  872.        
  873.                 public boolean walkTileMMCustom(final RSTile t) {
  874.                 final Point p = tileToMinimap(t);
  875.                 if (p.x == -1 || p.y == -1) {
  876.                         return false;
  877.                 }
  878.                 clickMouse(p, 0, 0, true);
  879.                 return true;
  880.         }
  881.        
  882.         public void goFight() {
  883.                 RSObject downHole = findObject(hole);
  884.                 RSArea area1 = new RSArea(southWest1, northEast1);
  885.                 RSArea area2 = new RSArea(southWest2, northEast2);
  886.                 RSArea area3 = new RSArea(southWest3, northEast3);
  887.                 RSArea area4 = new RSArea(southWest4, northEast4);
  888.                 RSArea area5 = new RSArea(southWest5, northEast5);
  889.                 RSArea area6 = new RSArea(southWest6, northEast6);
  890.                 RSArea area7 = new RSArea(southWest7, northEast7);
  891.                 RSArea area8A = new RSArea(southWest8A, northEast8A);
  892.                 RSArea area8B = new RSArea(southWest8B, northEast8B);
  893.                 RSArea area9 = new RSArea(southWest9, northEast9);
  894.                 RSArea area10 = new RSArea(southWest10, northEast10);
  895.                 RSArea area11 = new RSArea(southWest11, northEast11);
  896.                 RSArea area12 = new RSArea(southWest12, northEast12);
  897.                 RSArea area13 = new RSArea(southWest13, northEast13);
  898.                 RSArea area14 = new RSArea(southWest14, northEast14);
  899.                 RSArea area15 = new RSArea(southWest15, northEast15);
  900.                 RSArea area16 = new RSArea(southWest16, northEast16);
  901.                 RSArea area17 = new RSArea(southWest17, northEast17);
  902.                 RSArea area18 = new RSArea(southWest18, northEast18);
  903.                 RSArea area19 = new RSArea(southWest19, northEast19);
  904.                 RSArea area20 = new RSArea(southWest20, northEast20);
  905.                 RSArea area21 = new RSArea(southWest21, northEast21);
  906.                 RSArea area22 = new RSArea(southWest22, northEast22);
  907.                 RSArea area23 = new RSArea(southWest23, northEast23);
  908.                 RSArea area24 = new RSArea(southWest24, northEast24);
  909.                 RSArea area25 = new RSArea(southWest25, northEast25);
  910.                 RSArea area26 = new RSArea(southWest26, northEast26);
  911.                 RSArea area27 = new RSArea(southWest27, northEast27);
  912.                 RSArea area28 = new RSArea(southWest28, northEast28);
  913.                 RSArea area29 = new RSArea(southWest29, northEast29);
  914.                
  915.  
  916.                 if(cave1) {
  917.                         if(onPath(bankToHole) && inventoryContains(food)) {
  918.                                 walkPathMMCustom(bankToHole, 13);
  919.                         }
  920.                         if(onPath(varrockToHole) && inventoryContains(food)) {
  921.                                 walkPathMMCustom(varrockToHole, 13);
  922.                         }
  923.                         if(downHole != null && inventoryContains(food)) {
  924.                                 atObject(downHole, "Climb-down");
  925.                                 wait(random(300,500));
  926.                         }
  927.                                 if(area1.contains(getMyPlayer().getLocation()) && distanceTo(DOOR_1) > 2 && inventoryContains(food)) {
  928.                                         walkTileMMCustom(DOOR_1);
  929.                                         wait(random(2000,3000));
  930.                                 }
  931.                                 if(area1.contains(getMyPlayer().getLocation()) && distanceTo(DOOR_1) < 3 && inventoryContains(food)) {
  932.                                         findDoor(DOOR_1, 'n');
  933.                                         wait(random(10,20));
  934.                                 }
  935.                         if(area2.contains(getMyPlayer().getLocation()) && inventoryContains(food)) {
  936.                                 findDoor(DOOR_2, 'n');
  937.                                 wait(random(10,20));
  938.                         }
  939.                         if(area3.contains(getMyPlayer().getLocation()) && distanceTo(DOOR_3) > 2 && inventoryContains(food)) {
  940.                                 walkPathMMCustom(door2To3, 13);
  941.                                 wait(random(2000,3000));
  942.                         }
  943.                                 if(area3.contains(getMyPlayer().getLocation()) && distanceTo(DOOR_3) < 3 && inventoryContains(food)) {
  944.                                         findDoor(DOOR_3, 'w');
  945.                                         wait(random(20,30));
  946.                                 }
  947.                         if(area4.contains(getMyPlayer().getLocation()) && inventoryContains(food)) {
  948.                                 findDoor(DOOR_4, 'w');
  949.                                 wait(random(20,30));
  950.                         }
  951.                                 if(canReach(wrongPlace1, false) && inventoryContains(food)) {
  952.                                         findDoor(wrongDoor1, 'n');
  953.                                         wait(random(10,20));
  954.                                 }
  955.                         if(canReach(wrongPlace2, false) && inventoryContains(food)) {
  956.                                 findDoor(wrongDoor2, 'n');
  957.                                 wait(random(10,20));
  958.                         }
  959.                 }
  960.                 if(cave2) {
  961.                         if(onPath(bankToHole) && inventoryContains(food)) {
  962.                                 walkPathMMCustom(bankToHole, 13);
  963.                         }
  964.                         if(onPath(varrockToHole) && inventoryContains(food)) {
  965.                                 walkPathMMCustom(varrockToHole, 13);
  966.                         }
  967.                         if(downHole != null && inventoryContains(food)) {
  968.                                 atObject(downHole, "Climb-down");
  969.                                 wait(random(300,500));
  970.                         }
  971.                         if(distanceTo(portal1) < 20 && canReach(portal1, true) && inventoryContains(food)) {
  972.                                 if(distanceTo(portal1) > 3) {
  973.                                         walkTileMMCustom(portal1);
  974.                                         wait(random(500,1000));
  975.                                 }
  976.                                 if(distanceTo(portal1) < 4) {
  977.                                         atTile(portal1, "Use");
  978.                                         wait(random(200,300));
  979.                                 }
  980.                         }
  981.                         if(area6.contains(getMyPlayer().getLocation()) && distanceTo(door5) > 2 && inventoryContains(food)) {
  982.                                 walkTileMMCustom(door5);
  983.                                 wait(random(1000,2000));
  984.                         }
  985.                         if(area6.contains(getMyPlayer().getLocation()) && distanceTo(door5) < 3 && inventoryContains(food)) {
  986.                                 findDoor(door5, 'n');
  987.                                 wait(random(10,20));
  988.                         }
  989.                         if(area7.contains(getMyPlayer().getLocation()) && inventoryContains(food)) {
  990.                                 findDoor(door6, 'n');
  991.                                 wait(random(10,20));
  992.                         }
  993.                         if(area8A.contains(getMyPlayer().getLocation()) || area8B.contains(getMyPlayer().getLocation()) && distanceTo(door7) > 2 && inventoryContains(food)) {
  994.                                 walkTileMMCustom(door7);
  995.                                 wait(random(2000,3000));
  996.                         }
  997.                         if(area8B.contains(getMyPlayer().getLocation()) && distanceTo(door7) < 3 && inventoryContains(food)) {
  998.                                 findDoor(door7, 'w');
  999.                                 wait(random(10,20));
  1000.                         }
  1001.                         if(area9.contains(getMyPlayer().getLocation()) && inventoryContains(food)) {
  1002.                                 findDoor(door8, 'w');
  1003.                                 wait(random(10,20));
  1004.                         }
  1005.                         if(canReach(wrongPlace3, false) && inventoryContains(food)) {
  1006.                                 findDoor(wrongDoor3, 'w');
  1007.                                 wait(random(10,20));
  1008.                         }
  1009.                         if(canReach(wrongPlace4, false) && inventoryContains(food)) {
  1010.                                 findDoor(wrongDoor4, 'w');
  1011.                                 wait(random(10,20));
  1012.                         }
  1013.                 }
  1014.                 if(cave4) {
  1015.                         if(onPath(bankToHole) && inventoryContains(food)) {
  1016.                                 walkPathMMCustom(bankToHole, 13);
  1017.                         }
  1018.                         if(onPath(varrockToHole) && inventoryContains(food)) {
  1019.                                 walkPathMMCustom(varrockToHole, 13);
  1020.                         }
  1021.                         if(downHole != null && inventoryContains(food)) {
  1022.                                 atObject(downHole, "Climb-down");
  1023.                                 wait(random(300,500));
  1024.                         }
  1025.                         if(distanceTo(portal1) < 20 && canReach(portal1, true) && inventoryContains(food)) {
  1026.                                 if(distanceTo(portal1) > 3) {
  1027.                                         walkTileMMCustom(portal1);
  1028.                                         wait(random(500,1000));
  1029.                                 }
  1030.                                 if(distanceTo(portal1) < 4) {
  1031.                                         atTile(portal1, "Use");
  1032.                                         wait(random(200,300));
  1033.                                 }
  1034.                         }
  1035.                         if(area6.contains(getMyPlayer().getLocation()) && distanceTo(ladder2Tile) > 2 && inventoryContains(food)) {
  1036.                                 walkTileMMCustom(ladder2Tile);
  1037.                                 wait(random(500,1000));
  1038.                         }
  1039.                         if(area6.contains(getMyPlayer().getLocation()) && distanceTo(ladder2Tile) < 3 && inventoryContains(food)) {
  1040.                                 atTile(ladder2Tile, "Climb-down");
  1041.                                 wait(random(2000,3000));
  1042.                         }
  1043.                         if(area13.contains(getMyPlayer().getLocation()) && distanceTo(portal2) > 2 && inventoryContains(food)) {
  1044.                                 walkTileMMCustom(portal2);
  1045.                                 wait(random(500,1000));
  1046.                         }
  1047.                         if(area13.contains(getMyPlayer().getLocation()) && distanceTo(portal2) < 3 && inventoryContains(food)) {
  1048.                                 atTile(portal2, "Use");
  1049.                                 wait(random(500,1000));
  1050.                         }
  1051.                         if(area14.contains(getMyPlayer().getLocation()) && distanceTo(door11) > 2 && inventoryContains(food)) {
  1052.                                 walkTileMMCustom(door11);
  1053.                                 wait(random(500,1000));
  1054.                         }
  1055.                         if(area14.contains(getMyPlayer().getLocation()) && distanceTo(door11) < 3 && inventoryContains(food)) {
  1056.                                 findDoor(door11, 'e');
  1057.                                 wait(random(10,20));
  1058.                         }
  1059.                         if(area15.contains(getMyPlayer().getLocation()) && inventoryContains(food)) {
  1060.                                 findDoor(door12, 'w');
  1061.                                 wait(random(10,20));
  1062.                         }
  1063.                         if(area16.contains(getMyPlayer().getLocation()) && inventoryContains(food)) {
  1064.                                 walkTileMMCustom(area17Tile);
  1065.                                 wait(random(500,1000));
  1066.                         }
  1067.                 }
  1068.                 if(cave5) {
  1069.                         if(onPath(bankToHole) && inventoryContains(food)) {
  1070.                                 walkPathMMCustom(bankToHole, 13);
  1071.                         }
  1072.                         if(onPath(varrockToHole) && inventoryContains(food)) {
  1073.                                 walkPathMMCustom(varrockToHole, 13);
  1074.                         }
  1075.                         if(downHole != null && inventoryContains(food)) {
  1076.                                 atObject(downHole, "Climb-down");
  1077.                                 wait(random(300,500));
  1078.                         }
  1079.                         if(distanceTo(portal1) < 20 && canReach(portal1, true) && inventoryContains(food)) {
  1080.                                 if(distanceTo(portal1) > 3) {
  1081.                                         walkTileMMCustom(portal1);
  1082.                                         wait(random(500,1000));
  1083.                                 }
  1084.                                 if(distanceTo(portal1) < 4) {
  1085.                                         atTile(portal1, "Use");
  1086.                                         wait(random(200,300));
  1087.                                 }
  1088.                         }
  1089.                         if(area6.contains(getMyPlayer().getLocation()) && distanceTo(ladder2Tile) > 2 && inventoryContains(food)) {
  1090.                                 walkTileMMCustom(ladder2Tile);
  1091.                                 wait(random(500,1000));
  1092.                         }
  1093.                         if(area6.contains(getMyPlayer().getLocation()) && distanceTo(ladder2Tile) < 3 && inventoryContains(food)) {
  1094.                                 atTile(ladder2Tile, "Climb-down");
  1095.                                 wait(random(2000,3000));
  1096.                         }
  1097.                         if(area13.contains(getMyPlayer().getLocation()) && distanceTo(portal2) > 2 && inventoryContains(food)) {
  1098.                                 walkTileMMCustom(portal2);
  1099.                                 wait(random(500,1000));
  1100.                         }
  1101.                         if(area13.contains(getMyPlayer().getLocation()) && distanceTo(portal2) < 3 && inventoryContains(food)) {
  1102.                                 atTile(portal2, "Use");
  1103.                                 wait(random(500,1000));
  1104.                         }
  1105.                         if(area14.contains(getMyPlayer().getLocation()) && !area19.contains(getMyPlayer().getLocation()) && !area18.contains(getMyPlayer().getLocation()) && distanceTo(door13) > 2 && inventoryContains(food)) {
  1106.                                 walkTileMMCustom(door13);
  1107.                                 wait(random(500,1000));
  1108.                         }
  1109.                         if(area14.contains(getMyPlayer().getLocation()) && !area19.contains(getMyPlayer().getLocation()) && !area18.contains(getMyPlayer().getLocation()) && distanceTo(door13) < 3 && inventoryContains(food)) {
  1110.                                 findDoor(door13, 'e');
  1111.                                 wait(random(10,20));
  1112.                         }
  1113.                         if(area18.contains(getMyPlayer().getLocation()) && inventoryContains(food)) {
  1114.                                 findDoor(door14, 'w');
  1115.                                 wait(random(10,20));
  1116.                         }
  1117.                         if(area19.contains(getMyPlayer().getLocation()) && distanceTo(door15) > 2 && inventoryContains(food)) {
  1118.                                 walkTileMMCustom(door15);
  1119.                                 wait(random(500,1000));
  1120.                         }
  1121.                         if(area19.contains(getMyPlayer().getLocation()) && distanceTo(door15) < 3 && inventoryContains(food)) {
  1122.                                 findDoor(door15, 's');
  1123.                                 wait(random(10,20));
  1124.                         }
  1125.                         if(area20.contains(getMyPlayer().getLocation()) && inventoryContains(food)) {
  1126.                                 findDoor(door16, 'n');
  1127.                                 wait(random(10,20));
  1128.                         }
  1129.                         if(area21.contains(getMyPlayer().getLocation()) && inventoryContains(food)) {
  1130.                                 walkTileMMCustom(area22Tile);
  1131.                                 wait(random(2000,3000));
  1132.                         }
  1133.                 }
  1134.                 if(cave6) {
  1135.                         if(onPath(bankToHole) && inventoryContains(food)) {
  1136.                                 walkPathMMCustom(bankToHole, 13);
  1137.                         }
  1138.                         if(onPath(varrockToHole) && inventoryContains(food)) {
  1139.                                 walkPathMMCustom(varrockToHole, 13);
  1140.                         }
  1141.                         if(downHole != null && inventoryContains(food)) {
  1142.                                 atObject(downHole, "Climb-down");
  1143.                                 wait(random(300,500));
  1144.                         }
  1145.                         if(distanceTo(portal1) < 20 && canReach(portal1, true) && inventoryContains(food)) {
  1146.                                 if(distanceTo(portal1) > 3) {
  1147.                                         walkTileMMCustom(portal1);
  1148.                                         wait(random(500,1000));
  1149.                                 }
  1150.                                 if(distanceTo(portal1) < 4) {
  1151.                                         atTile(portal1, "Use");
  1152.                                         wait(random(200,300));
  1153.                                 }
  1154.                         }
  1155.                         if(area6.contains(getMyPlayer().getLocation()) && distanceTo(ladder2Tile) > 2 && inventoryContains(food)) {
  1156.                                 walkTileMMCustom(ladder2Tile);
  1157.                                 wait(random(500,1000));
  1158.                         }
  1159.                         if(area6.contains(getMyPlayer().getLocation()) && distanceTo(ladder2Tile) < 3 && inventoryContains(food)) {
  1160.                                 atTile(ladder2Tile, "Climb-down");
  1161.                                 wait(random(2000,3000));
  1162.                         }
  1163.                         if(area13.contains(getMyPlayer().getLocation()) && distanceTo(portal2) > 2 && inventoryContains(food)) {
  1164.                                 walkTileMMCustom(portal2);
  1165.                                 wait(random(500,1000));
  1166.                         }
  1167.                         if(area13.contains(getMyPlayer().getLocation()) && distanceTo(portal2) < 3 && inventoryContains(food)) {
  1168.                                 atTile(portal2, "Use");
  1169.                                 wait(random(500,1000));
  1170.                         }
  1171.                         if(area14.contains(getMyPlayer().getLocation()) && !area23.contains(getMyPlayer().getLocation()) && inventoryContains(food)) {
  1172.                                 walkTileMMCustom(area23Tile);
  1173.                                 wait(random(500,1000));
  1174.                         }
  1175.                         if(area23.contains(getMyPlayer().getLocation()) && distanceTo(door17) > 2 && inventoryContains(food)) {
  1176.                                 walkTileMMCustom(door17);
  1177.                                 wait(random(500,1000));
  1178.                         }
  1179.                         if(area23.contains(getMyPlayer().getLocation()) && distanceTo(door17) < 3 && inventoryContains(food)) {
  1180.                                 findDoor(door17, 'n');
  1181.                                 wait(random(10,20));
  1182.                         }
  1183.                         if(area24.contains(getMyPlayer().getLocation()) && inventoryContains(food)) {
  1184.                                 findDoor(door18, 's');
  1185.                                 wait(random(10,20));
  1186.                         }
  1187.                         if(area25.contains(getMyPlayer().getLocation()) && !getMyPlayer().isMoving() &&inventoryContains(food)) {
  1188.                                 walkTileMMCustom(area26Tile);
  1189.                                 wait(random(500,1000));
  1190.                         }
  1191.                         if(area26.contains(getMyPlayer().getLocation()) && distanceTo(door19) > 2 && inventoryContains(food)) {
  1192.                                 walkTileMMCustom(door19);
  1193.                                 wait(random(500,1000));
  1194.                         }
  1195.                         if(area26.contains(getMyPlayer().getLocation()) && distanceTo(door19) < 3 && inventoryContains(food)) {
  1196.                                 findDoor(door19, 'w');
  1197.                                 wait(random(10,20));
  1198.                         }
  1199.                         if(area27.contains(getMyPlayer().getLocation()) && inventoryContains(food)) {
  1200.                                 findDoor(door20, 'e');
  1201.                                 wait(random(10,20));
  1202.                         }
  1203.                 }
  1204.                        
  1205.         }
  1206.        
  1207.         public void goBank() {
  1208.         RSObject downHole = findObject(hole);
  1209.         RSArea area1 = new RSArea(southWest1, northEast1);
  1210.         RSArea area2 = new RSArea(southWest2, northEast2);
  1211.         RSArea area3 = new RSArea(southWest3, northEast3);
  1212.         RSArea area4 = new RSArea(southWest4, northEast4);
  1213.         RSArea area5 = new RSArea(southWest5, northEast5);
  1214.         RSArea area6 = new RSArea(southWest6, northEast6);
  1215.         RSArea area7 = new RSArea(southWest7, northEast7);
  1216.         RSArea area8A = new RSArea(southWest8A, northEast8A);
  1217.         RSArea area8B = new RSArea(southWest8B, northEast8B);
  1218.         RSArea area9 = new RSArea(southWest9, northEast9);
  1219.         RSArea area10 = new RSArea(southWest10, northEast10);
  1220.         RSArea area11 = new RSArea(southWest11, northEast11);
  1221.         RSArea area12 = new RSArea(southWest12, northEast12);
  1222.         RSArea area13 = new RSArea(southWest13, northEast13);
  1223.         RSArea area14 = new RSArea(southWest14, northEast14);
  1224.         RSArea area15 = new RSArea(southWest15, northEast15);
  1225.         RSArea area16 = new RSArea(southWest16, northEast16);
  1226.         RSArea area17 = new RSArea(southWest17, northEast17);
  1227.         RSArea area18 = new RSArea(southWest18, northEast18);
  1228.         RSArea area19 = new RSArea(southWest19, northEast19);
  1229.         RSArea area20 = new RSArea(southWest20, northEast20);
  1230.         RSArea area21 = new RSArea(southWest21, northEast21);
  1231.         RSArea area22 = new RSArea(southWest22, northEast22);
  1232.         RSArea area23 = new RSArea(southWest23, northEast23);
  1233.         RSArea area24 = new RSArea(southWest24, northEast24);
  1234.         RSArea area25 = new RSArea(southWest25, northEast25);
  1235.         RSArea area26 = new RSArea(southWest26, northEast26);
  1236.         RSArea area27 = new RSArea(southWest27, northEast27);
  1237.         RSArea area28 = new RSArea(southWest28, northEast28);
  1238.         RSArea area29 = new RSArea(southWest29, northEast29);
  1239.        
  1240.         if(inventoryContains(fireRune) && inventoryContains(airRune) && inventoryContains(lawRune) && skills.getRealSkillLevel(STAT_MAGIC) > 24 && !onPath(fountainToBank)) {
  1241.                 teleVarrock();
  1242.         }
  1243.         if(onPath(fountainToBank)) {
  1244.                 walkPathMMCustom(fountainToBank, 13);
  1245.         }
  1246.                 else {
  1247.        
  1248.                 if(cave1) {
  1249.                         if(area5.contains(getMyPlayer().getLocation()) && distanceTo(DOOR_4) > 2 && !inventoryContains(food)) {
  1250.                                 walkTileMMCustom(DOOR_4);
  1251.                                 wait(random(2000,3000));
  1252.                         }
  1253.                                 if(area5.contains(getMyPlayer().getLocation()) && distanceTo(DOOR_4) < 3 && !inventoryContains(food)) {
  1254.                                         findDoor(DOOR_4, 'w');
  1255.                                         wait(random(10,20));
  1256.                                 }
  1257.                         if(area4.contains(getMyPlayer().getLocation()) && !inventoryContains(food)) {
  1258.                                 findDoor(DOOR_3, 'w');
  1259.                                 wait(random(10,20));
  1260.                         }
  1261.                         if(area3.contains(getMyPlayer().getLocation()) && distanceTo(DOOR_2) > 2 && !inventoryContains(food)) {
  1262.                                 walkPathMMCustom(door3To2, 13);
  1263.                                 wait(random(2000,3000));
  1264.                         }
  1265.                                 if(area3.contains(getMyPlayer().getLocation()) && distanceTo(DOOR_2) < 3 && !inventoryContains(food)) {
  1266.                                         findDoor(DOOR_2, 'n');
  1267.                                         wait(random(10,20));
  1268.                                 }
  1269.                         if(area2.contains(getMyPlayer().getLocation()) && !inventoryContains(food)) {
  1270.                                 findDoor(DOOR_1, 'n');
  1271.                                 wait(random(10,20));
  1272.                         }
  1273.                         if(area1.contains(getMyPlayer().getLocation()) && distanceTo(ladder1Tile) > 2 && !inventoryContains(food)) {
  1274.                                 walkTileMMCustom(NEXT_TO_LADDER1);
  1275.                                 wait(random(2000,3000));
  1276.                         }
  1277.                         if(area1.contains(getMyPlayer().getLocation()) && distanceTo(ladder1Tile) < 3 && !inventoryContains(food)) {
  1278.                                 atTile(ladder1Tile, "Climb-up");
  1279.                                 wait(random(2000,3000));
  1280.                         }
  1281.                         if(onPath(holeToBank) || distanceTo(downHole) < 5 && !inventoryContains(food)) {
  1282.                                 walkPathMMCustom(holeToBank, 13);
  1283.                         }
  1284.  
  1285.                         }
  1286.                         if(cave2) {
  1287.                                 if(area10.contains(getMyPlayer().getLocation()) && distanceTo(door9) < 3 && !inventoryContains(food)) {
  1288.                                         findDoor(door9, 'w');
  1289.                                         wait(random(10,20));
  1290.                                 }
  1291.                                 if(area11.contains(getMyPlayer().getLocation()) && !inventoryContains(food)) {
  1292.                                         findDoor(door10, 'w');
  1293.                                         wait(random(10,20));
  1294.                                 }
  1295.                                 if(area12.contains(getMyPlayer().getLocation()) && !inventoryContains(food)) {
  1296.                                         if(distanceTo(chain1Tile) < 3) {
  1297.                                                 atTile(chain1Tile, "Climb-up");
  1298.                                                 wait(random(1000,2000));
  1299.                                         }
  1300.                                         else {
  1301.                                                 walkTileMMCustom(chain1Tile);
  1302.                                                 wait(random(300,500));
  1303.                                         }
  1304.                                 }
  1305.                                 if(area1.contains(getMyPlayer().getLocation()) && distanceTo(ladder1Tile) < 5 && !inventoryContains(food)) {
  1306.                                         atTile(ladder1Tile, "Climb-up");
  1307.                                         wait(random(2000,3000));
  1308.                                 }
  1309.                                 if(onPath(holeToBank) && !inventoryContains(food)) {
  1310.                                         walkPathMMCustom(holeToBank, 13);
  1311.                                 }
  1312.                                 else {
  1313.                                         if (area10.contains(getMyPlayer().getLocation()) && distanceTo(door9) > 2 && !inventoryContains(food)) {
  1314.                                                 walkTileMMCustom(door9);
  1315.                                                 wait(random(1000,2000));
  1316.                                         }
  1317.                                 }
  1318.                         }
  1319.                         if(cave4) {
  1320.                                 if(area17.contains(getMyPlayer().getLocation()) && !inventoryContains(food)) {
  1321.                                         walkTileMMCustom(area16Tile);
  1322.                                         wait(random(500,1000));
  1323.                                 }
  1324.                                 if(area16.contains(getMyPlayer().getLocation()) && distanceTo(door12) > 2 && !inventoryContains(food)) {
  1325.                                         walkTileMMCustom(door12);
  1326.                                         wait(random(500,1000));
  1327.                                 }
  1328.                                 if(area16.contains(getMyPlayer().getLocation()) && distanceTo(door12) < 3 && !inventoryContains(food)) {
  1329.                                         findDoor(door12, 'w');
  1330.                                         wait(random(10,20));
  1331.                                 }
  1332.                                 if(area15.contains(getMyPlayer().getLocation()) && !inventoryContains(food)) {
  1333.                                         findDoor(door11, 'e');
  1334.                                         wait(random(10,20));
  1335.                                 }
  1336.                                 if(area14.contains(getMyPlayer().getLocation()) && distanceTo(chain2Tile) > 2 && !inventoryContains(food)) {
  1337.                                         walkTileMMCustom(chain2Tile);
  1338.                                         wait(random(500,1000));
  1339.                                 }
  1340.                                 if(area14.contains(getMyPlayer().getLocation()) && distanceTo(chain2Tile) < 3 && !inventoryContains(food)) {
  1341.                                         atTile(chain2Tile, "Climb-up");
  1342.                                         wait(random(1000,2000));
  1343.                                 }
  1344.                                 if(area13.contains(getMyPlayer().getLocation()) && distanceTo(ladder3Tile) > 2 && !inventoryContains(food)) {
  1345.                                         walkTileMMCustom(ladder3Tile);
  1346.                                         wait(random(500,1000));
  1347.                                 }
  1348.                                 if(area13.contains(getMyPlayer().getLocation()) && distanceTo(ladder3Tile) < 3 && !inventoryContains(food)) {
  1349.                                         atTile(ladder3Tile, "Climb-up");
  1350.                                         wait(random(1000,2000));
  1351.                                 }
  1352.                                 if(area1.contains(getMyPlayer().getLocation()) && distanceTo(ladder1Tile) > 2 && !inventoryContains(food)) {
  1353.                                         walkTileMMCustom(ladder1Tile);
  1354.                                         wait(random(500,1000));
  1355.                                 }
  1356.                                 if(area1.contains(getMyPlayer().getLocation()) && distanceTo(ladder1Tile) < 3 && !inventoryContains(food)) {
  1357.                                         atTile(ladder1Tile, "Climb-up");
  1358.                                         wait(random(1000,2000));
  1359.                                 }
  1360.                                 if(onPath(holeToBank) && !inventoryContains(food)) {
  1361.                                         walkPathMMCustom(holeToBank, 13);
  1362.                                 }
  1363.                         }
  1364.                         if(cave5) {
  1365.                                 if(area22.contains(getMyPlayer().getLocation()) && !inventoryContains(food)) {
  1366.                                         walkTileMMCustom(area21Tile);
  1367.                                         wait(random(500,1000));
  1368.                                 }
  1369.                                 if(area21.contains(getMyPlayer().getLocation()) && distanceTo(door16) > 2 && !inventoryContains(food)) {
  1370.                                         walkTileMMCustom(door16);
  1371.                                         wait(random(500,1000));
  1372.                                 }
  1373.                                 if(area21.contains(getMyPlayer().getLocation()) && distanceTo(door16) < 3 && !inventoryContains(food)) {
  1374.                                         findDoor(door16, 'n');
  1375.                                         wait(random(10,20));
  1376.                                 }
  1377.                                 if(area20.contains(getMyPlayer().getLocation()) && !inventoryContains(food)) {
  1378.                                         findDoor(door15, 's');
  1379.                                         wait(random(10,20));
  1380.                                 }
  1381.                                 if(area19.contains(getMyPlayer().getLocation()) && distanceTo(door14) > 2 && !inventoryContains(food)) {
  1382.                                         walkTileMMCustom(door14);
  1383.                                         wait(random(500,1000));
  1384.                                 }
  1385.                                 if(area19.contains(getMyPlayer().getLocation()) && distanceTo(door14) < 3 && !inventoryContains(food)) {
  1386.                                         findDoor(door14, 'w');
  1387.                                         wait(random(10,20));
  1388.                                 }
  1389.                                 if(area18.contains(getMyPlayer().getLocation()) && !inventoryContains(food)) {
  1390.                                         findDoor(door13, 'e');
  1391.                                         wait(random(10,20));
  1392.                                 }
  1393.                                 if(area14.contains(getMyPlayer().getLocation()) && !area19.contains(getMyPlayer().getLocation()) && !area18.contains(getMyPlayer().getLocation()) && distanceTo(door13) < 2 && !inventoryContains(food)) {
  1394.                                         walkTileMMCustom(area14Tile);
  1395.                                         wait(random(500,1000));
  1396.                                 }
  1397.                                 if(area14.contains(getMyPlayer().getLocation()) && !area19.contains(getMyPlayer().getLocation()) && !area18.contains(getMyPlayer().getLocation()) && distanceTo(chain2Tile) > 2 && !inventoryContains(food)) {
  1398.                                         walkTileMMCustom(chain2Tile);
  1399.                                         wait(random(500,1000));
  1400.                                 }
  1401.                                 if(area14.contains(getMyPlayer().getLocation()) && !area19.contains(getMyPlayer().getLocation()) && !area18.contains(getMyPlayer().getLocation()) && distanceTo(chain2Tile) < 3 && !inventoryContains(food)) {
  1402.                                         atTile(chain2Tile, "Climb-up");
  1403.                                         wait(random(1000,2000));
  1404.                                 }
  1405.                                 if(area13.contains(getMyPlayer().getLocation()) && distanceTo(ladder3Tile) > 2 && !inventoryContains(food)) {
  1406.                                         walkTileMMCustom(ladder3Tile);
  1407.                                         wait(random(500,1000));
  1408.                                 }
  1409.                                 if(area13.contains(getMyPlayer().getLocation()) && distanceTo(ladder3Tile) < 3 && !inventoryContains(food)) {
  1410.                                         atTile(ladder3Tile, "Climb-up");
  1411.                                         wait(random(1000,2000));
  1412.                                 }
  1413.                                 if(area1.contains(getMyPlayer().getLocation()) && distanceTo(ladder1Tile) > 2 && !inventoryContains(food)) {
  1414.                                         walkTileMMCustom(ladder1Tile);
  1415.                                         wait(random(500,1000));
  1416.                                 }
  1417.                                 if(area1.contains(getMyPlayer().getLocation()) && distanceTo(ladder1Tile) < 3 && !inventoryContains(food)) {
  1418.                                         atTile(ladder1Tile, "Climb-up");
  1419.                                         wait(random(1000,2000));
  1420.                                 }
  1421.                                 if(onPath(holeToBank) && !inventoryContains(food)) {
  1422.                                         walkPathMMCustom(holeToBank, 13);
  1423.                                 }
  1424.                         }
  1425.                         if(cave6) {
  1426.                                 if((area28.contains(getMyPlayer().getLocation()) || area29.contains(getMyPlayer().getLocation())) && distanceTo(door20) > 2  && !inventoryContains(food)) {
  1427.                                         walkTileMMCustom(door20);
  1428.                                         wait(random(1000,2000));
  1429.                                 }
  1430.                                 if(area28.contains(getMyPlayer().getLocation()) && distanceTo(door20) < 3 && !inventoryContains(food)) {
  1431.                                         findDoor(door20, 'e');
  1432.                                         wait(random(10,20));
  1433.                                 }
  1434.                                 if(area27.contains(getMyPlayer().getLocation()) && !inventoryContains(food)) {
  1435.                                         findDoor(door19, 'w');
  1436.                                         wait(random(10,20));
  1437.                                 }
  1438.                                 if(area26.contains(getMyPlayer().getLocation()) && distanceTo(chain3Tile) > 2 && !getMyPlayer().isMoving() && !inventoryContains(food)) {
  1439.                                         walkTileMMCustom(chain3Tile);
  1440.                                         wait(random(1000,2000));
  1441.                                 }
  1442.                                 if(area26.contains(getMyPlayer().getLocation()) && distanceTo(chain3Tile) < 3 && !inventoryContains(food)) {
  1443.                                         atTile(chain3Tile, "Climb-up");
  1444.                                         wait(random(1000,2000));
  1445.                                 }
  1446.                                 if(area13.contains(getMyPlayer().getLocation()) && distanceTo(ladder3Tile) > 2 && !inventoryContains(food)) {
  1447.                                         walkTileMMCustom(ladder3Tile);
  1448.                                         wait(random(500,1000));
  1449.                                 }
  1450.                                 if(area13.contains(getMyPlayer().getLocation()) && distanceTo(ladder3Tile) < 3 && !inventoryContains(food)) {
  1451.                                         atTile(ladder3Tile, "Climb-up");
  1452.                                         wait(random(1000,2000));
  1453.                                 }
  1454.                                 if(area1.contains(getMyPlayer().getLocation()) && distanceTo(ladder1Tile) > 2 && !inventoryContains(food)) {
  1455.                                         walkTileMMCustom(ladder1Tile);
  1456.                                         wait(random(500,1000));
  1457.                                 }
  1458.                                 if(area1.contains(getMyPlayer().getLocation()) && distanceTo(ladder1Tile) < 3 && !inventoryContains(food)) {
  1459.                                         atTile(ladder1Tile, "Climb-up");
  1460.                                         wait(random(1000,2000));
  1461.                                 }
  1462.                                 if(onPath(holeToBank) && !inventoryContains(food)) {
  1463.                                         walkPathMMCustom(holeToBank, 13);
  1464.                                 }
  1465.                         }
  1466.                 }
  1467.         }
  1468.        
  1469.         public int teleVarrock() {
  1470.                 openTab(TAB_MAGIC);
  1471.                 wait(random(200,300));
  1472.                 clickMouse(597,278,2,2,true);
  1473.                 return(random(200,300));
  1474.         }
  1475.        
  1476.         public boolean findDoor(RSTile t, char direction) {
  1477.                 RSObject theDoor = getObjectAt(t);
  1478.                 if(theDoor == null)
  1479.                         return false;
  1480.                 switch(direction) {
  1481.                         case 'n':
  1482.                                 return atDoorTiles(theDoor.getLocation(), new RSTile(theDoor.getLocation().getX(), theDoor.getLocation().getY() + 1));
  1483.                         case 'w':
  1484.                                 return atDoorTiles(theDoor.getLocation(), new RSTile(theDoor.getLocation().getX() - 1, theDoor.getLocation().getY()));                 
  1485.                         case 'e':
  1486.                                 return atDoorTiles(theDoor.getLocation(), new RSTile(theDoor.getLocation().getX() + 1, theDoor.getLocation().getY()));                 
  1487.                         case 's':
  1488.                                 return atDoorTiles(theDoor.getLocation(), new RSTile(theDoor.getLocation().getX(), theDoor.getLocation().getY() - 1));                 
  1489.                         default:
  1490.                                 log("Invalid door direction char");
  1491.                 }
  1492.                 return false;
  1493.         }
  1494.         private long lastTry = 0;
  1495.         private int tryCount = 0;
  1496.         private RSTile lastDoor = null;
  1497.         public boolean atDoorTiles(RSTile a, RSTile b) {
  1498.                 if(a != lastDoor) {
  1499.                         lastTry = 0;
  1500.                         tryCount = 0;
  1501.                         lastDoor = a;
  1502.                 }
  1503.                 tryCount++;
  1504.                 if(System.currentTimeMillis() - lastTry > random(2000, 4000)) {
  1505.                         tryCount = 1;
  1506.                 }
  1507.                 lastTry = System.currentTimeMillis();
  1508.                 if(tryCount > 4) {
  1509.                         if(random(1,2) < random(1,2))
  1510.                                 setCameraRotation(getCameraAngle() + ((random(0, 9) < random(6, 8)) ? (random(-20, 20)) : (random(-360, 360))));
  1511.                         if(random(1,2) < random(1,2))
  1512.                                 setCameraAltitude(random(0, 100));
  1513.                 }              
  1514.                 if(tryCount > 100) {
  1515.                         log("Problems finding door....");
  1516.                         stopAllScripts();
  1517.                 }
  1518.                 else {
  1519.                         ArrayList<RSTile> theObjs = new ArrayList<RSTile>();
  1520.                         theObjs.add(a);
  1521.                         theObjs.add(b);
  1522.                         try {
  1523.                                 Point[] thePoints = new Point[theObjs.size()];
  1524.                                 for(int c = 0; c < theObjs.size(); c++) {
  1525.                                         thePoints[c] = Calculations.tileToScreen(theObjs.get(c));
  1526.                                 }
  1527.                                 float xTotal = 0;
  1528.                                 float yTotal = 0;
  1529.                                 for(int c = 0; c < thePoints.length; c++) {
  1530.                                         xTotal += thePoints[c].getX();
  1531.                                         yTotal += thePoints[c].getY();
  1532.                                 }
  1533.                                 Point location = new Point((int)(xTotal / (float)thePoints.length), (int)(yTotal / (float)thePoints.length) - random(0, 40));
  1534.                                 if (location.x == -1 || location.y == -1) {
  1535.                                         return false;
  1536.                                 }
  1537.                                
  1538.                                 if(Math.sqrt(Math.pow((getMouseLocation().getX() - location.getX()), 2) + Math.pow((getMouseLocation().getY() - location.getY()), 2)) < random(20, 30)) {
  1539.                                         ArrayList<String> commands = getMenuItems();
  1540.                                 for(int c = 0; c < commands.size(); c++) {
  1541.                                         if(commands.get(c).contains("Open")) {
  1542.                                                         if(atMenu("Open")) {
  1543.                                                                 wait(random(1000,2000));
  1544.                                                                 lastTry = 0;
  1545.                                                                 tryCount = 0;
  1546.                                                                 return true;
  1547.                                                         }
  1548.                                         }                                              
  1549.                                 }              
  1550.                         }                                                              
  1551.                                 moveMouse(location, 7, 7);
  1552.                                 if(atMenu("Open")) {
  1553.                                         wait(random(1000,2000));
  1554.                                         lastTry = 0;
  1555.                                         tryCount = 0;
  1556.                                         return true;
  1557.                                 }
  1558.                         } catch (final Exception e) {
  1559.                                 return false;
  1560.                         }                      
  1561.                 }
  1562.                 return false;
  1563.         }
  1564.        
  1565.         public boolean rightClickTile(final RSTile tile) {
  1566.                 try {
  1567.                         final Point location = Calculations.tileToScreen(tile);
  1568.                         if (location.x == -1 || location.y == -1) {
  1569.                                 return false;
  1570.                         }
  1571.                         moveMouse(location, 3, 3);
  1572.                         clickMouse(false);
  1573.                         wait(random(50,100));
  1574.                         return true;
  1575.                 } catch (final Exception e) {
  1576.                         return false;
  1577.                 }
  1578.         }
  1579.        
  1580.         public boolean atMenuItemCustom(final int i) {
  1581.                 if (!isMenuOpen()) {
  1582.                         return false;
  1583.                 }
  1584.                 try {
  1585.                         final RSTile menu = getMenuLocation();
  1586.                         final int xOff = random(4, getMenuItems().get(i).length() * 4);
  1587.                         final int yOff = random(24, 28) + (15 * (i - 1));
  1588.                         moveMouse(menu.getX() + xOff, menu.getY() + yOff, 2, 2);
  1589.                         if (!isMenuOpen()) {
  1590.                                 return false;
  1591.                         }
  1592.                         clickMouse(true);
  1593.                         return true;
  1594.                 } catch (final Exception e) {
  1595.                         e.printStackTrace();
  1596.                         return false;
  1597.                 }
  1598.         }
  1599.        
  1600.         public boolean atNPCCustom(final RSNPC npc, final String action) {
  1601.                 if (npc == null) {
  1602.                         return false;
  1603.                 }
  1604.                 final RSTile tile = npc.getLocation();
  1605.                 if (!tile.isValid()) {
  1606.                         return false;
  1607.                 }
  1608.                 if (distanceTo(tile) > 5) {
  1609.                         walkTileMM(tile);
  1610.                 }
  1611.                 return clickRSNPCCustom(npc, action);
  1612.         }
  1613.        
  1614.         public boolean clickRSNPCCustom(final RSNPC npc, final String action) {
  1615.                 try {
  1616.                         int a;
  1617.                         final String fullCommand = action + " " + npc.getName();
  1618.                         for (a = 10; a-- >= 0;) {
  1619.                                 final List<String> menuItems = getMenuItems();
  1620.                                 if (menuItems.size() > 1) {
  1621.                                         if (listContainsString(menuItems, fullCommand)) {
  1622.                                                 if (menuItems.get(0).contains(fullCommand)) {
  1623.                                                         clickMouse(true);
  1624.                                                         return true;
  1625.                                                 } else {       
  1626.                                                         return atMenuCustom(fullCommand);
  1627.                                                 }
  1628.                                         }
  1629.                                 }
  1630.                                 final Point screenLoc = npc.getScreenLocation();
  1631.                                 if (!pointOnScreen(screenLoc)) {
  1632.                                         return false;
  1633.                                 }
  1634.                                 moveMouse(screenLoc);
  1635.                         }
  1636.                         return false;
  1637.                 } catch (final Exception e) {
  1638.                         e.printStackTrace();
  1639.                         return false;
  1640.                 }
  1641.         }
  1642.        
  1643.         public boolean atMenuCustom(final String optionContains) {
  1644.                 int idx = getMenuIndex(optionContains);
  1645.                 if (!isMenuOpen()) {
  1646.                         if (idx == -1) {
  1647.                                 return false;
  1648.                         }
  1649.                         if (idx == 0) {
  1650.                                 clickMouse(true);
  1651.                         } else {
  1652.                                 clickMouse(false);
  1653.                                 atMenuItemCustom(idx);
  1654.                         }
  1655.                         return true;
  1656.                 } else {
  1657.                         if (idx == -1) {
  1658.                                 idx = getMenuIndex("Cancel");
  1659.                                 atMenuItemCustom(idx);
  1660.                                 return false;
  1661.                         } else {
  1662.                                 atMenuItemCustom(idx);
  1663.                                 return true;
  1664.                         }
  1665.                 }
  1666.         }
  1667.        
  1668.         private boolean listContainsString(final List<String> list, final String string) {
  1669.                 try {
  1670.                         for(String command : list) {
  1671.                                 if(command.contains(string)) {
  1672.                                         return true;
  1673.                                 }
  1674.                         }
  1675.                 } catch (final Exception e) {
  1676.                     e.printStackTrace();
  1677.                 }
  1678.                 return false;
  1679.         }
  1680.        
  1681.         public void onRepaint(Graphics g) {
  1682.                         long millis = System.currentTimeMillis() - startTime;
  1683.                         long hours = millis / (1000 * 60 * 60);
  1684.                         millis -= hours * 1000 * 60 * 60;
  1685.                         long minutes = millis / (1000 * 60);
  1686.                         millis -= minutes * 1000 * 60;
  1687.                         long seconds = millis / 1000;
  1688.                         int XPChangeAttack = skills.getCurrentSkillExp(0) - startXPAttack;
  1689.                         int LevelChangeAttack = skills.getRealSkillLevel(0) - startLevelAttack;
  1690.                         int XPChangeDefense = skills.getCurrentSkillExp(1) - startXPDefense;
  1691.                         int LevelChangeDefense = skills.getRealSkillLevel(1) - startLevelDefense;
  1692.                         int XPChangeStrength = skills.getCurrentSkillExp(2) - startXPStrength;
  1693.                         int LevelChangeStrength = skills.getRealSkillLevel(2) - startLevelStrength;
  1694.                         int XPChangeHP = skills.getCurrentSkillExp(3) - startXPHP;
  1695.                         int LevelChangeHP = skills.getRealSkillLevel(3) - startLevelHP;
  1696.                         int XPChangeRange = skills.getCurrentSkillExp(4) - startXPRange;
  1697.                         int LevelChangeRange = skills.getRealSkillLevel(4) - startLevelRange;
  1698.                        
  1699.                         int x = 330;
  1700.             int y = 200;
  1701.                        
  1702.                         if(skills.getCurrentSkillExp(0) > startXPAttack) {
  1703.                                 skill = 0;
  1704.                                 skillName = "Attack";
  1705.                                 xpChange = XPChangeAttack;
  1706.                                 lvlChange = LevelChangeAttack;
  1707.                                 startLevel = startLevelAttack;
  1708.                         }
  1709.                         if(skills.getCurrentSkillExp(1) > startXPDefense) {
  1710.                                 skill = 1;
  1711.                                 skillName = "Defense";
  1712.                                 xpChange = XPChangeDefense;
  1713.                                 lvlChange = LevelChangeDefense;
  1714.                                 startLevel = startLevelDefense;
  1715.                         }
  1716.                         if(skills.getCurrentSkillExp(2) > startXPStrength) {
  1717.                                 skill = 2;
  1718.                                 skillName = "Strength";
  1719.                                 xpChange = XPChangeStrength;
  1720.                                 lvlChange = LevelChangeStrength;
  1721.                                 startLevel = startLevelStrength;
  1722.                         }
  1723.                         if(skills.getCurrentSkillExp(4) > startXPRange) {
  1724.                                 skill = 4;
  1725.                                 skillName = "Range";
  1726.                                 xpChange = XPChangeRange;
  1727.                                 lvlChange = LevelChangeRange;
  1728.                                 startLevel = startLevelRange;
  1729.                         }
  1730.                        
  1731.                         g.setColor(new Color(0, 0, 0, 175));
  1732.                         g.fillRoundRect(330, 200, 185, 135, 10, 10);              
  1733.                         g.fillRoundRect(365, 0, 150, 20, 10, 10);
  1734.             g.setColor(Color.red);
  1735.             g.drawString ("Stronghold Of Security", x + 32,y += 15);
  1736.             g.setColor(Color.yellow);
  1737.             g.drawString("Run Time: " + hours + " : " + minutes + " : " + seconds, x + 10, y += 22);
  1738.             g.drawString(skillName + " level " + skills.getCurrentSkillLevel(skill) + "  (Gained " + + lvlChange + " )", x + 10, y += 15);
  1739.             g.drawString("Gained: " + skillName + " exp : " + xpChange, x + 10, y += 15);
  1740.                         g.drawString("% Left To Level " + skillName + ": " + (100 - skills.getPercentToNextLevel(skill)) + "%", x + 10, y += 15);
  1741.             g.drawString(skillName + " Exp/hour : " + (int) ((xpChange) * (3600000D / (((double) System.currentTimeMillis() - (double) startTime)))), 368,15);
  1742.                         g.drawString("Hitpoints lvl: " + skills.getRealSkillLevel(STAT_HITPOINTS), x + 10, y += 15);
  1743.                         g.drawString("Hp Exp Gained: " + XPChangeHP, x + 10, y += 15);
  1744.                         g.drawString("% Left To Level HP: " + (100 - skills.getPercentToNextLevel(STAT_HITPOINTS)) + "%", x + 10, y += 15);
  1745.                
  1746.                 }
  1747.                
  1748.         public boolean clickNPC(final RSNPC npc, final String action) {
  1749.                 try {
  1750.                         int a;
  1751.                         final StringBuffer npcCommandBuf = new StringBuffer();
  1752.                         npcCommandBuf.append(action);
  1753.                         npcCommandBuf.append(" ");
  1754.                         npcCommandBuf.append(npc.getName());
  1755.                         final String npcCommand = npcCommandBuf.toString();
  1756.                         for (a = 10; a-- >= 0;) {
  1757.                                 if (npc.getInteracting() != null
  1758.                                                 && !npc.isInteractingWithLocalPlayer()) {
  1759.                                         return false;
  1760.                                 }
  1761.                                 final List<String> menuItems = getMenuItems();
  1762.                                 if (menuItems.size() > 1) {
  1763.                                         if (listContainsString(menuItems, npcCommand)) {
  1764.                                                 if (menuItems.get(0).contains(npcCommand)) {
  1765.                                                         clickMouse(true);
  1766.                                                         lastAttack = System.currentTimeMillis();
  1767.                                                         return true;
  1768.                                                 } else {
  1769.                                                         // clickMouse(false);
  1770.                                                         wait(random(230, 520));
  1771.                                                         lastAttack = System.currentTimeMillis();
  1772.                                                         return atMenu(npcCommand);
  1773.                                                 }
  1774.                                         }
  1775.                                 }
  1776.                                 final Point screenLoc = npc.getScreenLocation();
  1777.                                 if (!pointOnScreen(screenLoc)) {
  1778.                                         walkTileMMCustom(npc.getLocation());
  1779.                                         return false;
  1780.                                 }
  1781.                                 final Point randomP = new Point(random(screenLoc.x - 15,
  1782.                                                 screenLoc.x + 15), random(screenLoc.y - 15,
  1783.                                                 screenLoc.y + 15));
  1784.                                 if (randomP.x >= 0 && randomP.y >= 0) {
  1785.                                         moveMouse(randomP);
  1786.                                 }
  1787.                         }
  1788.                         return false;
  1789.                 } catch (final Exception e) {
  1790.                         return false;
  1791.                 }
  1792.         }
  1793.        
  1794.         public boolean atInventoryItemCustom(final int itemID, final String option) {
  1795.                 if (getCurrentTab() != Constants.TAB_INVENTORY
  1796.                                 && !RSInterface.getInterface(Constants.INTERFACE_BANK)
  1797.                                                 .isValid()
  1798.                                 && !RSInterface.getInterface(Constants.INTERFACE_STORE)
  1799.                                                 .isValid()) {
  1800.                         openTab(Constants.TAB_INVENTORY);
  1801.                 }
  1802.                 final int[] items = getInventoryArray();
  1803.                 final java.util.List<Integer> possible = new ArrayList<Integer>();
  1804.                 for (int i = 0; i < items.length; i++) {
  1805.                         if (items[i] == itemID) {
  1806.                                 possible.add(i);
  1807.                         }
  1808.                 }
  1809.                 final int idx = possible.get(random(0, possible.size()));
  1810.                 final Point t = getInventoryItemPoint(idx);
  1811.                 moveMouse(t, 5, 5);
  1812.                 return atMenu(option);
  1813.         }
  1814.                
  1815.         @Override
  1816.         public void onFinish() {
  1817.                 Bot.getEventManager().removeListener(PaintListener.class, this);
  1818.         }
  1819.        
  1820.         public boolean walkPathMMCustom(final RSTile[] path, final int maxDist) {
  1821.                 try {
  1822.                         final RSTile next = nextTile(path, maxDist);
  1823.                         if (next != null) {
  1824.                                 walkTileMMCustom(next);
  1825.                                 current = next;
  1826.                                 wait(random(1000,2000));
  1827.                                 return false;
  1828.                         } else if (next != null && next.equals(current)) {
  1829.                                 return false;
  1830.                         }
  1831.                 } catch (final Exception e) {
  1832.                         return false;
  1833.                 }
  1834.                 return true;
  1835.         }              
  1836.        
  1837.         private static RSTile current = new RSTile(0, 0);
  1838.        
  1839.         private boolean isUnderAttack() {
  1840.                 final NPC[] NPCS = Bot.getClient().getNPCArray();
  1841.                 final RSPlayer PLAYER = getMyPlayer();
  1842.                 RSNPC npc;
  1843.  
  1844.                 for (final int i : Bot.getClient().getNPCIndexArray()) {
  1845.                         if (NPCS[i] != null) {
  1846.                                 npc = new RSNPC(NPCS[i]);
  1847.                                         if(npc.getInteracting() != null && PLAYER.equals(npc.getInteracting()) && (npc.getHPPercent() > 0)) {
  1848.                                                 return true;
  1849.                                         }
  1850.                         }
  1851.                 }
  1852.                 return false;
  1853.         }
  1854.  
  1855. }
Submit a correction or amendment below. Make A New Post
To highlight particular lines, prefix each line with @h@
Syntax highlighting:
Post expiration:
Post exposure:
Name / Title:
Email: