kirbymario123
Active Member
- Joined
- Feb 8, 2009
- Sythe Gold
- 0
- Messages
- 114
how the hell do you get the scripts from media fire. i put it in my files but i cant do anything with it
import java.awt.*;
import java.awt.event.*;
import java.text.*;
import java.util.*;
import java.lang.Thread;
import javax.swing.*;
import com.speljohan.rsbot.script.*;
import com.speljohan.rsbot.script.wrappers.*;
import com.speljohan.rsbot.event.events.ServerMessageEvent;
import com.speljohan.rsbot.event.listeners.*;
import com.speljohan.rsbot.accessors.Player;
import com.speljohan.rsbot.bot.Bot;
public class AzWFletcher extends Script implements PaintListener, ServerMessageListener {
public int logID = 0;
public int bowID = 0;
public int knifeID = 946;
public int xPos = 0;
public int yPos = 0;
public int fletched = 0;
public int requiredLevel = 0;
public int numbOfLogs = 0;
public int numbOfBows = 0;
public int numbOfStrings = 0;
public int done = 0; // for animation purposes
public int currentLevel = skills.getCurrentSkillLevel(9);
public int currentEXP = skills.getCurrentSkillExp(9);
public long currentTime = System.currentTimeMillis();
public String bowName = "";
public String logName = "";
public int interfaceID = 304;
public boolean withdrawing = false;
public boolean onStart = true;
public boolean usingPC = false;
public boolean stringing = false;
public boolean onStart(Map<String, String> args) {
Bot.getEventManager().addListener(PaintListener.class, this);
logName = args.get("log");
bowName = args.get("fletch");
if (args.get("string") != null) {
stringing = true;
}
// i'll just add the stringing and break the loop..
// cbb touching the original code
if (stringing) {
knifeID = 1777; // using that var for strings
xPos = 255;
yPos = 415;
interfaceID = 309;
if (logName.contains("Normal")) {
if (bowName.contains("Longbow")) {
logID = 48;
requiredLevel = 10;
}
else if (bowName.contains("Shortbow")) {
logID = 50;
requiredLevel = 5;
}
else {
log("The combination you chose does not exist.");
log("You chose: " + logName + " and: " + bowName + ".");
stopAllScripts();
}
}
else if (logName.contains("Oak")) {
if (bowName.contains("Longbow")) {
logID = 56;
requiredLevel = 25;
}
else if (bowName.contains("Shortbow")) {
logID = 54;
requiredLevel = 20;
}
else {
log("The combination you chose does not exist.");
log("You chose: " + logName + " and: " + bowName + ".");
stopAllScripts();
}
}
else if (logName.contains("Willow")) {
if (bowName.contains("Longbow")) {
logID = 58;
requiredLevel = 40;
}
else if (bowName.contains("Shortbow")) {
logID = 60;
requiredLevel = 35;
}
else {
log("The combination you chose does not exist.");
log("You chose: " + logName + " and: " + bowName + ".");
stopAllScripts();
}
}
else if (logName.contains("Maple")) {
if (bowName.contains("Longbow")) {
logID = 62;
requiredLevel = 55;
}
else if (bowName.contains("Shortbow")) {
logID = 64;
requiredLevel = 50;
}
else {
log("The combination you chose does not exist.");
log("You chose: " + logName + " and: " + bowName + ".");
stopAllScripts();
}
}
else if (logName.contains("Yew")) {
if (bowName.contains("Longbow")) {
logID = 66;
requiredLevel = 70;
}
else if (bowName.contains("Shortbow")) {
logID = 68;
requiredLevel = 65;
}
else {
log("The combination you chose does not exist.");
log("You chose: " + logName + " and: " + bowName + ".");
stopAllScripts();
}
}
else if (logName.contains("Magic")) {
if (bowName.contains("Longbow")) {
logID = 70;
requiredLevel = 85;
}
else if (bowName.contains("Shortbow")) {
logID = 72;
requiredLevel = 80;
}
else {
log("The combination you chose does not exist.");
log("You chose: " + logName + " and: " + bowName + ".");
stopAllScripts();
}
}
}
else {
if (logName.contains("Normal")) {
logID = 1511;
interfaceID = 305;
if (bowName.contains("Short")) {
bowID = 50;
xPos = 200;
yPos = 390;
requiredLevel = 5;
}
else if (bowName.contains("Long")) {
bowID = 48;
xPos = 320;
yPos = 390;
requiredLevel = 10;
}
else if (bowName.contains("Shaft")) {
bowID = 52;
xPos = 80;
yPos = 390;
requiredLevel = 1;
}
else {
bowID = 1;
xPos = 415;
yPos = 390;
requiredLevel = 9;
}
}
else {
if (bowName.contains("Short")) {
xPos = 115;
yPos = 390;
}
else if (bowName.contains("Long")) {
xPos = 260;
yPos = 390;
}
else {
log("The combination you chose does not exist.");
log("You chose: " + logName + " and: " + bowName + ".");
stopAllScripts();
}
if (logName.contains("Oak")) {
logID = 1521;
if (bowName.contains("Short")) {
bowID = 54;
requiredLevel = 20;
}
else if (bowName.contains("Long")) {
bowID = 56;
requiredLevel = 25;
}
}
else if (logName.contains("Willow")) {
logID = 1519;
if (bowName.contains("Short")) {
bowID = 60;
requiredLevel = 35;
}
else if (bowName.contains("Long")) {
bowID = 58;
requiredLevel = 40;
}
}
else if (logName.contains("Maple")) {
logID = 1517;
if (bowName.contains("Short")) {
bowID = 64;
requiredLevel = 50;
}
else if (bowName.contains("Long")) {
bowID = 62;
requiredLevel = 55;
}
}
else if (logName.contains("Yew")) {
logID = 1515;
if (bowName.contains("Short")) {
bowID = 68;
requiredLevel = 65;
}
else if (bowName.contains("Long")) {
bowID = 66;
requiredLevel = 70;
}
}
else if (logName.contains("Magic")) {
logID = 1513;
if (bowName.contains("Short")) {
bowID = 72;
requiredLevel = 80;
}
else if (bowName.contains("Long")) {
bowID = 70;
requiredLevel = 85;
}
}
}
}
log("You chose: " + logName + " and: " + bowName + ".");
if (stringing) {
log("and we are going to be stringing these.");
}
return true;
}
public int loop() {
if (!isLoggedIn()) {
return random(300, 500);
}
if (isLoggedIn() && onStart) {
onStart = false;
while (currentLevel == 0 && currentEXP == 0) {
currentLevel = skills.getCurrentSkillLevel(9);
currentEXP = skills.getCurrentSkillExp(9);
}
openBank(); // now needed to do count
wait(500);
if (stringing) {
doDepositExcept();
}
else {
doDepositExcept(knifeID);
}
countBankStack();
log("Current level is: " + currentLevel);
log("Current EXP is: " + currentEXP);
log("Required level: " + requiredLevel);
}
if (isLoggedIn() && currentLevel < requiredLevel && currentLevel != 0 && currentEXP != 0) {
log("You do not have the required level to fletch the specified combination.");
log("You chose: " + logName + " and: " + bowName + ".");
stopAllScripts();
}
if (isLoggedIn() && getCurrentTab() != TAB_INVENTORY) {
openTab(TAB_INVENTORY);
}
if (isLoggedIn() && inventoryContains(logID) && inventoryContains(knifeID)) {
if (getCurrentTab() != TAB_INVENTORY) {
openTab(TAB_INVENTORY);
}
doInventory(logID, "Use");
wait(random(350, 500));
doInventory(knifeID, "Use");
wait(random(500, 700));
int fail = 0;
while (!interfaceExists(interfaceID)) {
// the dialog on the bottom does not exist
fail++; // better add a failsafe
if (fail >= 10) {
fail = 0;
doInventory(logID, "Use");
wait(random(350, 500));
doInventory(knifeID, "Use");
wait(random(200, 400));
}
else {
wait(random(500, 650));
}
}
clickMouse(xPos + random(-5, 5), yPos + random(-5, 5), false);
if (!stringing) {
atMenu("Make X");
wait(random(500, 700));
fail = 0;
while (!interfaceExists(752)) {
// the second dialog
fail++;
if (fail >= 10) {
return random(200, 400); // failed so let's just try again.
}
else {
wait(random(200, 450));
}
}
wait(random(500, 1000)); // just incase
String random = String.valueOf(random(3, 9));
String random2 = String.valueOf(Integer.parseInt(random) + random(-2, 2));
int randInt = Integer.parseInt(random + random2);
sendText(String.valueOf(randInt), false);
if (RSInterface.getChildInterface(752, 5).getText().contains(random + random2)) {
sendKey((char) KeyEvent.VK_ENTER);
}
else {
for (int i = 1; i < RSInterface.getChildInterface(752, 5).getText().length() - 1; i++) {
sendKey((char) KeyEvent.VK_BACK_SPACE);
wait(50);
}
sendText(String.valueOf(randInt), true);
}
wait(random(250, 500));
checkChatBox();
}
else {
atMenu("Make All");
wait(random(250, 400));
}
wait(random(250, 400));
// finally.. now for the animation check
waitTillAnimationStop();
if (!stringing && numbOfLogs <= 0) {
log("Completed all logs. Logging out.");
logout();
return -1; // logout and end.
}
else if (stringing && (numbOfStrings <= 0 || numbOfBows <= 0)) {
log("Completed all bows. Logging out.");
logout();
return -1;
}
}
else if (!inventoryContains(logID) || !inventoryContains(knifeID)) {
doBank();
return random(750, 1000);
}
return random(500, 1000);
}
public void waitTillAnimationStop() {
int shouldAntiBan = 0;
done = 0;
while (true) {
while (getMyPlayer().getAnimation() != -1) {
wait(random(300, 500));
shouldAntiBan++;
if (shouldAntiBan == random(1, 10)) {
AzWAntiBan();
shouldAntiBan = 0;
}
else if (shouldAntiBan > 10) {
shouldAntiBan = 0;
AzWAntiBan();
}
}
if (getMyPlayer().getAnimation() == -1) {
// stopped, but for how long?
if (done >= 2 && !stringing) {
break;
}
else if (done >= 4 && stringing) {
break;
}
else {
done++;
shouldAntiBan++;
wait(random(300, 500));
}
}
else {
done = 0; // guess it wasn't for long XD
}
}
}
public void checkChatBox() {
String whatAmISaying = RSInterface.getChildInterface(137, 51).getText();
String noSeriously = whatAmISaying.substring(whatAmISaying.indexOf("f>"), whatAmISaying.indexOf("*"));
noSeriously = noSeriously.replaceAll("f>", "");
if (!noSeriously.equals("")) {
log("Chat box: " + noSeriously);
log("Backspacing...");
for (int i = 0; i < noSeriously.length(); i++) {
sendKey((char) KeyEvent.VK_BACK_SPACE);
wait(50);
}
}
}
public void doInventory(int id, String action) {
// okay, RSBot really needs an update
int[] items = getInventoryArray(); // gets all items
ArrayList<Integer> theItems = new ArrayList<Integer>(); // all possible matches
for (int i = 0; i < items.length; i++) {
if (items[i] == id) {
theItems.add(i); // add all possible matches to the arraylist
}
}
if (theItems.isEmpty() || theItems == null) {
// ..... error LOL
stopAllScripts();
}
int randPossible = theItems.get(random(0, theItems.size())); // get a random possible match
Point itemPos = getInventoryItemPoint(randPossible); // get the XY of the item
// now we should interpret the action
if (action.equals("Use")) {
clickMouse(itemPos, 5, 5, true); // left click with 5 xy tolerance
}
else {
clickMouse(itemPos, 5, 5, false); // right click with 5 xy tolerance
atMenu(action); // and then do the action
}
}
public boolean doDepositExcept(int... ids) {
// custom deposit except
int inventoryCount = getInventoryCount();
int[] inventoryArray = getInventoryArray();
outer:
for (int off = 0; off < inventoryArray.length; off++) {
if (inventoryArray[off] == -1) {
continue;
}
for (int item : ids) {
if (inventoryArray[off] == item) {
continue outer;
}
}
for (int tries = 0; tries < 5; tries++) {
atInventoryItem(inventoryArray[off], "Deposit-All");
wait(random(800, 1200));
if (getInventoryCount() < inventoryCount) {
break;
}
}
if (getInventoryCount() >= inventoryCount) {
// equally, otherwise
// something really weird
// happend :P
return false;
}
inventoryArray = getInventoryArray();
inventoryCount = getInventoryCount();
}
return true;
}
public void openBank() {
int random = random(1, 10);
int[] bankObj = null;
int[] bankNPC = null;
while (!interfaceExists(762) && !RSInterface.getInterface(13).isValid() && !RSInterface.getInterface(14).isValid()) {
if (random > 5 || usingPC) {
if (distanceTo(new RSTile(3253, 3422)) < 10) {
// Varrock East Bank
bankObj = new int[]{11402};
}
else if (distanceTo(new RSTile(3186, 3438)) < 10) {
// Varrock West Bank
bankObj = new int[]{11402};
}
else if (distanceTo(new RSTile(3013, 3356)) < 10) {
// Falador East Bank
bankObj = new int[]{11758};
}
else if (distanceTo(new RSTile(2945, 3370)) < 10) {
// Falador West Bank
bankObj = new int[]{11758};
}
else if (distanceTo(new RSTile(3209, 3218)) < 10) {
// Lumbridge Bank
bankObj = new int[]{36786};
}
else if (distanceTo(new RSTile(3093, 3243)) < 10) {
// Draynor Bank
bankObj = new int[]{2213};
}
else if (distanceTo(new RSTile(3270, 3167)) < 10) {
// Al Kharid Bank
bankObj = new int[]{35647, 35678};
}
else if (distanceTo(new RSTile(2668, 2653)) < 10) {
// Pest Control Bank
bankObj = new int[]{14367};
}
// actually open the bank now
if (bankObj != null) {
if (bankObj.length == 1) {
RSObject object = findObject(bankObj[0]);
atObject(object, "Use-quickly");
}
else {
random = random(0, bankObj.length - 1);
RSObject object = findObject(bankObj[random]);
atObject(object, "Use-quickly");
}
wait(random(500, 1000));
}
}
else {
if (distanceTo(new RSTile(3253, 3422)) < 10) {
// Varrock East Bank
bankNPC = new int[]{5912, 5913};
}
else if (distanceTo(new RSTile(3186, 3438)) < 10) {
// Varrock West Bank
bankNPC = new int[]{5912, 5913};
}
else if (distanceTo(new RSTile(3013, 3356)) < 10) {
// Falador East Bank
bankNPC = new int[]{6200};
}
else if (distanceTo(new RSTile(2945, 3370)) < 10) {
// Falador West Bank
bankNPC = new int[]{6200};
}
else if (distanceTo(new RSTile(3209, 3218)) < 10) {
// Lumbridge Bank
bankNPC = new int[]{4907};
}
else if (distanceTo(new RSTile(3093, 3243)) < 10) {
// Draynor Bank
bankNPC = new int[]{495, 494};
}
else if (distanceTo(new RSTile(3270, 3167)) < 10) {
// Al Kharid Bank
bankNPC = new int[]{496, 497};
}
else if (distanceTo(new RSTile(2668, 2653)) < 10) {
// Pest Control Bank
usingPC = true;
}
// actually open the bank now
if (bankNPC != null && !usingPC) {
if (bankNPC.length == 1) {
RSNPC npc = getNearestNPCByID(bankNPC[0]);
atNPC(npc, "Bank Bank");
}
else {
random = random(0, bankNPC.length - 1);
RSNPC npc = getNearestNPCByID(bankNPC[random]);
atNPC(npc, "Bank Bank");
}
wait(random(500, 1000));
}
}
}
if (RSInterface.getInterface(13).isValid() || RSInterface.getInterface(14).isValid()) {
// doesn't pick up bank pins? --- copy of BankPasswords.java
if (RSInterface.getInterface(14).isValid()) {
atInterface(RSInterface.getInterface(14).getChild(1));
wait(random(800, 1500));
}
String pin = getAccountProperty("pin");
if (pin == null || pin == "") {
log("You must add a new key in account manager called 'PIN' with the value of your PIN.");
log("Could not enter PIN. Stopping script.");
wait(20000);
stopAllScripts();
}
else {
log("Entering bank PIN.");
}
while (!enterCode(pin)) {
// wait(random(300,1000));
}
// Click to continue
if (RSInterface.getInterface(211).isValid()) {
atInterface(RSInterface.getInterface(211).getChild(3));
wait(random(100, 1500));
}
}
}
public boolean enterCode(String pass) {
if (!RSInterface.getInterface(13).isValid()) {
return true;
}
RSInterface pif = RSInterface.getInterface(13);
RSInterfaceChild[] children = pif.getChildren();
int state = 0;
for (int i = 21; i < 25; i++) {
if (children[i].containsText("?")) {
state++;
}
}
state = 4 - state;
for (int j = 11; j < 21; j++) {
if (children[j].containsText(pass.substring(state, state + 1))) {
atInterface(children[j - 10]);
wait(random(1000, 2000));
break;
}
else {
if (j == 20) {
moveMouse(random(0, 750), random(0, 500));
}
}
}
if (state == 3 || !RSInterface.getInterface(13).isValid()) {
return true;
}
return false;
}
public void doBank() {
if (!interfaceExists(762) && !RSInterface.getInterface(13).isValid() && !RSInterface.getInterface(14).isValid()) {
openBank();
wait(random(400, 600));
}
if (interfaceExists(762) || RSInterface.getInterface(13).isValid() || RSInterface.getInterface(14).isValid()) {
doDepositExcept(knifeID, logID);
if (!isInventoryFull()) {
if (fletched == 0 && numbOfBows == 0 && numbOfStrings == 0 && numbOfLogs == 0) {
countBankStack();
}
if (!inventoryContains(knifeID) && !stringing) {
bank.withdraw(knifeID, 1);
}
if (!isInventoryFull()) {
if (!stringing) {
int randX = random(130, 150);
int randY = random(95, 120);
clickMouse(randX, randY, false);
wait(random(500, 700));
atMenu("Withdraw-All");
}
else {
int randBowX = random(130, 150);
int randBowY = random(95, 120);
int randStringX = random(175, 195);
int randStringY = random(95, 120);
moveMouse(randBowX, randBowY);
wait(random(500, 700));
if (!getMenuItems().contains("Withdraw-14")) {
clickMouse(false);
atMenu("Withdraw-X");
wait(random(800, 1000));
sendText("14", true); // has to be 14
wait(random(700, 1000));
}
else {
clickMouse(false);
wait(random(500, 700));
atMenu("Withdraw-14");
wait(random(400, 600));
}
clickMouse(randStringX, randStringY, false);
wait(random(500, 700));
atMenu("Withdraw-All");
wait(random(400, 600));
}
}
checkChatBox();
}
else {
if (!inventoryContains(knifeID) && !stringing) {
// bank does not work yet.
log("Lost knife. Error.");
stopAllScripts();
/*
openBank();
atInventoryItem(logID, "Deposit-1");
bank.withdraw(knifeID, 1);
*/
}
}
bank.close();
}
}
public void countBankStack() {
int invCount = getInventoryCount();
// bank.setWithdrawModeToNote(); doubt it even works
if (getSetting(115) == 0) { // note
clickMouse(230, 300, 20, 15, true);
wait(200);
}
if (!stringing) {
int randX = random(130, 150);
int randY = random(95, 120);
clickMouse(randX, randY, false);
wait(random(500, 700));
atMenu("but one");
while (invCount == getInventoryCount()) {
wait(random(200, 400));
}
numbOfLogs = getInventoryStackArray()[getInventoryCount() - 1] + 1;
wait(200);
doDepositExcept(knifeID);
}
else {
int randBowX = random(130, 150);
int randBowY = random(95, 120);
int randStringX = random(175, 195);
int randStringY = random(95, 120);
clickMouse(randBowX, randBowY, false);
wait(random(500, 700));
atMenu("but one");
while (invCount == getInventoryCount()) {
wait(random(200, 400));
}
numbOfBows = getInventoryStackArray()[getInventoryCount() - 1] + 1;
clickMouse(randStringX, randStringY, false);
wait(random(500, 700));
atMenu("but one");
while (invCount == getInventoryCount()) {
wait(random(200, 400));
}
wait(random(500, 750));
numbOfStrings = getInventoryStackArray()[getInventoryCount() - 1] + 1;
doDepositExcept();
}
wait(200);
if (getSetting(115) == 1) { // note
clickMouse(230, 300, 20, 15, true);
wait(200);
}
}
public void AzWAntiBan() {
//antiban activated.
int antiban = random(1, 40);
checkChatBox();
if (antiban < 5 && antiban > 0) {
// player examining
RSCharacter nearPlayer = getNearestPlayerByLevel(1, 130);
if (nearPlayer != null) {
if (nearPlayer.getScreenLocation().x < 10 || nearPlayer.getScreenLocation().y > 500) {
log("AzWAntiBan: Nearby player is too far away.");
}
else {
log("AzWAntiBan: Moving mouse to a nearby player.");
moveMouse(nearPlayer.getScreenLocation().x, nearPlayer.getScreenLocation().y);
int random = random(1, 10);
if (random > 7) {
log("AzWAntiBan: Right-clicking nearby player.");
clickMouse(nearPlayer.getScreenLocation().x, nearPlayer.getScreenLocation().y, false);
random = random(1, 10);
if (random > 7) {
log("AzWAntiBan: Pressing cancel.");
atMenu("Cancel");
}
}
}
}
}
if (antiban < 15 && antiban > 5) {
//tabs
int[] tabs = new int[]{TAB_ATTACK, TAB_CLAN, TAB_EQUIPMENT, TAB_FRIENDS, TAB_IGNORE, TAB_INVENTORY, TAB_MAGIC, TAB_MUSIC, TAB_OPTIONS, TAB_PRAYER, TAB_QUESTS, TAB_STATS};
String[] tabNames = new String[]{"Combat", "Clan", "Equipment", "Friends", "Ignore", "Inventory", "Magic", "Music", "Options", "Prayer", "Quests", "Statistics"};
int randTab = random(0, tabs.length - 1);
// let's think twice before selecting a useless tab
int random = random(1, 10);
if (random > 5) {
// useless means: attack, clan, ignore, music, quest, options
if (tabNames[randTab].contains("Attack") || tabNames[randTab].contains("Clan") || tabNames[randTab].contains("Ignore") || tabNames[randTab].contains("Music") || tabNames[randTab].contains("Quest") || tabNames[randTab].contains("Options")) {
AzWAntiBan();
}
}
log("AzWAntiBan: Selecting the " + tabNames[randTab] + " tab.");
if (getCurrentTab() != tabs[randTab]) {
openTab(tabs[randTab]);
}
else {
AzWAntiBan();
}
if (tabs[randTab] == TAB_STATS) {
log("AzWAntiBan: Checking experience points of random stat.");
int randX = random(555, 710);
int randY = random(230, 445);
moveMouse(randX, randY);
wait(random(6000, 8000));
}
if (tabs[randTab] == TAB_OPTIONS) {
if (isRunning()) {
log("AzWAntiBan: Activating run.");
setRun(true);
}
}
}
if (antiban < 40 && antiban > 25) {
//mouse -- 765, 500
int randX = random(0, 765);
int randY = random(0, 500);
String randomXY = String.valueOf(randX) + "," + String.valueOf(randY);
log("AzWAntiBan: Moving mouse to - " + randomXY);
moveMouse(randX, randY, 3, 3);
int randomExamine = random(1, 10);
if (randomExamine > 3) {
wait(500);
if (getMenuItems().contains("Examine")) {
clickMouse(getMouseLocation().x, getMouseLocation().y, false);
wait(500);
if (atMenu("Examine")) {
log("AzWAntiBan: Successfully examined mouse position!");
}
}
}
}
if (antiban < 25 && antiban > 15) {
log("AzWAntiBan: Moving the compass / camera.");
//compass and camera -- thanks to WarXperiment ~ AllAntiBan
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 serverMessageRecieved(ServerMessageEvent svr) {
String msg = svr.getMessage();
if (msg.contains("carefully cut the")) {
fletched++;
numbOfLogs--;
}
if (msg.contains("add a string")) {
fletched++;
numbOfBows--;
numbOfStrings--;
}
if (msg.contains("run out of")) {
done = 10; // automatically breaks waitTillAnimationStop();
}
}
public void onRepaint(Graphics g) {
long millis = System.currentTimeMillis() - currentTime;
long hours = millis / (1000 * 60 * 60);
millis -= hours * 1000 * 60 * 60;
long minutes = millis / (1000 * 60);
millis -= minutes * 1000 * 60;
long seconds = millis / 1000;
StringBuilder b = new StringBuilder();
b.append(hours);
b.append(':');
if (minutes < 10) {
b.append('0');
}
b.append(minutes);
b.append(':');
if (seconds < 10) {
b.append('0');
}
b.append(seconds);
String timeElapsed = b.toString();
g.setColor(Color.MAGENTA);
g.drawString("AzWFletcher v" + getVersion(), 25, 235);
g.drawString("Gained Levels: " + (skills.getCurrentSkillLevel(9) - currentLevel), 25, 250);
g.drawString("Gained EXP: " + (skills.getCurrentSkillExp(9) - currentEXP), 25, 265);
g.drawString("EXP till next level: " + skills.getXPToNextLevel(9), 25, 280);
g.drawString("Time elapsed: " + timeElapsed, 25, 295);
if (!stringing) {
g.drawString("Logs left: " + numbOfLogs, 25, 310);
g.drawString("Fletched: " + fletched, 25, 325);
}
else {
g.drawString("Strings left: " + numbOfStrings + " || " + "Bows left: " + numbOfBows, 25, 310);
g.drawString("Strung: " + fletched, 25, 325);
}
}
public void onFinish() {
Bot.getEventManager().removeListener(PaintListener.class, this);
}
public String getName() {
return "AzWFletcher";
}
public String getAuthor() {
return "AzN-WoNd3R5";
}
public double getVersion() {
return 1.30;
}
public String getScriptCategory() {
return "Fletching";
}
public String getScriptDescription() {
String html = "";
html += "<html>";
html += "<center>";
html += "<h2>" + getName() + " v" + getVersion() + " - by AzN-WoNd3R5</h2>";
html += "<br />";
html += "Start in one of the following banks:<br>";
html += "Al Kharid, Draynor, Varrock, Falador, Lumbridge, Pest Control.<br>";
html += "<br />";
html += "<b>To string, put bows in third bank slot, and strings in forth bank slot.</b><br>";
html += "Otherwise, <U>put the logs in your <b>THIRD</b> bank slot and have a knife in inventory.</U>";
html += "<br />";
html += "<br />";
html += "<form>";
html += "<b>Log Type: </b>";
html += "<select name=\"log\">";
html += "<option value=\"Normal\">Normal Logs</option>";
html += "<option value=\"Oak\">Oak Logs</option>";
html += "<option value=\"Willow\">Willow Logs</option>";
html += "<option value=\"Maple\">Maple Logs</option>";
html += "<option value=\"Yew\">Yew Logs</option>";
html += "<option value=\"Magic\">Magic Logs</option>";
html += "</select>";
html += "<br>";
html += "<br>";
html += "<b>Fletch: </b>";
html += "<select name=\"fletch\">";
html += "<option value=\"Shafts\">15 Arrow Shafts</option>";
html += "<option value=\"Shortbow\">Shortbow</option>";
html += "<option value=\"Longbow\">Longbow</option>";
html += "<option value=\"Stock\">Crossbow Stock</option>";
html += "</select>";
html += "</form>";
html += "<br />";
html += "<input type=\"checkbox\" name=\"string\" value=\"no\">String only?<br>";
html += "</center>";
html += "</html>";
return html;
}
}
I've also got the new ruski auto-fighter.Hmm, does anyone have the newer script of Ruski's auto-fighter? V1.5 doesn't work [I got it from this thread] and I think it was because some of the script was censored off as ******* so it doesn't work
import com.speljohan.rsbot.accessors.NPC;
import com.speljohan.rsbot.bot.Bot;
import com.speljohan.rsbot.event.listeners.PaintListener;
import com.speljohan.rsbot.plugin.NonPluginClass;
import com.speljohan.rsbot.script.Calculations;
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.RSPlayer;
import com.speljohan.rsbot.script.wrappers.RSTile;
import java.awt.Color;
import java.awt.Graphics;
import java.awt.Point;
import java.awt.event.ActionEvent;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.List;
import java.util.Properties;
import java.awt.event.ActionListener;
import java.util.ArrayList;
import java.util.Map;
public class RuskisFighter extends Script implements ActionListener, PaintListener {
@Override
public int loop() {
try {
if (canContinue()) {
clickContinue();
return random(570, 1410);
}
if(runCheck()) {
setRun(true);
return random(1410, 1800);
}
int action = getAction();
switch (action) {
case ATTACK:
RSNPC npc = npcBase.npc;
if (clickNPC(npc, "Attack")) {
return random(1120, 2310);
} else {
return random(240, 610);
}
case WALK:
if (tileBase.useHalfTile) {
RSTile tile = tileBase.getHalfWayTile().randomizeTile(2, 2);
if (distanceTo(tile) <= 10) {
if (walkTileMM(tile)) {
tileBase.setUseHalfTile(false);
return random(820, 1410);
} else {
return random(140, 510);
}
} else {
RSTile halfWayTile = tileBase.calcHalfWayTile(getLocation(), tile);
tileBase.setUseHalfTile(true);
tileBase.setHalfWayTile(halfWayTile);
return random(150, 410);
}
} else {
RSTile tile = tileBase.tile.randomizeTile(2, 2);
if (distanceTo(tile) <= 10) {
if (walkTileMM(tile)) {
tileBase.setUseHalfTile(false);
return random(820, 1410);
} else {
return random(140, 510);
}
} else {
RSTile halfWayTile = tileBase.calcHalfWayTile(getLocation(), tile);
tileBase.setHalfWayTile(halfWayTile);
tileBase.setUseHalfTile(true);
return random(130, 410);
}
}
case EAT:
if (getInventoryCount(FOODID) > 0) {
clickInventoryFood(FOODID);
return random(1412, 2413);
} else {
return random(140, 410);
}
case PICKUP:
RSItemTile itemTile = pickUpItemSet.tile;
try {
if (pickUpItem(itemTile)) {
pickUpFail = 0;
return random(710, 2310);
} else {
pickUpFail++;
if (pickUpFail >= random(2, 4)) {
pickUpFail = 0;
int randomNum = random(0, 1);
switch (randomNum) {
case 0:
setCameraRotation(getCameraAngle() + random(35, 150));
return random(320, 710);
case 1:
setCameraRotation(getCameraAngle() - random(35, 150));
return random(320, 1410);
}
}
}
} catch (Exception e) {
System.out.print("pick up item error: " + e);
return random(120, 541);
}
case WAIT:
return random(waitRange.range[0], waitRange.range[1]);
case KILLSCRIPT:
while (getMyPlayer().isInCombat()) {
wait(random(1310, 7244));
}
stopAllScripts();
return -1;
}
} catch (Exception e) {
System.out.print("loop() error: " + e);
}
return random(320, 520);
}
@Override
public String getAuthor() {
return "Ruski";
}
@Override
public String getName() {
return "RuskisFighter";
}
@Override
public double getVersion() {
return 1.9;
}
@Override
public String getScriptCategory() {
return "Ruski/Combat";
}
@Override
public String getScriptDescription() {
String html = "<hmtl>";
html += "<center>";
html += "<p>All settings can be set on the GUI, select your character and Start!</p>";
html += "</center>";
html += "</html>";
return html;
}
@Override
public void onFinish() {
Bot.getEventManager().removeListener(PaintListener.class, this);
}
@Override
public boolean onStart(Map<String, String> args) {
if (settings.settingsExist(settingsFileName)) {
showSettingsInterface();
try {
settings.setSettings();
npcIDText.setText(settings.intArrayToString(settings.getNPCIDs()));
pickUpItemsCheck.setSelected(settings.getPickUpItems());
if (settings.getPickUpItems()) {
itemIDText.setText(settings.intArrayToString(settings.getItemIDs()));
itemNameText.setText(settings.stringArrayToString(settings.getItemNames()));
}
eatFoodCheck.setSelected(settings.getEatFood());
stopScriptWhenNoFoodCheck.setSelected(settings.getStopScriptWhenNoFood());
speedSlider.setValue(settings.getSpeed());
} catch (Exception e) {
System.out.print("error getting settings: " + e);
}
} else {
showSettingsInterface();
}
while (!START_SCRIPT) {
wait(10);
}
log("*******************************************");
log("Ruskis Fighter V" + getVersion());
if (settings.getEatFood()) {
log("Food eating is enabled");
}
if (settings.getPickUpItems()) {
log("Picking up items: " + settings.stringArrayToString(settings.getItemNames()));
}
if (settings.getStopScriptWhenNoFood()) {
log("Stopping script, when run out of food");
}
log("*******************************************");
Bot.getEventManager().addListener(PaintListener.class, this);
START_SCRIPT = false;
return true;
}
private int getAction() {
if (!isLoggedIn() || !validInventory() || validWelcomeScreen()) {
return -1;
}
if (healthCheck()) {
if (isLoggedIn() && settings.getStopScriptWhenNoFood() && getInventoryCount(FOODID) == 0 && validInventory()) {
log("Run out of food, stopping script!!!");
return KILLSCRIPT;
}
if (settings.getEatFood() && getInventoryCount(FOODID) > 0) {
return EAT;
}
}
RSPlayer thisPlayer = getMyPlayer();
if (thisPlayer.isMoving()) {
waitRange.range = new int[]{320, 610};
return WAIT;
}
if (thisPlayer.getInteracting() != null) {
waitRange.range = new int[]{210, 310};
return WAIT;
}
if (settings.getPickUpItems()) {
RSItemTile itemTile = getNearestGroundItemByID(10, settings.getItemIDs());
if (itemTile != null && canPickUpItem(itemTile.getItem().getID())) {
pickUpItemSet.setItemTile(itemTile);
try {
Point itemPoint = Calculations.tileToScreen(itemTile);
if (pointOnScreen(itemPoint)) {
pickUpItemSet.setItemTile(itemTile);
return PICKUP;
} else {
turnToTile(itemTile);
tileBase.setTile(itemTile);
return WALK;
}
} catch (Exception e) {
System.out.print("itemPoint error: " + e);
}
}
}
RSNPC npc = getNearestNPC(settings.getNPCIDs());
if (npc != null) {
npcCheck = false;
npcBase.setNPC(npc);
Point npcScreen = npc.getScreenLocation();
if (!pointOnScreen(npcScreen) || distanceTo(npc.getLocation()) >= 12) {
tileBase.setTile(npc.getLocation());
return WALK;
}
return ATTACK;
} else {
if (!npcCheck) {
lastNPCCheck = System.currentTimeMillis();
npcCheck = true;
}
if (npcCheck) {
if (System.currentTimeMillis() - lastNPCCheck >= 50000) {
log("No npcs around for 50 seconds, killing script");
return KILLSCRIPT;
}
}
}
return WAIT;
}
long healthRandomTime = 0;
int hpToHealAt = 10;
private boolean healthCheck() {
try {
if (System.currentTimeMillis() - healthRandomTime > 120000) {
healthRandomTime = System.currentTimeMillis();
hpToHealAt = (int) random(skills.getRealSkillLevel(3) / 3, skills.getRealSkillLevel(3) / 1.5);
}
return (skills.getCurrentSkillLevel(3) <= hpToHealAt);
} catch (Exception e) {
System.out.print("healthCheck() error: " + e);
}
return false;
}
int runEnergy = random(15, 25);
private boolean runCheck() {
try {
if(getEnergy() >= runEnergy && !isRunning()) {
runEnergy = random(15, 50);
return true;
} else {
return false;
}
} catch (Exception e) {
System.out.print("runCheck() error: " + e);
return false;
}
}
public RSNPC getNearestNPC(int... ids) {
int Dist = 99999;
RSNPC closest = null;
int[] validNPCs = Bot.getClient().getNPCIndexArray();
NPC[] npcs = Bot.getClient().getNPCArray();
for (int element : validNPCs) {
if (npcs[element] == null) {
continue;
}
RSNPC Monster = new RSNPC(npcs[element]);
if (!canReach(Monster.getLocation(), false)) {
continue;
}
try {
for (int id : ids) {
if (id != Monster.getID() || Monster.isInCombat()) {
continue;
}
int distance = distanceTo(Monster);
if (distance < Dist) {
Dist = distance;
closest = Monster;
}
}
} catch (Exception e) {
}
}
lastNPC = closest;
return closest;
}
RSNPC lastNPC = null;
public RSNPC getNextNearestNPC(int... ids) {
int Dist = 99999;
RSNPC closest = null;
int[] validNPCs = Bot.getClient().getNPCIndexArray();
NPC[] npcs = Bot.getClient().getNPCArray();
for (int element : validNPCs) {
if (npcs[element] == null) {
continue;
}
RSNPC Monster = new RSNPC(npcs[element]);
if (Monster.equals(lastNPC) || !canReach(Monster.getLocation(), false)) {
continue;
}
try {
for (int id : ids) {
if (id != Monster.getID() || Monster.isInCombat()) {
continue;
}
int distance = distanceTo(Monster);
if (distance < Dist) {
Dist = distance;
closest = Monster;
}
}
} catch (Exception e) {
}
}
lastNPC = closest;
return closest;
}
public boolean pickUpItem(RSItemTile tile) {
try {
Point location = Calculations.tileToScreen(tile);
if (location.x == -1 || location.y == -1) {
return false;
}
for (int a = 0; a < 10; a++) {
location = Calculations.tileToScreen(tile);
moveMouse(location, -15, 15);
if (getMenuItems().get(0).contains("Take")) {
break;
}
if (getMouseLocation().equals(location)) {
break;
}
}
String[] itemNames = settings.getItemNames();
for (int c = 0; c < itemNames.length; c++) {
if (getMenuItems().get(0).contains(itemNames[c])) {
clickMouse(true);
return true;
}
for (int x = 0; x < getMenuItems().size(); x++) {
if (getMenuItems().get(x).contains(itemNames[c])) {
if (!atMenu(itemNames[c])) {
return false;
} else {
return true;
}
}
}
}
return false;
} catch (Exception e) {
System.out.print("pickUpItem(RSTile, RSItem) error: " + e);
return false;
}
}
private boolean validWelcomeScreen() {
return RSInterface.getInterface(378).getChild(45).getAbsoluteX() > 20;
}
private boolean validInventory() {
return getEquipmentArray().length >= 1;
}
public RSItemTile getNearestGroundItemByID(int range, int[] ids) {
int pX = getMyPlayer().getLocation().getX();
int pY = getMyPlayer().getLocation().getY();
int minX = pX - range;
int minY = pY - range;
int maxX = pX + range;
int maxY = pY + range;
int dist = 100;
RSItemTile nItem = null;
for (int x = minX; x <= maxX; x++) {
for (int y = minY; y <= maxY; y++) {
if (Calculations.canReach(new RSTile(x, y), false)) {
RSItemTile[] items = getGroundItemsAt(x, y);
for (RSItemTile item : items) {
int iId = item.getItem().getID();
for (int id : ids) {
if (iId == id) {
if (distanceTo(new RSTile(x, y)) < dist) {
dist = distanceTo(new RSTile(x, y));
nItem = item;
}
}
}
}
}
}
}
return nItem;
}
private boolean clickInventoryFood(int... ids) {
try {
if (getCurrentTab() != TAB_INVENTORY && !RSInterface.getInterface(INTERFACE_BANK).isValid() &&
!RSInterface.getInterface(INTERFACE_STORE).isValid()) {
openTab(TAB_INVENTORY);
}
int[] items = getInventoryArray();
java.util.List<Integer> possible = new ArrayList<Integer>();
for (int i = 0; i < items.length; i++) {
for (int item : ids) {
if (items[i] == item) {
possible.add(i);
}
}
}
if (possible.size() == 0) {
return false;
}
int idx = possible.get(random(0, possible.size()));
Point t = getInventoryItemPoint(idx);
clickMouse(t, 5, 5, false);
return atMenu("Eat");
} catch (Exception e) {
System.out.print("clickInventoryFood(int...) error: " + e);
return false;
}
}
private boolean canPickUpItem(int itemID) {
if (getInventoryCount() < 28) {
return true;
} else {
if (getInventoryCount(itemID) > 0 && getInventoryItemByID(itemID).getStackSize() > 1) {
return true;
}
}
return false;
}
private boolean clickNPC(RSNPC npc, String action) {
if (npc == null) {
return false;
}
RSTile tile = npc.getLocation();
if (!tile.isValid()) {
return false;
}
try {
Point screenLoc = npc.getScreenLocation();
if (distanceTo(tile) > 6 || !pointOnScreen(screenLoc)) {
turnToTile(tile);
}
if (distanceTo(tile) > 20) {
walkTileMM(tile);
return false;
}
for (int i = 0; i < 12; i++) {
screenLoc = npc.getScreenLocation();
if (!npc.isValid() || !pointOnScreen(screenLoc)) {
return false;
}
moveMouse(screenLoc, -15, 15);
if (getMenuItems().get(0).toLowerCase().contains(npc.getName().toLowerCase())) {
break;
}
if (getMouseLocation().equals(screenLoc)) {
break;
}
}
List<String> menuItems = getMenuItems();
if (menuItems.isEmpty()) {
return false;
}
for (int a = 0; a < menuItems.size(); a++) {
if (menuItems.get(a).toLowerCase().contains(npc.getName().toLowerCase())) {
if (menuItems.get(0).toLowerCase().contains(action.toLowerCase())) {
clickMouse(true);
return true;
} else {
clickMouse(false);
return atMenu(action);
}
}
}
} catch (Exception e) {
System.out.print("clickNPC(RSNPC, String) error: " + e);
return false;
}
return false;
}
public void onRepaint(Graphics g) {
if (isLoggedIn()) {
if (startTime == 0) {
startTime = System.currentTimeMillis();
}
ArrayList<String> reportList = new ArrayList<String>();
reportList.add("RuskisFight V" + getVersion());
int startAttackExp = experienceHandler.getSkillExp(STAT_ATTACK);
int startStrengthExp = experienceHandler.getSkillExp(STAT_STRENGTH);
int startDefenseExp = experienceHandler.getSkillExp(STAT_DEFENSE);
int startHitpointsExp = experienceHandler.getSkillExp(STAT_HITPOINTS);
int startRangeExp = experienceHandler.getSkillExp(STAT_RANGE);
int startMagicExp = experienceHandler.getSkillExp(STAT_MAGIC);
int currentAttackExp = skills.getCurrentSkillExp(STAT_ATTACK);
int currentStrengthExp = skills.getCurrentSkillExp(STAT_STRENGTH);
int currentDefenseExp = skills.getCurrentSkillExp(STAT_DEFENSE);
int currentHitpointsExp = skills.getCurrentSkillExp(STAT_HITPOINTS);
int currentRangeExp = skills.getCurrentSkillExp(STAT_RANGE);
int currentMagicExp = skills.getCurrentSkillExp(STAT_MAGIC);
if (startAttackExp == 0) {
experienceHandler.setExperiencePoints(STAT_ATTACK, skills.getCurrentSkillExp(STAT_ATTACK));
}
int attackExpChange = currentAttackExp - startAttackExp;
if (attackExpChange > 0) {
reportList.add("Attack Exp: " + attackExpChange);
}
if (startStrengthExp == 0) {
experienceHandler.setExperiencePoints(STAT_STRENGTH, skills.getCurrentSkillExp(STAT_STRENGTH));
}
int strengthExpChange = currentStrengthExp - startStrengthExp;
if (strengthExpChange > 0) {
reportList.add("Strength Exp: " + strengthExpChange);
}
if (startDefenseExp == 0) {
experienceHandler.setExperiencePoints(STAT_DEFENSE, skills.getCurrentSkillExp(STAT_DEFENSE));
}
int defenseExpChange = currentDefenseExp - startDefenseExp;
if (defenseExpChange > 0) {
reportList.add("Defense Exp: " + defenseExpChange);
}
if (startHitpointsExp == 0) {
experienceHandler.setExperiencePoints(STAT_HITPOINTS, skills.getCurrentSkillExp(STAT_HITPOINTS));
}
int hitpointsExpChange = currentHitpointsExp - startHitpointsExp;
if (hitpointsExpChange > 0) {
reportList.add("Hitpoints Exp: " + hitpointsExpChange);
}
if (startRangeExp == 0) {
experienceHandler.setExperiencePoints(STAT_RANGE, skills.getCurrentSkillExp(STAT_RANGE));
}
int rangeExpChange = currentRangeExp - startRangeExp;
if (rangeExpChange > 0) {
reportList.add("Range Exp: " + rangeExpChange);
}
if (startMagicExp == 0) {
experienceHandler.setExperiencePoints(STAT_MAGIC, skills.getCurrentSkillExp(STAT_MAGIC));
}
int magicExpChange = currentMagicExp - startMagicExp;
if (magicExpChange > 0) {
reportList.add("Magic Exp: " + magicExpChange);
}
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;
reportList.add("Runtime: " + hours + ":" + minutes + ":" + seconds);
Point str = new Point(350, 25);
g.setColor(new Color(60, 155, 200, 50));
g.fill3DRect(340, 10, 165, reportList.size() * 20 + 6, true);
g.setColor(new Color(60, 155, 200, 50));
g.fill3DRect(341, 11, 163, reportList.size() * 20 + 4, true);
g.setColor(Color.WHITE);
for (int a = 0; a < reportList.size(); a++) {
g.drawString(reportList.get(a), str.x, str.y);
str = new Point(str.x, str.y + 20);
}
}
}
private final int ATTACK = 0;
private final int WALK = 1;
private final int EAT = 2;
private final int PICKUP = 3;
private final int WAIT = 4;
private final int WALK2 = 5;
private final int KILLSCRIPT = 999;
private long startTime = 0;
private RSTile lastPlayerPosition = new RSTile(0, 0);
private int standingCount = 0;
private int pickUpFail = 0;
private boolean npcCheck = false;
private long lastNPCCheck = 0;
private NPCBase npcBase = new NPCBase();
private TileBase tileBase = new TileBase();
private PickUpItemSet pickUpItemSet = new PickUpItemSet();
private Settings settings = new Settings();
private ExperienceHandler experienceHandler = new ExperienceHandler();
private WaitRange waitRange = new WaitRange(new int[]{500, 1000});
private FailSafe failSafe = new FailSafe();
private final String settingsFileName = "RuskisFighterSettings.ini";
private int[] FOODID = {
1895, 1893, 1891, 4293, 2142, 291, 2140, 3228, 9980, 7223,
6297, 6293, 6295, 6299, 7521, 9988, 7228, 2878, 7568, 2343,
1861, 13433, 315, 325, 319, 3144, 347, 355, 333, 339,
351, 329, 3381, 361, 10136, 5003, 379, 365, 373,
7946, 385, 397, 391, 3369, 3371, 3373, 2309, 2325, 2333,
2327, 2331, 2323, 2335, 7178, 7180, 7188, 7190, 7198, 7200,
7208, 7210, 7218, 7220, 2003, 2011, 2289, 2291, 2293, 2295,
2297, 2299, 2301, 2303, 1891, 1893, 1895, 1897, 1899, 1901,
7072, 7062, 7078, 7064, 7084, 7082, 7066, 7068, 1942, 6701,
6703, 7054, 6705, 7056, 7060, 2130, 1985, 1993, 1989, 1978,
5763, 5765, 1913, 5747, 1905, 5739, 1909, 5743, 1907, 1911,
5745, 2955, 5749, 5751, 5753, 5755, 5757, 5759, 5761, 2084,
2034, 2048, 2036, 2217, 2213, 2205, 2209, 2054, 2040, 2080,
2277, 2225, 2255, 2221, 2253, 2219, 2281, 2227, 2223, 2191,
2233, 2092, 2032, 2074, 2030, 2281, 2235, 2064, 2028, 2187,
2185, 2229, 6883
};
//GUI
private void showSettingsInterface() {
mainFrame = new javax.swing.JFrame("Ruskis Fighter V" + getVersion());
jPanel1 = new javax.swing.JPanel();
jLabel1 = new javax.swing.JLabel();
jPanel2 = new javax.swing.JPanel();
jLabel2 = new javax.swing.JLabel();
npcIDText = new javax.swing.JTextField();
jLabel3 = new javax.swing.JLabel();
jPanel3 = new javax.swing.JPanel();
jLabel4 = new javax.swing.JLabel();
itemIDText = new javax.swing.JTextField();
jLabel5 = new javax.swing.JLabel();
pickUpItemsCheck = new javax.swing.JCheckBox();
jLabel7 = new javax.swing.JLabel();
itemNameText = new javax.swing.JTextField();
jLabel8 = new javax.swing.JLabel();
jPanel4 = new javax.swing.JPanel();
jLabel6 = new javax.swing.JLabel();
eatFoodCheck = new javax.swing.JCheckBox();
stopScriptWhenNoFoodCheck = new javax.swing.JCheckBox();
startButton = new javax.swing.JButton();
saveSettingsCheck = new javax.swing.JCheckBox();
jPanel5 = new javax.swing.JPanel();
jLabel9 = new javax.swing.JLabel();
speedSlider = new javax.swing.JSlider();
jLabel10 = new javax.swing.JLabel();
jLabel11 = new javax.swing.JLabel();
mainFrame.setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
mainFrame.setAlwaysOnTop(true);
mainFrame.setResizable(false);
jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Welcome", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION,
javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 1, 11))); // NOI18N
jLabel1.setText("<html>Fill out the below form to start auto fighting. " +
"You can also click on \"Save Settings\" to save the form input for future use.</html>");
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).
addGroup(jPanel1Layout.createSequentialGroup().addContainerGap().
addComponent(jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, 331, Short.MAX_VALUE).addContainerGap()));
jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).
addGroup(jPanel1Layout.createSequentialGroup().addComponent(jLabel1).
addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)));
jPanel2.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "NPCs", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION,
javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 1, 11))); // NOI18N
jLabel2.setText("NPC IDs:");
jLabel3.setFont(new java.awt.Font("Tahoma", 2, 11));
jLabel3.setText("(separate npc ids with a comma, e.g: 123, 423, 23)");
javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
jPanel2.setLayout(jPanel2Layout);
jPanel2Layout.setHorizontalGroup(
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).
addGroup(jPanel2Layout.createSequentialGroup().addContainerGap().addComponent(jLabel2).
addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED).
addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addComponent(jLabel3).
addComponent(npcIDText, javax.swing.GroupLayout.DEFAULT_SIZE, 278, Short.MAX_VALUE)).addContainerGap()));
jPanel2Layout.setVerticalGroup(
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).
addGroup(jPanel2Layout.createSequentialGroup().
addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE).
addComponent(jLabel2).addComponent(npcIDText, javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)).
addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addComponent(jLabel3).
addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)));
jPanel3.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Item pickup", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION,
javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 1, 11))); // NOI18N
jLabel4.setText("Item IDs:");
jLabel5.setFont(new java.awt.Font("Tahoma", 2, 11));
jLabel5.setText("(separate item ids with a comma, e.g: 123, 423, 23)");
pickUpItemsCheck.setText("Pick up items?");
jLabel7.setText("Item Names:");
jLabel8.setFont(new java.awt.Font("Tahoma", 2, 11));
jLabel8.setText("(separate item names with a comma, e.g: coins, arrow)");
javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
jPanel3.setLayout(jPanel3Layout);
jPanel3Layout.setHorizontalGroup(
jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).
addGroup(jPanel3Layout.createSequentialGroup().addContainerGap().
addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).
addGroup(jPanel3Layout.createSequentialGroup().addComponent(jLabel4).addGap(18, 18, 18).
addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).
addComponent(itemIDText, javax.swing.GroupLayout.DEFAULT_SIZE, 268, Short.MAX_VALUE).
addComponent(jLabel5, javax.swing.GroupLayout.DEFAULT_SIZE, 268, Short.MAX_VALUE).
addComponent(pickUpItemsCheck).addComponent(jLabel8).
addComponent(itemNameText, javax.swing.GroupLayout.DEFAULT_SIZE, 268, Short.MAX_VALUE))).
addComponent(jLabel7)).addContainerGap()));
jPanel3Layout.setVerticalGroup(
jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).
addGroup(jPanel3Layout.createSequentialGroup().addComponent(pickUpItemsCheck).addGap(10, 10, 10).
addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE).
addComponent(jLabel4).addComponent(itemIDText, javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)).
addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addComponent(jLabel5).
addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED).
addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE).
addComponent(jLabel7).addComponent(itemNameText, javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)).
addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE,
Short.MAX_VALUE).addComponent(jLabel8).addContainerGap()));
jPanel4.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Eating/Food", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION,
javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 1, 11))); // NOI18N
jLabel6.setFont(new java.awt.Font("Tahoma", 2, 11)); // NOI18N
jLabel6.setText("<html>(food is automatically found in inventory)</html>");
eatFoodCheck.setText("Eat food?");
stopScriptWhenNoFoodCheck.setText("Stop script when no food?");
javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4);
jPanel4.setLayout(jPanel4Layout);
jPanel4Layout.setHorizontalGroup(
jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).
addGroup(jPanel4Layout.createSequentialGroup().addContainerGap().
addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).
addGroup(jPanel4Layout.createSequentialGroup().addComponent(eatFoodCheck).addGap(18, 18, 18).
addComponent(stopScriptWhenNoFoodCheck)).addComponent(jLabel6,
javax.swing.GroupLayout.PREFERRED_SIZE, 313, javax.swing.GroupLayout.PREFERRED_SIZE)).
addContainerGap(28, Short.MAX_VALUE)));
jPanel4Layout.setVerticalGroup(
jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).
addGroup(jPanel4Layout.createSequentialGroup().
addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE).
addComponent(eatFoodCheck).addComponent(stopScriptWhenNoFoodCheck)).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).
addComponent(jLabel6).addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)));
startButton.setText("START SCRIPT!");
startButton.addActionListener(this);
saveSettingsCheck.setText("Save Settings?");
jPanel5.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Speed", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION,
javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 1, 11))); // NOI18N
jLabel9.setText("<html>Have a try at adjusting to different speeds of the script, " +
"different<br> training locations could benefit different speeds, so it's up to you.</html> ");
speedSlider.setMajorTickSpacing(25);
speedSlider.setPaintTicks(true);
speedSlider.setSnapToTicks(true);
jLabel10.setText("Min");
jLabel11.setText("Max");
javax.swing.GroupLayout jPanel5Layout = new javax.swing.GroupLayout(jPanel5);
jPanel5.setLayout(jPanel5Layout);
jPanel5Layout.setHorizontalGroup(
jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(jPanel5Layout.createSequentialGroup().
addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).
addGroup(jPanel5Layout.createSequentialGroup().addContainerGap().addComponent(jLabel9)).
addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel5Layout.createSequentialGroup().
addContainerGap().addComponent(jLabel10).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED).
addComponent(speedSlider, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE).
addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addComponent(jLabel11).
addGap(27, 27, 27))).addContainerGap(25, Short.MAX_VALUE)));
jPanel5Layout.setVerticalGroup(
jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).
addGroup(jPanel5Layout.createSequentialGroup().addComponent(jLabel9).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED).
addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).
addComponent(speedSlider, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE).
addComponent(jLabel10).addComponent(jLabel11)).addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)));
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(mainFrame.getContentPane());
mainFrame.getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).
addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE).
addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE).
addComponent(jPanel4, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE).
addComponent(jPanel3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE).
addComponent(jPanel5, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE).
addGroup(layout.createSequentialGroup().addGap(130, 130, 130).addComponent(saveSettingsCheck).addContainerGap(136, Short.MAX_VALUE)).
addGroup(layout.createSequentialGroup().addContainerGap().addComponent(startButton,
javax.swing.GroupLayout.DEFAULT_SIZE, 343, Short.MAX_VALUE).addContainerGap()));
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).
addGroup(layout.createSequentialGroup().addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE).
addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE).
addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addComponent(jPanel3,
javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE).
addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addComponent(jPanel4, javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE).
addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addComponent(jPanel5, javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE).
addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED).addComponent(saveSettingsCheck).
addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED).addComponent(startButton).addContainerGap(27, Short.MAX_VALUE)));
mainFrame.pack();
mainFrame.setVisible(true);
}
public void actionPerformed(ActionEvent action) {
Object event = action.getSource();
if (event.equals(startButton)) {
settings.setNPCIDs(settings.extractIntegers(npcIDText.getText()));
settings.setEatFood(eatFoodCheck.isSelected());
settings.setStopScriptWhenNoFood(stopScriptWhenNoFoodCheck.isSelected());
settings.setPickUpItems(pickUpItemsCheck.isSelected());
if (settings.getPickUpItems()) {
settings.setItemIDs(settings.extractIntegers(itemIDText.getText()));
settings.setItemNames(settings.extractStrings(itemNameText.getText()));
}
settings.setSpeed(speedSlider.getValue());
if (saveSettingsCheck.isSelected()) {
try {
settings.saveSettings(settings.getSettingsArray(), settingsFileName);
log("Successfully saved settings at RuskisFighterSettings.ini");
} catch (Exception e) {
System.out.print("saving settings error: " + e);
}
}
mainFrame.setVisible(false);
mainFrame.dispose();
START_SCRIPT = true;
}
}
private boolean START_SCRIPT = false;
private javax.swing.JCheckBox eatFoodCheck;
private javax.swing.JTextField itemIDText;
private javax.swing.JTextField itemNameText;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel10;
private javax.swing.JLabel jLabel11;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
private javax.swing.JLabel jLabel5;
private javax.swing.JLabel jLabel6;
private javax.swing.JLabel jLabel7;
private javax.swing.JLabel jLabel8;
private javax.swing.JLabel jLabel9;
private javax.swing.JPanel jPanel1;
private javax.swing.JPanel jPanel2;
private javax.swing.JPanel jPanel3;
private javax.swing.JPanel jPanel4;
private javax.swing.JPanel jPanel5;
private javax.swing.JTextField npcIDText;
private javax.swing.JCheckBox pickUpItemsCheck;
private javax.swing.JCheckBox saveSettingsCheck;
private javax.swing.JSlider speedSlider;
private javax.swing.JButton startButton;
private javax.swing.JCheckBox stopScriptWhenNoFoodCheck;
private javax.swing.JFrame mainFrame;
}
class WaitRange implements NonPluginClass {
int[] range = new int[2];
public WaitRange(int[] range) {
this.range[0] = range[0];
this.range[1] = range[1];
}
}
class NPCBase implements NonPluginClass {
RSNPC npc;
public NPCBase() {
}
public void setNPC(RSNPC npc) {
this.npc = npc;
}
}
class TileBase implements NonPluginClass {
RSTile tile;
RSTile halfWayTile;
boolean useHalfTile = false;
public TileBase() {
}
public void setUseHalfTile(boolean a) {
this.useHalfTile = a;
}
public void setTile(RSTile tile) {
this.tile = tile;
}
public RSTile calcHalfWayTile(RSTile location, RSTile tile) {
return new RSTile((tile.getX() + location.getX()) / 2, (tile.getY() + location.getY()) / 2);
}
public void setHalfWayTile(RSTile tile) {
this.halfWayTile = tile;
}
public RSTile getHalfWayTile() {
return this.halfWayTile;
}
}
class PickUpItemSet implements NonPluginClass {
RSItemTile tile;
public PickUpItemSet() {
}
public void setItemTile(RSItemTile tile) {
this.tile = tile;
}
}
class ExperienceHandler implements NonPluginClass {
int[][] skillExp = new int[24][1];
public ExperienceHandler() {
}
public void setExperiencePoints(int skill, int exp) {
this.skillExp[skill][0] = exp;
}
public int getSkillExp(int skill) {
return this.skillExp[skill][0];
}
}
class FailSafe implements NonPluginClass {
long time = 0;
boolean check = false;
public FailSafe() {
}
public void setTime(long time) {
this.time = time;
}
public void setCheck(boolean a) {
this.check = a;
}
public long getTime() {
return this.time;
}
public boolean getCheck() {
return this.check;
}
}
class Settings implements NonPluginClass {
protected int[] npcIDs = new int[50];
protected int[] itemIDs = new int[50];
protected String[] itemNames = new String[50];
protected boolean pickUpItems = false;
protected boolean stopScriptWhenNoFood = false;
protected boolean eatFood = false;
protected int speed = 0;
public Settings() {
}
public void setNPCIDs(int[] ids) {
this.npcIDs = ids;
}
public void setItemIDs(int[] ids) {
this.itemIDs = ids;
}
public void setItemNames(String[] names) {
this.itemNames = names;
}
public void setPickUpItems(boolean a) {
this.pickUpItems = a;
}
public void setStopScriptWhenNoFood(boolean a) {
this.stopScriptWhenNoFood = a;
}
public void setEatFood(boolean a) {
this.eatFood = a;
}
public void setSpeed(int speed) {
this.speed = speed;
}
public int[] getNPCIDs() {
return this.npcIDs;
}
public int[] getItemIDs() {
return this.itemIDs;
}
public String[] getItemNames() {
return this.itemNames;
}
public boolean getPickUpItems() {
return this.pickUpItems;
}
public boolean getStopScriptWhenNoFood() {
return this.stopScriptWhenNoFood;
}
public boolean getEatFood() {
return this.eatFood;
}
public int getSpeed() {
return this.speed;
}
public int[] extractIntegers(String text) {
int[] ints = null;
try {
text = text.replaceAll(" ", "");
String[] strInts = text.split(",");
ints = new int[strInts.length];
for (int a = 0; a < strInts.length; a++) {
ints[a] = Integer.parseInt(strInts[a]);
}
} catch (Exception e) {
System.out.print("extractIntegers(String) error: " + e);
}
return ints;
}
public String[] extractStrings(String text) {
return text.split(",");
}
public boolean extractBoolean(String text) {
return (text.equals("true"));
}
public String booleanToString(boolean a) {
if (a) {
return "true";
} else {
return "false";
}
}
public void setSettings() {
try {
String filename = "RuskisFighterSettings.ini";
this.npcIDs = extractIntegers(getSetting("NPCIDS", filename));
this.eatFood = extractBoolean(getSetting("EATFOOD", filename));
this.pickUpItems = extractBoolean(getSetting("PICKUPITEMS", filename));
this.stopScriptWhenNoFood = extractBoolean(getSetting("STOPSCRIPTWHENNOFOOD", filename));
this.speed = Integer.parseInt(getSetting("SPEED", filename));
if (this.pickUpItems) {
this.itemIDs = extractIntegers(getSetting("ITEMIDS", filename));
this.itemNames = extractStrings(getSetting("ITEMNAMES", filename));
}
} catch (Exception e) {
System.out.print("setSettings error: " + e);
}
}
public String getSetting(String settingName, String filename) {
try {
Properties p = new Properties();
p.load(new FileInputStream(filename));
return p.getProperty(settingName);
} catch (IOException ioe) {
System.out.print("loadSettings(String) error: " + ioe);
return null;
}
}
public String intArrayToString(int[] array) {
String intArray = "";
for (int a = 0; a < array.length; a++) {
if (array[a] != 0) {
intArray += array[a];
if (a != array.length - 1) {
intArray += ",";
}
}
}
return intArray;
}
public String stringArrayToString(String[] array) {
String strArray = "";
if (array.length <= 0) {
return "";
}
for (int a = 0; a < array.length; a++) {
if (!array[a].equals(null) && !array[a].equals("")) {
strArray += array[a];
if (a != array.length - 1) {
strArray += ",";
}
}
}
return strArray;
}
public String[][] getSettingsArray() {
String[][] settingsArray;
if (getPickUpItems()) {
settingsArray = new String[7][2];
} else {
settingsArray = new String[5][2];
}
settingsArray[0][0] = "NPCIDS";
settingsArray[0][1] = intArrayToString(getNPCIDs());
settingsArray[1][0] = "PICKUPITEMS";
settingsArray[1][1] = booleanToString(getPickUpItems());
if (getPickUpItems()) {
settingsArray[2][0] = "ITEMIDS";
settingsArray[2][1] = intArrayToString(getItemIDs());
settingsArray[3][0] = "ITEMNAMES";
settingsArray[3][1] = stringArrayToString(getItemNames());
settingsArray[4][0] = "STOPSCRIPTWHENNOFOOD";
settingsArray[4][1] = booleanToString(getStopScriptWhenNoFood());
settingsArray[5][0] = "EATFOOD";
settingsArray[5][1] = booleanToString(getEatFood());
settingsArray[6][0] = "SPEED";
settingsArray[6][1] = "" + getSpeed();
} else {
settingsArray[2][0] = "STOPSCRIPTWHENNOFOOD";
settingsArray[2][1] = booleanToString(getStopScriptWhenNoFood());
settingsArray[3][0] = "EATFOOD";
settingsArray[3][1] = booleanToString(getEatFood());
settingsArray[4][0] = "SPEED";
settingsArray[4][1] = "" + getSpeed();
}
return settingsArray;
}
public void saveSettings(String[][] settings, String filename) {
try {
Properties p = new Properties();
File file = new File(filename);
file.createNewFile();
p.load(new FileInputStream(filename));
for (int a = 0; a < settings.length; a++) {
p.setProperty(settings[a][0], settings[a][1]);
}
FileOutputStream out = new FileOutputStream(filename);
p.store(out, "");
} catch (IOException ioe) {
System.out.print("saveSettings(String[][]) error: " + ioe);
}
}
public boolean settingsExist(String filename) {
File settingsFile = new File(filename);
return settingsFile.exists();
}
}
import java.awt.*;
import java.util.Map;
import com.speljohan.rsbot.bot.Bot;
import com.speljohan.rsbot.script.*;
import com.speljohan.rsbot.script.wrappers.*;
public class NestFinder extends Random {
private final int[] NEST_IDS = { 5075, 5074, 5073, 5072, 5071, 5070, 7413 };
public double getVersion() {
return 1.0;
}
public String getAuthor() {
return "Bart";
}
public String getName() {
return "NestFinder";
}
public boolean activateCondition() {
// Are we logged in?
if (!isLoggedIn()) {
return false;
}
RSTile nest = getGroundItemByID(NEST_IDS);
// Was a nest found?
if(nest != null && distanceTo(nest) <= 6) {
return true;
}
return false;
}
public int loop() {
RSTile nest = getGroundItemByID(NEST_IDS);
if(distanceTo(nest) <= 6 && getMyPlayer().getAnimation() == -1 && !getMyPlayer().isMoving()) {
atTile(nest, "Take");
wait(random(700, 700));
while(getMyPlayer().isMoving()) {
wait(random(1000, 1000));
}
return -1;
}
return -1;
}
}

