// My Script:
// [PHP]
/* SAVE AS MultiKFisher.java in notepad.
*
* Feature:
* Up to 1k lines of code
* Built in Antiban
* Avoids whirlpools
* Checks if you need more money
* Powers or banks
* Drops Tuna if you choose Swordfish
* Faster at* methods
* Waiting for new walkpathmm methods
* Should I add deathwalk?
*/
import java.util.List;
import java.awt.Color;
import java.awt.Graphics;
import java.util.Map;
import java.awt.*;
import java.awt.Point;
import java.awt.event.KeyEvent;
import java.util.ArrayList;
import java.util.*;
import java.lang.String.*;
import java.lang.String;
import com.speljohan.rsbot.accessors.Player;
import com.speljohan.rsbot.bot.Bot;
import com.speljohan.rsbot.event.events.ServerMessageEvent;
import com.speljohan.rsbot.event.listeners.PaintListener;
import com.speljohan.rsbot.event.listeners.ServerMessageListener;
import com.speljohan.rsbot.script.Script;
import com.speljohan.rsbot.script.wrappers.RSInterface;
import com.speljohan.rsbot.script.wrappers.RSItemTile;
import com.speljohan.rsbot.script.wrappers.RSNPC;
import com.speljohan.rsbot.script.wrappers.RSObject;
import com.speljohan.rsbot.script.wrappers.RSPlayer;
import com.speljohan.rsbot.script.wrappers.RSTile;
import com.speljohan.rsbot.script.*;
import com.speljohan.rsbot.script.wrappers.*;
import com.speljohan.rsbot.script.Random;
import com.speljohan.rsbot.script.wrappers.RSPlayer;
import com.speljohan.rsbot.script.*;
import com.speljohan.rsbot.bot.*;
import com.speljohan.rsbot.script.wrappers.*;
import com.speljohan.rsbot.event.listeners.*;
import com.speljohan.rsbot.event.events.*;
import com.speljohan.rsbot.script.MouseHandler;
public class MultiKFisher extends Script implements PaintListener{
public int currenttab;
public int GambleInt;
public int checkTime, checkTime1 = random(240000, 480000);
public int speed = 50;
public long lastCheck = -1, lastcheck1 = -1, lastCheck2,
lastCheck3 = System.currentTimeMillis();
// Above is values for tahayassen and WARXPERIMENT's antiban
public int tunaBanked = 0;
public int swordfishBanked = 0;
int tunaCount = 0;
int swordfishCount = 0;
public Point mousePos;
public String select; // string if drop down box
public int numberOfCatches;
public int lastExp;
public boolean dbank; // bolean if checkbox
private long startTime;
public int whirlpoolsAvoided;
int fails;
int sfails;
int fishing = Skills.getStatIndex("fishing");
int startxp = skills.getCurrentSkillExp(fishing);
int sfishlvl = skills.getCurrentSkillLevel(fishing);
int state = 0;
int trolla = 391;
int trollb = 392;
int trollc = 393;
int trolld = 394;
int trolle = 395;
int trollf = 396;
int bigfisha = 18482;
public int[] whirlpools = new int[] {
403, 404, 406, 406
};
RSTile[] bankToShipTile = { new RSTile(3093, 3243) ,
new RSTile(3081, 3242), // An array with give a special
new RSTile(3071, 3251), // value for rsbot called tiles.
new RSTile(3060, 3253), // Tiles are x, y coordinates that usually
new RSTile(3049, 3245), // create a path to walk.
new RSTile(3037, 3235),
new RSTile(3029, 3232),
new RSTile(3028, 3220)
};
RSTile[] KaramjaTile = {
new RSTile(2956, 3146),
new RSTile(2953, 3147),
new RSTile(2942, 3145),
new RSTile(2933, 3148),
new RSTile(2926, 3151),
new RSTile(2918, 3159),
new RSTile(2924, 3172),
new RSTile(2924, 3179)
};
RSTile[] shipToBankTiles = {
new RSTile(3028, 3232),
new RSTile(3041, 3240),
new RSTile(3053, 3248),
new RSTile(3067, 3250),
new RSTile(3080, 3241),
new RSTile(3093, 3243)
};
RSTile[] spotToShipTile = reversePath(KaramjaTile);
RSTile planker = new RSTile (3032, 3217);
RSTile sbank = new RSTile (3093, 3243);
RSTile Karamja = new RSTile (2956, 3146);
RSTile port = new RSTile(3028, 3220);
RSTile spot = new RSTile(2924, 3179);
public final RSTilePath shipToBank = new RSTilePath(shipToBankTiles, this);
public final RSTilePath KaramjaPath = new RSTilePath(KaramjaTile, this);
public final RSTilePath spotToShip = new RSTilePath(spotToShipTile, this);
public final RSTilePath bankToShip = new RSTilePath(bankToShipTile, this);
public void antiBan() {
switch (GambleInt = random(1, 20)) {
case 1: // Camera Rotation\
turnCamera();
wait(random(300, 500));
case 2: // Move mouse & come back to original mouse location &
// Camera Rotation
int xA = random(0, 750);
int yA = random(0, 500);
mousePos = getMouseLocation();
moveMouse(xA, yA);
wait(random(300, 500));
moveMouse(mousePos, 7, 7);
wait(random(100, 200));
turnCamera();
wait(random(300, 500));
case 3: // Inventory Tab Selection & Camera Rotation
if (getCurrentTab() != TAB_INVENTORY) {
currenttab = getCurrentTab();
openTab(TAB_INVENTORY);
wait(random(300, 500));
turnCamera();
wait(random(300, 500));
}
case 4: // Player right click
mousePos = getMouseLocation();
RSPlayer p = getNearestPlayerByLevel(1, 130);
if (p != null && p.isValid()) {
moveMouse(p.getScreenLocation(), 5, 5);
wait(random(300, 500));
clickMouse(false);
wait(random(1000, 1500));
moveMouse(mousePos, 7, 7);
wait(random(100, 200));
}
case 5: // Camera Rotation & Move mouse & come back to original
// mouse location
turnCamera();
wait(random(300, 500));
int xB = random(0, 750);
int yB = random(0, 500);
mousePos = getMouseLocation();
moveMouse(xB, yB);
wait(random(300, 500));
moveMouse(mousePos, 7, 7);
wait(random(100, 200));
case 6: // Camera Rotation
turnCamera();
wait(random(300, 500));
case 7: // Open different tab and go back to original tab
mousePos = getMouseLocation();
currenttab = getCurrentTab();
openTab(random(0, 13));
wait(random(300, 500));
openTab(currenttab);
wait(random(300, 500));
moveMouse(mousePos, 7, 7);
wait(random(100, 200));
case 8: // Move mouse && come back to original mouse location
mousePos = getMouseLocation();
moveMouse(random(0, 450), random(0, 450));
wait(random(300, 500));
moveMouse(mousePos, 7, 7);
wait(random(100, 200));
}
if ((System.currentTimeMillis() - lastCheck2) >= checkTime) {
lastCheck2 = System.currentTimeMillis();
checkTime = random(300000, 600000);
turnCamera();
wait(random(300, 500));
mousePos = getMouseLocation();
currenttab = getCurrentTab();
openTab(random(0, 13));
wait(random(300, 500));
turnCamera();
wait(random(300, 500));
openTab(currenttab);
wait(random(300, 500));
moveMouse(mousePos, 7, 7);
wait(random(100, 200));
}
}
public boolean activateCondition() {
return random(1, speed) == 1;
}
public String getName(){
return "MultiKFisher"; // Determines name of script with .java added.
}
public String getAuthor(){
return "Smashton227";
}
public String getScriptCategory(){
return "Fishing"; // This is the folder it will be in.
}
public String getScriptDescription() { // Add this for a description, or options.
String html = "";
html += "\n"; // Starts html
html += "
\n"; // Starts body of html
html += "
";
html += "MultiKFisher" + getVersion();
html += "
Choose Fish: "; // in html is a space between lines.
html += "";
html += "\n"; // ends body of html
html += " lastExp) {
lastExp = skills.getCurrentSkillExp(STAT_FISHING);
numberOfCatches++;
}
int htword = htuna + hsword;
g.drawString("Experience earned: " +
(skills.getCurrentSkillExp(fishing) - startxp), 18, 326);
g.drawString("Runtime: " + hours + ":" + minutes + ":" +
seconds + " and counting", 18, 278);
if (select.equals("Swordies")){
g.drawString("Swordfish Cought: " +Integer.toString(sword),
18, 302);
g.drawString(Integer.toString(sxp) + " swordfish left", 18, 206);
}
if (select.equals("Lobsters")){
g.drawString("Lobsters Cought: " +Integer.toString(lobbys),
18, 302);
g.drawString(Integer.toString(cxp) + " lobsters left", 18, 206);
}
if (select.equals("Tuna/Swordies")){
g.drawString("Fish Cought: " + numberOfCatches,
18, 302);
g.drawString(Integer.toString(sxp) + " swordfish or " +
Integer.toString(txp) +
" tuna left", 18, 206);
}
g.drawString("Levels Gained: " +
(skills.getCurrentSkillLevel(fishing) - sfishlvl), 18, 254);
g.drawString(Integer.toString(pcl) + "% Done", 18, 230);
g.setColor(Color.RED);
g.drawString("Created by SmashTon227", 355, 326);
g.setColor(new Color(0, 0, 0, 50)); // black
g.fill3DRect(12, 180, 190, 160, true);
}
public void camera() {
setCameraRotation(0);
setCameraAltitude(true);
if (!isRunning() && getEnergy() > 50){ // ! means false.
// Checks if not running.
setRun(true); // Clicks run icon.
log("Running has been enabled.");
}
}
public void fpayfare() {
wait(1500); // waits 1500
clickMouse(269, 456, true);// Clicks mouse to continue
wait(2000);
clickMouse(259, 404, true);
wait(1500);
clickMouse(217, 455, true);
wait(10000);
setCameraRotation(0);
clickMouse(269, 456, true);
wait(5000);
clickMouse(252, 140, true);
RSObject plAnK = getNearestObjectByID(2082);
atObject(plAnK, "Cross Gangplank");
atObject(plAnK, "Cross");
log("Arrived at Karamja!");
clickMouse(263, 138, true);
camera();
}
public void spayfare() {
wait(2000);
atInterface(241, 5);
wait(2000);
atInterface(228, 2);
wait(2000);
atInterface(64, 5);
wait(2000);
atInterface(241, 5);
wait(2000);
atInterface(230, 3);
wait(2000);
atInterface(64, 5);
wait(2000);
atInterface(242, 6);
wait(2000);
atInterface(228, 2);
wait(2000);
atInterface(64, 5);
wait(10000);
atInterface(210, 2);
camera();
RSObject splank = getNearestObjectByID(242);
camera();
clickMouse(224, 180, true);
wait(100);
atObject(splank, "Cross Gangplank");
atObject(splank, "Cross");
log("Arrived at Port Sarim!");
wait(3000);
}
public void payloop() {
RSNPC seaman = getNearestFreeNPCByID(377);
log("Please wait...");
wait(1500);
atNPC(seaman, "Pay-fare");
atNPC(seaman, "Pay-fare Seaman Lorris");
fails++;
if (RSInterface.getInterface(513).getChild(2).getText( ).contains
("The trip to Karamja will cost you 30 coins.")
|| fails >= 4) {
fpayfare();
}
else{
payloop();
}
}public void spayloop() {
RSNPC seaman = getNearestFreeNPCByID(377);
log("Please wait...");
RSNPC officer = getNearestNPCByID(380);
wait(1500);
atNPC(officer, "Pay-Fare");
sfails++;
if (RSInterface.getInterface(241).getChild(4).getText( ).contains
("Can I help you?")
|| fails >= 4) {
spayfare();
}
else {
spayloop();
}
}
public boolean atPort(){
if (distanceTo(port) < 10 && !getMyPlayer().isMoving()){
return true;
}
else {
return false;
}
}
public boolean hasTools() {
if(getInventoryCount(995) >= 120){
return true;
}
if(select.equals("Lobsters") && getInventoryCount(301) >= 1) {
return true;
}
if(select.equals("Tuna/Swordies") && getInventoryCount(311) >= 1){
return true;
}
if(select.equals("Swordies") && getInventoryCount(311) >= 1){
return true;
}
log("Please have your tools ready next time!");
return false;
}
public boolean atBank() {
if (distanceTo(sbank) < 10 && !getMyPlayer().isMoving()){
return true;
}
return false;
}
public void fishloop() {
if (isInventoryFull() == false && getMyPlayer().getAnimation() == -1){
RSNPC fishingspot = getNearestNPCByID(324);
setCameraRotation(180);
if (select.equals("Lobsters")){
atNPC (fishingspot, "cage");
}
else{
atNPC (fishingspot, "harpoon");
}
}
else {
fishloop();
}
}
@Override
protected int getMouseSpeed() {
return 5;
}
public boolean onStart(Map args) {
startTime = System.currentTimeMillis();
select = args.get("select"); // locationName.equals("Barbarian Village")
dbank = args.get("dbank") != null ? true : false;
Bot.getEventManager().addListener(PaintListener.class, this);
return true;
}
public void onFinish(){
Bot.getEventManager().removeListener(PaintListener.class, this);
log("Time to shutdown, error, stopped script, or looped 10k times!");
return;
}
public int loop() {
int pX = getMyPlayer().getLocation().getX();
int pY = getMyPlayer().getLocation().getY();
if (getMyPlayer().getAnimation() != -1 &&
!checkAndAvoidWhirlpools() || getMyPlayer().isMoving()){
antiBan();
}
camera();
if (pX > 3028 && pY > 3223 && !isInventoryFull()){
state = 1;
}
if (atPort() && !isInventoryFull()){
state = 2;
}
if (pX < 2959 && !isInventoryFull()){
state = 3;
}
if (distanceTo(spot) < 7 && !isInventoryFull()){
if(dbank){
state = 4;
}
if(!dbank){
state = 9;
}
}
if (pX < 2959 && isInventoryFull()){
state = 5;
}
if (isInventoryFull() && distanceTo(Karamja) < 5){
state = 6;
}
if (pX > 3000 && pX < 3086 && isInventoryFull()){
state = 7;
}
if(isInventoryFull() && distanceTo(sbank) < 5){
state = 8;
}
if(ntool()){
if(distanceTo(sbank) < 5){
state = 777;
}
if (atPort()){
state = 7;
}
}
switch (state){
case 1: one(); break;
case 2: two(); break;
case 3: three(); break;
case 4: four(); break;
case 5: five(); break;
case 6: six(); break;
case 7: seven(); break;
case 8: eight(); break;
case 9: power(); break;
case 777: nmoney(); break;
}
return 10000;
}
public void power() {
if(hasTools()){
if(!isInventoryFull()){
log("Attempting to fish");
RSNPC fishingspot = getNearestNPCByID(324);
int ani = getMyPlayer().getAnimation();
if (ani == 619 || ani == 618){
log("Fishing...");
}
else{
fishloop();
}
}
else {
dropInventoryExcluding(true, 995, 301, 311);
}
}
}
public boolean ntool() {
if(getInventoryCount(995) < 61){
return true;
}
if (select.equals("Lobsters") && getInventoryCount(301) < 1){
return true;
}
if(select.equals("Tuna/Swordies") && getInventoryCount(311) < 1){
return true;
}
if(select.equals("Swordies") && getInventoryCount(311) < 1){
return true;
}
return false;
}
public void nmoney(){
RSObject booth = findObject(2213);
atObject(booth, "Use-quickly");
wait(1500);
if(!bank.isOpen()){
atObject(booth, "Use-quickly");
}
else {
bank.depositAllExcept(995, 301, 311);
if(select.equals("Lobsters") && getInventoryCount(301) < 1) {
atBankItem(301, "Withdraw-1");
}
if(select.equals("Tuna/Swordies") && getInventoryCount(311) < 1){
atBankItem(311, "Withdraw-1");
}
if(select.equals("Swordies") && getInventoryCount(311) < 1){
atBankItem(311, "Withdraw-1");
}
if(getInventoryCount(995) < 61){
atBankItem(995, "Withdraw-X");
wait(1500);
sendText("600", true);
}
wait(1500);
bank.close();
}
}
public void ten() {
clickMouse(224, 180, true);
}
public void one() {
log("walking...");
walkPathMM(bankToShipTile, 15);
}
public void two() {
setCameraRotation(352);
camera();
wait(1500);
RSNPC seaman = getNearestNPCByID(377);
atNPC(seaman, "Pay-fare");
atNPC(seaman, "Pay-fare Seaman Lorris");
if (RSInterface.getInterface(513).getChild(2).getText( ).contains
("The trip to Karamja will cost you 30 coins.")) {
fpayfare();
}
else {
payloop();
}
}
public void three() {
log("walking...");
walkPathMM(KaramjaTile, 15);
}
public void four() {
log("Attempting to fish");
RSNPC fishingspot = getNearestNPCByID(324);
int ani = getMyPlayer().getAnimation();
if (ani == 619 || ani == 618){
log("Fishing...");
}
else{
fishloop();
}
}
public void five() {
if(select.equals("Swordies")){
dropInventoryExcluding(true, 371, 377, 995, 301, 311);
}
log("Inventory full. Walking...");
walkPathMM(spotToShipTile, 15);
}
public void six() {
wait(1500);
RSNPC officer = getNearestNPCByID(380);
atNPC(officer, "Pay-Fare");
if (RSInterface.getInterface(241).getChild(4).getText( ).contains
("Can I help you?")) {
spayfare(); }
else {
spayloop();
}
}
public void seven() {
try{
shipToBank.walkToEnd();
log("walking to the bank...");
}
catch(Exception e){
log("Erawr");
}
}
public void eight() {
RSObject booth = findObject(2213);
atObject(booth, "Use-quickly");
wait(1500);
if(!bank.isOpen()){
atObject(booth, "Use-quickly");
}
else {
bank.depositAllExcept(995, 301, 311);
if(getInventoryCount(995) < 61){
atBankItem(995, "Withdraw-X");
wait(1500);
sendText("600", true);
}
bank.close();
}
}
public void turnCamera() {
char[] LR = new char[] { KeyEvent.VK_LEFT, KeyEvent.VK_RIGHT };
char[] UD = new char[] { KeyEvent.VK_DOWN, KeyEvent.VK_UP };
char[] LRUD = new char[] { KeyEvent.VK_LEFT, KeyEvent.VK_RIGHT,
KeyEvent.VK_UP, KeyEvent.VK_UP };
int random2 = random(0, 2);
int random1 = random(0, 2);
int random4 = random(0, 4);
if (random(0, 3) == 0) {
Bot.getInputManager().pressKey(LR[random1]);
try {
Thread.sleep(random(100, 400));
} catch (Exception e) {
}
Bot.getInputManager().pressKey(UD[random2]);
try {
Thread.sleep(random(300, 600));
} catch (Exception e) {
}
Bot.getInputManager().releaseKey(UD[random2]);
try {
Thread.sleep(random(100, 400));
} catch (Exception e) {
}
Bot.getInputManager().releaseKey(LR[random1]);
} else {
Bot.getInputManager().pressKey(LRUD[random4]);
if (random4 > 1) {
try {
Thread.sleep(random(300, 600));
} catch (Exception e) {
}
} else {
try {
Thread.sleep(random(500, 900));
} catch (Exception e) {
}
}
Bot.getInputManager().releaseKey(LRUD[random4]);
}
}
public void dropItem(int col, int row){
if (getCurrentTab() != TAB_INVENTORY
&& !RSInterface.getInterface(INTERFACE_BANK).isValid()
&& !RSInterface.getInterface(INTERFACE_STORE).isValid())
openTab(TAB_INVENTORY);
if(col<0||col>3||row<0||row>6)
return;
if(getInventoryArray()[col+row*4] == -1)
return;
clickMouse(563+col*42+random(0,32), 213+row*36+random(0,32),false);
wait(random(100,250));
atMenu("drop");
wait(random(100,250));
}
public void dropRectangle(int col, int row, int width, int height,
boolean leftToRight){
if(!leftToRight)
for(int c = col; c < col+width; c++)
for(int r = row; r < row+height; r++)
dropItem(c, r);
else
for(int r = row; r < row+height; r++)
for(int c = col; c < col+width; c++)
dropItem(c, r);
}
public void dropInventoryExcluding(boolean leftToRight, int ... ids){
if(!leftToRight)
for(int c = 0; c < 4; c++)
for(int r = 0; r < 7; r++){
boolean found = false;
for(int i = 0; i < ids.length && !found; i++)
found = ids[i] == getInventoryArray()[c+r*4];
if(!found)
dropItem(c, r);
}
else
for(int r = 0; r < 7; r++)
for(int c = 0; c < 4; c++){
boolean found = false;
for(int i = 0; i < ids.length && !found; i++)
found = ids[i] == getInventoryArray()[c+r*4];
if(!found)
dropItem(c, r);
}
}
public void dropInventory(boolean leftToRight){
dropRectangle(0, 0, 4, 7, leftToRight);
}
public int getMenuIndexExact(String optionContains) {
optionContains = optionContains.toLowerCase();
final java.util.List actions = getMenuItems();
for (int i = 0; i < actions.size(); i++) {
final String action = actions.get(i);
if (action.toLowerCase().equals(optionContains)) {
return i;
}
}
return -1;
}
public boolean atMenuExact(final String optionContains) {
int idx = getMenuIndexExact(optionContains);
// log.info((optionContains + " " + idx + " " + getMenuItems());
if (!isMenuOpen()) {
if (idx == -1) {
return false;
}
if (idx == 0) {
clickMouse(true);
} else {
clickMouse(false);
atMenuItem(idx);
}
return true;
} else {
if (idx == -1) {
idx = getMenuIndex("Cancel");
atMenuItem(idx);
return false;
} else {
atMenuItem(idx);
return true;
}
}
}
private boolean arrayHas(final String[] items, String searchString) {
searchString = searchString.toLowerCase();
for (final String s : items) {
if (s.toLowerCase().equals(searchString)) {
return true;
}
}
return false;
}
public boolean atTileExact(RSTile tile, String option){
Point p = Calculations.tileToScreen(tile);
p.x += random(-5, 6);
p.y += random(-5, 6);
if(p.x < 0 || p.y < 0)
return false;
moveMouse(p);
//wait(random(100,150));
getMenuItems();
List itemsList = getMenuItems();
long waitTime = System.currentTimeMillis() + random(50,250);
boolean found = false;
while(System.currentTimeMillis() < waitTime && !found){
wait(15);
found = (itemsList = getMenuItems()).get(0).toLowerCase().equals(option.toLowerCase());
}
if(found){
clickMouse(true);
wait(random(150, 300));
return true;
}
clickMouse(false);
wait(random(150, 300));
return atMenuExact(option);
}
public boolean atTile(RSTile tile, String option){
Point p = Calculations.tileToScreen(tile);
p.x += random(-5, 6);
p.y += random(-5, 6);
if(p.x < 0 || p.y < 0)
return false;
moveMouse(p);
//wait(random(100,150));
getMenuItems();
List itemsList = getMenuItems();
long waitTime = System.currentTimeMillis() + random(50,250);
boolean found = false;
while(System.currentTimeMillis() < waitTime && !found){
wait(15);
found = (itemsList = getMenuItems()).get(0).toLowerCase().contains(option.toLowerCase());
}
if(found){
clickMouse(true);
wait(random(150, 300));
return true;
}
clickMouse(false);
wait(random(150, 300));
return atMenu(option);
}
public boolean atInventoryItem(int itemID, String option) {
if (getCurrentTab() != TAB_INVENTORY
&& !RSInterface.getInterface(INTERFACE_BANK).isValid()
&& !RSInterface.getInterface(INTERFACE_STORE).isValid()) {
openTab(TAB_INVENTORY);
}
int[] items = getInventoryArray();
java.util.List possible = new ArrayList();
for (int i = 0; i < items.length; i++) {
if (items[i] == itemID) {
possible.add(i);
}
}
if (possible.size() == 0) return false;
int idx = possible.get(random(0, possible.size()));
Point t = getInventoryItemPoint(idx);
moveMouse(t, 5, 5);
getMenuItems();
List itemsList = getMenuItems();
long waitTime = System.currentTimeMillis() + random(50,250);
boolean found = false;
while(!found && System.currentTimeMillis() < waitTime){
wait(15);
if((itemsList = getMenuItems()).get(0).toLowerCase().contains(option.toLowerCase()))
found = true;
}
if(found){
clickMouse(true);
wait(random(150, 250));
return true;
}
clickMouse(false);
wait(random(150, 250));
return atMenu(option);
}
public int bankCount(int itemID){
final int[] itemArray = bank.getItemArray();
int count = 0;
for (int off = 0; off < itemArray.length; off++)
if(itemArray[off] == itemID)
count++;
return count;
}
public boolean atBankItem(final int itemID, final String txt) {
if (!isLoggedIn() || !bank.isOpen()) {
return false;
}
final int[] itemArray = bank.getItemArray();
for (int off = 0; off < itemArray.length; off++) {
if (itemArray[off] == itemID) {
moveMouse(bank.getItemPoint(off), 5, 5);
List itemsList = getMenuItems();
long waitTime = System.currentTimeMillis() + random(50,250);
boolean found = false;
while(!found && System.currentTimeMillis() < waitTime){
wait(15);
if((itemsList = getMenuItems()).get(0).toLowerCase().contains(txt.toLowerCase()))
found = true;
}
if(found){
clickMouse(true);
wait(random(150, 250));
return true;
}
clickMouse(false);
wait(random(150, 250));
return atMenu(txt);
}
}
return false;
}
public boolean checkAndAvoidWhirlpools( ) {
RSTile playerLocation = getMyPlayer( ).getLocation( );
RSTile tileToTest1 = new RSTile(playerLocation.getX() + 1, playerLocation.getY());
RSTile tileToTest2 = new RSTile(playerLocation.getX() - 1, playerLocation.getY());
RSTile tileToTest3 = new RSTile(playerLocation.getX(), playerLocation.getY() + 1);
RSTile tileToTest4 = new RSTile(playerLocation.getX(), playerLocation.getY() - 1);
for ( int id : whirlpools ) {
RSNPC whirlpool = getNearestNPCByID( id );
if ( whirlpool == null ) continue;
if ( whirlpool.getLocation( ).equals(tileToTest1) || whirlpool.getLocation( ).equals(tileToTest2) ||
whirlpool.getLocation( ).equals(tileToTest3) || whirlpool.getLocation( ).equals(tileToTest4) ) {
whirlpoolsAvoided++;
log("Found whirlpool");
return true;
}
}
return false;
}
}
// [/PHP]