- import java.awt.Color;
- import java.awt.Graphics;
- import java.util.Map;
- import java.awt.Point;
- import java.util.ArrayList;
- import java.util.List;
- import com.speljohan.rsbot.bot.Bot;
- import com.speljohan.rsbot.script.wrappers.RSTile;
- import com.speljohan.rsbot.script.Script;
- import com.speljohan.rsbot.script.wrappers.RSInterface;
- import com.speljohan.rsbot.script.wrappers.RSInterfaceChild;
- import com.speljohan.rsbot.script.wrappers.RSInterfaceComponent;
- import com.speljohan.rsbot.script.Calculations;
- import com.speljohan.rsbot.script.Constants;
- import com.speljohan.rsbot.script.wrappers.RSObject;
- import com.speljohan.rsbot.script.wrappers.RSItemTile;
- import com.speljohan.rsbot.script.wrappers.RSCharacter;
- import com.speljohan.rsbot.event.listeners.PaintListener;
- import com.speljohan.rsbot.accessors.Character;
- import com.speljohan.rsbot.script.Bank;
- import com.speljohan.rsbot.script.wrappers.RSNPC;
- import com.speljohan.rsbot.accessors.Item;
- import com.speljohan.rsbot.script.wrappers.RSItem;
- import com.speljohan.rsbot.script.wrappers.RSArea;
- import com.speljohan.rsbot.script.wrappers.RSPlayer;
- import com.speljohan.rsbot.accessors.NPC;
- public class WazzuStronghold extends Script implements PaintListener{
- @Override
- public String getAuthor() {
- return "Wazzu";
- }
- @Override
- public String getName() {
- return "Stronghold of Security";
- }
- @Override
- public String getScriptCategory() {
- return "Combat";
- }
- public static final int [] minotaur = new int [] {4404, 4406};
- public static final int [] goblin = new int [] {4407, 4408, 4409, 4410, 4411, 4412};
- public static final int [] fleshCrawler = new int [] {4391, 4390};
- public static final int [] zombie = new int [] {5377, 5378, 5393, 4394, 5379, 5380};
- public static final int [] fleshZombie = new int [] {4391, 4390, 5377, 5378, 5393, 4394, 5379, 5380};
- public int [] enemy;
- public boolean foodIsTrout;
- public boolean foodIsSalmon;
- public boolean foodIsLobster;
- public boolean foodIsMonkfish;
- public boolean foodIsSwordfish;
- public boolean foodIsTuna;
- public boolean foodIsCake;
- public boolean foodIsChocCake;
- public long lastArrowPick;
- public long lastCharmPick;
- public long lastGemPick;
- public long lastItemPick;
- public long lastPick;
- public long lastAttack;
- public long lastLog;
- public boolean cave1;
- public boolean cave2;
- public boolean cave4;
- public boolean cave5;
- public boolean cave6;
- public RSTile northEast1 = new RSTile(1865,5244);
- public RSTile southWest1 = new RSTile(1858,5239);
- public RSTile northEast2 = new RSTile(1859,5238);
- public RSTile southWest2 = new RSTile(1858,5236);
- public RSTile northEast3 = new RSTile(1866,5235);
- public RSTile southWest3 = new RSTile(1858,5213);
- public RSTile northEast4 = new RSTile(1869,5218);
- public RSTile southWest4 = new RSTile(1867,5217);
- public RSTile northEast5 = new RSTile(1881,5222);
- public RSTile southWest5 = new RSTile(1870,5208);
- public RSTile northEast6 = new RSTile(1915,5230);
- public RSTile southWest6 = new RSTile(1901,5210);
- public RSTile northEast7 = new RSTile(1905,5233);
- public RSTile southWest7 = new RSTile(1904,5231);
- public RSTile northEast8A = new RSTile(1914,5240);
- public RSTile southWest8A = new RSTile(1904,5234);
- public RSTile northEast8B = new RSTile(1914,5244);
- public RSTile southWest8B = new RSTile(1908,5240);
- public RSTile northEast9 = new RSTile(1907,5243);
- public RSTile southWest9 = new RSTile(1904,5242);
- public RSTile northEast10 = new RSTile(1903,5245);
- public RSTile southWest10 = new RSTile(1887,5218);
- public RSTile northEast11 = new RSTile(1888,5236);
- public RSTile southWest11 = new RSTile(1886,5235);
- public RSTile northEast12 = new RSTile(1885,5236);
- public RSTile southWest12 = new RSTile(1878,5226);
- public RSTile northEast13 = new RSTile(2046,5246);
- public RSTile southWest13 = new RSTile(2040,5239);
- public RSTile northEast14 = new RSTile(2031,5228);
- public RSTile southWest14 = new RSTile(2009,5208);
- public RSTile northEast15 = new RSTile(2008,5216);
- public RSTile southWest15 = new RSTile(2006,5215);
- public RSTile northEast16 = new RSTile(2005,5220);
- public RSTile southWest16 = new RSTile(2000,5209);
- public RSTile northEast17 = new RSTile(2008,5208);
- public RSTile southWest17 = new RSTile(2001,5195);
- public RSTile northEast18 = new RSTile(2018,5228);
- public RSTile southWest18 = new RSTile(2016,5227);
- public RSTile northEast19 = new RSTile(2015,5234);
- public RSTile southWest19 = new RSTile(2004,5223);
- public RSTile northEast20 = new RSTile(2006,5237);
- public RSTile southWest20 = new RSTile(2005,5235);
- public RSTile northEast21 = new RSTile(2010,5244);
- public RSTile southWest21 = new RSTile(1997,5238);
- public RSTile northEast22 = new RSTile(1996,5244);
- public RSTile southWest22 = new RSTile(1988,5228);
- public RSTile northEast23 = new RSTile(2026,5214);
- public RSTile southWest23 = new RSTile(2014,5203);
- public RSTile northEast24 = new RSTile(2021,5202);
- public RSTile southWest24 = new RSTile(2020,5200);
- public RSTile northEast25 = new RSTile(2020,5199);
- public RSTile southWest25 = new RSTile(2008,5185);
- public RSTile northEast26 = new RSTile(2033,5199);
- public RSTile southWest26 = new RSTile(2021,5185);
- public RSTile northEast27 = new RSTile(2036,5186);
- public RSTile southWest27 = new RSTile(2034,5185);
- public RSTile northEast28 = new RSTile(2046,5191);
- public RSTile southWest28 = new RSTile(2037,5185);
- public RSTile northEast29 = new RSTile(2046,5194);
- public RSTile southWest29 = new RSTile(2036,5189);
- public int skill;
- public String skillName;
- public int xpChange;
- public int lvlChange;
- public int startLevel;
- public String doing = "Start";
- public int fireRune = 554;
- public int airRune = 556;
- public int lawRune = 563;
- public int [] noDeposit = {554, 556, 563};
- public int foodTrout = 333;
- public int foodSalmon = 329;
- public int foodLobster = 379;
- public int foodSwordfish = 373;
- public int foodMonkfish = 7946;
- public int foodTuna = 361;
- public int chocCake1 = 1901;
- public int chocCake2 = 1899;
- public int chocCake3 = 1897;
- public int cake1 = 1895;
- public int cake2 = 1893;
- public int cake3 = 1891;
- public int [] arrowID;
- public int [] gemID;
- public int [] charmID;
- public int [] customID;
- public boolean takeArrow;
- public boolean takeCharm;
- public boolean takeGem;
- public boolean takeCustom;
- public int food;
- public int hole = 16154;
- public int [] booth = {26972, 11402};
- public int eatHP;
- public int eatHP2;
- public int currentHP;
- public char n;
- public char s;
- public char w;
- public char e;
- public long startTime = System.currentTimeMillis();
- public int startLevelAttack = 0;
- public int startXPAttack = 0;
- public int startLevelDefense = 0;
- public int startXPDefense = 0;
- public int startLevelStrength = 0;
- public int startXPStrength = 0;
- public int startLevelHP = 0;
- public int startXPHP = 0;
- public int startLevelRange = 0;
- public int startXPRange = 0;
- RSTile [] bankToHole = new RSTile[] { new RSTile(3094,3491), new RSTile(3086,3485),
- new RSTile(3081,3476), new RSTile(3080,3467),
- new RSTile(3087,3460), new RSTile(3087,3450),
- new RSTile(3087,3440), new RSTile(3080,3433),
- new RSTile(3080,3423)
- };
- RSTile [] holeToBank = reversePath(bankToHole);
- RSTile [] fountainToBank = new RSTile [] {new RSTile(3212,3424), new RSTile(3205,3428),
- new RSTile(3196, 3429), new RSTile(3189,3435)
- };
- RSTile [] varrockToHole = new RSTile [] {new RSTile(3189,3435), new RSTile(3180, 3430),
- new RSTile(3170,3427), new RSTile(3162,3421),
- new RSTile(3153,3417), new RSTile(3143,3417),
- new RSTile(3133,3416), new RSTile(3123,3415),
- new RSTile(3114,3420), new RSTile(3104,3420),
- new RSTile(3094,3420), new RSTile(3084,3421),
- };
- RSTile [] door2To3 = new RSTile [] { new RSTile(1859,5235), new RSTile(1862,5226), new RSTile(1866,5217)
- };
- RSTile [] door3To2 = reversePath(door2To3);
- RSTile [] cave5Path = new RSTile [] {new RSTile(1996, 5216), new RSTile(1989, 5223),
- new RSTile(1989, 5233)
- };
- RSTile [] cave5Reverse = reversePath(cave5Path);
- public RSTile DOOR_1 = new RSTile(1859, 5238);
- public RSTile DOOR_2 = new RSTile(1859, 5235);
- public RSTile DOOR_3 = new RSTile(1867, 5217);
- public RSTile DOOR_4 = new RSTile(1870, 5217);
- public RSTile NEXT_TO_LADDER1 = new RSTile(1859, 5243);
- public RSTile doorTile;
- public RSTile teleTile1 = new RSTile(1914, 5222);
- public RSTile wrongPlace1 = new RSTile(1878, 5224);
- public RSTile wrongPlace2 = new RSTile(1875, 5206);
- public RSTile wrongPlace3 = new RSTile(1845, 5243);
- public RSTile wrongPlace4 = new RSTile(1887, 5236);
- public RSTile wrongDoor1 = new RSTile(1878, 5222);
- public RSTile wrongDoor2 = new RSTile(1874, 5207);
- public RSTile wrongDoor3 = new RSTile(1887, 5243);
- public RSTile wrongDoor4 = new RSTile(1889, 5236);
- public RSTile area14Tile = new RSTile(2021, 5217);
- public RSTile area16Tile = new RSTile(2003, 5210);
- public RSTile area17Tile = new RSTile(2005, 5205);
- public RSTile area21Tile = new RSTile(2000, 5243);
- public RSTile area22Tile = new RSTile(1994, 5241);
- public RSTile area23Tile = new RSTile(2021, 5210);
- public RSTile area25Tile = new RSTile(2019, 5193);
- public RSTile area26Tile = new RSTile(2023, 5193);
- public RSTile door5 = new RSTile(1905, 5230);
- public RSTile door6 = new RSTile(1905, 5233);
- public RSTile door7 = new RSTile(1908, 5242);
- public RSTile door8 = new RSTile(1904, 5242);
- public RSTile door9 = new RSTile(1889, 5236);
- public RSTile door10 = new RSTile(1886, 5236);
- public RSTile door11 = new RSTile(2008, 5216);
- public RSTile door12 = new RSTile(2006, 5216);
- public RSTile door13 = new RSTile(2018, 5228);
- public RSTile door14 = new RSTile(2016, 5228);
- public RSTile door15 = new RSTile(2005, 5235);
- public RSTile door16 = new RSTile(2005, 5237);
- public RSTile door17 = new RSTile(2020, 5202);
- public RSTile door18 = new RSTile(2020, 5200);
- public RSTile door19 = new RSTile(2034, 5186);
- public RSTile door20 = new RSTile(2036, 5186);
- public RSTile portal1 = new RSTile(1863, 5238);
- public RSTile portal2 = new RSTile(2039, 5240);
- public RSTile ladder1Tile = new RSTile(1859, 5244);
- public RSTile ladder1bTile = new RSTile(1913, 5226);
- public RSTile ladder2Tile = new RSTile(1902, 5222);
- public RSTile ladder3Tile = new RSTile(2042, 5246);
- public RSTile chain1Tile = new RSTile(1881, 5232);
- public RSTile chain2Tile = new RSTile(2017, 5210);
- public RSTile chain3Tile = new RSTile(2031,5189);
- @Override
- public String getScriptDescription() {
- String html = "";
- html += "<html>\n";
- html += "<head>\n";
- html += "</head>\n";
- html += "<body bgcolor=\"#CC033C\">\n";
- html += "<font color=\"black\">\n";
- html += "<center><font size=\"8\"><b>Stronghold Of Security</b></font>\n<br>";
- html += "<font size=\"3\"><b>Version 1.6</b></font></center><br><br>";
- html += "<b>Select Cave </b>";
- html += "<select name='cave'>";
- html += "<option>Cave 1";
- html += "<option>Cave 2";
- html += "<option>Cave 4";
- html += "<option>Cave 5";
- html += "<option>Cave 6";
- html += "<br><b>Select NPC To Fight </b>";
- html += "<select name='Enemy'>";
- html += "<option>Minotaur";
- html += "<option>Goblin";
- html += "<option>Flesh Crawler";
- html += "<option>Zombie";
- html += "<option>Flesh Crawler And Zombie";
- html += "<br><b>Select Food </b>";
- html += "<select name='Food'>";
- html += "<option>Trout";
- html += "<option>Salmon";
- html += "<option>Tuna";
- html += "<option>Lobster";
- html += "<option>Monkfish";
- html += "<option>Swordfish";
- html += "<option>Cake";
- html += "<option>Chocolate Cake";
- html += "<br><b>HP To Eat At (If Not In Combat) </b>";
- html += "<input type=\"text\" size=\"3\" name=\"eatHP\">";
- html += "<br><b>HP To Eat At (No Matter What) </b>";
- html += "<input type=\"text\" size=\"3\" name=\"eatHP2\">";
- html += "<br><b>Select Arrow Pickup </b>";
- html += "<select name='arrow'>";
- html += "<option>None";
- html += "<option>Bronze";
- html += "<option>Iron";
- html += "<option>Steel";
- html += "<option>All";
- html += "<br><b>Pickup Gems </b>";
- html += "<input type=\"checkbox\" name=\"Gems\" value=\"true\">";
- html += "<br><b>Pickup Charms </b>";
- html += "<input type=\"checkbox\" name=\"Charms\" value=\"true\">";
- html += "<br><b>Other Item ID's </b>";
- html += "<input type=\"text\" name=\"item\">";
- html += "<br>(Separate w/comma)";
- html += "</font>\n";
- html += "</body>\n";
- html += "</html>\n";
- return html;
- }
- public boolean onStart(Map<String, String> args) {
- if (args.get("Enemy").equals("Minotaur")) {
- enemy = minotaur;
- }
- if (args.get("Enemy").equals("Goblin")) {
- enemy = goblin;
- }
- if (args.get("Enemy").equals("Flesh Crawler")) {
- enemy = fleshCrawler;
- }
- if (args.get("Enemy").equals("Zombie")) {
- enemy = zombie;
- }
- if (args.get("Enemy").equals("Flesh Crawler And Zombie")) {
- enemy = fleshZombie;
- }
- cave1 = (args.get("cave").equals("Cave 1"));
- cave2 = (args.get("cave").equals("Cave 2"));
- cave4 = (args.get("cave").equals("Cave 4"));
- cave5 = (args.get("cave").equals("Cave 5"));
- cave6 = (args.get("cave").equals("Cave 6"));
- foodIsSalmon = (args.get("Food").equals("Salmon"));
- foodIsTrout = (args.get("Food").equals("Trout"));
- foodIsLobster = (args.get("Food").equals("Lobter"));
- foodIsMonkfish = (args.get("Food").equals("Monkfish"));
- foodIsSwordfish = (args.get("Food").equals("Swordfish"));
- foodIsTuna = (args.get("Food").equals("Tuna"));
- foodIsChocCake = (args.get("Food").equals("Chocolate Cake"));
- foodIsCake = (args.get("Food").equals("Cake"));
- if (args.get("Food").equals("Trout")) {
- food = foodTrout;
- }
- if (args.get("Food").equals("Salmon")) {
- food = foodSalmon;
- }
- if (args.get("Food").equals("Lobster")) {
- food = foodLobster;
- }
- if (args.get("Food").equals("Monkfish")) {
- food = foodMonkfish;
- }
- if (args.get("Food").equals("Swordfish")) {
- food = foodSwordfish;
- }
- if (args.get("Food").equals("Tuna")) {
- food = foodTuna;
- }
- if (args.get("Food").equals("Chocolate Cake")) {
- food = chocCake3;
- }
- if (args.get("Food").equals("Cake")) {
- food = cake3;
- }
- eatHP = Integer.parseInt(args.get("eatHP"));
- eatHP2 = Integer.parseInt(args.get("eatHP2"));
- if (args.get("arrow").equals("None")) {
- arrowID = new int [] {1};
- takeArrow = false;
- }
- if (args.get("arrow").equals("Bronze")) {
- arrowID = new int [] {882};
- takeArrow = true;
- }
- if (args.get("arrow").equals("Iron")) {
- arrowID = new int [] {884};
- takeArrow = true;
- }
- if (args.get("arrow").equals("Steel")) {
- arrowID = new int [] {886};
- takeArrow = true;
- }
- if (args.get("arrow").equals("All")) {
- arrowID = new int [] {882, 884, 886};
- takeArrow = true;
- }
- if (args.get("Charms") != null) {
- charmID = new int [] {12158, 12159, 12160, 12163};
- takeCharm = true;
- }
- if (args.get("Charms") == null) {
- charmID = new int [] {1};
- takeCharm = false;
- }
- if (args.get("Gems") != null) {
- gemID = new int [] {1617, 1619, 1621, 1623};
- takeGem = true;
- }
- if (args.get("Gems") == null) {
- gemID = new int [] {1};
- takeGem = false;
- }
- String itemCus = args.get("item");
- if(itemCus.length() < 1) {
- customID = new int [] {1};
- takeCustom = false;
- }
- else {
- String[] itemCust = itemCus.split(",");
- customID = new int[itemCust.length];
- for(int i = 0; i < itemCust.length; i++) {
- itemCust[i] = itemCust[i].trim();
- customID[i] = Integer.parseInt(itemCust[i]);
- }
- takeCustom = true;
- }
- log("Time To Fight, Bitch");
- startTime = System.currentTimeMillis();
- if (isLoggedIn()) {
- startLevelAttack = skills.getRealSkillLevel(0);
- startXPAttack = skills.getCurrentSkillExp(0);
- startLevelDefense = skills.getRealSkillLevel(1);
- startXPDefense = skills.getCurrentSkillExp(1);
- startLevelStrength = skills.getRealSkillLevel(2);
- startXPStrength = skills.getCurrentSkillExp(2);
- startLevelHP = skills.getRealSkillLevel(3);
- startXPHP = skills.getCurrentSkillExp(3);
- startLevelRange = skills.getRealSkillLevel(4);
- startXPRange = skills.getCurrentSkillExp(4);
- }
- return true;
- }
- public int loop () {
- RSObject bankBooth = findObject(booth);
- RSNPC theNPC = getNearestFreeNPCByID(enemy);
- if(!inventoryContains(food)) {
- goBank();
- }
- if(!inventoryContains(food) && bankBooth != null) {
- if(distanceTo(bankBooth.getLocation()) < 5) {
- bank();
- }
- }
- if(inventoryContains(food)) {
- if(theNPC == null || !canReach(theNPC, false)) {
- goFight();
- }
- }
- if(inventoryContains(food) && theNPC != null && canReach(theNPC.getLocation(), false)) {
- fight();
- }
- return(random(50,100));
- }
- public int fight() {
- currentHP = skills.getCurrentSkillLevel(Constants.STAT_HITPOINTS);
- if(currentHP < eatHP2) {
- eat();
- return(random(10,20));
- }
- if(isUnderAttack()) {
- return(random(2,5));
- }
- if(System.currentTimeMillis() - lastPick < 500) {
- return(random(2,5));
- }
- if(System.currentTimeMillis() - lastAttack < 500) {
- return(random(2,5));
- }
- if(getMyPlayer().getInteracting() != null) {
- return(random(2,5));
- }
- if(getMyPlayer().isMoving()) {
- return(random(2,5));
- }
- else {
- RSItemTile pickArrow = getGroundItemByID(6, arrowID);
- RSItemTile pickCharm = getGroundItemByID(6, charmID);
- RSItemTile pickGem = getGroundItemByID(6, gemID);
- RSItemTile pickItem = getGroundItemByID(6, customID);
- RSNPC theNPC = getNearestFreeNPCByID(enemy);
- if(System.currentTimeMillis() - lastArrowPick > 3000) {
- if(canReach(pickArrow, false)) {
- if(takeArrow == true && getMyPlayer().isIdle() && getMyPlayer().getInteracting() == null && inventoryContains(arrowID) || getInventoryCount() < 28) {
- pickUpArrow();
- return(random(10,20));
- }
- }
- }
- if(System.currentTimeMillis() - lastCharmPick > 3000) {
- if(canReach(pickCharm, false)) {
- if(takeCharm == true && getMyPlayer().isIdle() && getMyPlayer().getInteracting() == null && getInventoryCount() < 28) {
- pickUpCharm();
- return(random(10,20));
- }
- }
- }
- if(System.currentTimeMillis() - lastGemPick > 3000) {
- if(canReach(pickGem, false)) {
- if(takeGem == true && getMyPlayer().isIdle() && getMyPlayer().getInteracting() == null && getInventoryCount() < 28) {
- pickUpGem();
- return(random(10,20));
- }
- }
- }
- if(System.currentTimeMillis() - lastItemPick > 3000) {
- if(canReach(pickItem, false)) {
- if(takeCustom == true && getMyPlayer().isIdle() && getMyPlayer().getInteracting() == null && getInventoryCount() < 28) {
- pickUpCustomItem();
- return(random(10,20));
- }
- }
- }
- if(currentHP <= eatHP) {
- eat();
- return(random(10,20));
- }
- else {
- if(getEnergy() > random(25,100)) {
- setRun(true);
- wait(random(10,20));
- }
- if(theNPC != null) {
- if(getMyPlayer().getInteracting() == null && !getMyPlayer().isMoving()) {
- if(!clickNPC(theNPC, "Attack")) {
- return(random(750,1000));
- }
- else {
- return(random(2,5));
- }
- }
- }
- else {
- return(random(50,100));
- }
- }
- return(random(50,100));
- }
- }
- public int eat() {
- if(!foodIsChocCake && !foodIsCake) {
- atInventoryItemCustom(food, "Eat");
- return(random(10,20));
- }
- if(foodIsChocCake) {
- if(inventoryContains(chocCake1)) {
- atInventoryItemCustom(chocCake1, "Eat");
- return(random(10, 20));
- }
- if(inventoryContains(chocCake2)) {
- atInventoryItemCustom(chocCake2, "Eat");
- return(random(10, 20));
- }
- if(inventoryContains(chocCake3)) {
- atInventoryItemCustom(chocCake3, "Eat");
- return(random(10, 20));
- }
- }
- if(foodIsCake) {
- if(inventoryContains(cake1)) {
- atInventoryItemCustom(cake1, "Eat");
- return(random(10, 20));
- }
- if(inventoryContains(cake2)) {
- atInventoryItemCustom(cake2, "Eat");
- return(random(10, 20));
- }
- if(inventoryContains(cake3)) {
- atInventoryItemCustom(cake3, "Eat");
- return(random(10, 20));
- }
- }
- return(random(10,20));
- }
- public int pickUpArrow() {
- RSItemTile pickArrow = getGroundItemByID(6, arrowID);
- if(canReach(pickArrow, false)) {
- RSItemTile [] allArrows = getGroundItemsAt(pickArrow);
- int listPosition = 0;
- for (int i = 0; i < allArrows.length; i++) {
- int currentArrow = allArrows[i].getItem().getID();
- for (int itemArrow : arrowID) {
- if (itemArrow == currentArrow) {
- listPosition = (allArrows.length - i);
- break;
- }
- }
- }
- rightClickTile(pickArrow);
- wait(random(200,300));
- if(!getMenuActions().contains("Take")) {
- atMenu("Cancel");
- lastArrowPick = System.currentTimeMillis();
- }
- int menuPosition = 0;
- int i = 0;
- for (String menuItem : getMenuActions()) {
- if (menuItem.contains("Take")) {
- menuPosition = i;
- break;
- }
- i++;
- }
- if(isMenuOpen()) {
- atMenuItemCustom(menuPosition + listPosition);
- lastArrowPick = System.currentTimeMillis();
- lastPick = System.currentTimeMillis();
- return(random(1000,1500));
- }
- return(random(2,5));
- }
- return(random(2,5));
- }
- public int pickUpCharm() {
- RSItemTile pickCharm = getGroundItemByID(6, charmID);
- if(canReach(pickCharm, false)) {
- RSItemTile [] allCharms = getGroundItemsAt(pickCharm);
- int listPosition = 0;
- for (int i = 0; i < allCharms.length; i++) {
- int currentCharm = allCharms[i].getItem().getID();
- for (int itemCharm : charmID) {
- if (itemCharm == currentCharm) {
- listPosition = (allCharms.length - i);
- break;
- }
- }
- }
- rightClickTile(pickCharm);
- wait(random(200,300));
- if(!getMenuActions().contains("Take")) {
- atMenu("Cancel");
- lastCharmPick = System.currentTimeMillis();
- }
- int menuPosition = 0;
- int i = 0;
- for (String menuItem : getMenuActions()) {
- if (menuItem.contains("Take")) {
- menuPosition = i;
- break;
- }
- i++;
- }
- if(isMenuOpen()) {
- atMenuItemCustom(menuPosition + listPosition);
- lastCharmPick = System.currentTimeMillis();
- lastPick = System.currentTimeMillis();
- return(random(1000,1500));
- }
- return(random(2,5));
- }
- return(random(2,5));
- }
- public int pickUpGem() {
- RSItemTile pickGem = getGroundItemByID(6, gemID);
- if(canReach(pickGem, false)) {
- RSItemTile [] allGems = getGroundItemsAt(pickGem);
- int listPosition = 0;
- for (int i = 0; i < allGems.length; i++) {
- int currentGem = allGems[i].getItem().getID();
- for (int itemGem : gemID) {
- if (itemGem == currentGem) {
- listPosition = (allGems.length - i);
- break;
- }
- }
- }
- rightClickTile(pickGem);
- wait(random(200,300));
- if(!getMenuActions().contains("Take")) {
- atMenu("Cancel");
- lastGemPick = System.currentTimeMillis();
- }
- int menuPosition = 0;
- int i = 0;
- for (String menuItem : getMenuActions()) {
- if (menuItem.contains("Take")) {
- menuPosition = i;
- break;
- }
- i++;
- }
- if(isMenuOpen()) {
- atMenuItemCustom(menuPosition + listPosition);
- lastGemPick = System.currentTimeMillis();
- lastPick = System.currentTimeMillis();
- return(random(1000,1500));
- }
- return(random(2,5));
- }
- return(random(2,5));
- }
- public int pickUpCustomItem() {
- RSItemTile pickItem = getGroundItemByID(6, customID);
- if(canReach(pickItem, false)) {
- RSItemTile [] allItems = getGroundItemsAt(pickItem);
- int listPosition = 0;
- for (int i = 0; i < allItems.length; i++) {
- int currentItem = allItems[i].getItem().getID();
- for (int itemCustom : customID) {
- if (itemCustom == currentItem) {
- listPosition = (allItems.length - i);
- break;
- }
- }
- }
- rightClickTile(pickItem);
- wait(random(200,300));
- if(!getMenuActions().contains("Take")) {
- atMenu("Cancel");
- lastItemPick = System.currentTimeMillis();
- }
- int menuPosition = 0;
- int i = 0;
- for (String menuItem : getMenuActions()) {
- if (menuItem.contains("Take")) {
- menuPosition = i;
- break;
- }
- i++;
- }
- if(isMenuOpen()) {
- atMenuItemCustom(menuPosition + listPosition);
- lastItemPick = System.currentTimeMillis();
- lastPick = System.currentTimeMillis();
- return(random(1000,1500));
- }
- return(random(2,5));
- }
- return(random(2,5));
- }
- public boolean onPath(RSTile[] t){
- for(int i = 0; i < t.length; i++ ){
- if(distanceTo(t[i]) < 13){
- return true;
- }
- }
- return false;
- }
- public void bank() {
- RSObject bankBooth = findObject(booth);
- if(bankBooth != null) {
- atObject(bankBooth, "Use-quickly");
- if(interfaceExists(Constants.INTERFACE_BANK)) {
- bank.depositAllExcept(noDeposit);
- wait(random(1000,2000));
- clickMouse(83,309,5,5,true);
- wait(random(1000,2000));
- if(foodIsTrout) {
- sendText("trout", false);
- }
- if(foodIsSalmon) {
- sendText("salmon", false);
- }
- if(foodIsLobster) {
- sendText("lobster", false);
- }
- if(foodIsMonkfish) {
- sendText("monkfish", false);
- }
- if(foodIsSwordfish) {
- sendText("swordfish", false);
- }
- if(foodIsTuna) {
- sendText("tuna", false);
- }
- if(foodIsChocCake) {
- sendText("chocolate cake", false);
- }
- wait(random(2000,3000));
- clickMouse(53,112,5,5,false);
- atMenu("Withdraw-All");
- wait(random(1000,2000));
- if(inventoryContains(food)) {
- bank.close();
- }
- }
- }
- }
- public boolean walkTileMMCustom(final RSTile t) {
- final Point p = tileToMinimap(t);
- if (p.x == -1 || p.y == -1) {
- return false;
- }
- clickMouse(p, 0, 0, true);
- return true;
- }
- public void goFight() {
- RSObject downHole = findObject(hole);
- RSArea area1 = new RSArea(southWest1, northEast1);
- RSArea area2 = new RSArea(southWest2, northEast2);
- RSArea area3 = new RSArea(southWest3, northEast3);
- RSArea area4 = new RSArea(southWest4, northEast4);
- RSArea area5 = new RSArea(southWest5, northEast5);
- RSArea area6 = new RSArea(southWest6, northEast6);
- RSArea area7 = new RSArea(southWest7, northEast7);
- RSArea area8A = new RSArea(southWest8A, northEast8A);
- RSArea area8B = new RSArea(southWest8B, northEast8B);
- RSArea area9 = new RSArea(southWest9, northEast9);
- RSArea area10 = new RSArea(southWest10, northEast10);
- RSArea area11 = new RSArea(southWest11, northEast11);
- RSArea area12 = new RSArea(southWest12, northEast12);
- RSArea area13 = new RSArea(southWest13, northEast13);
- RSArea area14 = new RSArea(southWest14, northEast14);
- RSArea area15 = new RSArea(southWest15, northEast15);
- RSArea area16 = new RSArea(southWest16, northEast16);
- RSArea area17 = new RSArea(southWest17, northEast17);
- RSArea area18 = new RSArea(southWest18, northEast18);
- RSArea area19 = new RSArea(southWest19, northEast19);
- RSArea area20 = new RSArea(southWest20, northEast20);
- RSArea area21 = new RSArea(southWest21, northEast21);
- RSArea area22 = new RSArea(southWest22, northEast22);
- RSArea area23 = new RSArea(southWest23, northEast23);
- RSArea area24 = new RSArea(southWest24, northEast24);
- RSArea area25 = new RSArea(southWest25, northEast25);
- RSArea area26 = new RSArea(southWest26, northEast26);
- RSArea area27 = new RSArea(southWest27, northEast27);
- RSArea area28 = new RSArea(southWest28, northEast28);
- RSArea area29 = new RSArea(southWest29, northEast29);
- if(cave1) {
- if(onPath(bankToHole) && inventoryContains(food)) {
- walkPathMMCustom(bankToHole, 13);
- }
- if(onPath(varrockToHole) && inventoryContains(food)) {
- walkPathMMCustom(varrockToHole, 13);
- }
- if(downHole != null && inventoryContains(food)) {
- atObject(downHole, "Climb-down");
- wait(random(300,500));
- }
- if(area1.contains(getMyPlayer().getLocation()) && distanceTo(DOOR_1) > 2 && inventoryContains(food)) {
- walkTileMMCustom(DOOR_1);
- wait(random(2000,3000));
- }
- if(area1.contains(getMyPlayer().getLocation()) && distanceTo(DOOR_1) < 3 && inventoryContains(food)) {
- findDoor(DOOR_1, 'n');
- wait(random(10,20));
- }
- if(area2.contains(getMyPlayer().getLocation()) && inventoryContains(food)) {
- findDoor(DOOR_2, 'n');
- wait(random(10,20));
- }
- if(area3.contains(getMyPlayer().getLocation()) && distanceTo(DOOR_3) > 2 && inventoryContains(food)) {
- walkPathMMCustom(door2To3, 13);
- wait(random(2000,3000));
- }
- if(area3.contains(getMyPlayer().getLocation()) && distanceTo(DOOR_3) < 3 && inventoryContains(food)) {
- findDoor(DOOR_3, 'w');
- wait(random(20,30));
- }
- if(area4.contains(getMyPlayer().getLocation()) && inventoryContains(food)) {
- findDoor(DOOR_4, 'w');
- wait(random(20,30));
- }
- if(canReach(wrongPlace1, false) && inventoryContains(food)) {
- findDoor(wrongDoor1, 'n');
- wait(random(10,20));
- }
- if(canReach(wrongPlace2, false) && inventoryContains(food)) {
- findDoor(wrongDoor2, 'n');
- wait(random(10,20));
- }
- }
- if(cave2) {
- if(onPath(bankToHole) && inventoryContains(food)) {
- walkPathMMCustom(bankToHole, 13);
- }
- if(onPath(varrockToHole) && inventoryContains(food)) {
- walkPathMMCustom(varrockToHole, 13);
- }
- if(downHole != null && inventoryContains(food)) {
- atObject(downHole, "Climb-down");
- wait(random(300,500));
- }
- if(distanceTo(portal1) < 20 && canReach(portal1, true) && inventoryContains(food)) {
- if(distanceTo(portal1) > 3) {
- walkTileMMCustom(portal1);
- wait(random(500,1000));
- }
- if(distanceTo(portal1) < 4) {
- atTile(portal1, "Use");
- wait(random(200,300));
- }
- }
- if(area6.contains(getMyPlayer().getLocation()) && distanceTo(door5) > 2 && inventoryContains(food)) {
- walkTileMMCustom(door5);
- wait(random(1000,2000));
- }
- if(area6.contains(getMyPlayer().getLocation()) && distanceTo(door5) < 3 && inventoryContains(food)) {
- findDoor(door5, 'n');
- wait(random(10,20));
- }
- if(area7.contains(getMyPlayer().getLocation()) && inventoryContains(food)) {
- findDoor(door6, 'n');
- wait(random(10,20));
- }
- if(area8A.contains(getMyPlayer().getLocation()) || area8B.contains(getMyPlayer().getLocation()) && distanceTo(door7) > 2 && inventoryContains(food)) {
- walkTileMMCustom(door7);
- wait(random(2000,3000));
- }
- if(area8B.contains(getMyPlayer().getLocation()) && distanceTo(door7) < 3 && inventoryContains(food)) {
- findDoor(door7, 'w');
- wait(random(10,20));
- }
- if(area9.contains(getMyPlayer().getLocation()) && inventoryContains(food)) {
- findDoor(door8, 'w');
- wait(random(10,20));
- }
- if(canReach(wrongPlace3, false) && inventoryContains(food)) {
- findDoor(wrongDoor3, 'w');
- wait(random(10,20));
- }
- if(canReach(wrongPlace4, false) && inventoryContains(food)) {
- findDoor(wrongDoor4, 'w');
- wait(random(10,20));
- }
- }
- if(cave4) {
- if(onPath(bankToHole) && inventoryContains(food)) {
- walkPathMMCustom(bankToHole, 13);
- }
- if(onPath(varrockToHole) && inventoryContains(food)) {
- walkPathMMCustom(varrockToHole, 13);
- }
- if(downHole != null && inventoryContains(food)) {
- atObject(downHole, "Climb-down");
- wait(random(300,500));
- }
- if(distanceTo(portal1) < 20 && canReach(portal1, true) && inventoryContains(food)) {
- if(distanceTo(portal1) > 3) {
- walkTileMMCustom(portal1);
- wait(random(500,1000));
- }
- if(distanceTo(portal1) < 4) {
- atTile(portal1, "Use");
- wait(random(200,300));
- }
- }
- if(area6.contains(getMyPlayer().getLocation()) && distanceTo(ladder2Tile) > 2 && inventoryContains(food)) {
- walkTileMMCustom(ladder2Tile);
- wait(random(500,1000));
- }
- if(area6.contains(getMyPlayer().getLocation()) && distanceTo(ladder2Tile) < 3 && inventoryContains(food)) {
- atTile(ladder2Tile, "Climb-down");
- wait(random(2000,3000));
- }
- if(area13.contains(getMyPlayer().getLocation()) && distanceTo(portal2) > 2 && inventoryContains(food)) {
- walkTileMMCustom(portal2);
- wait(random(500,1000));
- }
- if(area13.contains(getMyPlayer().getLocation()) && distanceTo(portal2) < 3 && inventoryContains(food)) {
- atTile(portal2, "Use");
- wait(random(500,1000));
- }
- if(area14.contains(getMyPlayer().getLocation()) && distanceTo(door11) > 2 && inventoryContains(food)) {
- walkTileMMCustom(door11);
- wait(random(500,1000));
- }
- if(area14.contains(getMyPlayer().getLocation()) && distanceTo(door11) < 3 && inventoryContains(food)) {
- findDoor(door11, 'e');
- wait(random(10,20));
- }
- if(area15.contains(getMyPlayer().getLocation()) && inventoryContains(food)) {
- findDoor(door12, 'w');
- wait(random(10,20));
- }
- if(area16.contains(getMyPlayer().getLocation()) && inventoryContains(food)) {
- walkTileMMCustom(area17Tile);
- wait(random(500,1000));
- }
- }
- if(cave5) {
- if(onPath(bankToHole) && inventoryContains(food)) {
- walkPathMMCustom(bankToHole, 13);
- }
- if(onPath(varrockToHole) && inventoryContains(food)) {
- walkPathMMCustom(varrockToHole, 13);
- }
- if(downHole != null && inventoryContains(food)) {
- atObject(downHole, "Climb-down");
- wait(random(300,500));
- }
- if(distanceTo(portal1) < 20 && canReach(portal1, true) && inventoryContains(food)) {
- if(distanceTo(portal1) > 3) {
- walkTileMMCustom(portal1);
- wait(random(500,1000));
- }
- if(distanceTo(portal1) < 4) {
- atTile(portal1, "Use");
- wait(random(200,300));
- }
- }
- if(area6.contains(getMyPlayer().getLocation()) && distanceTo(ladder2Tile) > 2 && inventoryContains(food)) {
- walkTileMMCustom(ladder2Tile);
- wait(random(500,1000));
- }
- if(area6.contains(getMyPlayer().getLocation()) && distanceTo(ladder2Tile) < 3 && inventoryContains(food)) {
- atTile(ladder2Tile, "Climb-down");
- wait(random(2000,3000));
- }
- if(area13.contains(getMyPlayer().getLocation()) && distanceTo(portal2) > 2 && inventoryContains(food)) {
- walkTileMMCustom(portal2);
- wait(random(500,1000));
- }
- if(area13.contains(getMyPlayer().getLocation()) && distanceTo(portal2) < 3 && inventoryContains(food)) {
- atTile(portal2, "Use");
- wait(random(500,1000));
- }
- if(area14.contains(getMyPlayer().getLocation()) && !area19.contains(getMyPlayer().getLocation()) && !area18.contains(getMyPlayer().getLocation()) && distanceTo(door13) > 2 && inventoryContains(food)) {
- walkTileMMCustom(door13);
- wait(random(500,1000));
- }
- if(area14.contains(getMyPlayer().getLocation()) && !area19.contains(getMyPlayer().getLocation()) && !area18.contains(getMyPlayer().getLocation()) && distanceTo(door13) < 3 && inventoryContains(food)) {
- findDoor(door13, 'e');
- wait(random(10,20));
- }
- if(area18.contains(getMyPlayer().getLocation()) && inventoryContains(food)) {
- findDoor(door14, 'w');
- wait(random(10,20));
- }
- if(area19.contains(getMyPlayer().getLocation()) && distanceTo(door15) > 2 && inventoryContains(food)) {
- walkTileMMCustom(door15);
- wait(random(500,1000));
- }
- if(area19.contains(getMyPlayer().getLocation()) && distanceTo(door15) < 3 && inventoryContains(food)) {
- findDoor(door15, 's');
- wait(random(10,20));
- }
- if(area20.contains(getMyPlayer().getLocation()) && inventoryContains(food)) {
- findDoor(door16, 'n');
- wait(random(10,20));
- }
- if(area21.contains(getMyPlayer().getLocation()) && inventoryContains(food)) {
- walkTileMMCustom(area22Tile);
- wait(random(2000,3000));
- }
- }
- if(cave6) {
- if(onPath(bankToHole) && inventoryContains(food)) {
- walkPathMMCustom(bankToHole, 13);
- }
- if(onPath(varrockToHole) && inventoryContains(food)) {
- walkPathMMCustom(varrockToHole, 13);
- }
- if(downHole != null && inventoryContains(food)) {
- atObject(downHole, "Climb-down");
- wait(random(300,500));
- }
- if(distanceTo(portal1) < 20 && canReach(portal1, true) && inventoryContains(food)) {
- if(distanceTo(portal1) > 3) {
- walkTileMMCustom(portal1);
- wait(random(500,1000));
- }
- if(distanceTo(portal1) < 4) {
- atTile(portal1, "Use");
- wait(random(200,300));
- }
- }
- if(area6.contains(getMyPlayer().getLocation()) && distanceTo(ladder2Tile) > 2 && inventoryContains(food)) {
- walkTileMMCustom(ladder2Tile);
- wait(random(500,1000));
- }
- if(area6.contains(getMyPlayer().getLocation()) && distanceTo(ladder2Tile) < 3 && inventoryContains(food)) {
- atTile(ladder2Tile, "Climb-down");
- wait(random(2000,3000));
- }
- if(area13.contains(getMyPlayer().getLocation()) && distanceTo(portal2) > 2 && inventoryContains(food)) {
- walkTileMMCustom(portal2);
- wait(random(500,1000));
- }
- if(area13.contains(getMyPlayer().getLocation()) && distanceTo(portal2) < 3 && inventoryContains(food)) {
- atTile(portal2, "Use");
- wait(random(500,1000));
- }
- if(area14.contains(getMyPlayer().getLocation()) && !area23.contains(getMyPlayer().getLocation()) && inventoryContains(food)) {
- walkTileMMCustom(area23Tile);
- wait(random(500,1000));
- }
- if(area23.contains(getMyPlayer().getLocation()) && distanceTo(door17) > 2 && inventoryContains(food)) {
- walkTileMMCustom(door17);
- wait(random(500,1000));
- }
- if(area23.contains(getMyPlayer().getLocation()) && distanceTo(door17) < 3 && inventoryContains(food)) {
- findDoor(door17, 'n');
- wait(random(10,20));
- }
- if(area24.contains(getMyPlayer().getLocation()) && inventoryContains(food)) {
- findDoor(door18, 's');
- wait(random(10,20));
- }
- if(area25.contains(getMyPlayer().getLocation()) && !getMyPlayer().isMoving() &&inventoryContains(food)) {
- walkTileMMCustom(area26Tile);
- wait(random(500,1000));
- }
- if(area26.contains(getMyPlayer().getLocation()) && distanceTo(door19) > 2 && inventoryContains(food)) {
- walkTileMMCustom(door19);
- wait(random(500,1000));
- }
- if(area26.contains(getMyPlayer().getLocation()) && distanceTo(door19) < 3 && inventoryContains(food)) {
- findDoor(door19, 'w');
- wait(random(10,20));
- }
- if(area27.contains(getMyPlayer().getLocation()) && inventoryContains(food)) {
- findDoor(door20, 'e');
- wait(random(10,20));
- }
- }
- }
- public void goBank() {
- RSObject downHole = findObject(hole);
- RSArea area1 = new RSArea(southWest1, northEast1);
- RSArea area2 = new RSArea(southWest2, northEast2);
- RSArea area3 = new RSArea(southWest3, northEast3);
- RSArea area4 = new RSArea(southWest4, northEast4);
- RSArea area5 = new RSArea(southWest5, northEast5);
- RSArea area6 = new RSArea(southWest6, northEast6);
- RSArea area7 = new RSArea(southWest7, northEast7);
- RSArea area8A = new RSArea(southWest8A, northEast8A);
- RSArea area8B = new RSArea(southWest8B, northEast8B);
- RSArea area9 = new RSArea(southWest9, northEast9);
- RSArea area10 = new RSArea(southWest10, northEast10);
- RSArea area11 = new RSArea(southWest11, northEast11);
- RSArea area12 = new RSArea(southWest12, northEast12);
- RSArea area13 = new RSArea(southWest13, northEast13);
- RSArea area14 = new RSArea(southWest14, northEast14);
- RSArea area15 = new RSArea(southWest15, northEast15);
- RSArea area16 = new RSArea(southWest16, northEast16);
- RSArea area17 = new RSArea(southWest17, northEast17);
- RSArea area18 = new RSArea(southWest18, northEast18);
- RSArea area19 = new RSArea(southWest19, northEast19);
- RSArea area20 = new RSArea(southWest20, northEast20);
- RSArea area21 = new RSArea(southWest21, northEast21);
- RSArea area22 = new RSArea(southWest22, northEast22);
- RSArea area23 = new RSArea(southWest23, northEast23);
- RSArea area24 = new RSArea(southWest24, northEast24);
- RSArea area25 = new RSArea(southWest25, northEast25);
- RSArea area26 = new RSArea(southWest26, northEast26);
- RSArea area27 = new RSArea(southWest27, northEast27);
- RSArea area28 = new RSArea(southWest28, northEast28);
- RSArea area29 = new RSArea(southWest29, northEast29);
- if(inventoryContains(fireRune) && inventoryContains(airRune) && inventoryContains(lawRune) && skills.getRealSkillLevel(STAT_MAGIC) > 24 && !onPath(fountainToBank)) {
- teleVarrock();
- }
- if(onPath(fountainToBank)) {
- walkPathMMCustom(fountainToBank, 13);
- }
- else {
- if(cave1) {
- if(area5.contains(getMyPlayer().getLocation()) && distanceTo(DOOR_4) > 2 && !inventoryContains(food)) {
- walkTileMMCustom(DOOR_4);
- wait(random(2000,3000));
- }
- if(area5.contains(getMyPlayer().getLocation()) && distanceTo(DOOR_4) < 3 && !inventoryContains(food)) {
- findDoor(DOOR_4, 'w');
- wait(random(10,20));
- }
- if(area4.contains(getMyPlayer().getLocation()) && !inventoryContains(food)) {
- findDoor(DOOR_3, 'w');
- wait(random(10,20));
- }
- if(area3.contains(getMyPlayer().getLocation()) && distanceTo(DOOR_2) > 2 && !inventoryContains(food)) {
- walkPathMMCustom(door3To2, 13);
- wait(random(2000,3000));
- }
- if(area3.contains(getMyPlayer().getLocation()) && distanceTo(DOOR_2) < 3 && !inventoryContains(food)) {
- findDoor(DOOR_2, 'n');
- wait(random(10,20));
- }
- if(area2.contains(getMyPlayer().getLocation()) && !inventoryContains(food)) {
- findDoor(DOOR_1, 'n');
- wait(random(10,20));
- }
- if(area1.contains(getMyPlayer().getLocation()) && distanceTo(ladder1Tile) > 2 && !inventoryContains(food)) {
- walkTileMMCustom(NEXT_TO_LADDER1);
- wait(random(2000,3000));
- }
- if(area1.contains(getMyPlayer().getLocation()) && distanceTo(ladder1Tile) < 3 && !inventoryContains(food)) {
- atTile(ladder1Tile, "Climb-up");
- wait(random(2000,3000));
- }
- if(onPath(holeToBank) || distanceTo(downHole) < 5 && !inventoryContains(food)) {
- walkPathMMCustom(holeToBank, 13);
- }
- }
- if(cave2) {
- if(area10.contains(getMyPlayer().getLocation()) && distanceTo(door9) < 3 && !inventoryContains(food)) {
- findDoor(door9, 'w');
- wait(random(10,20));
- }
- if(area11.contains(getMyPlayer().getLocation()) && !inventoryContains(food)) {
- findDoor(door10, 'w');
- wait(random(10,20));
- }
- if(area12.contains(getMyPlayer().getLocation()) && !inventoryContains(food)) {
- if(distanceTo(chain1Tile) < 3) {
- atTile(chain1Tile, "Climb-up");
- wait(random(1000,2000));
- }
- else {
- walkTileMMCustom(chain1Tile);
- wait(random(300,500));
- }
- }
- if(area1.contains(getMyPlayer().getLocation()) && distanceTo(ladder1Tile) < 5 && !inventoryContains(food)) {
- atTile(ladder1Tile, "Climb-up");
- wait(random(2000,3000));
- }
- if(onPath(holeToBank) && !inventoryContains(food)) {
- walkPathMMCustom(holeToBank, 13);
- }
- else {
- if (area10.contains(getMyPlayer().getLocation()) && distanceTo(door9) > 2 && !inventoryContains(food)) {
- walkTileMMCustom(door9);
- wait(random(1000,2000));
- }
- }
- }
- if(cave4) {
- if(area17.contains(getMyPlayer().getLocation()) && !inventoryContains(food)) {
- walkTileMMCustom(area16Tile);
- wait(random(500,1000));
- }
- if(area16.contains(getMyPlayer().getLocation()) && distanceTo(door12) > 2 && !inventoryContains(food)) {
- walkTileMMCustom(door12);
- wait(random(500,1000));
- }
- if(area16.contains(getMyPlayer().getLocation()) && distanceTo(door12) < 3 && !inventoryContains(food)) {
- findDoor(door12, 'w');
- wait(random(10,20));
- }
- if(area15.contains(getMyPlayer().getLocation()) && !inventoryContains(food)) {
- findDoor(door11, 'e');
- wait(random(10,20));
- }
- if(area14.contains(getMyPlayer().getLocation()) && distanceTo(chain2Tile) > 2 && !inventoryContains(food)) {
- walkTileMMCustom(chain2Tile);
- wait(random(500,1000));
- }
- if(area14.contains(getMyPlayer().getLocation()) && distanceTo(chain2Tile) < 3 && !inventoryContains(food)) {
- atTile(chain2Tile, "Climb-up");
- wait(random(1000,2000));
- }
- if(area13.contains(getMyPlayer().getLocation()) && distanceTo(ladder3Tile) > 2 && !inventoryContains(food)) {
- walkTileMMCustom(ladder3Tile);
- wait(random(500,1000));
- }
- if(area13.contains(getMyPlayer().getLocation()) && distanceTo(ladder3Tile) < 3 && !inventoryContains(food)) {
- atTile(ladder3Tile, "Climb-up");
- wait(random(1000,2000));
- }
- if(area1.contains(getMyPlayer().getLocation()) && distanceTo(ladder1Tile) > 2 && !inventoryContains(food)) {
- walkTileMMCustom(ladder1Tile);
- wait(random(500,1000));
- }
- if(area1.contains(getMyPlayer().getLocation()) && distanceTo(ladder1Tile) < 3 && !inventoryContains(food)) {
- atTile(ladder1Tile, "Climb-up");
- wait(random(1000,2000));
- }
- if(onPath(holeToBank) && !inventoryContains(food)) {
- walkPathMMCustom(holeToBank, 13);
- }
- }
- if(cave5) {
- if(area22.contains(getMyPlayer().getLocation()) && !inventoryContains(food)) {
- walkTileMMCustom(area21Tile);
- wait(random(500,1000));
- }
- if(area21.contains(getMyPlayer().getLocation()) && distanceTo(door16) > 2 && !inventoryContains(food)) {
- walkTileMMCustom(door16);
- wait(random(500,1000));
- }
- if(area21.contains(getMyPlayer().getLocation()) && distanceTo(door16) < 3 && !inventoryContains(food)) {
- findDoor(door16, 'n');
- wait(random(10,20));
- }
- if(area20.contains(getMyPlayer().getLocation()) && !inventoryContains(food)) {
- findDoor(door15, 's');
- wait(random(10,20));
- }
- if(area19.contains(getMyPlayer().getLocation()) && distanceTo(door14) > 2 && !inventoryContains(food)) {
- walkTileMMCustom(door14);
- wait(random(500,1000));
- }
- if(area19.contains(getMyPlayer().getLocation()) && distanceTo(door14) < 3 && !inventoryContains(food)) {
- findDoor(door14, 'w');
- wait(random(10,20));
- }
- if(area18.contains(getMyPlayer().getLocation()) && !inventoryContains(food)) {
- findDoor(door13, 'e');
- wait(random(10,20));
- }
- if(area14.contains(getMyPlayer().getLocation()) && !area19.contains(getMyPlayer().getLocation()) && !area18.contains(getMyPlayer().getLocation()) && distanceTo(door13) < 2 && !inventoryContains(food)) {
- walkTileMMCustom(area14Tile);
- wait(random(500,1000));
- }
- if(area14.contains(getMyPlayer().getLocation()) && !area19.contains(getMyPlayer().getLocation()) && !area18.contains(getMyPlayer().getLocation()) && distanceTo(chain2Tile) > 2 && !inventoryContains(food)) {
- walkTileMMCustom(chain2Tile);
- wait(random(500,1000));
- }
- if(area14.contains(getMyPlayer().getLocation()) && !area19.contains(getMyPlayer().getLocation()) && !area18.contains(getMyPlayer().getLocation()) && distanceTo(chain2Tile) < 3 && !inventoryContains(food)) {
- atTile(chain2Tile, "Climb-up");
- wait(random(1000,2000));
- }
- if(area13.contains(getMyPlayer().getLocation()) && distanceTo(ladder3Tile) > 2 && !inventoryContains(food)) {
- walkTileMMCustom(ladder3Tile);
- wait(random(500,1000));
- }
- if(area13.contains(getMyPlayer().getLocation()) && distanceTo(ladder3Tile) < 3 && !inventoryContains(food)) {
- atTile(ladder3Tile, "Climb-up");
- wait(random(1000,2000));
- }
- if(area1.contains(getMyPlayer().getLocation()) && distanceTo(ladder1Tile) > 2 && !inventoryContains(food)) {
- walkTileMMCustom(ladder1Tile);
- wait(random(500,1000));
- }
- if(area1.contains(getMyPlayer().getLocation()) && distanceTo(ladder1Tile) < 3 && !inventoryContains(food)) {
- atTile(ladder1Tile, "Climb-up");
- wait(random(1000,2000));
- }
- if(onPath(holeToBank) && !inventoryContains(food)) {
- walkPathMMCustom(holeToBank, 13);
- }
- }
- if(cave6) {
- if((area28.contains(getMyPlayer().getLocation()) || area29.contains(getMyPlayer().getLocation())) && distanceTo(door20) > 2 && !inventoryContains(food)) {
- walkTileMMCustom(door20);
- wait(random(1000,2000));
- }
- if(area28.contains(getMyPlayer().getLocation()) && distanceTo(door20) < 3 && !inventoryContains(food)) {
- findDoor(door20, 'e');
- wait(random(10,20));
- }
- if(area27.contains(getMyPlayer().getLocation()) && !inventoryContains(food)) {
- findDoor(door19, 'w');
- wait(random(10,20));
- }
- if(area26.contains(getMyPlayer().getLocation()) && distanceTo(chain3Tile) > 2 && !getMyPlayer().isMoving() && !inventoryContains(food)) {
- walkTileMMCustom(chain3Tile);
- wait(random(1000,2000));
- }
- if(area26.contains(getMyPlayer().getLocation()) && distanceTo(chain3Tile) < 3 && !inventoryContains(food)) {
- atTile(chain3Tile, "Climb-up");
- wait(random(1000,2000));
- }
- if(area13.contains(getMyPlayer().getLocation()) && distanceTo(ladder3Tile) > 2 && !inventoryContains(food)) {
- walkTileMMCustom(ladder3Tile);
- wait(random(500,1000));
- }
- if(area13.contains(getMyPlayer().getLocation()) && distanceTo(ladder3Tile) < 3 && !inventoryContains(food)) {
- atTile(ladder3Tile, "Climb-up");
- wait(random(1000,2000));
- }
- if(area1.contains(getMyPlayer().getLocation()) && distanceTo(ladder1Tile) > 2 && !inventoryContains(food)) {
- walkTileMMCustom(ladder1Tile);
- wait(random(500,1000));
- }
- if(area1.contains(getMyPlayer().getLocation()) && distanceTo(ladder1Tile) < 3 && !inventoryContains(food)) {
- atTile(ladder1Tile, "Climb-up");
- wait(random(1000,2000));
- }
- if(onPath(holeToBank) && !inventoryContains(food)) {
- walkPathMMCustom(holeToBank, 13);
- }
- }
- }
- }
- public int teleVarrock() {
- openTab(TAB_MAGIC);
- wait(random(200,300));
- clickMouse(597,278,2,2,true);
- return(random(200,300));
- }
- public boolean findDoor(RSTile t, char direction) {
- RSObject theDoor = getObjectAt(t);
- if(theDoor == null)
- return false;
- switch(direction) {
- case 'n':
- return atDoorTiles(theDoor.getLocation(), new RSTile(theDoor.getLocation().getX(), theDoor.getLocation().getY() + 1));
- case 'w':
- return atDoorTiles(theDoor.getLocation(), new RSTile(theDoor.getLocation().getX() - 1, theDoor.getLocation().getY()));
- case 'e':
- return atDoorTiles(theDoor.getLocation(), new RSTile(theDoor.getLocation().getX() + 1, theDoor.getLocation().getY()));
- case 's':
- return atDoorTiles(theDoor.getLocation(), new RSTile(theDoor.getLocation().getX(), theDoor.getLocation().getY() - 1));
- default:
- log("Invalid door direction char");
- }
- return false;
- }
- private long lastTry = 0;
- private int tryCount = 0;
- private RSTile lastDoor = null;
- public boolean atDoorTiles(RSTile a, RSTile b) {
- if(a != lastDoor) {
- lastTry = 0;
- tryCount = 0;
- lastDoor = a;
- }
- tryCount++;
- if(System.currentTimeMillis() - lastTry > random(2000, 4000)) {
- tryCount = 1;
- }
- lastTry = System.currentTimeMillis();
- if(tryCount > 4) {
- if(random(1,2) < random(1,2))
- setCameraRotation(getCameraAngle() + ((random(0, 9) < random(6, 8)) ? (random(-20, 20)) : (random(-360, 360))));
- if(random(1,2) < random(1,2))
- setCameraAltitude(random(0, 100));
- }
- if(tryCount > 100) {
- log("Problems finding door....");
- stopAllScripts();
- }
- else {
- ArrayList<RSTile> theObjs = new ArrayList<RSTile>();
- theObjs.add(a);
- theObjs.add(b);
- try {
- Point[] thePoints = new Point[theObjs.size()];
- for(int c = 0; c < theObjs.size(); c++) {
- thePoints[c] = Calculations.tileToScreen(theObjs.get(c));
- }
- float xTotal = 0;
- float yTotal = 0;
- for(int c = 0; c < thePoints.length; c++) {
- xTotal += thePoints[c].getX();
- yTotal += thePoints[c].getY();
- }
- Point location = new Point((int)(xTotal / (float)thePoints.length), (int)(yTotal / (float)thePoints.length) - random(0, 40));
- if (location.x == -1 || location.y == -1) {
- return false;
- }
- if(Math.sqrt(Math.pow((getMouseLocation().getX() - location.getX()), 2) + Math.pow((getMouseLocation().getY() - location.getY()), 2)) < random(20, 30)) {
- ArrayList<String> commands = getMenuItems();
- for(int c = 0; c < commands.size(); c++) {
- if(commands.get(c).contains("Open")) {
- if(atMenu("Open")) {
- wait(random(1000,2000));
- lastTry = 0;
- tryCount = 0;
- return true;
- }
- }
- }
- }
- moveMouse(location, 7, 7);
- if(atMenu("Open")) {
- wait(random(1000,2000));
- lastTry = 0;
- tryCount = 0;
- return true;
- }
- } catch (final Exception e) {
- return false;
- }
- }
- return false;
- }
- public boolean rightClickTile(final RSTile tile) {
- try {
- final Point location = Calculations.tileToScreen(tile);
- if (location.x == -1 || location.y == -1) {
- return false;
- }
- moveMouse(location, 3, 3);
- clickMouse(false);
- wait(random(50,100));
- return true;
- } catch (final Exception e) {
- return false;
- }
- }
- public boolean atMenuItemCustom(final int i) {
- if (!isMenuOpen()) {
- return false;
- }
- try {
- final RSTile menu = getMenuLocation();
- final int xOff = random(4, getMenuItems().get(i).length() * 4);
- final int yOff = random(24, 28) + (15 * (i - 1));
- moveMouse(menu.getX() + xOff, menu.getY() + yOff, 2, 2);
- if (!isMenuOpen()) {
- return false;
- }
- clickMouse(true);
- return true;
- } catch (final Exception e) {
- e.printStackTrace();
- return false;
- }
- }
- public boolean atNPCCustom(final RSNPC npc, final String action) {
- if (npc == null) {
- return false;
- }
- final RSTile tile = npc.getLocation();
- if (!tile.isValid()) {
- return false;
- }
- if (distanceTo(tile) > 5) {
- walkTileMM(tile);
- }
- return clickRSNPCCustom(npc, action);
- }
- public boolean clickRSNPCCustom(final RSNPC npc, final String action) {
- try {
- int a;
- final String fullCommand = action + " " + npc.getName();
- for (a = 10; a-- >= 0;) {
- final List<String> menuItems = getMenuItems();
- if (menuItems.size() > 1) {
- if (listContainsString(menuItems, fullCommand)) {
- if (menuItems.get(0).contains(fullCommand)) {
- clickMouse(true);
- return true;
- } else {
- return atMenuCustom(fullCommand);
- }
- }
- }
- final Point screenLoc = npc.getScreenLocation();
- if (!pointOnScreen(screenLoc)) {
- return false;
- }
- moveMouse(screenLoc);
- }
- return false;
- } catch (final Exception e) {
- e.printStackTrace();
- return false;
- }
- }
- public boolean atMenuCustom(final String optionContains) {
- int idx = getMenuIndex(optionContains);
- if (!isMenuOpen()) {
- if (idx == -1) {
- return false;
- }
- if (idx == 0) {
- clickMouse(true);
- } else {
- clickMouse(false);
- atMenuItemCustom(idx);
- }
- return true;
- } else {
- if (idx == -1) {
- idx = getMenuIndex("Cancel");
- atMenuItemCustom(idx);
- return false;
- } else {
- atMenuItemCustom(idx);
- return true;
- }
- }
- }
- private boolean listContainsString(final List<String> list, final String string) {
- try {
- for(String command : list) {
- if(command.contains(string)) {
- return true;
- }
- }
- } catch (final Exception e) {
- e.printStackTrace();
- }
- return false;
- }
- public void onRepaint(Graphics g) {
- long millis = System.currentTimeMillis() - startTime;
- long hours = millis / (1000 * 60 * 60);
- millis -= hours * 1000 * 60 * 60;
- long minutes = millis / (1000 * 60);
- millis -= minutes * 1000 * 60;
- long seconds = millis / 1000;
- int XPChangeAttack = skills.getCurrentSkillExp(0) - startXPAttack;
- int LevelChangeAttack = skills.getRealSkillLevel(0) - startLevelAttack;
- int XPChangeDefense = skills.getCurrentSkillExp(1) - startXPDefense;
- int LevelChangeDefense = skills.getRealSkillLevel(1) - startLevelDefense;
- int XPChangeStrength = skills.getCurrentSkillExp(2) - startXPStrength;
- int LevelChangeStrength = skills.getRealSkillLevel(2) - startLevelStrength;
- int XPChangeHP = skills.getCurrentSkillExp(3) - startXPHP;
- int LevelChangeHP = skills.getRealSkillLevel(3) - startLevelHP;
- int XPChangeRange = skills.getCurrentSkillExp(4) - startXPRange;
- int LevelChangeRange = skills.getRealSkillLevel(4) - startLevelRange;
- int x = 330;
- int y = 200;
- if(skills.getCurrentSkillExp(0) > startXPAttack) {
- skill = 0;
- skillName = "Attack";
- xpChange = XPChangeAttack;
- lvlChange = LevelChangeAttack;
- startLevel = startLevelAttack;
- }
- if(skills.getCurrentSkillExp(1) > startXPDefense) {
- skill = 1;
- skillName = "Defense";
- xpChange = XPChangeDefense;
- lvlChange = LevelChangeDefense;
- startLevel = startLevelDefense;
- }
- if(skills.getCurrentSkillExp(2) > startXPStrength) {
- skill = 2;
- skillName = "Strength";
- xpChange = XPChangeStrength;
- lvlChange = LevelChangeStrength;
- startLevel = startLevelStrength;
- }
- if(skills.getCurrentSkillExp(4) > startXPRange) {
- skill = 4;
- skillName = "Range";
- xpChange = XPChangeRange;
- lvlChange = LevelChangeRange;
- startLevel = startLevelRange;
- }
- g.setColor(new Color(0, 0, 0, 175));
- g.fillRoundRect(330, 200, 185, 135, 10, 10);
- g.fillRoundRect(365, 0, 150, 20, 10, 10);
- g.setColor(Color.red);
- g.drawString ("Stronghold Of Security", x + 32,y += 15);
- g.setColor(Color.yellow);
- g.drawString("Run Time: " + hours + " : " + minutes + " : " + seconds, x + 10, y += 22);
- g.drawString(skillName + " level " + skills.getCurrentSkillLevel(skill) + " (Gained " + + lvlChange + " )", x + 10, y += 15);
- g.drawString("Gained: " + skillName + " exp : " + xpChange, x + 10, y += 15);
- g.drawString("% Left To Level " + skillName + ": " + (100 - skills.getPercentToNextLevel(skill)) + "%", x + 10, y += 15);
- g.drawString(skillName + " Exp/hour : " + (int) ((xpChange) * (3600000D / (((double) System.currentTimeMillis() - (double) startTime)))), 368,15);
- g.drawString("Hitpoints lvl: " + skills.getRealSkillLevel(STAT_HITPOINTS), x + 10, y += 15);
- g.drawString("Hp Exp Gained: " + XPChangeHP, x + 10, y += 15);
- g.drawString("% Left To Level HP: " + (100 - skills.getPercentToNextLevel(STAT_HITPOINTS)) + "%", x + 10, y += 15);
- }
- public boolean clickNPC(final RSNPC npc, final String action) {
- try {
- int a;
- final StringBuffer npcCommandBuf = new StringBuffer();
- npcCommandBuf.append(action);
- npcCommandBuf.append(" ");
- npcCommandBuf.append(npc.getName());
- final String npcCommand = npcCommandBuf.toString();
- for (a = 10; a-- >= 0;) {
- if (npc.getInteracting() != null
- && !npc.isInteractingWithLocalPlayer()) {
- return false;
- }
- final List<String> menuItems = getMenuItems();
- if (menuItems.size() > 1) {
- if (listContainsString(menuItems, npcCommand)) {
- if (menuItems.get(0).contains(npcCommand)) {
- clickMouse(true);
- lastAttack = System.currentTimeMillis();
- return true;
- } else {
- // clickMouse(false);
- wait(random(230, 520));
- lastAttack = System.currentTimeMillis();
- return atMenu(npcCommand);
- }
- }
- }
- final Point screenLoc = npc.getScreenLocation();
- if (!pointOnScreen(screenLoc)) {
- walkTileMMCustom(npc.getLocation());
- return false;
- }
- final Point randomP = new Point(random(screenLoc.x - 15,
- screenLoc.x + 15), random(screenLoc.y - 15,
- screenLoc.y + 15));
- if (randomP.x >= 0 && randomP.y >= 0) {
- moveMouse(randomP);
- }
- }
- return false;
- } catch (final Exception e) {
- return false;
- }
- }
- public boolean atInventoryItemCustom(final int itemID, final String option) {
- if (getCurrentTab() != Constants.TAB_INVENTORY
- && !RSInterface.getInterface(Constants.INTERFACE_BANK)
- .isValid()
- && !RSInterface.getInterface(Constants.INTERFACE_STORE)
- .isValid()) {
- openTab(Constants.TAB_INVENTORY);
- }
- final int[] items = getInventoryArray();
- final java.util.List<Integer> possible = new ArrayList<Integer>();
- for (int i = 0; i < items.length; i++) {
- if (items[i] == itemID) {
- possible.add(i);
- }
- }
- final int idx = possible.get(random(0, possible.size()));
- final Point t = getInventoryItemPoint(idx);
- moveMouse(t, 5, 5);
- return atMenu(option);
- }
- @Override
- public void onFinish() {
- Bot.getEventManager().removeListener(PaintListener.class, this);
- }
- public boolean walkPathMMCustom(final RSTile[] path, final int maxDist) {
- try {
- final RSTile next = nextTile(path, maxDist);
- if (next != null) {
- walkTileMMCustom(next);
- current = next;
- wait(random(1000,2000));
- return false;
- } else if (next != null && next.equals(current)) {
- return false;
- }
- } catch (final Exception e) {
- return false;
- }
- return true;
- }
- private static RSTile current = new RSTile(0, 0);
- private boolean isUnderAttack() {
- final NPC[] NPCS = Bot.getClient().getNPCArray();
- final RSPlayer PLAYER = getMyPlayer();
- RSNPC npc;
- for (final int i : Bot.getClient().getNPCIndexArray()) {
- if (NPCS[i] != null) {
- npc = new RSNPC(NPCS[i]);
- if(npc.getInteracting() != null && PLAYER.equals(npc.getInteracting()) && (npc.getHPPercent() > 0)) {
- return true;
- }
- }
- }
- return false;
- }
- }