Skocz do zawartości
  • 👋 Witaj na MPCForum!

    Przeglądasz forum jako gość, co oznacza, że wiele świetnych funkcji jest jeszcze przed Tobą! 😎

    • Pełny dostęp do działów i ukrytych treści
    • Możliwość pisania i odpowiadania w tematach
    • System prywatnych wiadomości
    • Zbieranie reputacji i rozwijanie swojego profilu
    • Członkostwo w jednej z największych społeczności graczy

    👉 Dołączenie zajmie Ci mniej niż minutę – a zyskasz znacznie więcej!

    Zarejestruj się teraz

Wszystko Na Temat RSbota


menak

Rekomendowane odpowiedzi

Opublikowano

Wszystko dotyczące RsBota2 1.1v

 

Witam, tutaj zamieszczę wszystkie potrzebne informacje i porady dotyczące RsBota. Jeżeli jesteś zainteresowany i chcesz dowiedzieć się czegoś więcej zapraszam.

 

Wiele ludzi chce zacząć przygodę z RsBot'em i zadaje wiele pytań, zaśmiecając dział. Ja stworzyłem jeden temat który będę aktualizował i odpowiadał w nim na wasze pytania.

 

Download

 

Aby zacząć botować należy pierwsze ściągnąć Bota, nie zajmuje on więcej niż 1mb więc nie będzie z tym problemu.

Wchodzimy na Główną stronę RsBota i ściągamy go (zakładka pod logiem download)

Po ściągnięciu RsBota nie uruchamiamy go, ściągamy wymaganą Jave. Wiadomo instalujemy jave, i po zakończeniu instalacji odczekujemy 1-2min~ żeby java zaczęła działać i odpalamy RsBota.

RsBot będzie się updatować, choć były przypadki w których się nie updatował. Po updacie lub jeżeli go nie było to po włączeniu rs bota, zacznie nam się ładować RuneScape.

Po załadowaniu, wchodzimy na górze paska w zakładke "edit" następnie "Account" i uzupełniamy dane.

 

Username- Nick w RS'ie

Password- Hasło w RS'ie

Pin- Pin jeżeli mamy uzupełniamy.

Reward- Zostawiamy Cash

Members- Jeżeli mamy p2p

Take Break- Ważna rzecz, chodzi o to czy bot ma robić przerwy co kilka godzin, jeżeli zamierzamy botować długo polecam zaznaczyć ponieważ jest to w jakiś sposób Anti-Ban

 

Po z konfigurowaniu nie zostaje nam nic tylko Expić !

 

Uruchamianie Bota.

Po z konfigurowaniu logujemy się na postać i trzeba zastanowić się co będziemy robić? Ja myślę o miningu w Mining Guild, więc biorę i na górze na pasku klikam File następnie Run Script i teraz potrzebuje wybrać odpowiedni skrypt, łatwo się połapać po nazwie, ale jeżeli mamy trudności jest też krótki opis skryptu. Ja wybieram Guild Miner więc idę do Falandor Banku (East) staję w banku (piszę w instrukcji skryptu aby tak zrobić) i wybieram skrypt Guild Miner Po kliknięciu na linijkę z skryptem podświetla się ona na niebiesko i na dole uaktywnia się przycisk Start Script Bot powinien zacząć działać (przy niektórych skomplikowanych skryptach i wolniejszym komputerze, potrzeba odczekać kilkanaście sekund i dopiero zaczyna działać) w moim przypadku, bot idzie do Mining Guild, kopie coal i zanosi do banku. W większej ilości skryptów jest też Gui (Menu) w którym ustawia się wszystko. W Bardziej fachowych skryptach mozemy też zobaczyć specjalnie umieszczona (przeważnie na czacie lub gdzieś w rogu) tabelkę w której znajdują się informacje takie jak :

 

- Ilość zdobytego expa

- Przewidziana ilość zdobytego expa na godzinę

- Przewidziany Zarobek

- Czas działania Bota

- Oraz informacja jaką czynność wykonuje bot.

 

W Podstawowym RsBocie jest kilka (24-25) skryptów, dokładnie jest to jakiś Shit bo większość się buguje lub nie działa. Może 2-3 są dobre. Skąd wziąść więcej skryptów ? To w dalszej części Zapraszam.

 

Skrypty

 

Bardzo dużo skryptów można ściągnąć z oficjalnej Strony RsBota.

Szukamy sobie skryptu, ja posłużę się przykładem WillowChoppera

Znalazłem skrypt (w Spoilerze) :

 

import org.rsbot.script.*;
import org.rsbot.event.events.*;
import org.rsbot.script.methods.*;
import org.rsbot.event.listeners.*;
import org.rsbot.script.wrappers.*;

import java.awt.*;
import java.net.URL;
import javax.imageio.ImageIO;
import java.awt.image.BufferedImage;

@ScriptManifest(authors = "Kenneh", keywords = "willow, tree, woodcutting, draynor", name = "Kennehs Willow Chopper", description = "Chops and banks willow logs at draynor village", version = 1.337)

public class WillowChopper extends Script implements PaintListener, MessageListener {

@Override
public boolean onStart() {
	log("STARTING UP");
	loadImages();
	START_TIME = System.currentTimeMillis();
	WOODCUTTING = skills.WOODCUTTING;
	START_EXP = skills.getCurrentExp(WOODCUTTING);
	STARTING_WC_LEVEL = skills.getCurrentLevel(skills.WOODCUTTING);
	if(!inventory.containsOneOf(hatchet) && !equipment.containsOneOf(hatchet)) {
		log("PLEASE START WITH A HATCHET IN YOUR INVENTORY OR EQUIPPED");
		return false;
	} else {
		return true;
	}
}

public void Bank() {
	if(!DRAYNOR_BANK_AREA.contains(getMyPlayer().getLocation())) {
		walking.walkTileMM(DRAYNOR_BANK);
	} else {
		RSObject BANK_BOOTH = objects.getNearest(BANK_BOOTHS);
		camera.turnToObject(objects.getNearest(BANK_BOOTHS));
		BANK_BOOTH.doAction("Use-quickly");
		sleep(random(1000, 4000));
		bank.depositAllExcept(hatchet);
		if(inventory.contains(1519)) {
			bank.depositAllExcept(hatchet);
		}
		bank.close();
		status = "walking back to willows";
		walking.walkTileMM(DRAYNOR_WILLOWS);
	}
}


public void currentArea() {
	if(DRAYNOR_BANK_AREA.contains(getMyPlayer().getLocation())) {
		location = "draynor bank";
	} else if(DRAYNOR_WILLOWS_AREA.contains(getMyPlayer().getLocation())) {
		location = "draynor willows";
	} else {
		location = "UNKNOWN";
	}
}

public int loop() {
	currentArea();
	CURRENT_WC_LEVEL = skills.getCurrentLevel(skills.WOODCUTTING);
	if (interfaces.canContinue()) {
		interfaces.clickContinue();
		return random(120, 160);
	}
	if(!inventory.isFull() && location.equalsIgnoreCase("draynor willows")) {
		RSObject WILLOW = objects.getNearest(WILLOW_TREE);
		camera.turnToObject(objects.getNearest(WILLOW_TREE));
		if(WILLOW != null) {
			if((getMyPlayer().getAnimation()) == 867) {
				status = "chopping tree";
				antiban();
			} else {
				status = "searching for tree";
				antiban();
				WILLOW.doAction("Chop");
			}
		}
	} else if(!inventory.isFull() && location.equalsIgnoreCase("draynor bank")) {
		status = "walking to bank";
		walking.setRun(true);
		antiban();
		walking.walkTileMM(DRAYNOR_WILLOWS);
	} else if(inventory.isFull() && location.equalsIgnoreCase("draynor willows")) {
		status = "banking";
		antiban();
		walking.setRun(true);
		Bank();
	} else if(inventory.isFull() && location.equalsIgnoreCase("draynor bank")) {
		status = "banking";
		antiban();
		walking.setRun(true);
		Bank();
	} else if(!inventory.isFull() && location.equalsIgnoreCase("unknown")) {
		walking.walkTileMM(DRAYNOR_WILLOWS);
	} else if(inventory.isFull() && location.equalsIgnoreCase("unknown")) {
		Bank();
	}
	return(random(500, 1000));
}

@Override
public void onFinish() {
	log("Thank you for using Kennehs Willow Chopper!");
}


public void messageReceived(MessageEvent e) {
	String x = e.getMessage().toLowerCase();
	if (x.contains("you get some")) {
		LOGS_CHOPPED++;
	}
	if (x.contains("a nest")) {
		NEST_COUNT++;
	}
}

public void onRepaint(Graphics g) {
	millis = System.currentTimeMillis() - START_TIME;
	hours = millis / (1000 * 60 * 60);
	millis -= hours * (1000 * 60 * 60);
	minutes = millis / (1000 * 60);
	millis -= minutes * (1000 * 60);
	seconds = millis / 1000;

	EXP_GAINED = skills.getCurrentExp(WOODCUTTING) - START_EXP;
	EXP_HR = (int) ((EXP_GAINED) * 3600000D / (System.currentTimeMillis() - START_TIME));
	LOGS_HR = (int) ((LOGS_CHOPPED) * 3600000D / (System.currentTimeMillis() - START_TIME));
	final int percent = skills.getPercentToNextLevel(WOODCUTTING);
	int WILLOW_LOG_XP = 67;
	LOGS_TIL_LEVEL = skills.getExpToNextLevel(WOODCUTTING) / WILLOW_LOG_XP;

	g.drawImage(banner, 4, 200, null);
	g.drawString("Runtime: " + hours +":"+ minutes + ":" + seconds, 7, 265);
	g.drawString("Nests Found: " + NEST_COUNT, 7, 285);
	g.drawString("Location: " + location, 272, 285); 
	g.drawString("Logs Chopped: " + LOGS_CHOPPED, 7, 325);
	g.drawString("Logs/hour: " + LOGS_HR, 144, 265);
	g.drawString("Logs TNL: " + LOGS_TIL_LEVEL, 144, 285);
	g.drawString("Exp gained: " + EXP_GAINED, 144, 305);
	g.drawString("Exp/hour: " + EXP_HR, 144, 325);
	g.drawString("Exp TNL: " + skills.getExpToNextLevel(WOODCUTTING), 272, 265);
	g.drawString("Status: " + status, 272, 325);
	g.drawString("Current lvl: " + CURRENT_WC_LEVEL + " (" + LEVELS_GAINED + ")", 7, 305);
	g.drawString("Percent TNL: " + percent + "%", 272, 305);
	drawMouse(g);
}

public void loadImages() {
	try {
		normal = ImageIO.read(new URL("http://i54.tinypic.com/2unwz85.png"));
		clicked = ImageIO.read(new URL("http://i51.tinypic.com/24y1lxe.png"));
		banner = ImageIO.read(new URL("http://dl.dropbox.com/u/9359719/WC_LOGO.png"));
	} catch (final java.io.IOException e) {
		e.printStackTrace();
	}
}

public void antiban() {
	int b = random(0, 10);
	switch ( {
	case 1:
		if (random(0, 10) == 5) {
			log("Antiban- move mouse");
			status = "Antiban";
			mouse.moveSlightly();
			sleep(200, 600);
			mouse.moveRandomly(150, 350);
		}
		break;
	case 2:
		if (random(0, 13) == 2) {

			log("Antiban- Turn screen");
			status = "Antiban";
			camera.setAngle(random(30, 70));
			sleep(400, 1200);                

		}            
		break;
	case 3:
		if (random(0, 24) == 6) {

			log("Antiban- mouse off screen");
			mouse.moveOffScreen();
			status = "Antiban";
			sleep(random(600, random(1200, 2000)));
		}
		break;
	case 4:
		if (random(0, 18) == 3) {

			log("Antiban- Checking Xp.");
			game.openTab(1);
			status = "Antiban";
			skills.doHover(skills.INTERFACE_WOODCUTTING);                
			sleep(random(2100, 3400));
		}
		break;
	default:
		break;
	}
}

public void drawMouse(Graphics g) { // Mouse
	final double mouseX = mouse.getLocation().getX() - 8,
	mouseY = mouse.getLocation().getY() - 8;
	final double mousePressX = mouse.getPressLocation().getX() - 8,
	mousePressY = mouse.getPressLocation().getY() - 8;
	if (System.currentTimeMillis() - mouse.getPressTime() < 400) {
		g.drawImage(clicked, (int) mousePressX, (int) mousePressY, null);
	}
	g.drawImage(normal, (int) mouseX, (int) mouseY, null);
}

BufferedImage normal = null;
BufferedImage clicked = null;
BufferedImage banner = null;
public int[] BANK_BOOTHS = {2213, 2214};
public long startTime = 0, millis = 0, hours = 0, minutes = 0, seconds = 0, START_TIME = 0;
public String status, location;
public int STARTING_WC_LEVEL, CURRENT_WC_LEVEL, LEVELS_GAINED = CURRENT_WC_LEVEL - STARTING_WC_LEVEL,
LOGS_CHOPPED, START_EXP, EXP_GAINED, EXP_HR, LOGS_HR, NEST_COUNT, LOGS_TIL_LEVEL, WOODCUTTING;
public int[] hatchet = {1351, 1353, 1355, 1357, 1359};
public int[] WILLOW_TREE = {5551, 5553, 5552};
RSTile DRAYNOR_BANK = new RSTile(3092, 3243);
RSTile DRAYNOR_WILLOWS = new RSTile(3088, 3233);
RSArea DRAYNOR_BANK_AREA = new RSArea(new RSTile(3091, 3246), new RSTile(3094, 3241));
RSArea DRAYNOR_WILLOWS_AREA = new RSArea(new RSTile(3082, 3241), new RSTile(3090, 3227));
}

 

Co dalej ? Teraz przyda nam się wcześniej zainstalowana java. Kopjujemy Skrypt do nowego dowolnego edytora textu np Notatnik

Wklejamy skrypt i Plik potem Zapisz Jako.. i teraz ważna rzecz, trzeba wiedzieć jak skrypt się nazywa zazwyczaj Autor podaje jego nazwę nad skryptem, lub jak zapomniał dopisuje post niżej. Dobra Zapisz Jako... (Nazwa mojego skryptu to WillowChopper) Ja zapisuje jako WillowChoper.java ! Ważną rzeczą jest aby jak zapisujemy dodać na końcu .java ! Więc nazwa będzie "WillowChopper.java"

Teraz kopjujemy nasz nowo zapisany plik w moim przypadku WillowChopper.java do Moje Dokumenty Następnie folder RsBot(Tworzy się przy włączeniu RsBota) >> Script's i Sources Wklejamy i plik w moim przypadku WillowChopper.java i cofamy się do folderu RsBot Znajduje się tam plik o nazwie Complite-Scripts Włączamy go czekamy, aż da polecenie kliknięcia dowolnego przycisku aby zamknąć program. Jak skończy i da polecenie klikamy dowolny przycisk i Gotowe Cieszymy się nowym skryptem ;> Skrypt "WillowChopper" ścina Willow w Drayon Village ;>

To koniec ciężkiego etapu, teraz tylko skrypty i expienie,expienie,expienie...

 

UPDATE v1.1 Odpowiedź na pytanie zadane przez osobe na PW Pytanie dotyczyło tego Tematu

!Kliknij Tutaj!

Moim zdaniem nie opłaca się pieprzyć z takimi zabawkami, Po co sobie utrudniać życie ? Ten Fighter jest przeznaczony na dzieci nie umiejące dodawać skryptów. Jest mało wydajny i się buguje. Pytający zadał pytanie:

"Czy opłaca się tym expić na Giant Spiderach ?" Odpowiedź jest raczej prosta NIE. Do expienie na Giant Spiderach proponuje lepsze rozwiązanie, proponuje zaopatrzyć się w Skrypt GiantSpiderKiller, ten skrypt dodaje specjalnie dla osób którym FIGHTER nie przypadł do gustu. Zapraszam niżej do Skryptów. I Przestroga dla osób którym chce się bawić w te "ID" w tym Fighterze nie ma Anti-Bana. Proponuje zajrzeć na Oficjalne Forum RSB2 do działu "Skrypty" Pozdrawiam.

 

 

 

 

Lista przydatnych skryptów !

 

AIOFiremaker.java

 

import java.awt.BorderLayout;

import java.awt.Color;

import java.awt.Graphics;

import java.awt.Point;

import java.awt.event.ActionEvent;

import java.awt.event.ActionListener;

import java.awt.event.KeyEvent;

import java.io.BufferedReader;

import java.io.BufferedWriter;

import java.io.File;

import java.io.FileReader;

import java.io.FileWriter;

import java.io.IOException;

import java.util.ArrayList;

import java.util.HashMap;

import java.util.concurrent.ExecutorService;

import java.util.concurrent.Executors;

 

import javax.swing.DefaultComboBoxModel;

import javax.swing.JButton;

import javax.swing.JComboBox;

import javax.swing.JFrame;

import javax.swing.WindowConstants;

 

import org.rsbot.event.listeners.PaintListener;

import org.rsbot.script.Script;

import org.rsbot.script.ScriptManifest;

import org.rsbot.script.methods.Bank;

import org.rsbot.script.methods.Game;

import org.rsbot.script.methods.Skills;

import org.rsbot.script.util.Filter;

import org.rsbot.script.wrappers.*;

import org.rsbot.script.util.Timer;

import org.rsbot.util.GlobalConfiguration;

 

/**

* RSBot AIO Firemaker

*

* @author Jacmob

* @version 2.0

*/

@ScriptManifest(authors = {"Jacmob & AutoCook"}, keywords = "Firemaking", name = "AIO Firemaker (Edited by AutoCook)", version = 2.0, description = "Logs must be at bank's top, first tab.")

public class AIOFiremaker extends Script implements PaintListener {

 

private enum State {

FIREMAKE, OPEN_BANK, BANK

}

 

class AntiBan implements Runnable {

 

public void run() {

int camAlt = camera.getZ();

char LR = KeyEvent.VK_LEFT;

char UD;

if (camAlt > -1600) {

UD = KeyEvent.VK_UP;

} else if (camAlt < -2215 || random(0, 2) == 0) {

UD = KeyEvent.VK_DOWN;

} else {

UD = KeyEvent.VK_UP;

}

if (random(0, 2) == 0) {

LR = KeyEvent.VK_RIGHT;

}

 

keyboard.pressKey(LR);

try {

Thread.sleep(random(50, 400));

} catch (Exception ignored) {

}

keyboard.pressKey(UD);

try {

Thread.sleep(random(300, 700));

} catch (Exception ignored) {

}

keyboard.releaseKey(UD);

try {

Thread.sleep(random(100, 400));

} catch (Exception ignored) {

}

keyboard.releaseKey(LR);

}

 

}

 

public static final int TINDERBOX = 590;

public static final int FIRE_RING = 13659;

public static final int FLAME_GLOVES = 13660;

public static final int[] FireObjects = {2732, 2982, 2983, 2984, 2985, 2986, 1189};

 

public static final Color BG = new Color(100, 0, 0, 150);

public static final Color DROP = new Color(20, 0, 0, 255);

public static final Color TEXT = new Color(200, 255, 0, 255);

 

private int logId = 0;

private String logName = "";

private String eqString = "";

private double xpPerFire = 0;

private double xpMultiplier = 1;

private FMLocation location;

 

private int nextMinRunEnergy = random(20, 50);

private int currentZone = 0;

private int sine = 0;

private int sineM = 1;

private int scriptStartXP = 0;

private long scriptStartTime = 0;

private long lastXPCheckTime = 0;

private RSTile nextTile = null;

private RSTile blackListedTile = null;

 

private final AStar pathFinder = new AStar();

private final ExecutorService antiBanExecutor = Executors.newSingleThreadExecutor();

 

private RSTile checkTile(RSTile tile) {

if (calc.distanceTo(tile) < 17) {

return tile;

}

RSTile loc = getMyPlayer().getLocation();

RSTile walk = new RSTile((loc.getX() + tile.getX()) / 2,

(loc.getY() + tile.getY()) / 2);

return calc.distanceTo(walk) < 17 ? walk : checkTile(walk);

}

 

private void checkXP() {

if (System.currentTimeMillis() - lastXPCheckTime < 300000) {

return;

}

lastXPCheckTime = System.currentTimeMillis();

game.openTab(Game.TAB_STATS);

sleep(random(50, 500));

if (random(0, 5) != 1) {

if (random(0, 2) == 1) {

mouse.move(random(575, 695), random(240, 435), 10);

}

interfaces.getComponent(320, 85).doHover();

sleep(random(800, 3400));

}

if (random(0, 2) == 0) {

game.openTab(Game.TAB_INVENTORY);

}

}

 

private RSTile getBestFreeTile() {

RSTile nextT = getProceedingTile(getMyPlayer().getLocation());

if (nextT != null) {

RSTile nextT2 = getProceedingTile(nextT);

if (nextT2 != null && isFreeTile(nextT) && isFreeTile(nextT2)

&& !isPlayerAt(nextT) && !isPlayerAt(nextT2)) {

return nextT;

}

}

int start = 0, longest = 0, length = 0;

RSTile[] bestRow = location.zones[currentZone].rows[0].tiles;

outer:

for (int i = 0; i < location.zones[currentZone].rows.length; i++) {

RSTile[] tiles = location.zones[currentZone].rows.tiles;

// log.info("Traversing Row " + i);

for (int j = 0; j < tiles.length; j++) {

if (tiles[j] == blackListedTile) {

blackListedTile = null;

continue outer;

}

if (isFireAt(tiles[j])) {

if (j - start > length

|| (j - start >= inventory.getCount(logId) || j

- start == length)

&& calc.distanceTo(tiles[start]) < calc.distanceTo(bestRow[longest])) {

length = j - start;

longest = start;

bestRow = tiles;

// log.info(" Set Best - " + i + ", " + start + " (" +

// length + "/" + tiles.length + ")");

}

start = j + 1;

} else if (j == tiles.length - 1) {

if (j - start > length - 1

|| (j - start + 1 >= inventory.getCount(logId) || j

- start == length - 1)

&& calc.distanceTo(tiles[start]) < calc.distanceTo(bestRow[longest])) {

length = j - start + 1;

longest = start;

bestRow = tiles;

// log.info(" Set Best - " + i + ", " + start + " (" +

// length + "/" + tiles.length + ")");

}

}

}

start = 0;

}

 

// log("Calculated Best Tile: " + bestRow[longest].getX() + "," +

// bestRow[longest].getY());

if (length == 0 && start != 0) {

return null;

} else {

return bestRow[longest];

}

}

 

private RSTile getClosestTileInRegion(RSTile tile) {

RSTile loc = getMyPlayer().getLocation();

for (int i = 0; i < 1000; ++i) {

if (tileInRegion(tile)) {

return tile;

}

tile = new RSTile((loc.getX() + tile.getX()) / 2,

(loc.getY() + tile.getY()) / 2);

}

return null;

}

 

private RSTile getProceedingTile(RSTile location) {

if (location == null) {

return null;

}

FMRow[] rows = this.location.zones[currentZone].rows;

int x = location.getX(), y = location.getY();

for (FMRow row : rows) {

int start = Math.min(row.start, row.end);

int end = Math.max(row.start, row.end);

if (this.location.zones[currentZone].horizontal && y == row.pos

&& x >= start && x <= end) {

if (row.start < row.end && x + 1 <= row.end) {

return new RSTile(x + 1, y);

} else if (row.start > row.end && x - 1 >= row.end) {

return new RSTile(x - 1, y);

}

return null;

} else if (!this.location.zones[currentZone].horizontal && x == row.pos

&& y >= start && y <= end) {

if (row.start < row.end && y + 1 <= row.end) {

return new RSTile(x, y + 1);

} else if (row.start > row.end && y - 1 >= row.end) {

return new RSTile(x, y - 1);

}

return null;

}

}

return null;

}

 

private State getState() {

if (!inventory.contains(logId) || !inventory.contains(TINDERBOX)) {

if (bank.isOpen()) {

return State.BANK;

} else {

return State.OPEN_BANK;

}

} else {

return State.FIREMAKE;

}

}

 

private void highlightTile(Graphics g, RSTile t, Color outline, Color fill) {

Point pn = calc.tileToScreen(t, 0, 0, 0);

Point px = calc.tileToScreen(t, 1, 0, 0);

Point py = calc.tileToScreen(t, 0, 1, 0);

Point pxy = calc.tileToScreen(t, 1, 1, 0);

if (py.x == -1 || pxy.x == -1 || px.x == -1 || pn.x == -1) {

return;

}

g.setColor(outline);

g.drawPolygon(new int[]{py.x, pxy.x, px.x, pn.x},

new int[]{py.y, pxy.y, px.y, pn.y}, 4);

g.setColor(fill);

g.fillPolygon(new int[]{py.x, pxy.x, px.x, pn.x},

new int[]{py.y, pxy.y, px.y, pn.y}, 4);

}

 

private boolean isFireAt(RSTile location) {

RSObject obj = objects.getTopAt(location);

if (obj == null) {

return false;

}

int objID = obj.getID();

for (int i : FireObjects) {

if (objID == i) {

return true;

}

}

return false;

}

 

private boolean isFreeTile(RSTile location) {

return isInRow(location) && !isFireAt(location);

}

 

private boolean isInRow(RSTile location) {

FMRow[] rows = this.location.zones[currentZone].rows;

int x = location.getX(), y = location.getY();

for (FMRow row : rows) {

int start = Math.min(row.start, row.end);

int end = Math.max(row.start, row.end);

if (this.location.zones[currentZone].horizontal && y == row.pos

&& x >= start && x <= end

|| !this.location.zones[currentZone].horizontal && x == row.pos

&& y >= start && y <= end) {

return true;

}

}

return false;

}

 

private boolean isPlayerAt(final RSTile tile) {

return players.getAll(new Filter<RSPlayer>() {

public boolean accept(RSPlayer player) {

return player.getLocation().equals(tile);

}

}).length > 0;

}

 

@Override

public int loop() {

if (scriptStartTime == -1 && skills.getRealLevel(Skills.FIREMAKING) > 1) {

int fireLevel = skills.getRealLevel(Skills.FIREMAKING);

scriptStartTime = System.currentTimeMillis();

scriptStartXP = skills.getCurrentExp(Skills.FIREMAKING);

 

// if (equipment.containsAll(FIRE_RING, FLAME_GLOVES)) {

// log.info("Your ring and gloves will grant you 5% extra XP per log.");

// xpMultiplier = 1.05;

// eqString = " (+5%)";

// } else if (equipment.containsAll(FIRE_RING)) {

// log.info("Your Ring of Fire will grant you 2% extra XP per log.");

// if (fireLevel >= 79) {

// log.info("Flame Gloves with your ring would grant you 5% extra XP per log.");

// }

// xpMultiplier = 1.02;

// eqString = " (+2%)";

// } else if (equipment.containsAll(FLAME_GLOVES)) {

// log.info("A Ring of Fire with your gloves would grant you 5% extra XP per log.");

// xpMultiplier = 1.02;

// eqString = " (+2%)";

// } else if (fireLevel >= 79) {

// log.info("A Ring of Fire and Flame Gloves would grant you 5% extra XP per log.");

// } else if (fireLevel >= 62) {

// log.info("A Ring of Fire from 'All Fired Up' would grant you 2% extra XP per log.");

//}

} else {

mouse.setSpeed(random(5, 10));

}

State state = getState();

switch (state) {

case FIREMAKE:

if (!isFreeTile(getMyPlayer().getLocation())) {

nextTile = getBestFreeTile();

if (calc.distanceTo(nextTile) == 0) {

return random(100, 200);

}

if (nextTile != null) {

int iters = 0;

while (calc.distanceTo(nextTile) > 0) {

if (isFireAt(nextTile)) {

blackListedTile = nextTile;

return random(100, 300);

}

if (calc.tileOnScreen(nextTile) && !bank.isOpen()) {

if (inventory.isItemSelected()) {

unUse();

}

Point location = calc.tileToScreen(nextTile);

if (location.x == -1 || location.y == -1) {

break;

} else {

mouse.move(location, 5, 5);

}

if (inventory.isItemSelected()) {

RSItem item = inventory.getItem(TINDERBOX);

if (item != null) {

item.doClick(true);

}

}

tiles.doAction(nextTile, "Walk here");

sleep(random(10, 03));

if (random(0, 3) != 0) {

RSItem item = inventory.getItem(TINDERBOX);

if (item != null) {

item.getComponent().doHover();

}

}

sleep(random(5, 10));

} else {

if (walking.getEnergy() > nextMinRunEnergy) {

walking.setRun(true);

nextMinRunEnergy = random(20, 50);

}

if (calc.distanceTo(nextTile) < 16) {

walkTo(nextTile);

sleep(random(30, 50));

} else {

walkTo(nextTile);

}

}

int tries = 0;

sleep(random(1, 2));

RSTile proceeding = getProceedingTile(nextTile);

if (proceeding != null && calc.distanceTo(proceeding) == 0

&& isFreeTile(proceeding) || iters > 50

|| calc.distanceTo(nextTile) > 100) {

break;

}

iters++;

}

}

sleep(random(200,300));

} else if (bank.isOpen()) {

bank.close();

} else if (isTinderboxSelected()) {

RSTile currTile = getMyPlayer().getLocation();

if (currTile.equals(nextTile)) {

nextTile = getProceedingTile(currTile);

if (nextTile != null && !isFreeTile(nextTile)) {

nextTile = null;

}

}

RSTile secondTile = nextTile == null ? null : getProceedingTile(nextTile);

if (secondTile != null && !isFreeTile(secondTile)) {

secondTile = null;

}

boolean oneLog = inventory.getCount(logId) == 1;

RSItem item = inventory.getItem(logId);

if (item != null) {

item.getComponent().doClick();

}

if (random(0, 40) == 0) {

antiBanExecutor.submit(new AntiBan());

}

if (random(0, 100) != 0 && secondTile != null && !oneLog) {

item = inventory.getItem(TINDERBOX);

if (item != null || inventory.getCount(logId) > 1) {

item.doClick(true);

}

if (random(0, 100) != 0) {

item = inventory.getItem(logId);

if (item != null) {

mouse.move(item.getComponent().getCenter(), 30, 30);

if (mouse.getLocation().distance(item.getComponent().getCenter()) > 10) {

if (item != null) {

mouse.move(inventory.getItem(logId).getComponent().getCenter(), 8, 8);

while (getMyPlayer().getAnimation() != -1) {

sleep(random(10, 90));

}

}

}

}

}

} else if (random(0, 5) != 0 && !oneLog) {

item = inventory.getItem(TINDERBOX);

if (item != null || inventory.getCount(logId) > 1) {

item.getComponent().doHover();

while (getMyPlayer().getAnimation() != -1) {

sleep(random(10, 90));

}

}

}

if (random(0,100) == 0) {

antiBanExecutor.submit(new AntiBan());

}

while (getMyPlayer().getAnimation() != -1) {

sleep(random(10, 90));

}

} else {

if (random(0, 100) == 0) {

checkXP();

}

if (!inventory.isItemSelected()) {

//if (getMyPlayer().isMoving()) {

//}

RSItem item = inventory.getItem(TINDERBOX);

if (item != null || inventory.getCount(logId) > 1) {

item.doClick(true);

}

}

}

break;

case OPEN_BANK:

RSTile bankLoc = nearestBank();

nextTile = bankLoc;

if (walking.getEnergy() > nextMinRunEnergy) {

walking.setRun(true);

nextMinRunEnergy = random(20, 50);

}

if (inventory.isItemSelected()) {

unUse();

}

if (bankLoc == null) {

walkTo(location.bank);

} else if (calc.distanceTo(bankLoc) < 7) {

if (bank.open()) {

sleep(700);

if (getMyPlayer().isMoving()) {

sleep(1000);

}

} else {

sleep(random(200, 400));

if (!bank.open()) {

rotateCamera();

}

}

} else if (location.randomness == -1) {

walkTo(bankLoc);

} else {

walkTo(new RSTile(location.bank.getX()

+ random(0, location.randomness + 1),

location.bank.getY()

+ random(0, location.randomness + 1)));

}

break;

case BANK:

try {

bank.depositAllExcept(logId, TINDERBOX);

}

catch (Exception e) {

 

}

if (!inventory.contains(TINDERBOX)) {

withdraw(TINDERBOX, "Tinderbox", false);

sleep(1000);

if (!inventory.contains(TINDERBOX)) {

sleep(1000);

}

} else if (!inventory.contains(logId)) {

withdraw(logId, logName, true);

sleep(random(500, 800));

if (!inventory.contains(logId)) {

sleep(random(500, 700));

}

}

if (inventory.contains(logId) && random(0, 2) == 0) {

bank.close();

}

currentZone = random(0, location.zones.length);

break;

default:

break;

}

return random(500, 1000);

}

 

private RSTile nearestBank() {

RSObject booth = objects.getNearest(Bank.BANK_BOOTHS);

RSNPC BankerNPC = npcs.getNearest(Bank.BANKERS);

RSObject BankChest = objects.getNearest(Bank.BANK_CHESTS);

int minDist = 30;

if (BankChest != null) {

minDist = calc.distanceTo(BankChest);

}

if (BankerNPC != null && calc.distanceTo(BankerNPC) < minDist) {

minDist = calc.distanceTo(BankerNPC);

BankChest = null;

}

if (booth != null && calc.distanceTo(booth) < minDist) {

BankerNPC = null;

}

if (BankerNPC != null) {

return BankerNPC.getLocation();

}

if (BankChest != null) {

return BankChest.getLocation();

}

if (booth != null) {

return booth.getLocation();

}

return null;

}

 

@Override

public void onFinish() {

log.info("AIO Firemaker Stopped. You gained "

+ (skills.getCurrentExp(Skills.FIREMAKING) - scriptStartXP)

+ " XP in "

+ Timer.format(System.currentTimeMillis() - scriptStartTime) + ".");

}

 

public void onRepaint(Graphics g) {

if (game.isLoggedIn()) {

if (bank.isOpen()) {

RSItem logIF = bank.getItem(logId);

RSItem tbIF = bank.getItem(TINDERBOX);

g.setColor(Color.green);

if (logIF != null && logIF.getComponent().getAbsoluteY() < 270) {

g.drawRect(logIF.getComponent().getAbsoluteX() - 1,

logIF.getComponent().getAbsoluteY() - 1,

logIF.getComponent().getWidth() + 2,

logIF.getComponent().getHeight() + 2);

}

g.setColor(Color.blue);

if (tbIF != null && tbIF.getComponent().getAbsoluteY() < 270) {

g.drawRect(tbIF.getComponent().getAbsoluteX() - 1,

tbIF.getComponent().getAbsoluteY() - 1,

tbIF.getComponent().getWidth() + 2,

tbIF.getComponent().getHeight() + 2);

}

} else if (nextTile != null) {

highlightTile(g, nextTile, new Color(255, 0, 0, 20), new Color(255, 255, 0, 20));

}

 

if (scriptStartTime == -1) {

return;

}

 

String title = "AIOFiremaker "

+ getClass().getAnnotation(ScriptManifest.class).version()

+ " by Jacmob";

int x = 13;

int y = 26;

 

if (sine >= 84) {

sine = 84;

sineM *= -1;

} else if (sine <= 1) {

sine = 1;

sineM *= -1;

}

 

sine += sineM;

 

g.setColor(BG);

g.fill3DRect(x - 6, y, 211, 25, true);

 

g.setColor(DROP);

g.drawString(title, x + 1, y += 18);

g.setColor(TEXT);

g.drawString(title, x, y -= 1);

 

if (xpPerFire == 0) {

return;

}

 

int fireLevel = skills.getRealLevel(Skills.FIREMAKING);

int levelsGained = fireLevel - Skills.getLevelAt(scriptStartXP);

int XPGained = skills.getCurrentExp(Skills.FIREMAKING) - scriptStartXP;

int lvlPerc = skills.getPercentToNextLevel(Skills.FIREMAKING);

int XPToLevel = skills.getExpToNextLevel(Skills.FIREMAKING);

long runMillis = System.currentTimeMillis() - scriptStartTime;

 

int LogsBurned = (int) Math.round(XPGained

/ (xpPerFire * xpMultiplier));

String lvlStr = levelsGained + " lvls";

if (levelsGained == 1) {

lvlStr = "1 lvl";

}

 

g.setColor(BG);

g.fill3DRect(x - 6, y += 11, 211, 112, true);

 

g.setColor(TEXT);

if (scriptStartTime == 0) {

g.drawString("Waiting For > Lvl 1...", x, y += 17);

} else {

g.drawString("Runtime: " + Timer.format(runMillis), x, y += 17);

}

g.drawString("Gained: " + XPGained + " XP (" + lvlStr + ")", x, y += 17);

g.drawString("Burned: " + LogsBurned + " Logs" + eqString, x, y += 17);

g.drawString("Next Level: " + (fireLevel + 1) + " ("

+ (int) Math.ceil(XPToLevel / (xpPerFire * xpMultiplier))

+ " Fires)", x, y += 17);

g.drawString("Next Level: " + XPToLevel + " XP", x, y += 17);

 

g.setColor(new Color(0, 0, 0, 150));

g.fill3DRect(x, y += 8, 199, 12, true);

 

g.setColor(new Color(255 - 2 * lvlPerc,

(int) (1.7 * lvlPerc + sine), 0, 150));

g.fillRect(x + 1, y += 1, (int) (1.97 * lvlPerc), 10);

g.setColor(new Color(255, 255, 255, 50));

g.fillRect(x + 1, y, (int) (1.97 * lvlPerc), 5);

 

g.setColor(BG);

 

if (XPGained >= 1000) {

int XPPerSecond = (int) (XPGained * 1000 / runMillis);

int SecsToLevel = XPToLevel / XPPerSecond;

 

g.fill3DRect(x - 6, y += 21, 211, 59, true);

g.setColor(TEXT);

g.drawString("Next Level: "

+ Timer.format(SecsToLevel * 1000), x, y += 17);

g.drawString("Averaging: " + XPPerSecond * 3600 + " XP/hr", x,

y += 17);

g.drawString("Averaging: "

+ (int) Math.ceil(LogsBurned * 360000D / runMillis)

+ "0 Logs/hr", x, y += 17);

} else {

g.fill3DRect(x - 6, y += 21, 211, 25, true);

g.setColor(TEXT);

g.drawString("Calculating...", x, y += 17);

}

 

}

}

 

@Override

public boolean onStart() {

log.info("Waiting for options to be set...");

FMFrame gui = new FMFrame("AIO Firemaker");

while (gui.isVisible()) {

sleep(500);

}

location = gui.getSelectedLocation();

if (location == null) {

return false;

}

logId = (int) gui.getSelectedLogInfo()[0];

xpPerFire = gui.getSelectedLogInfo()[1];

logName = gui.getSelectedLogName();

scriptStartTime = -1;

log.info("Options Loaded - Burning " + logName + "...");

return true;

}

 

private void rotateCamera() {

int angle = camera.getAngle() + random(-40, 40);

if (angle < 0) {

angle += 359;

}

if (angle > 359) {

angle -= 359;

}

 

camera.setAngle(angle);

}

 

private boolean tileInRegion(RSTile tile) {

int tileX = tile.getX() - game.getBaseX(), tileY = tile.getY() - game.getBaseY();

return !(tileX < 0 || tileY < 0 || tileX > 103 || tileY > 103);

}

 

private void unUse() {

int rand = random(0, 2);

if (game.getCurrentTab() != Game.TAB_INVENTORY) {

game.openTab(Game.TAB_INVENTORY);

} else if (rand == 0) {

//game.openTab(Game.TAB_FRIENDS);

sleep(random(20, 50));

if (random(0, 3) != 0) {

mouse.move(random(575, 695), random(238, 418));

}

//game.openTab(Game.TAB_INVENTORY);

} else {

checkXP();

}

}

 

private boolean isTinderboxSelected() {

RSItem item = inventory.getSelectedItem();

return item != null && item.getID() == TINDERBOX;

}

 

public void walkTo(RSTile tile) {

if (inventory.isItemSelected()) {

RSItem item = inventory.getItem(TINDERBOX);

if (item != null) {

item.doClick(true);

}

}

RSTile dest = getMyPlayer().getLocation();

RSTile[] path = null;

if (calc.distanceBetween(tile, dest) > 1) {

dest = getClosestTileInRegion(tile);

if (dest != null) {

path = pathFinder.findPath(getMyPlayer().getLocation(), dest);

}

}

if (path == null) {

walking.walkTileMM(checkTile(tile));

return;

}

for (int i = path.length - 1; i >= 0; i--) {

if (calc.distanceTo(path) < 17) {

RSTile currDest = walking.getDestination();

if (currDest != null) {

if (calc.distanceBetween(currDest, path) <= 3) {

break;

}

}

walking.walkTileMM(checkTile(path));

sleep(random(200, 400));

RSTile cdest = walking.getDestination();

if (cdest != null && calc.distanceTo(cdest) > 6) {

sleep(random(300, 500));

}

break;

}

}

}

 

private void withdraw(int ID, String name, boolean all) {

if (!bank.isOpen()) {

return;

}

RSComponent[] scrollbox = interfaces.getComponent(

Bank.INTERFACE_BANK, Bank.INTERFACE_BANK_SCROLLBAR)

.getComponents();

if (scrollbox.length > 1) {

int scrollTop = scrollbox[0].getAbsoluteY();

if (scrollbox[1].getAbsoluteY() > scrollTop + 1) {

mouse.click(scrollbox[0].getAbsoluteX() + random(2, 4),

scrollTop + random(2, 4), true);

}

}

RSItem bankItem = bank.getItem(ID);

if (bankItem == null) {

sleep(2000);

if (bank.getItem(ID) == null) {

log.severe("Unable to withraw " + name

+ ". You will be logged out in ten seconds.");

sleep(random(9000, 11000));

bank.close();

stopScript();

}

} else if (bankItem.getComponent().getAbsoluteY() > 270

&& interfaces.getComponent(Bank.INTERFACE_BANK,

Bank.INTERFACE_BANK_BUTTON_SEARCH).doAction("Search")) {

sleep(random(1200, 1500));

int rand = random(0, Math.min(4, name.length() - 2));

keyboard.sendText(name.toLowerCase().substring(0, name.length() - rand),

false);

sleep(random(900, 1200));

bankItem = bank.getItem(ID);

if (bankItem == null

|| bankItem.getComponent().getAbsoluteY() > 270

|| !bank.getItem(ID).doAction(all ? "Withdraw-All " + name

: "Withdraw-1 " + name)

&& !bank.getItem(ID).doAction(all ? "Withdraw-All " + name

: "Withdraw-1 " + name)) {

log.severe("Unable to withraw " + name

+ ". You will be logged out in ten seconds.");

sleep(random(9000, 11000));

if (bank.isOpen()) {

bank.close();

}

stopScript();

} else {

interfaces.getComponent(Bank.INTERFACE_BANK, 50).doClick();

}

} else {

bank.getItem(ID).doAction(all ? "Withdraw-All " + name : "Withdraw-1 " + name);

}

}

 

class AStar {

 

private class Node {

 

public int x, y;

public Node parent;

public double g, f;

 

public Node(int x, int y) {

this.x = x;

this.y = y;

g = f = 0;

}

 

public boolean isAt(Node another) {

return x == another.x && y == another.y;

}

 

public RSTile toRSTile(int baseX, int baseY) {

return new RSTile(x + baseX, y + baseY);

}

 

}

 

private int[][] blocks;

 

public AStar() {

 

}

 

private Node cheapestNode(ArrayList<Node> open) {

Node c = null;

for (Node t : open) {

if (c == null || t.f < c.f) {

c = t;

}

}

return c;

}

 

private double diagonalHeuristic(Node current, Node end) {

double dx = Math.abs(current.x - end.x);

double dy = Math.abs(current.y - end.y);

double diag = Math.min(dx, dy);

double straight = dx + dy;

return Math.sqrt(2.0) * diag + straight - 2 * diag;

}

 

public RSTile[] findPath(RSTile cur, RSTile dest) {

int baseX = game.getBaseX(), baseY = game.getBaseY();

int currX = cur.getX() - baseX, currY = cur.getY() - baseY;

int destX = dest.getX() - baseX, destY = dest.getY() - baseY;

if (currX < 0 || currY < 0 || currX > 103 || currY > 103 || destX < 0

|| destY < 0 || destX > 103 || destY > 103) {

return null;

}

ArrayList<Node> closed = new ArrayList<Node>(), open = new ArrayList<Node>();

blocks = walking.getCollisionFlags(game.getPlane());

Node current = new Node(currX, currY);

Node destination = new Node(destX, destY);

open.add(current);

while (open.size() > 0) {

current = cheapestNode(open);

closed.add(current);

open.remove(open.indexOf(current));

for (Node n : getSurroundingWalkableNodes(current)) {

if (!isIn(closed, n)) {

if (!isIn(open, n)) {

n.parent = current;

n.g = current.g + getAdditionalCost(n, current);

n.f = n.g + diagonalHeuristic(n, destination);

open.add(n);

} else {

Node old = getNode(open, n);

if (current.g + getAdditionalCost(old, current) < old.g) {

old.parent = current;

old.g = current.g + getAdditionalCost(old, current);

old.f = old.g + diagonalHeuristic(old, destination);

}

}

}

}

if (isIn(closed, destination)) {

return getPath(closed.get(closed.size() - 1), baseX, baseY);

}

}

return null;

}

 

private double getAdditionalCost(Node start, Node end) {

double cost = 1.0;

if (!(start.x == end.y) || start.x == end.y) {

cost = Math.sqrt(2.0);

}

return cost;

}

 

private Node getNode(ArrayList<Node> nodes, Node key) {

for (Node n : nodes) {

if (n.isAt(key)) {

return n;

}

}

return null;

}

 

private RSTile[] getPath(Node endNode, int baseX,

int baseY) {

ArrayList<RSTile> reversePath = new ArrayList<RSTile>();

Node p = endNode;

while (p.parent != null) {

reversePath.add(p.toRSTile(baseX, baseY));

int next = (int) (Math.random() * 4 + 5);

for (int i = 0; i < next && p.parent != null; i++) {

p = p.parent;

}

}

RSTile[] fixedPath = new RSTile[reversePath.size()];

for (int i = 0; i < fixedPath.length; i++) {

fixedPath = reversePath.get(fixedPath.length - 1 - i);

}

return fixedPath;

}

 

private ArrayList<Node> getSurroundingWalkableNodes(Node t) {

ArrayList<Node> tiles = new ArrayList<Node>();

int curX = t.x, curY = t.y;

if (curX > 0 && curY < 103

&& (blocks[curX - 1][curY + 1] & 0x1280138) == 0

&& (blocks[curX - 1][curY] & 0x1280108) == 0

&& (blocks[curX][curY + 1] & 0x1280120) == 0) {

tiles.add(new Node(curX - 1, curY + 1));

}

if (curY < 103 && (blocks[curX][curY + 1] & 0x1280120) == 0) {

tiles.add(new Node(curX, curY + 1));

}

if (curX > 0 && curY < 103

&& (blocks[curX - 1][curY + 1] & 0x1280138) == 0

&& (blocks[curX - 1][curY] & 0x1280108) == 0

&& (blocks[curX][curY + 1] & 0x1280120) == 0) {

tiles.add(new Node(curX + 1, curY + 1));

}

if (curX > 0 && (blocks[curX - 1][curY] & 0x1280108) == 0) {

tiles.add(new Node(curX - 1, curY));

}

if (curX < 103 && (blocks[curX + 1][curY] & 0x1280180) == 0) {

tiles.add(new Node(curX + 1, curY));

}

if (curX > 0 && curY > 0

&& (blocks[curX - 1][curY - 1] & 0x128010e) == 0

&& (blocks[curX - 1][curY] & 0x1280108) == 0

&& (blocks[curX][curY - 1] & 0x1280102) == 0) {

tiles.add(new Node(curX - 1, curY - 1));

}

if (curY > 0 && (blocks[curX][curY - 1] & 0x1280102) == 0) {

tiles.add(new Node(curX, curY - 1));

}

if (curX < 103 && curY > 0

&& (blocks[curX + 1][curY - 1] & 0x1280183) == 0

&& (blocks[curX + 1][curY] & 0x1280180) == 0

&& (blocks[curX][curY - 1] & 0x1280102) == 0) {

tiles.add(new Node(curX + 1, curY - 1));

}

return tiles;

}

 

private boolean isIn(ArrayList<Node> nodes, Node key) {

return getNode(nodes, key) != null;

}

}

 

}

 

class FMFrame extends JFrame {

 

/**

* AIO Firemaker Swing GUI Class

*/

private static long serialVersionUID = -6177554547983230084L;

private int currentLogs;

private String currentLogName;

private JComboBox logsBox;

private JComboBox locationsBox;

private FMLocation currentLocation;

private HashMap<Integer, Double> XPMap;

private HashMap<String, Integer> logMap;

private HashMap<String, FMLocation> locationMap;

 

public FMLocation[] LOCATIONS;

public File SETTINGS_FILE = new File(new File(

GlobalConfiguration.Paths.getSettingsDirectory()), "AIOFM.txt");

 

public FMFrame(String title) {

super(title);

 

/*

* LOCATIONS ARRAY

*

* FMLocation("Name", FMZone[], (RSTile)bankLocation, (int)randomness)

* FMZone(FMRow[], (boolean)horizontal) FMRow((int)startpos,

* (int)endpos, (int)otheraxispos)

*

* If a zone is horizontal, starpos and endpos for all rows will refer

* to the x axis and otheraxispos will refer to the y position. As far

* as I have seen all firemaking runs from east to west, so horizontal =

* true && endpos < startpos The randomness for each location determins

* how it will walk to the bank tile. If -1 is specified, it will walk

* directly to the found bank if possible, otherwise the script will

* always walk to bankLocation, with the randomness specified. 0 = no

* randomness, 1 = one tile randomness etc.

*/

LOCATIONS = new FMLocation[]{

 

new FMLocation("Grand Exchange", new FMZone[]{

new FMZone(new FMRow[]{new FMRow(3172, 3157, 3484),

new FMRow(3178, 3151, 3483),

new FMRow(3178, 3151, 3482),

new FMRow(3169, 3161, 3481)}, true),

new FMZone(new FMRow[]{new FMRow(3173, 3156, 3494),

new FMRow(3172, 3157, 3495),

new FMRow(3178, 3151, 3496),

new FMRow(3178, 3151, 3497),

new FMRow(3168, 3161, 3498)}, true)},

new RSTile(3162, 3490), 1),

 

new FMLocation("Draynor Village", new FMZone[]{new FMZone(

new FMRow[]{new FMRow(3097, 3077, 3249),

new FMRow(3098, 3072, 3248),

new FMRow(3095, 3081, 3247)}, true)},

new RSTile(3093, 3244), 0),

 

new FMLocation("Fist of Guthix", new FMZone[]{new FMZone(

new FMRow[]{new FMRow(1717, 1676, 5601),

new FMRow(1718, 1676, 5600),

new FMRow(1718, 1676, 5599),

new FMRow(1718, 1676, 5598),

new FMRow(1718, 1676, 5597)}, true)},

new RSTile(1703, 5599), -1),

 

new FMLocation("Varrock West", new FMZone[]{new FMZone(

new FMRow[]{new FMRow(3199, 3175, 3431),

new FMRow(3199, 3168, 3430),

new FMRow(3199, 3168, 3429),

new FMRow(3199, 3168, 3428)}, true)},

new RSTile(3183, 3435), 0),

 

new FMLocation("Varrock East", new FMZone[]{new FMZone(

new FMRow[]{new FMRow(3265, 3241, 3429),

new FMRow(3265, 3241, 3428),

new FMRow(3257, 3255, 3427),

new FMRow(3252, 3250, 3427)}, true)},

new RSTile(3253, 3421), 0),

 

new FMLocation("Falador East", new FMZone[]{new FMZone(

new FMRow[]{new FMRow(3032, 3005, 3359),

new FMRow(3032, 3005, 3360),

new FMRow(3032, 3001, 3361),

new FMRow(3032, 3001, 3362),

new FMRow(3032, 3001, 3363)}, true)},

new RSTile(3012, 3356), 0),

 

new FMLocation("Yanille", new FMZone[]{new FMZone(

new FMRow[]{new FMRow(2606, 2577, 3099),

new FMRow(2606, 2577, 3098),

new FMRow(2606, 2578, 3097)}, true)},

new RSTile(2612, 3092), 0)

 

};

 

currentLocation = null;

logsBox = new JComboBox();

locationsBox = new JComboBox();

XPMap = new HashMap<Integer, Double>();

logMap = new HashMap<String, Integer>();

locationMap = new HashMap<String, FMLocation>();

setupFrame();

setVisible(true);

}

 

public FMLocation getSelectedLocation() {

return currentLocation;

}

 

public double[] getSelectedLogInfo() {

return new double[]{currentLogs, XPMap.get(currentLogs)};

}

 

public String getSelectedLogName() {

return currentLogName;

}

 

private void setupFrame() {

 

// FRAME

 

setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);

setResizable(false);

setAlwaysOnTop(true);

setLocationRelativeTo(null);

setSize(200, 120);

 

// START BUTTON

 

JButton startButton = new JButton("Start");

add(startButton, BorderLayout.SOUTH);

startButton.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent evt) {

 

currentLocation = locationMap.get(locationsBox

.getSelectedItem().toString());

currentLogs = logMap.get(logsBox.getSelectedItem().toString());

currentLogName = logsBox.getSelectedItem().toString();

 

// WRITE TO SETTINGS FILE

 

try {

BufferedWriter out = new BufferedWriter(

new FileWriter(SETTINGS_FILE));

out.write(currentLogName + ":"

+ locationsBox.getSelectedItem().toString());

out.close();

} catch (Exception ignored) {

}

 

// DISPOSE

 

setVisible(false);

dispose();

}

});

 

// COMBO BOXES

 

String[] locations = new String[LOCATIONS.length];

 

/*

* LOG ARRAYS

*

* The following three arrays must be the same length, with

* <code>logs</code> referring to the log name, <code>logIDs</code>

* referring to the log ID, and <code>logXPs</code> referring to the

* firemaking XP gained each time a log of that kind is burned.

*

* Each string in (String[] logs) must be the correct name of the item

* specified in logIDs or the script will be unable to withdraw the logs

* from the bank.

*/

String[] logs = {"Logs", "Oak logs", "Willow logs",

"Maple logs", "Yew logs", "Magic logs"};

int[] logIDs = {1511, 1521, 1519, 1517, 1515, 1513};

double[] logXPs = {40.0, 60.0, 90.0, 135.0, 202.5, 303.8};

 

for (int i = 0; i < logs.length; i++) {

logMap.put(logs, logIDs);

XPMap.put(logIDs, logXPs);

}

 

for (int i = 0; i < locations.length; i++) {

locations = LOCATIONS.name;

locationMap.put(locations, LOCATIONS);

}

 

locationsBox.setModel(new DefaultComboBoxModel(locations));

add(locationsBox, BorderLayout.CENTER);

 

logsBox.setModel(new DefaultComboBoxModel(logs));

add(logsBox, BorderLayout.NORTH);

 

// LOAD SAVED SELECTIONS FROM SETTINGS FILE

 

try {

 

BufferedReader in = new BufferedReader(new FileReader(

SETTINGS_FILE));

String line;

String[] opts = {};

 

while ((line = in.readLine()) != null) {

if (line.contains(":")) {

opts = line.split(":");

}

}

in.close();

if (opts.length == 2) {

logsBox.setSelectedItem(opts[0]);

locationsBox.setSelectedItem(opts[1]);

}

} catch (IOException ignored) {

}

 

}

 

}

 

class FMLocation {

public String name;

public FMZone[] zones;

public RSTile bank;

public int randomness;

 

public FMLocation(String name, FMZone[] zones,

RSTile bank, int randomness) {

this.name = name;

this.zones = zones;

this.bank = bank;

this.randomness = randomness;

}

}

 

class FMRow {

public RSTile[] tiles;

public int start, end, pos;

 

public FMRow(int start, int end, int pos) {

this.start = start;

this.end = end;

this.pos = pos;

}

 

public void generateTiles(boolean horizontal) {

int length = Math.abs(end - start) + 1;

tiles = new RSTile[length];

if (end > start) {

if (horizontal) {

for (int i = 0; i < length; i++) {

tiles = new RSTile(start + i, pos);

}

} else {

for (int i = 0; i < length; i++) {

tiles = new RSTile(pos, start + i);

}

}

} else {

if (horizontal) {

for (int i = 0; i < length; i++) {

tiles = new RSTile(start - i, pos);

}

} else {

for (int i = 0; i < length; i++) {

tiles = new RSTile(pos, start - i);

}

}

}

}

 

}

 

class FMZone {

public FMRow[] rows;

public boolean horizontal;

 

public FMZone(FMRow[] fmRows, boolean horizontal) {

rows = fmRows;

this.horizontal = horizontal;

for (FMRow r : rows) {

r.generateTiles(horizontal);

}

}

 

}

 

 

Cooker.java

 

import java.awt.BasicStroke;

import java.awt.Color;

import java.awt.Container;

import java.awt.Dimension;

import java.awt.Font;

import java.awt.Graphics;

import java.awt.Graphics2D;

import java.awt.Point;

import java.awt.Polygon;

import java.awt.Rectangle;

import java.awt.RenderingHints;

import java.awt.event.ActionEvent;

import java.awt.event.ActionListener;

import java.awt.image.BufferedImage;

import java.io.BufferedReader;

import java.io.BufferedWriter;

import java.io.FileWriter;

import java.io.IOException;

import java.io.InputStreamReader;

import java.io.PrintWriter;

import java.net.MalformedURLException;

import java.net.URL;

import java.net.URLConnection;

import java.util.regex.Matcher;

import java.util.regex.Pattern;

 

import javax.imageio.ImageIO;

import javax.swing.DefaultComboBoxModel;

import javax.swing.JButton;

import javax.swing.JCheckBox;

import javax.swing.JComboBox;

import javax.swing.JFileChooser;

import javax.swing.JFrame;

import javax.swing.JLabel;

import javax.swing.JOptionPane;

import javax.swing.JSlider;

import javax.swing.WindowConstants;

import javax.swing.border.TitledBorder;

 

import org.rsbot.event.events.MessageEvent;

import org.rsbot.event.events.ServerMessageEvent;

import org.rsbot.event.listeners.MessageListener;

import org.rsbot.event.listeners.PaintListener;

import org.rsbot.event.listeners.ServerMessageListener;

import org.rsbot.script.Script;

import org.rsbot.script.ScriptManifest;

import org.rsbot.script.methods.Bank;

import org.rsbot.script.methods.Game;

import org.rsbot.script.methods.Skills;

import org.rsbot.script.wrappers.RSModel;

import org.rsbot.script.wrappers.RSObject;

import org.rsbot.script.wrappers.RSTile;

import org.rsbot.util.GlobalConfiguration;

 

@ScriptManifest(authors = { "Pecka" }, keywords = "Cooking", name = "Cooker", version = 1.56, description = "A script that cook`s food")

public class Cooker extends Script implements PaintListener,

MessageListener {

 

public boolean GuiWait = true, GuiExit = false;

CookersGUI Gui;

String status;

String serverString, food;

int foodID = 0;

int cookedfoodID = 0;

BufferedImage normal = null;

BufferedImage clicked = null;

// Paint stuff

int startXP = 0;

int startLvl = 0;

int foodCooked = 0;

int foodCookedph = 0;

int lvl = 0;

int gainedXP = 0;

int gainedLVL = 0;

int xpPerHour = 0;

int[] rangeID = { 25730 };

int percent;

int nxtlvl;

int xptlnxtlvl;

int mousespeed;

 

long runTime = 0;

long seconds = 0;

long minutes = 0;

long hours = 0;

long startTime = System.currentTimeMillis();

// interfaces.getComponent(905, 14);

boolean cooking, antiban, lobby,olmostCooking=false;

String foodName = "";

 

@Override

public boolean onStart() {

if (JOptionPane

.showConfirmDialog(

null,

"Would you like to check for updates?\nPlease Note this requires an internet connection and the script will write files to your harddrive!") == 0) {

checkForUpdates();

}

 

startTime = System.currentTimeMillis();

Gui = new CookersGUI();

Gui.setVisible(true);

while (GuiWait) {

status = "Waiting for the GUI";

sleep(100);

}

try {

final URL cursorURL = new URL("http://dl.dropbox.com/u/3900566/Mouse.png");

final URL cursor80URL = new URL("http://dl.dropbox.com/u/3900566/click.png");

normal = ImageIO.read(cursorURL);

clicked = ImageIO.read(cursor80URL);

} catch (MalformedURLException e) {

log("Unable to buffer cursor.");

} catch (IOException e) {

log("Unable to open cursor image.");

}

startXP = skills.getCurrentExp(Skills.getIndex("COOKING"));

startLvl = skills.getCurrentLevel(Skills.getIndex("COOKING"));

camera.setPitch(true);

if (GuiExit) {

return false;

} else {

return true;

}

}

 

private enum State {

GO_BANK, BANK_ITEMS, GO_RANGE, COOK_FOOD, WAIT_TILL_COOK, IDK

}

 

private enum LocationState {

AT_BANK, AT_RANGE, UNK_1

}

 

// Tiles, used in location handler and walking and such.

RSTile bankTile = new RSTile(3269, 3167);

RSTile rangeTile = new RSTile(3273, 3180);

 

State useRange() {

if (objects.getNearest(rangeID) != null) {

if(isIdle()&&!interfaces.getComponent(905, 14).isValid()){

inventory.getItem(foodID).doClick(true);

sleep(400, 800);

}

if (inventory.isItemSelected()) {

if (!interfaces.getComponent(905, 14).isValid()) {

RSObject range = objects.getNearest(rangeID);

if (!interfaces.getComponent(905, 14).isValid()) {

if (food.equals("Sweetcorn")) {

doModelAction(range, "Use Sweetcorn -> Range");

} else {

doModelAction(range, "Use Raw " + foodName

+ " -> Range");

}

sleep(100, 150);

while (getMyPlayer().isMoving()) {

sleep(50);

}

sleep(1200, 1500);

}

}

}

if (interfaces.getComponent(905, 14).isValid()) {

interfaces.getComponent(905, 14).doClick();

cooking = true;

status = "Cooking";

sleep(3000, 4000);

return State.WAIT_TILL_COOK;

}

}

return State.IDK;

}

 

private boolean doModelAction(RSObject obj, String act) {

try{

if (obj == null)

return false;

 

if (obj.isOnScreen()) {

Point p = obj.getModel().getPoint();

if (p.x != -1 && p.y != -1) {

mouse.move(p);

if (menu.getIndex(act) == 0) {

if (menu.getIndex(act) == 0) {

mouse.click(true);

return true;

}

} else {

mouse.click(false);

sleep(100);

if (menu.isOpen()) {

menu.clickIndex(menu.getIndex(act));

return true;

}

}

return false;

}

}

return false;

}catch(Exception e){

log("Holy shit we just had an error if the script stops...");

log("Please tell that on forums....");

}

return false;

}

 

boolean dowehavefood() {

if (bank.isOpen()) {

if (bank.getCount(foodID) >= 1) {

return true;

}

}

return false;

}

 

void Logout() {

if (bank.isOpen()) {

bank.close();

sleep(700);

}

if (lobby) {

env.saveScreenshot(true);

game.logout(true);

sleep(500, 600);

stopScript();

} else {

env.saveScreenshot(true);

game.logout(false);

sleep(500, 600);

stopScript();

}

}

 

boolean checkRun() {

if (walking.getEnergy() >= 40) {

walking.setRun(true);

}

return true;

}

 

public int loop() {

checkRun();

while (getMyPlayer().isMoving()) {

sleep(100);

}

State stateSelector = getState();

switch (stateSelector) {

case GO_BANK:

walking.walkTileMM(bankTile);

status = "Going to bank";

break;

case BANK_ITEMS:

status = "Banking";

if (!bank.isOpen()) {

bank.open();

}

if (bank.isOpen()) {

if (inventory.contains(cookedfoodID)) {

bank.depositAll();

sleep(500, 700);

}

if (!inventory.contains(foodID) && dowehavefood()) {

bank.withdraw(foodID, 0);

sleep(700, 1000);

} else {

Logout();

}

}

break;

case GO_RANGE:

walking.walkTileMM(rangeTile);

status = "Going to range";

break;

case COOK_FOOD:

status = "Going to cook";

try{

useRange();

}catch(Exception e){

log("We just had an error! :O");

log("But i catched it and now we are doing the thing we did :D :D");

}

break;

case WAIT_TILL_COOK:

while (cooking) {

if (isIdle()) {

cooking = false;

}

if (interfaces.canContinue()) {

interfaces.clickContinue();

}

status = "Cooking";

if (antiban) {

antiban();

}

if (inventory.contains(foodID)) {

sleep(100);

}

if (!inventory.contains(foodID)) {

cooking = false;

}

}

break;

case IDK:

status = "WTF?We dont know wat were doing!";

sleep(400, 500);

break;

}

return random(100, 200);

}

 

private State getState() {

LocationState currentLoc = getCurrentLocation();

if (!inventory.contains(foodID)) {

switch (currentLoc) {

case AT_BANK:

return State.BANK_ITEMS;

case AT_RANGE:

case UNK_1:

return State.GO_BANK;

}

} else {

switch (currentLoc) {

case AT_BANK:

case UNK_1:

return State.GO_RANGE;

case AT_RANGE:

if (cooking) {

return State.WAIT_TILL_COOK;

} else {

return State.COOK_FOOD;

}

}

}

return State.IDK;

}

 

private LocationState getCurrentLocation() {

if (calc.distanceBetween(bankTile, getMyPlayer().getLocation()) <= 6) {

return LocationState.AT_BANK;

}

if (calc.distanceBetween(rangeTile, getMyPlayer().getLocation()) <= 8) {

return LocationState.AT_RANGE;

}

return LocationState.UNK_1;

}

 

public void antiban() {

status = "Antiban";

switch (random(0, 1800)) {

case 0:

case 1:

case 2:

case 3:

case 4:

case 5:

camera.setAngle(camera.getAngle() + random(-30, 30));

break;

case 6:

case 7:

case 8:

case 10:

case 11:

case 12:

case 13:

case 14:

case 15:

camera.setAngle(camera.getAngle() + random(-15, 60));

break;

case 17:

case 18:

case 19:

case 20:

case 21:

mouse.moveSlightly();

break;

case 22:

case 23:

case 24:

case 25:

case 26:

if (game.getCurrentTab() == Game.TAB_INVENTORY && !bank.isOpen()) {

game.openTab(Game.TAB_STATS);

 

}

if (game.getCurrentTab() == Game.TAB_STATS) {

skills.doHover(Skills.INTERFACE_COOKING);

sleep(1500, 4000);

}

break;

case 27:

case 28:

case 29:

case 30:

case 31:

game.openTab(Game.TAB_FRIENDS);

sleep(1500, 2000);

break;

case 32:

case 33:

case 34:

case 35:

case 36:

game.openTab(Game.TAB_QUESTS);

sleep(1500, 2000);

break;

 

default:

break;

}

}

 

private boolean isIdle() {

// Credits to Shoyukenn for this methode!

byte totalTickCount = 0;

while (totalTickCount <= 100) {

totalTickCount += 1;

if (getMyPlayer().getAnimation() != -1) {

return false;

}

sleep(10);

}

return true;

}

 

private final RenderingHints antialiasing = new RenderingHints(

RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);

 

private final Color color1 = new Color(102, 102, 102, 189);

private final Color color2 = new Color(0, 0, 0);

private final Color color3 = new Color(255, 255, 255);

private final Color color4 = new Color(0, 102, 102);

private final Color color5 = new Color(31, 191, 193);

 

private final BasicStroke stroke1 = new BasicStroke(1);

 

private final Font font1 = new Font("Arial", 0, 20);

private final Font font2 = new Font("Arial", 0, 10);

private final Font font3 = new Font("Arial", 0, 15);

private final Font font4 = new Font("Arial", 0, 13);

 

void paintObject(int[] id, Graphics g, Color color) {

RSObject obj = objects.getNearest(id);

if (obj != null) {

RSModel model = obj.getModel();

if (model != null) {

g.setColor(color);

for (Polygon p : model.getTriangles()) {

g.fillPolygon(p);

}

}

}

}

 

public void onRepaint(Graphics g1) {

Graphics2D g = (Graphics2D) g1;

g.setRenderingHints(antialiasing);

 

// Mouse

if (normal != null) {

final int mouse_x = mouse.getLocation().x;

final int mouse_y = mouse.getLocation().y;

final int mouse_x2 = mouse.getPressLocation().x;

final int mouse_y2 = mouse.getPressLocation().y;

final long mpt = System.currentTimeMillis() - mouse.getPressTime();

if (mouse.getPressTime() == -1 || mpt >= 1000) {

g.drawImage(normal, mouse_x - 8, mouse_y - 8, null);

}

if (mpt < 1000) {

g.drawImage(clicked, mouse_x2 - 8, mouse_y2 - 8, null);

g.drawImage(normal, mouse_x - 8, mouse_y - 8, null);

}

}

// Object painting

if (objects.getNearest(rangeID).isOnScreen()) {

paintObject(rangeID, g, (new Color(0, 255, 0, 134)));

}

if (objects.getNearest(Bank.BANK_BOOTHS).isOnScreen() && !bank.isOpen()) {

paintObject(Bank.BANK_BOOTHS, g, new Color(0, 51, 204, 134));

}

// Time running stuff

runTime = 0;

seconds = 0;

minutes = 0;

hours = 0;

runTime = System.currentTimeMillis() - startTime;

seconds = runTime / 1000;

if (seconds >= 60) {

minutes = seconds / 60;

seconds -= (minutes * 60);

}

if (minutes >= 60) {

hours = minutes / 60;

minutes -= (hours * 60);

}

foodCookedph = (int) ((3600000.0 / (double) runTime) * foodCooked);

gainedXP = skills.getCurrentExp(Skills.getIndex("COOKING")) - startXP;

gainedLVL = skills.getCurrentLevel(Skills.getIndex("COOKING"))

- startLvl;

xpPerHour = (int) ((3600000.0 / (double) runTime) * gainedXP);

lvl = skills.getCurrentLevel(Skills.getIndex("COOKING"));

percent = skills.getPercentToNextLevel(Skills.getIndex("COOKING"));

nxtlvl = skills.getCurrentLevel(Skills.getIndex("COOKING")) + 1;

xptlnxtlvl = skills.getExpToNextLevel(Skills.getIndex("COOKING"));

 

g.setColor(color1);

g.fillRoundRect(5, 166, 181, 154, 16, 16);

g.setColor(color2);

g.setStroke(stroke1);

g.drawRoundRect(5, 166, 181, 154, 16, 16);

g.setFont(font1);

g.setColor(color3);

g.drawString("Cooker", 67, 185);

g.setFont(font2);

g.drawString("By Pecka", 98, 194);

g.setFont(font3);

g.drawString("Time running:" + hours + ":" + minutes + ":" + seconds,

6, 211);

g.drawString("Food cooked:" + foodCooked, 7, 224);

g.drawString("Food cooked/h:" + foodCookedph, 7, 237);

g.drawString("Cooking xp gained:" + gainedXP, 7, 250);

g.drawString("Cooking xp/h:" + xpPerHour, 7, 264);

g.drawString("Cooking lvl:" + lvl + "(" + gainedLVL + ")", 7, 277);

g.drawString("Status:" + status, 7, 291);

g.setColor(color4);

g.fillRoundRect(9, 297, 175, 19, 16, 16);

g.setColor(color2);

g.drawRoundRect(9, 297, 175, 19, 16, 16);

g.setColor(color5);

g.fillRoundRect(10, 298, (int) (percent * 175 / 100.0), 18, 16, 16);

g.setColor(color3);

g.setFont(font4);

g.drawString("" + percent + "% to " + nxtlvl + " Cooking" + " - "

+ xptlnxtlvl / 1000 + "k XP", 15, 313);

g.setFont(font2);

g.drawString("V" + Cooker.class.getAnnotation(ScriptManifest.class).version(), 12, 178);

}

 

public class CookersGUI extends JFrame {

 

private static final long serialVersionUID = 1L;

 

public CookersGUI() {

initComponents();

}

 

private void button1ActionPerformed(ActionEvent e) {

food = comboBox1.getSelectedItem().toString();

if (food.equals("Shrimp")) {

foodName = "Shrimps";

foodID = 317;

cookedfoodID = 315;

} else if (food.equals("Crayfish")) {

foodName = "Crayfish";

foodID = 13435;

cookedfoodID = 13433;

} else if (food.equals("Chicken")) {

foodName = "Chicken";

foodID = 2138;

cookedfoodID = 2140;

} else if (food.equals("Anchovies")) {

foodName = "Anchovies";

foodID = 321;

cookedfoodID = 319;

} else if (food.equals("Sardine")) {

foodName = "Sardine";

foodID = 327;

cookedfoodID = 325;

} else if (food.equals("Herring")) {

foodName = "Herring";

foodID = 345;

cookedfoodID = 347;

} else if (food.equals("Trout")) {

foodName = "Trout";

foodID = 335;

cookedfoodID = 333;

} else if (food.equals("Pike")) {

foodName = "Pike";

foodID = 349;

cookedfoodID = 351;

} else if (food.equals("Salmon")) {

foodName = "Salmon";

foodID = 331;

cookedfoodID = 329;

} else if (food.equals("Tuna")) {

foodName = "Tuna";

foodID = 359;

cookedfoodID = 361;

} else if (food.equals("Lobster")) {

foodName = "Lobster";

foodID = 377;

cookedfoodID = 379;

} else if (food.equals("Bass")) {

foodName = "Bass";

foodID = 363;

cookedfoodID = 365;

} else if (food.equals("Swordfish")) {

foodName = "Swordfish";

foodID = 371;

cookedfoodID = 373;

} else if (food.equals("Monkfish")) {

foodName = "Monkfish";

foodID = 7944;

cookedfoodID = 7946;

} else if (food.equals("Shark")) {

foodName = "Shark";

foodID = 383;

cookedfoodID = 385;

} else if (food.equals("Sweetcorn")) {

foodName = "Sweetcorn";

foodID = 5986;

cookedfoodID = 5988;

}

if (checkBox1.isSelected()) {

antiban = true;

}

if (checkBox2.isSelected()) {

lobby = true;

}

mousespeed = slider1.getValue();

mouse.setSpeed(mousespeed);

log("Food we are going to cook:"+foodName);

log("ID:"+foodID);

log("Cooked ID:"+cookedfoodID);

GuiWait = false;

Gui.dispose();

}

 

private void button2ActionPerformed(ActionEvent e) {

GuiWait = false;

Gui.dispose();

GuiExit = true;

}

 

private void initComponents() {

label1 = new JLabel();

label2 = new JLabel();

button1 = new JButton();

button2 = new JButton();

comboBox1 = new JComboBox();

checkBox1 = new JCheckBox();

checkBox2 = new JCheckBox();

slider1 = new JSlider();

 

// ======== this ========

setTitle("Cooker`sGUI");

setResizable(false);

setFont(new Font("Arial Black", Font.BOLD, 12));

setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);

setAlwaysOnTop(true);

Container contentPane = getContentPane();

contentPane.setLayout(null);

 

// ---- label1 ----

label1.setText("Cooker`s GUI");

label1.setFont(new Font("Arial Black", Font.BOLD, 16));

contentPane.add(label1);

label1.setBounds(65, 5, 130, 25);

 

// ---- label2 ----

label2.setText("Food that were going to cook:");

label2.setFont(label2.getFont().deriveFont(

label2.getFont().getSize() + 1f));

contentPane.add(label2);

label2.setBounds(new Rectangle(new Point(5, 40), label2

.getPreferredSize()));

 

// ---- button1 ----

button1.setText("Start");

button1.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent e) {

button1ActionPerformed(e);

}

});

contentPane.add(button1);

button1.setBounds(50, 160, 65, 28);

 

// ---- button2 ----

button2.setText("Exit");

button2.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent e) {

button2ActionPerformed(e);

}

});

contentPane.add(button2);

button2.setBounds(135, 160, 65, 28);

 

// ---- comboBox1 ----

comboBox1.setModel(new DefaultComboBoxModel(new String[] {

"Shrimp", "Crayfish", "Chicken", "Anchovies", "Sardine",

"Herring", "Trout", "Pike", "Salmon", "Tuna", "Lobster",

"Bass", "Swordfish", "Monkfish", "Shark","Sweetcorn" }));

contentPane.add(comboBox1);

comboBox1.setBounds(new Rectangle(new Point(175, 40), comboBox1

.getPreferredSize()));

 

// ---- checkBox1 ----

checkBox1.setText("Antiban?");

contentPane.add(checkBox1);

checkBox1.setBounds(5, 65, checkBox1.getPreferredSize().width, 18);

 

// ---- checkBox2 ----

checkBox2.setText("Logout to lobby?");

contentPane.add(checkBox2);

checkBox2.setBounds(75, 65, checkBox2.getPreferredSize().width, 18);

 

// ---- slider1 ----

slider1.setValue(10);

slider1.setSnapToTicks(true);

slider1.setPaintTicks(true);

slider1.setMaximum(11);

slider1.setMinimum(3);

slider1.setMajorTickSpacing(1);

slider1.setBorder(new TitledBorder("Mouse speed"));

slider1.setPaintLabels(true);

contentPane.add(slider1);

slider1.setBounds(10, 85, slider1.getPreferredSize().width, 60);

 

contentPane.setPreferredSize(new Dimension(265, 225));

setSize(265, 225);

setLocationRelativeTo(getOwner());

}

 

private JLabel label1;

private JLabel label2;

private JButton button1;

private JButton button2;

private JComboBox comboBox1;

private JCheckBox checkBox1;

private JCheckBox checkBox2;

private JSlider slider1;

}

 

private static final String UPDATER_FILE_NAME = "Cooker.java";

private static final String UPDATER_URL = "http://dl.dropbox.com/u/17610658/Cooker.java";

private static final Pattern UPDATER_VERSION_PATTERN = Pattern

.compile("version\\s*=\\s*([0-9.]+)");

 

private boolean checkForUpdates() {

try {

/*

* Get the current version from the Script Manifest annotation

* defined at the top of your script's class

*/

double currentVer = Cooker.class.getAnnotation(

ScriptManifest.class).version();

double newVer = -1;

URL url = new URL(UPDATER_URL);

/* Open a stream to the newest script file hosted on your server */

BufferedReader in = new BufferedReader(new InputStreamReader(

url.openStream()));

String line, lines = "";

Matcher m;

/*

* Look for the "version = x.x" string in the newer file to figure

* out the newest version number

*/

while ((line = in.readLine()) != null) {

lines += line + "\n";

if ((m = UPDATER_VERSION_PATTERN.matcher(line)).find()) {

newVer = Double.parseDouble(m.group(1));

break;

}

}

/* Check if the updater was unable to read the newest version number */

if (newVer < 0) {

in.close();

log("Unable to find the new version number. Update failed");

return false;

}

/* Compare the current version to the newest. */

if (currentVer == newVer) {

in.close();

log("You already have the latest version of the script.");

return false;

}

/*

* The current version is less than the newest version, so we need

* to download it

*/

log("Update found! Downloading version " + newVer);

/* Figure out where to save the file */

String scriptFilePath = GlobalConfiguration.Paths

.getScriptsSourcesDirectory() + "\\" + UPDATER_FILE_NAME;

PrintWriter out = new PrintWriter(scriptFilePath);

/* Print the cached lines from the version checking */

out.print(lines);

/* Print the rest of the file */

while ((line = in.readLine()) != null)

out.println(line);

/* Close the streams */

out.close();

in.close();

log("Successfully saved " + UPDATER_FILE_NAME + " to "

+ GlobalConfiguration.Paths.getScriptsSourcesDirectory());

log("Compiling...");

try {

/* Attempt to compile the downloaded version */

Runtime.getRuntime().exec(

new String[] { "javac", "-classpath", "RSBot.jar",

scriptFilePath });

} catch (Exception ex) {

log("Could not compile the script. Please manually compile to finish the update.");

return false;

}

log("Update successful!");

log("The new version will appear near the bottom of the script selector.");

log("Stop and restart the script to run the newer version.");

return true;

} catch (IOException e) {

log(e.toString());

log("Update failed.");

}

return false;

}

 

@Override

public void messageReceived(MessageEvent e) {

serverString = e.getMessage();

if (serverString.toLowerCase().contains("roast")) {

foodCooked++;

}

if (serverString.toLowerCase().contains("cook")) {

foodCooked++;

}

}

}

 

 

FixedSmartSmelter.java

 

import java.awt.BorderLayout;

import java.awt.Color;

import java.awt.Container;

import java.awt.Font;

import java.awt.Graphics;

import java.awt.GridBagConstraints;

import java.awt.GridBagLayout;

import java.awt.Insets;

import java.awt.event.ActionEvent;

import java.awt.event.ActionListener;

import java.awt.event.KeyAdapter;

import java.awt.event.KeyEvent;

import java.awt.event.WindowAdapter;

import java.awt.event.WindowEvent;

import java.io.BufferedReader;

import java.io.BufferedWriter;

import java.io.File;

import java.io.FileReader;

import java.io.FileWriter;

import java.io.IOException;

 

import javax.swing.DefaultComboBoxModel;

import javax.swing.JButton;

import javax.swing.JCheckBox;

import javax.swing.JComboBox;

import javax.swing.JEditorPane;

import javax.swing.JFrame;

import javax.swing.JLabel;

import javax.swing.JPanel;

import javax.swing.JTextField;

import javax.swing.SwingConstants;

import javax.swing.WindowConstants;

 

import org.rsbot.event.events.ServerMessageEvent;

import org.rsbot.event.listeners.PaintListener;

import org.rsbot.event.listeners.ServerMessageListener;

import org.rsbot.script.Script;

import org.rsbot.script.ScriptManifest;

import org.rsbot.script.methods.Skills;

import org.rsbot.script.wrappers.GEItemInfo;

import org.rsbot.script.wrappers.RSObject;

import org.rsbot.script.wrappers.RSTile;

import org.rsbot.util.GlobalConfiguration;

 

@ScriptManifest(authors = { "Taha", "a20cellin" }, keywords = { "Smart", "Smelt", "Smelter",

"Taha", "a20cellin", "Edgeville", "gold" }, name = "Smart Smelter", description = "Smelts all bars at most locations. Now fully working.", version = 3.6)

public class FixedSmartSmelter extends Script implements PaintListener,

ServerMessageListener {

 

private boolean start, runScript, shutDown;

private String bar, state = "Loading";

private RSTile[] toBank, toFurnace;

private int primaryOreID, secondaryOreID,

numberOfPrimaryOresNeededForSmelting,

numberOfSecondaryOresNeededForSmelting,

numberOfPrimaryOresNeededForWithdrawal, numberToSmelt,

furnaceObjectID, primaryChild, copperOreID = 436, tinOreID = 438,

ironOreID = 440, silverOreID = 442, coalOreID = 453,

goldOreID = 444, mithrilOreID = 447, adamantOreID = 449,

runeOreID = 451, oreSelectionInterface = 916, startLvl, startExp,

barsSmelted, nextStep = 18;

private GEItemInfo profitPerBar;

private long startTime;

 

protected int getMouseSpeed() {

return random(3, 5);

}

 

private enum State {

BANK, SMELT, WALK_TO_BANK, WALK_TO_FURNACE, TOGGLE_RUN, WAIT, STOP, OPEN_DOOR

}

 

private State getState() {

if (barsSmelted >= numberToSmelt) {

return State.STOP;

} else if ((walking.getEnergy() > 40 && random(0, 5) == 0 || walking

.getEnergy() > 80)

&& !bank.isOpen()

&& !walking.isRunEnabled()

&& !interfaces.get(oreSelectionInterface).isValid()) {

return State.TOGGLE_RUN;

} else if (objects.getNearest(5244) != null

&& calc.tileOnScreen(objects.getNearest(5244).getLocation())) {

return State.OPEN_DOOR;

} else if (inventory.getCount(primaryOreID) >= numberOfPrimaryOresNeededForSmelting

&& inventory.getCount(secondaryOreID) >= numberOfSecondaryOresNeededForSmelting

&& calc.distanceTo(toBank[0]) > 3) {

return State.WALK_TO_FURNACE;

} else if (calc.distanceTo(toFurnace[0]) > 5

&& (inventory.getCount(primaryOreID) < numberOfPrimaryOresNeededForSmelting || inventory

.getCount(secondaryOreID) < numberOfSecondaryOresNeededForSmelting)) {

return State.WALK_TO_BANK;

} else if (inventory.getCount(primaryOreID) < numberOfPrimaryOresNeededForSmelting

|| inventory.getCount(secondaryOreID) < numberOfSecondaryOresNeededForSmelting) {

return State.BANK;

} else if (!isSmelting()) {

return State.SMELT;

} else {

return State.WAIT;

}

}

 

public boolean onStart() {

new SmartSmelterGUI().setVisible(true);

while (!start) {

sleep(100);

}

startTime = System.currentTimeMillis();

return runScript;

}

 

public int loop() {

try {

if (game.isLoggedIn()) {

camera.setPitch(true);

switch (getState()) {

case TOGGLE_RUN:

state = "Enabling Run Mode";

walking.setRun(true);

break;

 

case BANK:

state = "Banking";

if (!bank.isOpen()) {

bank.open();

sleep(random(500, 1000));

} else {

if (inventory.getCountExcept(primaryOreID,

secondaryOreID) > 0) {

bank.depositAll();

sleep(random(200, 400));

}

if (inventory.getCount(primaryOreID) > numberOfPrimaryOresNeededForWithdrawal) {

bank.deposit(

primaryOreID,

inventory.getCount(primaryOreID)

- numberOfPrimaryOresNeededForWithdrawal);

}

if (inventory.getCount(secondaryOreID) > (28 - numberOfPrimaryOresNeededForWithdrawal)) {

bank.deposit(

secondaryOreID,

inventory.getCount(secondaryOreID)

- (28 - numberOfPrimaryOresNeededForWithdrawal));

}

if (!bankContainsEnoughOres()) {

log("Not enough ores!");

bank.close();

stopScript();

return -1;

}

if (inventory.getCount(primaryOreID) < oresToWithdraw()

&& bankContainsEnoughOres()) {

bank.withdraw(primaryOreID, oresToWithdraw()

- inventory.getCount(primaryOreID));

}

if (!bar.equals("Iron") && !bar.equals("Silver")

&& !bar.equals("Gold")

&& inventory.getCount(primaryOreID) > 0) {

bank.withdraw(secondaryOreID, 0);

}

sleep(random(200, 400));

}

break;

 

case SMELT:

state = "Smelting";

RSObject furnace = objects.getNearest(furnaceObjectID);

if (furnace != null) {

if (!calc.tileOnScreen(furnace.getLocation())) {

int t = 0;

while (t < 6) {

camera.turnToTile(furnace.getLocation());

if (calc.tileOnScreen(furnace.getLocation())) {

break;

} else {

t++;

}

}

if (t > 5) {

while (step(toFurnace) != toFurnace.length) {

sleep(200, 400);

}

}

}

if (!interfaces.get(oreSelectionInterface).isValid()) {

furnace.doAction("Smelt");

sleep(random(100, 150));

}

if (interfaces.get(oreSelectionInterface).isValid()) {

while (!interfaces

.getComponent(oreSelectionInterface, 17)

.getText().equals("All")) {

interfaces.getComponent(oreSelectionInterface,

19).doAction("+1");

sleep(random(50, 100));

}

interfaces.getComponent(905, primaryChild)

.doAction("Make all");

}

}

break;

 

case WALK_TO_BANK:

state = "Walking to Bank";

while (step(toBank) != toBank.length) {

sleep(200, 400);

}

break;

 

case WALK_TO_FURNACE:

state = "Walking to Furnace";

while (step(toFurnace) != toFurnace.length) {

sleep(200, 400);

}

break;

 

case OPEN_DOOR:

state = "Opening Door";

objects.getNearest(5244).doAction("Open");

return random(1200, 1400);

 

case WAIT:

state = "Waiting";

break;

 

case STOP:

stopScript();

return -1;

}

}

} catch (Exception e) {

e.printStackTrace();

}

return random(300, 400);

}

 

public void onFinish() {

log("Gained: " + (skills.getCurrentLevel(Skills.SMITHING) - startLvl)

+ " Smithing Levels");

log.info("Profit: " + barsSmelted * profitPerBar.getMarketPrice()

+ " GP");

if (shutDown) {

try {

Runtime.getRuntime()

.exec("shutdown -s -t 120 -c \"Smart Smelter automatic shutdown has initiliazed. Please wait 120 seconds...\"");

} catch (IOException e) {

e.printStackTrace();

}

}

}

 

private int oresToWithdraw() {

return numberToSmelt - barsSmelted > numberOfPrimaryOresNeededForWithdrawal ? numberOfPrimaryOresNeededForWithdrawal

: numberToSmelt - barsSmelted;

}

 

private boolean bankContainsEnoughOres() {

if (bank.isOpen()

&& bank.getCount(primaryOreID)

+ inventory.getCount(primaryOreID) >= numberOfPrimaryOresNeededForSmelting

&& bank.getCount(secondaryOreID)

+ inventory.getCount(secondaryOreID) >= numberOfSecondaryOresNeededForSmelting) {

return true;

}

return false;

}

 

private boolean isSmelting() {

for (int i = 0; i < 8; i++) {

if (inventory.getCount(primaryOreID) < numberOfPrimaryOresNeededForSmelting

|| inventory.getCount(secondaryOreID) < numberOfSecondaryOresNeededForSmelting) {

return false;

} else if (getMyPlayer().getAnimation() == 3243) {

return true;

}

sleep(250);

}

return false;

}

 

public void serverMessageRecieved(ServerMessageEvent e) {

if (e.getMessage().contains("You retrieve a bar of")) {

barsSmelted++;

}

if (e.getMessage().contains("magic of the Varrock armour")) {

barsSmelted++;

}

if (e.getMessage().contains("members' server to use this furnace")) {

log("Use a F2P furnace!");

stopScript();

}

}

 

public void onRepaint(Graphics g) {

if (game.isLoggedIn()) {

long runTime = System.currentTimeMillis() - startTime;

int seconds = (int) (runTime / 1000 % 60);

int minutes = (int) (runTime / 1000 / 60) % 60;

int hours = (int) (runTime / 1000 / 60 / 60) % 60;

 

StringBuilder b = new StringBuilder();

if (hours < 10) {

b.append('0');

}

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);

 

if (startLvl <= 0 || startExp <= 0) {

startLvl = skills.getCurrentLevel(Skills.SMITHING);

startExp = skills.getCurrentExp(Skills.SMITHING);

}

 

int x = 270;

int y = 4;

int xl = 245;

int yl = 85;

 

g.setColor(new Color(0, 0, 0, 120));

g.fillRect(x, y, xl, yl);

g.setColor(new Color(248, 237, 22));

g.drawRect(x, y, xl, yl);

 

g.setFont(new Font("Comic Sans MS", Font.PLAIN, 14));

g.drawString(getClass().getAnnotation(ScriptManifest.class).name()

+ " v"

+ getClass().getAnnotation(ScriptManifest.class).version(),

x + 10, y += 15);

g.drawString(

"Gained: "

+ (skills.getCurrentExp(Skills.SMITHING) - startExp < 1000 ? skills

.getCurrentExp(Skills.SMITHING) - startExp

: Math.round((skills.getCurrentExp(Skills.SMITHING) - startExp) * 10) / 10)

+ " Exp"

+ " -- Exp/Hour: "

+ (int) ((skills.getCurrentExp(Skills.SMITHING) - startExp) * 3600000D / ((double) System

.currentTimeMillis() - (double) startTime)),

x + 10, y += 15);

g.drawString("Smelted: " + barsSmelted + " " + bar + " Bars",

x + 10, y += 15);

g.drawString("Time Running: " + b, x + 10, y += 15);

g.drawString("Current State: ", x + 10, y += 15);

g.setColor(Color.RED);

g.drawString(state, x + 112, y);

}

}

 

private boolean tileInNextRange(RSTile t) {

return calc.distanceBetween(t, getMyPlayer().getLocation()) < nextStep;

}

 

private int step(RSTile[] path) {

if (calc.distanceTo(path[path.length - 1]) < 3

|| (walking.getDestination() != null && calc.distanceBetween(

walking.getDestination(), path[path.length - 1]) < 3)) {

return path.length;

}

RSTile dest = walking.getDestination();

int index = -1;

int shortestDist = 0, dist, shortest = -1;

if (dest != null)

for (int i = 0; i < path.length; i++) {

dist = (int) calc.distanceBetween(path, dest);

if (shortest < 0 || shortestDist > dist) {

shortest = i;

shortestDist = dist;

}

}

for (int i = path.length - 1; i >= 0; i--)

if (tileInNextRange(path)) {

index = i;

break;

}

if (index != -1

&& (dest == null || (index > shortest) || !getMyPlayer()

.isMoving())) {

walking.walkTileMM(path[index]);

nextStep = random(16, 19);

return index;

}

return -1;

}

 

private class SmartSmelterGUI extends JFrame {

private File settingsFile = new File(new File(

GlobalConfiguration.Paths.getSettingsDirectory()),

"SmartSmelterSettings.txt");

 

private static final long serialVersionUID = 1L;

 

// GEN-BEGIN:variables

private JLabel label1;

private JPanel buttonPanel;

private JButton startButton;

private JButton exitButton;

private JPanel panel1;

private JLabel label14;

private JComboBox locComboBox;

private JLabel label3;

private JComboBox barComboBox;

private JLabel label4;

private JTextField numberTextField;

private JCheckBox shutDownCheckBox;

private JEditorPane description;

 

// GEN-END:variables

private SmartSmelterGUI() {

initComponents();

description.setEditable(false);

}

 

private void barComboBoxActionPerformed(final ActionEvent e) {

updateDescription();

}

 

private void exitButtonActionPerformed(final ActionEvent e) {

if (exitButton.getText().equals("Exit!")) {

dispose();

runScript = false;

start = true;

} else {

stopScript();

dispose();

}

}

 

private void initComponents() {

// GEN-BEGIN:initComponents

label1 = new JLabel();

buttonPanel = new JPanel();

startButton = new JButton();

exitButton = new JButton();

panel1 = new JPanel();

label14 = new JLabel();

locComboBox = new JComboBox();

label3 = new JLabel();

barComboBox = new JComboBox();

label4 = new JLabel();

numberTextField = new JTextField();

shutDownCheckBox = new JCheckBox();

description = new JEditorPane();

 

// ======== this ========

setTitle("Smart Smelter Script Options");

setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);

final Container contentPane = getContentPane();

contentPane.setLayout(new BorderLayout(0, 5));

addWindowListener(new WindowAdapter() {

public void windowClosing(final WindowEvent ev) {

if (exitButton.getText().equals("Exit!")) {

dispose();

start = true;

} else {

setVisible(false);

}

}

});

 

// ---- label1 ----

label1.setText("Smart Smelter Script Options");

label1.setFont(new Font("Century Gothic", Font.PLAIN, 22));

label1.setHorizontalAlignment(SwingConstants.CENTER);

contentPane.add(label1, BorderLayout.NORTH);

 

// ======== buttonPanel ========

{

buttonPanel.setLayout(new GridBagLayout());

((GridBagLayout) buttonPanel.getLayout()).columnWidths = new int[] {

90, 85 };

((GridBagLayout) buttonPanel.getLayout()).rowHeights = new int[] {

3, 0 };

((GridBagLayout) buttonPanel.getLayout()).rowWeights = new double[] {

1.0, 1.0E-4 };

 

// ---- startButton ----

startButton.setText("Start!");

startButton.setFont(new Font("Comic Sans MS", Font.PLAIN, 12));

startButton.setFocusable(false);

startButton.addActionListener(new ActionListener() {

public void actionPerformed(final ActionEvent e) {

startButtonActionPerformed(e);

}

});

buttonPanel.add(startButton, new GridBagConstraints(0, 0, 1, 1,

0.0, 0.0, GridBagConstraints.CENTER,

GridBagConstraints.BOTH, new Insets(0, 0, 0, 5), 0, 0));

 

// ---- exitButton ----

exitButton.setText("Exit!");

exitButton.setFont(new Font("Comic Sans MS", Font.PLAIN, 12));

exitButton.setFocusable(false);

exitButton.addActionListener(new ActionListener() {

public void actionPerformed(final ActionEvent e) {

exitButtonActionPerformed(e);

}

});

buttonPanel.add(exitButton, new GridBagConstraints(1, 0, 1, 1,

0.0, 0.0, GridBagConstraints.CENTER,

GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0));

}

contentPane.add(buttonPanel, BorderLayout.SOUTH);

 

// ======== panel1 ========

{

panel1.setFocusable(false);

panel1.setLayout(new GridBagLayout());

((GridBagLayout) panel1.getLayout()).columnWidths = new int[] {

47, 139, 35, 33, 0 };

((GridBagLayout) panel1.getLayout()).rowHeights = new int[] {

18, 10, 18, 16, 34, 0, 0 };

((GridBagLayout) panel1.getLayout()).columnWeights = new double[] {

0.0, 0.0, 0.0, 1.0, 1.0E-4 };

((GridBagLayout) panel1.getLayout()).rowWeights = new double[] {

0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 1.0E-4 };

 

// ---- label14 ----

label14.setText("Location:");

label14.setFont(new Font("Comic Sans MS", Font.PLAIN, 14));

label14.setHorizontalAlignment(SwingConstants.RIGHT);

panel1.add(label14, new GridBagConstraints(0, 0, 2, 1, 0.0,

0.0, GridBagConstraints.CENTER,

GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0));

 

// ---- locComboBox ----

locComboBox.setFont(new Font("Comic Sans MS", Font.PLAIN, 12));

locComboBox.setFocusable(false);

locComboBox.setModel(new DefaultComboBoxModel(new String[] {

"Falador", "Al Kharid", "Edgeville" }));

panel1.add(locComboBox, new GridBagConstraints(3, 0, 1, 1, 0.0,

0.0, GridBagConstraints.CENTER,

GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0));

 

// ---- label3 ----

label3.setHorizontalAlignment(SwingConstants.RIGHT);

label3.setText("Bar:");

label3.setFont(new Font("Comic Sans MS", Font.PLAIN, 14));

panel1.add(label3, new GridBagConstraints(0, 1, 2, 1, 0.0, 0.0,

GridBagConstraints.CENTER, GridBagConstraints.BOTH,

new Insets(0, 0, 0, 0), 0, 0));

 

// ---- barComboBox ----

barComboBox.setFocusable(false);

barComboBox.setModel(new DefaultComboBoxModel(new String[] {

"Bronze", "Iron", "Silver", "Steel", "Gold", "Mithril",

"Adamant", "Rune" }));

barComboBox.setFont(new Font("Comic Sans MS", Font.PLAIN, 12));

barComboBox.addActionListener(new ActionListener() {

public void actionPerformed(final ActionEvent e) {

barComboBoxActionPerformed(e);

}

});

panel1.add(barComboBox, new GridBagConstraints(3, 1, 1, 1, 0.0,

0.0, GridBagConstraints.CENTER,

GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0));

 

// ---- label4 ----

label4.setText("Numbers of bars to smelt:");

label4.setHorizontalAlignment(SwingConstants.RIGHT);

label4.setFont(new Font("Comic Sans MS", Font.PLAIN, 14));

panel1.add(label4, new GridBagConstraints(0, 2, 2, 1, 0.0, 0.0,

GridBagConstraints.CENTER, GridBagConstraints.BOTH,

new Insets(0, 0, 0, 0), 0, 0));

 

// ---- numberTextField ----

numberTextField.setFont(new Font("Comic Sans MS", Font.PLAIN,

12));

numberTextField.setText("100");

numberTextField.addKeyListener(new KeyAdapter() {

public void keyTyped(final KeyEvent e) {

numberTextFieldKeyTyped(e);

}

 

public void keyReleased(final KeyEvent e) {

numberTextFieldKeyReleased(e);

}

});

panel1.add(numberTextField, new GridBagConstraints(3, 2, 1, 1,

0.0, 0.0, GridBagConstraints.CENTER,

GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0));

 

// ---- shutDownCheckBox ----

shutDownCheckBox.setText("Turn off the computer when finished");

shutDownCheckBox.setFont(new Font("Comic Sans MS", Font.PLAIN,

12));

shutDownCheckBox.setFocusable(false);

shutDownCheckBox.addActionListener(new ActionListener() {

public void actionPerformed(final ActionEvent e) {

shutDownCheckBoxActionPerformed(e);

}

});

panel1.add(shutDownCheckBox, new GridBagConstraints(1, 4, 3, 1,

0.0, 0.0, GridBagConstraints.CENTER,

GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0));

 

// ---- description ----

description.setBorder(null);

description.setOpaque(false);

description.setFont(new Font("Comic Sans MS", Font.PLAIN, 12));

panel1.add(description, new GridBagConstraints(0, 5, 4, 1, 0.0,

0.0, GridBagConstraints.CENTER,

GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0));

}

 

contentPane.add(panel1, BorderLayout.CENTER);

setSize(400, 300);

setLocationRelativeTo(getOwner());

// FINAL TOUCHES

try {

settingsFile.createNewFile();

BufferedReader in;

in = new BufferedReader(new FileReader(settingsFile));

String line;

String[] opts = {};

while ((line = in.readLine()) != null) {

if (line.contains(":")) {

opts = line.split(":");

}

}

in.close();

if (opts.length == 4) {

locComboBox.setSelectedItem(opts[0]);

barComboBox.setSelectedItem(opts[1]);

numberTextField.setText(opts[2]);

if (opts[3].equals("true")) {

shutDownCheckBox.setSelected(true);

}

}

} catch (final IOException ignored) {

}

updateDescription();

// GEN-END:initComponents

}

 

private void numberTextFieldKeyTyped(final KeyEvent e) {

if (e.getKeyChar() != '0' && e.getKeyChar() != '1'

&& e.getKeyChar() != '2' && e.getKeyChar() != '3'

&& e.getKeyChar() != '4' && e.getKeyChar() != '5'

&& e.getKeyChar() != '6' && e.getKeyChar() != '7'

&& e.getKeyChar() != '8' && e.getKeyChar() != '9'

|| numberTextField.getText().length() >= 6) {

e.consume();

}

}

 

private void numberTextFieldKeyReleased(final KeyEvent e) {

updateDescription();

}

 

private void shutDownCheckBoxActionPerformed(final ActionEvent e) {

updateDescription();

}

 

private void startButtonActionPerformed(final ActionEvent e) {

setVisible(false);

bar = barComboBox.getSelectedItem().toString();

numberToSmelt = Integer.parseInt(numberTextField.getText());

shutDown = shutDownCheckBox.isSelected();

if (locComboBox.getSelectedItem().toString().equals("Falador")) {

toFurnace = new RSTile[] { new RSTile(2945, 3368),

new RSTile(2945, 3371), new RSTile(2946, 3375),

new RSTile(2949, 3376), new RSTile(2952, 3378),

new RSTile(2954, 3379), new RSTile(2957, 3379),

new RSTile(2960, 3379), new RSTile(2962, 3379),

new RSTile(2965, 3379), new RSTile(2968, 3379),

new RSTile(2970, 3378), new RSTile(2971, 3376),

new RSTile(2972, 3374), new RSTile(2973, 3372),

new RSTile(2973, 3370) };

toBank = walking.reversePath(toFurnace);

furnaceObjectID = 11666;

}

if (locComboBox.getSelectedItem().toString().equals("Al Kharid")) {

toFurnace = new RSTile[] { new RSTile(3269, 3167),

new RSTile(3271, 3167), new RSTile(3273, 3167),

new RSTile(3275, 3168), new RSTile(3276, 3170),

new RSTile(3276, 3173), new RSTile(3277, 3175),

new RSTile(3278, 3178), new RSTile(3279, 3181),

new RSTile(3281, 3183), new RSTile(3280, 3185),

new RSTile(3276, 3186) };

toBank = walking.reversePath(toFurnace);

furnaceObjectID = 11666;

}

if (locComboBox.getSelectedItem().toString().equals("Edgeville")) {

toFurnace = new RSTile[] { new RSTile(3097, 3496),

new RSTile(3108, 3500) };

toBank = new RSTile[] { new RSTile(3108, 3500),

new RSTile(3097, 3496) };

furnaceObjectID = 26814;

}

if (bar.equals("Bronze")) {

primaryOreID = copperOreID;

secondaryOreID = tinOreID;

numberOfPrimaryOresNeededForSmelting = 1;

numberOfSecondaryOresNeededForSmelting = 1;

numberOfPrimaryOresNeededForWithdrawal = 14;

primaryChild = 14;

profitPerBar = grandExchange.loadItemInfo(2349);

}

if (bar.equals("Iron")) {

primaryOreID = ironOreID;

numberOfPrimaryOresNeededForSmelting = 1;

numberOfPrimaryOresNeededForWithdrawal = 28;

primaryChild = 16;

profitPerBar = grandExchange.loadItemInfo(2351);

}

if (bar.equals("Silver")) {

primaryOreID = silverOreID;

numberOfPrimaryOresNeededForSmelting = 1;

numberOfPrimaryOresNeededForWithdrawal = 28;

primaryChild = 17;

profitPerBar = grandExchange.loadItemInfo(2355);

}

if (bar.equals("Steel")) {

primaryOreID = ironOreID;

secondaryOreID = coalOreID;

numberOfPrimaryOresNeededForSmelting = 1;

numberOfSecondaryOresNeededForSmelting = 2;

numberOfPrimaryOresNeededForWithdrawal = 10;

primaryChild = 18;

profitPerBar = grandExchange.loadItemInfo(2353);

}

if (bar.equals("Gold")) {

primaryOreID = goldOreID;

numberOfPrimaryOresNeededForSmelting = 1;

numberOfPrimaryOresNeededForWithdrawal = 28;

primaryChild = 19;

profitPerBar = grandExchange.loadItemInfo(2357);

}

if (bar.equals("Mithril")) {

primaryOreID = mithrilOreID;

secondaryOreID = coalOreID;

numberOfPrimaryOresNeededForSmelting = 1;

numberOfSecondaryOresNeededForSmelting = 4;

numberOfPrimaryOresNeededForWithdrawal = 5;

primaryChild = 20;

profitPerBar = grandExchange.loadItemInfo(2359);

}

if (bar.equals("Adamant")) {

primaryOreID = adamantOreID;

secondaryOreID = coalOreID;

numberOfPrimaryOresNeededForSmelting = 1;

numberOfSecondaryOresNeededForSmelting = 6;

numberOfPrimaryOresNeededForWithdrawal = 4;

primaryChild = 21;

profitPerBar = grandExchange.loadItemInfo(2361);

}

if (bar.equals("Rune")) {

primaryOreID = runeOreID;

secondaryOreID = coalOreID;

numberOfPrimaryOresNeededForSmelting = 1;

numberOfSecondaryOresNeededForSmelting = 8;

numberOfPrimaryOresNeededForWithdrawal = 3;

primaryChild = 22;

profitPerBar = grandExchange.loadItemInfo(2363);

}

try {

final BufferedWriter out = new BufferedWriter(new FileWriter(

settingsFile));

out.write(locComboBox.getSelectedItem().toString() + ":"

+ barComboBox.getSelectedItem().toString() + ":"

+ Integer.parseInt(numberTextField.getText()) + ":"

+ (shutDownCheckBox.isSelected() ? "true" : "false"));

out.close();

} catch (final Exception z) {

z.printStackTrace();

}

 

start = true;

runScript = true;

}

 

private void updateDescription() {

final String loc = locComboBox.getSelectedItem().toString();

if (shutDownCheckBox.isSelected()) {

description

.setText("You will be smelting "

+ numberTextField.getText()

+ " "

+ barComboBox.getSelectedItem().toString()

.toLowerCase()

+ " bars at "

+ loc

+ ". Your computer will shutdown itself when the task is finished.");

} else {

description.setText("You will be smelting "

+ numberTextField.getText()

+ " "

+ barComboBox.getSelectedItem().toString()

.toLowerCase() + " bars at " + loc + ".");

}

}

}

 

}

 

 

GiantSpiderKiller.java

 

import java.awt.*;

import java.awt.event.*;

import java.io.*;

import java.net.*;

import java.util.*;

import javax.swing.*;

import javax.swing.border.*;

import javax.swing.event.*;

import org.rsbot.event.events.*;

import org.rsbot.event.listeners.*;

import org.rsbot.script.*;

import org.rsbot.script.methods.*;

import org.rsbot.script.util.Timer;

import org.rsbot.script.wrappers.*;

import org.rsbot.util.*;

@ScriptManifest(authors = { "zr0k5" }, keywords = { "Combat" }, name = "GiantSpiderKiller", version = 1.8, description = ""

+ "Written by zr0k5")

public class GiantSpiderKiller extends Script implements PaintListener,

MessageListener {

 

private final double version = getClass().getAnnotation(

ScriptManifest.class).version();

private int foodID;

private int eatingValue[];

private int arrow;

private int potions[] = { 0, 0, 0, 0, 0 };

private int amounts[] = { 1, 1, 1, 1, 1 };

private int currentRoom;

private int tries;

private int objTries;

private int banked;

private int bankTab = -1;

private int stats[][];

private int trainedSkill = -1;

 

private long startTime;

 

private boolean enableTeleporting;

private boolean changeRooms;

private boolean useTablets;

private boolean enableRange;

private boolean noArrowsLeft;

private boolean atSpiders;

private boolean needBank;

private boolean allowPaint;

 

private RSTile myTile;

private RSTile bankTile;

 

private Timer mouseTimer = new Timer(random(20000, 45000));

private Timer antiBanTimer = new Timer(random(100000, 300000));

 

private final RSTile edgeTile = new RSTile(3094, 3491);

private final RSTile varrockTile = new RSTile(3189, 3437);

private final RSTile entranceTile = new RSTile(3081, 3421);

 

private final RSTile varrockPath[] = { new RSTile(3081, 3421),

new RSTile(3086, 3421), new RSTile(3090, 3420),

new RSTile(3096, 3420), new RSTile(3101, 3421),

new RSTile(3106, 3421), new RSTile(3113, 3420),

new RSTile(3119, 3418), new RSTile(3125, 3415),

new RSTile(3131, 3416), new RSTile(3137, 3417),

new RSTile(3144, 3417), new RSTile(3151, 3417),

new RSTile(3157, 3419), new RSTile(3163, 3423),

new RSTile(3167, 3427), new RSTile(3174, 3428),

new RSTile(3180, 3429), new RSTile(3185, 3432),

new RSTile(3186, 3436), new RSTile(3189, 3437) };

 

private final RSTile edgePath[] = { new RSTile(3081, 3421),

new RSTile(3085, 3424), new RSTile(3089, 3428),

new RSTile(3089, 3433), new RSTile(3090, 3439),

new RSTile(3091, 3445), new RSTile(3090, 3453),

new RSTile(3091, 3459), new RSTile(3085, 3465),

new RSTile(3081, 3469), new RSTile(3081, 3475),

new RSTile(3080, 3480), new RSTile(3084, 3485),

new RSTile(3088, 3488), new RSTile(3094, 3491) };

 

private final RSTile doors[] = { new RSTile(2132, 5257),

new RSTile(2132, 5260), new RSTile(2132, 5278),

new RSTile(2132, 5281), new RSTile(2138, 5294),

new RSTile(2141, 5294), new RSTile(2148, 5299),

new RSTile(2148, 5302) };

 

private final RSArea floor1 = new RSArea(new RSTile(1856, 5236),

new RSTile(1866, 5245));

private final RSArea floor1Middle = new RSArea(new RSTile(1900, 5210),

new RSTile(1917, 5230));

private final RSArea floor2 = new RSArea(new RSTile(2037, 5239),

new RSTile(2046, 5246));

private final RSArea floor2Middle = new RSArea(new RSTile(2009, 5203),

new RSTile(2034, 5228));

private final RSArea floor3 = new RSArea(new RSTile(2116, 5250),

new RSTile(2131, 5259));

private final RSArea floor3Front = new RSArea(new RSTile(2131, 5253),

new RSTile(2133, 5256));

 

private final RSArea doors1 = new RSArea(new RSTile(2132, 5257),

new RSTile(2133, 5259));

private final RSArea doors2 = new RSArea(new RSTile(2132, 5279),

new RSTile(2133, 5281));

private final RSArea doors3 = new RSArea(new RSTile(2138, 5294),

new RSTile(2140, 5295));

private final RSArea doors4 = new RSArea(new RSTile(2148, 5299),

new RSTile(2149, 5301));

 

private final RSArea room1 = new RSArea(new RSTile(2117, 5267), new RSTile(

2134, 5277));

private final RSArea room2 = new RSArea(new RSTile(2142, 5302), new RSTile(

2156, 5311));

 

private final int potionConstants[] = { Skills.ATTACK, Skills.STRENGTH,

Skills.STRENGTH, Skills.ATTACK, Skills.DEFENSE };

private final int skillConstants[] = { Skills.ATTACK, Skills.STRENGTH,

Skills.DEFENSE, Skills.RANGE };

private final int[] skillInterfaceComponents = { Skills.INTERFACE_ATTACK,

Skills.INTERFACE_STRENGTH, Skills.INTERFACE_DEFENSE,

Skills.INTERFACE_RANGE };

private final int foods[] = { 361, 379, 373, 7946, 385 };

private final int potionID[][] = { { 9745, 9743, 9741, 9739 },

{ 119, 117, 115, 113 }, { 161, 159, 157, 2440 },

{ 149, 147, 145, 2436 }, { 167, 165, 163, 2442 } };

private final int rewardID[] = { 11640, 2528, 6199, 14664 };

private final int bowID[] = { 841, 843, 849, 853, 857, 861, 839, 845, 847,

851, 855, 859 };

private final int arrowID[] = { 882, 884, 886, 888, 890, 892 };

private final int spiderID = 4400;

private final int tabletID = 8007;

private final int lawID = 563;

private final int fireID = 554;

private final int airID = 556;

private final int vialID = 229;

 

/*

* Paint Variables

*/

private final String skillNames[] = { "Attack", "Strength", "Defense",

"Range" };

private long runTime;

private final Font font1 = new Font("Tahoma", Font.BOLD, 11);

private final Font font2 = new Font("Tahoma", Font.PLAIN, 11);

private final Color color1 = new Color(0, 0, 0, 180);

private int currentLevel;

private int levelsGained;

private int xpGained;

private int xpHour;

private int TNL;

private int percentTNL;

private long timeTNL;

private String skillName;

 

@Override

public boolean onStart() {

try {

if (!game.isLoggedIn()) {

log.info("Please login before starting");

return false;

}

if (enableThreadExplorer) {

new TE();

}

/*

* Version check

*/

try {

URL url = new URL(

"http://giantspiderkiller.webs.com/version.txt");

BufferedReader in = new BufferedReader(new InputStreamReader(

url.openStream()));

final String line = in.readLine();

if (line != null) {

final double newest = Double.valueOf(line);

if (newest > version) {

JOptionPane

.showMessageDialog(

null,

"New version available! "

+ "Please check out the forum thread for download link!",

"Update found",

JOptionPane.INFORMATION_MESSAGE);

}

}

in.close();

} catch (Exception e) {

}

/*

* GUI Init

*/

SpiderGUI gui = new SpiderGUI();

gui.setVisible(true);

while (!gui.isReady) {

sleep(500);

}

if (useSavedSettings) {

loadSettings();

} else {

/*

* Eating

*/

if (gui.textField1.getText().length() > 0) {

try {

foodID = Integer.parseInt(gui.textField1.getText());

} catch (NumberFormatException e) {

log.info("Invalid food id");

return false;

}

} else {

if (gui.list1.getSelectedIndex() != -1) {

foodID = foods[gui.list1.getSelectedIndex()];

} else {

log.info("No food selected");

return false;

}

}

try {

final int value = Integer

.parseInt(gui.textField2.getText());

final int value1 = Integer.parseInt(gui.textField3

.getText());

eatingValue = new int[] { random(value, value1), value,

value1 };

} catch (NumberFormatException e) {

log.info("Invalid eating value(s)");

return false;

}

/*

* Potions

*/

final JCheckBox selections[] = { gui.checkBox1, gui.checkBox2,

gui.checkBox3, gui.checkBox4, gui.checkBox5 };

final JTextField fields[] = { gui.textField4, gui.textField5,

gui.textField6, gui.textField7, gui.textField8 };

for (int i = 0; i < selections.length; i++) {

if (selections.isSelected()) {

potions = 1;

try {

amounts = Integer.parseInt(fields.getText());

} catch (NumberFormatException e) {

log.info("Invalid potion amount(s)");

return false;

}

}

}

/*

* Banking

*/

if (!gui.radioButton2.isSelected()) {

bankTile = varrockTile;

} else {

bankTile = edgeTile;

}

if (!gui.radioButton3.isSelected()) {

enableTeleporting = true;

if (!gui.radioButton4.isSelected()) {

useTablets = true;

}

}

/*

* Other

*/

if (gui.radioButton7.isSelected()) {

changeRooms = true;

} else {

if (gui.radioButton8.isSelected()) {

currentRoom = 1;

} else {

currentRoom = 2;

}

}

if (gui.checkBox6.isSelected()) {

enableRange = true;

final RSItem knive = equipment.getItem(Equipment.WEAPON);

if (knive != null && knive.getID() == 863) {

arrow = 863;

} else {

final RSItem weared = equipment.getItem(Equipment.AMMO);

for (final int id : arrowID) {

if (weared != null && weared.getID() == id) {

arrow = id;

break;

}

}

if (arrow < 1) {

log.info("No arrows found");

return false;

}

}

if (!equipment.containsOneOf(bowID) && arrow != 863) {

log.info("No bow found");

return false;

}

}

saveSettings();

}

gui.dispose();

stats = new int[][] {

{ skills.getRealLevel(Skills.ATTACK),

skills.getCurrentExp(Skills.ATTACK) },

{ skills.getRealLevel(Skills.STRENGTH),

skills.getCurrentExp(Skills.STRENGTH) },

{ skills.getRealLevel(Skills.DEFENSE),

skills.getCurrentExp(Skills.DEFENSE) },

{ skills.getRealLevel(Skills.RANGE),

skills.getCurrentExp(Skills.RANGE) } };

if (!combat.isAutoRetaliateEnabled()) {

combat.setAutoRetaliate(true);

}

setRoom();

startTime = System.currentTimeMillis();

allowPaint = true;

/*

* Disabling Rewards Box Solver

*/

env.disableRandom("Improved Rewards Box");

return true;

} catch (Exception e) {

e.printStackTrace();

return false;

}

}

 

private boolean loadSettings() {

GSKSettings set = new GSKSettings();

FileInputStream fis = null;

ObjectInputStream in = null;

try {

fis = new FileInputStream(settingsFile);

in = new ObjectInputStream(fis);

set = (GSKSettings) in.readObject();

in.close();

} catch (Exception ex) {

ex.printStackTrace();

return false;

}

foodID = set.foodID;

eatingValue = set.eatingValues;

potions = set.potions;

amounts = set.potionAmounts;

currentRoom = set.currentRoom;

bankTile = set.bankIsEdge ? edgeTile : varrockTile;

enableTeleporting = set.enableTeleporting;

useTablets = set.useTablets;

changeRooms = set.changeRooms;

if (enableRange = set.enableRange) {

final RSItem knive = equipment.getItem(Equipment.WEAPON);

if (knive != null && knive.getID() == 863) {

arrow = 863;

} else {

final RSItem weared = equipment.getItem(Equipment.AMMO);

for (final int id : arrowID) {

if (weared != null && weared.getID() == id) {

arrow = id;

break;

}

}

if (arrow < 1) {

log.info("No arrows found");

return false;

}

}

if (!equipment.containsOneOf(bowID) && arrow != 863) {

log.info("No bow found");

return false;

}

}

return true;

}

 

@SuppressWarnings("deprecation")

@Override

public int loop() {

if (!game.isLoggedIn()) {

return random(800, 1200);

}

mouse.setSpeed(random(8, 11));

checkRunning();

if (eat()) {

return random(100, 250);

}

if (teleport()) {

return random(5000, 6000);

}

if (!hasFood() || noArrowsLeft) {

if (!needBank) {

setRoom();

needBank = true;

atSpiders = false;

if (tries != 0) {

tries = 0;

}

}

} else {

needBank = false;

}

if (atSpiders) {

final RSNPC interacting = (RSNPC) getMyPlayer().getInteracting();

if (interacting == null) {

if (!pickArrows()) {

attackSpiders();

}

} else {

if (tries != 0) {

tries = 0;

}

if (!drinkPotions() && !equipArrows()) {

antiBan();

}

}

return random(100, 250);

}

if ((myTile = getMyPlayer().getLocation()) != null) {

if (floor1.contains(myTile)) {

if (!needBank) {

clickObject(16150, "Enter");

} else {

clickObject(16148, "Climb-up");

}

} else if (floor1Middle.contains(myTile)) {

clickObject(16149, "Climb-down");

} else if (floor2.contains(myTile)) {

if (!needBank) {

clickObject(16082, "Enter");

} else {

clickObject(16080, "Climb-up");

}

} else if (floor2Middle.contains(myTile)) {

clickObject(16081, "Climb-down");

} else if (floor3.contains(myTile)) {

if (!needBank) {

clickDoor(doors[0]);

} else {

clickObject(16114, "Climb-up");

}

} else if (floor3Front.contains(myTile)) {

if (!needBank) {

clickDoor(doors[0]);

} else {

clickObject(16114, "Climb-up");

}

} else if (doors1.contains(myTile)) {

if (!needBank) {

clickDoor(doors[1]);

} else {

clickDoor(doors[0]);

}

} else if (myTile.getY() >= 5260 && myTile.getY() <= 5278) {

if (!needBank) {

if (currentRoom == 1) {

if (room1.contains(myTile)) {

atSpiders = true;

} else {

walkToTile(room1.getCentralTile());

}

} else {

clickDoor(doors[2]);

}

} else {

clickDoor(doors[1]);

}

} else if (doors2.contains(myTile)) {

if (!needBank && currentRoom == 2) {

clickDoor(doors[3]);

} else {

clickDoor(doors[2]);

}

} else if (myTile.getY() >= 5282 && myTile.getY() <= 5295

&& myTile.getX() <= 2137) {

if (!needBank && currentRoom == 2) {

clickDoor(doors[4]);

} else {

clickDoor(doors[3]);

}

} else if (doors3.contains(myTile)) {

if (!needBank && currentRoom == 2) {

clickDoor(doors[5]);

} else {

clickDoor(doors[4]);

}

} else if (myTile.getY() >= 5294 && myTile.getY() <= 5298

&& myTile.getX() >= 2141) {

if (!needBank && currentRoom == 2) {

clickDoor(doors[6]);

} else {

clickDoor(doors[5]);

}

} else if (doors4.contains(myTile)) {

if (!needBank && currentRoom == 2) {

clickDoor(doors[7]);

} else {

clickDoor(doors[6]);

}

} else if (room2.contains(myTile)) {

if (!needBank && currentRoom == 2) {

walkToTile(room2.getCentralTile());

atSpiders = true;

} else {

clickDoor(doors[7]);

}

} else {

if (needBank) {

if (dropVials()) {

return random(800, 1200);

}

if (dropRewards()) {

return random(800, 1200);

}

if (calc.distanceTo(bankTile) < 5) {

if (bank.isOpen()) {

if (tries != 0) {

tries = 0;

}

if (noArrowsLeft) {

log.info("No arrows left");

stopScript(true);

}

if (openBankTab()) {

return random(800, 1200);

}

if (depositCrap()) {

return random(800, 1200);

}

if (enableTeleporting) {

if (useTablets) {

if (!inventory.contains(tabletID)

&& bank.getCount(tabletID) > 0) {

bank.withdraw(tabletID, 1);

return random(800, 1200);

}

} else {

if (!inventory.contains(lawID)

&& bank.getCount(lawID) > 0) {

bank.withdraw(lawID, 1);

return random(800, 1200);

} else if (inventory.getCount(true, airID) < 3

&& bank.getCount(airID) >= 3) {

bank.withdraw(airID, 3);

return random(800, 1200);

} else if (!inventory.contains(fireID)

&& bank.getCount(fireID) > 0) {

bank.withdraw(fireID, 1);

return random(800, 1200);

}

}

}

for (int i = 0; i < potionID.length; i++) {

if (potions == 1) {

if (inventory.getCount(potionID) > amounts) {

if (depositPotion(potionID)) {

return random(800, 1200);

}

} else if (inventory.getCount(potionID) < amounts) {

if (withdrawPotion(potionID)) {

return random(800, 1200);

}

}

}

}

if (!inventory.contains(foodID)) {

if (bank.getCount(foodID) < 5) {

log.info("No food left");

stopScript(true);

} else {

bank.withdraw(foodID, 0);

return random(800, 1200);

}

} else {

banked++;

needBank = false;

}

} else {

if (tries > 3) {

walkToTile(bankTile);

tries = 0;

} else {

if (clickObject(

(bankTile.equals(edgeTile)) ? 26972

: 11402, "Use-quickly")) {

tries++;

}

}

}

} else {

walkPath((bankTile.equals(edgeTile)) ? edgePath

: varrockPath);

}

} else {

if (calc.distanceTo(entranceTile) < 5) {

clickObject(16154, "Climb-down");

} else {

walkPath(walking

.reversePath((bankTile.equals(edgeTile)) ? edgePath

: varrockPath));

}

}

}

}

return random(100, 250);

}

 

private boolean teleport() {

if (enableTeleporting && game.getBaseY() > 4000 && needBank

&& canTeleport()) {

if (useTablets) {

final RSItem tablet = inventory.getItem(tabletID);

if (tablet != null) {

return tablet.doAction("Break");

}

} else {

return magic.castSpell(Magic.SPELL_VARROCK_TELEPORT);

}

}

return false;

}

 

private boolean canTeleport() {

return (inventory.contains(tabletID))

|| (inventory.contains(lawID)

&& inventory.getCount(true, airID) >= 3 && inventory

.contains(fireID));

}

 

private boolean dropVials() {

if (inventory.contains(vialID)) {

for (final RSItem item : inventory.getItems()) {

if (item != null && item.getID() == vialID

&& item.doAction("Drop")) {

sleep(50, 90);

}

}

return true;

}

return false;

}

 

private boolean dropRewards() {

if (inventory.containsOneOf(rewardID)) {

for (final RSItem item : inventory.getItems()) {

if (item != null && isReward(item.getID())

&& item.doAction("Drop")) {

sleep(50, 90);

}

}

return true;

}

return false;

}

 

private boolean isReward(final int thisID) {

for (final int id : rewardID) {

if (thisID == id)

return true;

}

return false;

}

 

private boolean isPotion(final int thisID) {

for (final int id[] : potionID) {

for (final int id2 : id) {

if (thisID == id2)

return true;

}

}

return false;

}

 

private boolean depositCrap() {

ArrayList<Integer> items = new ArrayList<Integer>();

for (final RSItem item : inventory.getItems()) {

if (item != null) {

final int id = item.getID();

if (!items.contains(id) && id > 0 && id != lawID && id != airID

&& id != fireID && id != tabletID && id != foodID

&& id != arrow && !isPotion(id) && !isReward(id)) {

if (item.doAction("Deposit-All")) {

items.add(id);

sleep(60, 120);

}

}

}

}

return items.size() > 0;

}

 

private boolean equipArrows() {

if (enableRange && inventory.getCount(true, arrow) >= random(30, 50)) {

final RSItem arrows = inventory.getItem(arrow);

if (arrows != null && arrows.doAction("Wield")) {

sleep(600, 900);

return true;

}

}

return false;

}

 

private boolean pickArrows() {

if (enableRange && !inventory.isFull()) {

RSGroundItem thisItem = null;

final RSGroundItem items[] = groundItems.getAll();

for (final RSGroundItem item : items) {

if (item != null) {

if (room1.contains(item.getLocation())

|| room2.contains(item.getLocation())) {

final RSItem stack = item.getItem();

if (stack != null && stack.getID() == arrow

&& stack.getStackSize() >= 5) {

thisItem = item;

break;

}

}

}

}

if (thisItem != null) {

if (thisItem.isOnScreen()) {

if (!getMyPlayer().isMoving() && thisItem.doAction("Take")) {

sleep(700, 900);

waitToStop();

for (int i = 0; i < 20; i++) {

if (needToEat()) {

break;

}

sleep(50, 80);

}

return true;

}

} else {

walkToTile(thisItem.getLocation());

}

}

}

return false;

}

 

private boolean containsPotion(final int potion[]) {

return inventory.containsOneOf(potion);

}

 

private boolean hasFood() {

for (final RSItem cached : (!bank.isOpen()) ? inventory

.getCachedItems() : inventory.getItems()) {

if (cached != null && cached.getID() == foodID)

return true;

}

return false;

}

 

private boolean drinkPotions() {

for (int i = 0; i < potionID.length; i++) {

if (potions == 1

&& containsPotion(potionID)

&& skills.getCurrentLevel(potionConstants)

- skills.getRealLevel(potionConstants) <= random(

2, 5)) {

final RSItem potion = inventory.getItem(potionID);

if (potion != null && potion.doAction("Drink")) {

sleep(1000, 1300);

return true;

}

break;

}

}

return false;

}

 

private boolean openBankTab() {

if (bankTab != -1) {

if (bank.getCurrentTab() != bankTab) {

final RSComponent tab = interfaces.getComponent(

Bank.INTERFACE_BANK, Bank.INTERFACE_BANK_TAB[bankTab]);

if (tab.isValid()) {

return tab.doClick();

}

}

} else {

bankTab = bank.getCurrentTab();

}

return false;

}

 

private boolean withdrawPotion(final int potion[]) {

for (int i = potion.length - 1; i >= 0; i--) {

if (bank.getCount(potion) > 0) {

bank.withdraw(potion, 1);

return true;

}

}

return false;

}

 

private boolean depositPotion(final int potion[]) {

for (final int id : potion) {

if (inventory.contains(id)) {

bank.deposit(id, 0);

return true;

}

}

return false;

}

 

private boolean eat() {

if (needToEat()) {

final RSItem food = inventory.getItem(foodID);

if (food != null && food.doAction("Eat")) {

sleep(1000, 1300);

eatingValue[0] = random(eatingValue[1], eatingValue[2]);

return true;

}

}

return false;

}

 

private boolean needToEat() {

return combat.getLifePoints() <= eatingValue[0];

}

 

private boolean clickObject(final int id, final String action) {

final RSObject obj = objects.getNearest(id);

if (obj != null) {

if (obj.isOnScreen()) {

if (!getMyPlayer().isMoving()) {

if (objTries > 5) {

camera.setAngle(random(1, 360));

objTries = 0;

} else {

if (obj.doAction(action)) {

objTries = 0;

sleep(2500, 3000);

return true;

} else {

objTries++;

}

}

}

} else {

walkToTile(obj.getLocation());

}

}

return false;

}

 

private void clickDoor(final RSTile doorTile) {

if (camera.getPitch() != 3072) {

camera.setPitch(true);

}

final RSObject obj = objects.getTopAt(doorTile);

if (obj != null) {

if (obj.isOnScreen()) {

if (!getMyPlayer().isMoving()) {

if (objTries > 5) {

camera.setAngle(random(1, 360));

objTries = 0;

} else {

if (obj.doAction("Open")) {

objTries = 0;

sleep(2500, 3000);

} else {

objTries++;

}

}

}

} else {

walkToTile(obj.getLocation());

}

} else {

walkToTile(doorTile);

}

}

 

private void setRoom() {

if (changeRooms) {

currentRoom = random(1, 3);

}

}

 

private void walkToTile(final RSTile destination) {

if (calc.tileOnMap(destination)) {

if (walking.walkTileMM(destination, 2, 2)) {

sleep(700, 900);

waitToStop();

}

} else {

if (!getMyPlayer().isMoving()

|| walking.getDestination() == null

|| calc.distanceTo(walking.getDestination()) <= random(3, 8)) {

final RSTile step = walking.getClosestTileOnMap(destination);

if (step != null && walking.walkTileMM(step, 2, 2)) {

sleep(700, 900);

}

}

}

}

 

private int getNextTile(final RSTile path[]) {

for (int i = path.length - 1; i >= 0; i--) {

if (calc.tileOnMap(path)) {

return i;

}

}

return -1;

}

 

private void walkPath(final RSTile path[]) {

final int next = getNextTile(path);

if (next != -1) {

if (walking.walkTileMM(path[next], 2, 2)) {

if (path[next].equals(path[path.length - 1])) {

sleep(700, 900);

waitToStop();

} else {

for (int i = 0; i < 20; i++) {

if (getMyPlayer().isMoving()) {

i = 0;

}

if (calc.tileOnMap(path[next + 1])) {

break;

}

sleep(100, 200);

}

}

}

} else {

walkToTile(path[path.length - 1]);

}

}

 

private void waitToStop() {

while (getMyPlayer().isMoving()) {

sleep(100, 250);

}

}

 

private void checkRunning() {

if (!walking.isRunEnabled() && walking.getEnergy() >= random(25, 35)) {

walking.setRun(true);

sleep(900, 1300);

}

}

 

private void attackSpiders() {

final RSNPC agressive = getAgressive();

if (agressive != null) {

if (tries < 15) {

if (!agressive.isMoving()) {

tries++;

}

return;

}

}

final RSNPC free = getFree();

if (free != null) {

if (free.isOnScreen()) {

if (free.doAction("Attack")) {

sleep(700, 900);

waitToStop();

for (int i = 0; i < 20; i++) {

if (needToEat()) {

break;

}

sleep(50, 150);

}

}

} else {

walkToTile(free.getLocation());

}

}

}

 

private RSNPC getFree() {

RSNPC winner = null;

int distance = 1000;

for (final RSNPC npc : npcs.getAll()) {

if (npc != null && npc.getID() == spiderID && !npc.isInCombat()

&& npc.getHPPercent() > 0) {

if (room1.contains(npc.getLocation())

|| room2.contains(npc.getLocation())) {

final int thisDistance = calc.distanceTo(npc.getLocation());

if (thisDistance < distance) {

winner = npc;

distance = thisDistance;

}

}

}

}

return winner;

}

 

private RSNPC getAgressive() {

for (final RSNPC npc : npcs.getAll()) {

if (npc != null && npc.getID() == spiderID

&& npc.getInteracting() != null

&& npc.getInteracting().equals(getMyPlayer())) {

return npc;

}

}

return null;

}

 

private void antiBan() {

if (!mouseTimer.isRunning()) {

final int r = random(0, 8);

if (r == 1) {

mouse.moveOffScreen();

} else if (r == 2) {

mouse.moveSlightly();

} else {

mouse.moveRandomly(600);

}

mouseTimer.setEndIn(random(20000, 45000));

}

if (!antiBanTimer.isRunning()) {

if (random(0, 6) == 1) {

camera.setPitch(random(1, 100));

}

if (random(0, 10) < 8) {

camera.setAngle(random(1, 360));

} else {

skills.doHover(skillInterfaceComponents[random(0,

skillInterfaceComponents.length)]);

sleep(1000, 2000);

}

antiBanTimer.setEndIn(random(100000, 300000));

}

}

 

private int getTrainedSkill() {

if (enableRange) {

return 3;

}

for (int i = 0; i < skillConstants.length; i++) {

if (skills.getCurrentExp(skillConstants) - stats[1] > 0) {

return i;

}

}

return -1;

}

 

private String formatTime(final long time) {

final int sec = (int) (time / 1000), h = sec / 3600, m = sec / 60 % 60, s = sec % 60;

return (h < 10 ? "0" + h : h) + ":" + (m < 10 ? "0" + m : m) + ":"

+ (s < 10 ? "0" + s : s);

}

 

@Override

public void onRepaint(Graphics g1) {

if (!allowPaint || !isRunning())

return;

final Graphics2D g2 = (Graphics2D) g1;

g2.setFont(font1);

g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,

RenderingHints.VALUE_ANTIALIAS_ON);

g2.setColor(color1);

g2.fillRect(350, 5, 160, 155);

g2.setColor(Color.WHITE);

g2.drawString("Giant Spider Killer v." + version, 355, 20);

g2.setFont(font2);

if (trainedSkill == -1) {

trainedSkill = getTrainedSkill();

g2.drawString("Calculating...", 355, 35);

return;

}

 

runTime = System.currentTimeMillis() - startTime;

currentLevel = skills.getRealLevel(skillConstants[trainedSkill]);

levelsGained = currentLevel - stats[trainedSkill][0];

xpGained = skills.getCurrentExp(skillConstants[trainedSkill])

- stats[trainedSkill][1];

xpHour = (int) ((3600000.0 / (double) runTime) * xpGained);

TNL = skills.getExpToNextLevel(skillConstants[trainedSkill]);

percentTNL = skills.getPercentToNextLevel(skillConstants[trainedSkill]);

timeTNL = (long) ((double) TNL / (double) xpHour * 3600000);

skillName = skillNames[trainedSkill];

 

g2.drawString("Runtime: " + formatTime(runTime), 355, 35);

g2.drawString("Training: " + skillName, 355, 50);

g2.drawString("Current level: " + currentLevel, 355, 65);

g2.drawString("Levels gained: " + levelsGained, 355, 80);

g2.drawString("XP gained: " + (xpGained), 356, 95);

g2.drawString("XP / hour: " + xpHour, 356, 110);

g2.drawString("TNL: " + TNL, 355, 125);

g2.drawString("Time TNL: " + formatTime(timeTNL), 355, 140);

g2.setColor(Color.RED);

g2.fillRect(355, 148, 100, 4);

g2.setColor(Color.GREEN);

g2.fillRect(355, 148, percentTNL, 4);

 

}

 

private void saveSettings() {

GSKSettings set = new GSKSettings();

set.foodID = foodID;

set.eatingValues = eatingValue;

set.potions = potions;

set.potionAmounts = amounts;

set.currentRoom = currentRoom;

set.bankIsEdge = bankTile == edgeTile;

set.enableTeleporting = enableTeleporting;

set.useTablets = useTablets;

set.changeRooms = changeRooms;

set.enableRange = enableRange;

FileOutputStream fos = null;

ObjectOutputStream out = null;

try {

fos = new FileOutputStream(settingsFile);

out = new ObjectOutputStream(fos);

out.writeObject(set);

out.close();

} catch (IOException ex) {

ex.printStackTrace();

}

}

 

private boolean enableThreadExplorer = false;

 

public class TE extends JFrame implements ListSelectionListener {

private static final long serialVersionUID = -6905834962744665302L;

 

public TE() {

try {

init();

setTitle("Thread list - by Ramon");

setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);

addWindowListener(new WindowAdapter() {

public void windowClosing(final WindowEvent e) {

dispose();

return;

}

});

pack();

setVisible(true);

} catch (Exception e) {

e.printStackTrace();

}

}

 

public void init() {

threadList = new JList();

scrollPane = new JScrollPane(threadList);

threadInfoPanel = new JPanel(layout);

layout = new GroupLayout(threadInfoPanel);

scrollPane2 = new JScrollPane(threadInfoPanel);

splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, scrollPane,

scrollPane2);

refreshList();

add(splitPane, BorderLayout.CENTER);

}

 

public Map<Thread, StackTraceElement[]> STList;

 

public void refreshList() {

STList = Thread.getAllStackTraces();

Object[] list = new Object[sTList.size()];

int off = 0;

for (Thread thread : STList.keySet()) {

list[off++] = thread.getName() + "#" + thread.getId();

}

threadList = new JList(list);

threadList.addListSelectionListener(this);

scrollPane = new JScrollPane(threadList);

splitPane.setLeftComponent(scrollPane);

}

 

public JList threadList;

public JPanel threadInfoPanel;

public GroupLayout layout;

public JScrollPane scrollPane;

public JScrollPane scrollPane2;

public JSplitPane splitPane;

 

public void showThreadStatus(final Thread thread) {

threadInfoPanel = new JPanel(layout);

layout = new GroupLayout(threadInfoPanel);

JButton a = new JButton("Refresh data");

a.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent e) {

showThreadStatus(thread);

}

});

JLabel b = new JLabel("Name: " + thread.getName());

JLabel c = new JLabel("ID: " + thread.getId());

JLabel d = new JLabel("Active: " + thread.isAlive());

JLabel e = new JLabel("Daemon: " + thread.isDaemon());

JLabel f = new JLabel("Interrupted: " + thread.isInterrupted());

JList g = new JList(thread.getStackTrace());

JButton h = new JButton("Stop thread");

h.addActionListener(new ActionListener() {

@SuppressWarnings("deprecation")

public void actionPerformed(ActionEvent e) {

if (JOptionPane.YES_OPTION == JOptionPane

.showConfirmDialog(

null,

new String[] {

"Stopping threads can have negative effects on the bot.",

"Stopping non-RSBot threads may cause damage to your system.",

" Continue?" }, "Warning!",

JOptionPane.YES_NO_OPTION,

JOptionPane.WARNING_MESSAGE)) {

thread.stop();

}

 

}

});

layout.setHorizontalGroup(layout.createParallelGroup()

.addComponent(a).addComponent(B).addComponent©

.addComponent(d).addComponent(e).addComponent(f)

.addComponent(g).addComponent(h));

layout.setVerticalGroup(layout.createSequentialGroup()

.addComponent(a).addComponent(B).addComponent©

.addComponent(d).addComponent(e).addComponent(f)

.addComponent(g).addComponent(h));

threadInfoPanel.setLayout(layout);

scrollPane2 = new JScrollPane(threadInfoPanel);

splitPane.setRightComponent(scrollPane2);

splitPane.validate();

}

 

public void valueChanged(ListSelectionEvent e) {

for (Thread thread : STList.keySet()) {

if (((JList) e.getSource()).getSelectedValue().equals(

thread.getName() + "#" + thread.getId())) {

showThreadStatus(thread);

}

}

refreshList();

}

 

}

 

@Override

public void messageReceived(MessageEvent e) {

if (e.getID() == MessageEvent.MESSAGE_SERVER) {

final String msg = e.getMessage();

if (msg != null) {

if (msg.contains("You can't reach that")) {

atSpiders = false;

} else if (enableRange && msg.contains("There is no ammo left")) {

noArrowsLeft = true;

}

}

}

}

 

public class SpiderGUI extends JFrame {

private static final long serialVersionUID = -5092688983719659534L;

private boolean isReady;

 

public SpiderGUI() {

initComponents();

}

 

private void button1ActionPerformed(ActionEvent e) {

setVisible(false);

isReady = true;

}

 

private void initComponents() {

tabbedPane1 = new JTabbedPane();

panel1 = new JPanel();

label1 = new JLabel();

textField1 = new JTextField();

label2 = new JLabel();

list1 = new JList();

label3 = new JLabel();

textField2 = new JTextField();

label4 = new JLabel();

textField3 = new JTextField();

panel2 = new JPanel();

label5 = new JLabel();

checkBox1 = new JCheckBox();

checkBox2 = new JCheckBox();

checkBox3 = new JCheckBox();

checkBox4 = new JCheckBox();

checkBox5 = new JCheckBox();

textField4 = new JTextField();

textField5 = new JTextField();

textField6 = new JTextField();

textField7 = new JTextField();

textField8 = new JTextField();

label6 = new JLabel();

panel3 = new JPanel();

label7 = new JLabel();

radioButton1 = new JRadioButton();

radioButton2 = new JRadioButton();

label8 = new JLabel();

radioButton3 = new JRadioButton();

radioButton4 = new JRadioButton();

radioButton5 = new JRadioButton();

radioButton6 = new JRadioButton();

panel4 = new JPanel();

label9 = new JLabel();

radioButton7 = new JRadioButton();

radioButton8 = new JRadioButton();

radioButton9 = new JRadioButton();

checkBox6 = new JCheckBox();

button1 = new JButton();

button2 = new JButton();

 

// ======== this ========

setTitle("GiantSpiderKiller");

setAlwaysOnTop(true);

setResizable(false);

setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);

JPanel panel = new JPanel();

GroupLayout layout = new GroupLayout(panel);

panel.setLayout(layout);

 

// ======== tabbedPane1 ========

{

 

// ======== panel1 ========

{

panel1.setLayout(null);

 

// ---- label1 ----

label1.setText("Type in food ID:");

panel1.add(label1);

label1.setBounds(10, 10, 85,

label1.getPreferredSize().height);

panel1.add(textField1);

textField1.setBounds(97, 7, 95,

textField1.getPreferredSize().height);

 

// ---- label2 ----

label2.setText("...or select food from list:");

panel1.add(label2);

label2.setBounds(10, 35, 140,

label2.getPreferredSize().height);

 

// ---- list1 ----

list1.setBorder(new EtchedBorder());

list1.setModel(new AbstractListModel() {

private static final long serialVersionUID = 6343865554921813140L;

String[] values = { "Tuna", "Lobster", "Swordfish",

"Monkfish", "Shark" };

 

public int getSize() {

return values.length;

}

 

public Object getElementAt(int i) {

return values;

}

});

list1.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);

panel1.add(list1);

list1.setBounds(10, 55, 120, 90);

 

// ---- label3 ----

label3.setText("Eat when HP is");

panel1.add(label3);

label3.setBounds(10, 160, 75,

label3.getPreferredSize().height);

 

// ---- textField2 ----

textField2.setText("300");

panel1.add(textField2);

textField2.setBounds(89, 156, 30,

textField2.getPreferredSize().height);

 

// ---- label4 ----

label4.setText("-");

panel1.add(label4);

label4.setBounds(124, 159, 15,

label4.getPreferredSize().height);

 

// ---- textField3 ----

textField3.setText("350");

panel1.add(textField3);

textField3.setBounds(135, 156, 30, 20);

 

}

tabbedPane1.addTab("Eating", panel1);

 

// ======== panel2 ========

{

panel2.setLayout(null);

 

// ---- label5 ----

label5.setText("Potions to use:");

panel2.add(label5);

label5.setBounds(10, 10, 115,

label5.getPreferredSize().height);

 

// ---- checkBox1 ----

checkBox1.setText("Combat");

panel2.add(checkBox1);

checkBox1.setBounds(10, 30, 70,

checkBox1.getPreferredSize().height);

 

// ---- checkBox2 ----

checkBox2.setText("Strength");

panel2.add(checkBox2);

checkBox2.setBounds(10, 60, 70, 23);

 

// ---- checkBox3 ----

checkBox3.setText("Super Strength");

panel2.add(checkBox3);

checkBox3.setBounds(10, 90, 100, 23);

 

// ---- checkBox4 ----

checkBox4.setText("Super Attack");

panel2.add(checkBox4);

checkBox4.setBounds(10, 120, 95,

checkBox4.getPreferredSize().height);

 

// ---- checkBox5 ----

checkBox5.setText("Super Defense");

panel2.add(checkBox5);

checkBox5.setBounds(10, 150, 105, 23);

 

// ---- textField4 ----

textField4.setText("1");

panel2.add(textField4);

textField4.setBounds(125, 30, 15,

textField4.getPreferredSize().height);

 

// ---- textField5 ----

textField5.setText("1");

panel2.add(textField5);

textField5.setBounds(125, 60, 15, 20);

 

// ---- textField6 ----

textField6.setText("1");

panel2.add(textField6);

textField6.setBounds(125, 90, 15,

textField6.getPreferredSize().height);

 

// ---- textField7 ----

textField7.setText("1");

panel2.add(textField7);

textField7.setBounds(125, 120, 15,

textField7.getPreferredSize().height);

 

// ---- textField8 ----

textField8.setText("1");

panel2.add(textField8);

textField8.setBounds(125, 150, 15,

textField8.getPreferredSize().height);

 

// ---- label6 ----

label6.setText("(field = amount to withdraw per trip)");

panel2.add(label6);

label6.setBounds(10, 185, 205,

label6.getPreferredSize().height);

 

}

tabbedPane1.addTab("Potions", panel2);

 

// ======== panel3 ========

{

panel3.setLayout(null);

 

// ---- label7 ----

label7.setText("Bank at:");

panel3.add(label7);

label7.setBounds(10, 10, 60,

label7.getPreferredSize().height);

 

// ---- radioButton1 ----

radioButton1.setText("Varrock West");

radioButton1.setSelected(true);

panel3.add(radioButton1);

radioButton1.setBounds(15, 25, 95,

radioButton1.getPreferredSize().height);

 

// ---- radioButton2 ----

radioButton2.setText("Edgeville");

panel3.add(radioButton2);

radioButton2.setBounds(15, 45, 95, 23);

 

// ---- label8 ----

label8.setText("Teleporting:");

panel3.add(label8);

label8.setBounds(10, 75, 85,

label8.getPreferredSize().height);

 

// ---- radioButton3 ----

radioButton3.setText("Don't teleport");

panel3.add(radioButton3);

radioButton3.setBounds(15, 90, 100,

radioButton3.getPreferredSize().height);

 

// ---- radioButton4 ----

radioButton4.setText("Varrock telerunes");

radioButton4.setSelected(true);

panel3.add(radioButton4);

radioButton4.setBounds(15, 110, 115,

radioButton4.getPreferredSize().height);

 

// ---- radioButton5 ----

radioButton5.setText("Varrock teletablet");

panel3.add(radioButton5);

radioButton5.setBounds(15, 130, 120,

radioButton5.getPreferredSize().height);

 

// ---- radioButton6 ----

radioButton6.setText("Glory amulet");

radioButton6.setEnabled(false);

panel3.add(radioButton6);

radioButton6.setBounds(15, 150, 130,

radioButton6.getPreferredSize().height);

 

}

tabbedPane1.addTab("Banking", panel3);

 

// ======== panel4 ========

{

panel4.setLayout(null);

 

// ---- label9 ----

label9.setText("Room changing:");

panel4.add(label9);

label9.setBounds(10, 10, 85,

label9.getPreferredSize().height);

 

// ---- radioButton7 ----

radioButton7.setText("Change randomly every trip");

radioButton7.setSelected(true);

panel4.add(radioButton7);

radioButton7.setBounds(15, 25, 170,

radioButton7.getPreferredSize().height);

 

// ---- radioButton8 ----

radioButton8.setText("Fight in room 1");

panel4.add(radioButton8);

radioButton8.setBounds(15, 45, 130,

radioButton8.getPreferredSize().height);

 

// ---- radioButton9 ----

radioButton9.setText("Fight in room 2");

panel4.add(radioButton9);

radioButton9.setBounds(15, 65, 130,

radioButton9.getPreferredSize().height);

 

// ---- checkBox6 ----

checkBox6.setText("Pickup and re-equip arrows");

checkBox6.setEnabled(true);

panel4.add(checkBox6);

checkBox6.setBounds(5, 90, 175,

checkBox6.getPreferredSize().height);

 

}

tabbedPane1.addTab("Other", panel4);

 

}

// ---- button1 ----

button1.setText("Start");

button1.addActionListener(new ActionListener() {

@Override

public void actionPerformed(ActionEvent e) {

button1ActionPerformed(e);

}

});

// ---- button2 ----

button2.setText("Use last saved settings");

button2.addActionListener(new ActionListener() {

@Override

public void actionPerformed(ActionEvent e) {

useSavedSettings = true;

setVisible(false);

isReady = true;

}

});

button2.setEnabled(settingsFile.exists());

 

// ---- buttonGroup1 ----

ButtonGroup buttonGroup1 = new ButtonGroup();

buttonGroup1.add(radioButton1);

buttonGroup1.add(radioButton2);

 

// ---- buttonGroup2 ----

ButtonGroup buttonGroup2 = new ButtonGroup();

buttonGroup2.add(radioButton3);

buttonGroup2.add(radioButton4);

buttonGroup2.add(radioButton5);

buttonGroup2.add(radioButton6);

 

// ---- buttonGroup3 ----

ButtonGroup buttonGroup3 = new ButtonGroup();

buttonGroup3.add(radioButton7);

buttonGroup3.add(radioButton8);

buttonGroup3.add(radioButton9);

layout.setHorizontalGroup(layout

.createParallelGroup()

.addComponent(tabbedPane1)

.addGroup(

layout.createSequentialGroup()

.addComponent(button1)

.addComponent(button2)));

layout.setVerticalGroup(layout

.createSequentialGroup()

.addComponent(tabbedPane1)

.addGroup(

layout.createParallelGroup().addComponent(button1)

.addComponent(button2)));

add(panel);

setSize(220, 300);

setVisible(true);

}

 

private JTabbedPane tabbedPane1;

private JPanel panel1;

private JLabel label1;

private JTextField textField1;

private JLabel label2;

private JList list1;

private JLabel label3;

private JTextField textField2;

private JLabel label4;

private JTextField textField3;

private JPanel panel2;

private JLabel label5;

private JCheckBox checkBox1;

private JCheckBox checkBox2;

private JCheckBox checkBox3;

private JCheckBox checkBox4;

private JCheckBox checkBox5;

private JTextField textField4;

private JTextField textField5;

private JTextField textField6;

private JTextField textField7;

private JTextField textField8;

private JLabel label6;

private JPanel panel3;

private JLabel label7;

private JRadioButton radioButton1;

private JRadioButton radioButton2;

private JLabel label8;

private JRadioButton radioButton3;

private JRadioButton radioButton4;

private JRadioButton radioButton5;

private JRadioButton radioButton6;

private JPanel panel4;

private JLabel label9;

private JRadioButton radioButton7;

private JRadioButton radioButton8;

private JRadioButton radioButton9;

private JCheckBox checkBox6;

private JButton button1;

private JButton button2;

}

 

private boolean useSavedSettings = false;

private File settingsFile = new File(new File(

GlobalConfiguration.Paths.getSettingsDirectory()),

"GSKSettings.ini");

 

}

 

class GSKSettings implements Serializable {

private static final long serialVersionUID = -4807990096796711133L;

public int foodID, eatingValues[], potions[], potionAmounts[], currentRoom;

public boolean bankIsEdge, enableTeleporting, useTablets, changeRooms,

enableRange;

}

 

 

 

Mam nadzieje że pomogłem, jakieś pytania? Proszę pisać na dole ;>

 

Jeżeli przeczytałeś ten poradnik, OCEŃ GO !

Ocenienie Tego poradnika daje mi motywacje do kontynuowania go.

Jeżeli chcesz aby był na bieżąca Updatowany, zostaw ślad i komentarz na jego temat.

 

W Następnym Updacie :

- 2 Skrypty ! Combat i Money Maker (170k/h F2P !)

- Odpowiedzi na rozwiązanie błędu !

- Porady jak nie zostać nakrytym !

 

Zapraszam do oceny i pozdrawiam.

 

v1.1 - 06.02.11 - Dodanie odpowiedzi na temat "Fightera"

 

Proszę o pisanie na PW, co byście chcieli zobaczyć w Następnej versji lub jaki skrypt opisać ;>

 

Całość stworzona prze zemnie, nie kopiowane. Prawa Autorskie, Przed Skopiowaniem spytaj o możliwość kopjowania !

 

Ps. Proszę o ocene Moda i Podpięcie.

edytowane przez rumuna

Opublikowano

Masz u mnie wielkiego + ;]

 

Podpinamy ; )

 

 

@Jak kiedyś dostaniesz za coś % to napisz mi na PW to Ci zdejmę bo teraz masz 0 % ;]

1365339323-U58387.png

By Valky <3

Opublikowano

;> Piszcie co byście chcieli zobaczyć w nastepnej versji ;>

Lub podajcie jakiś ciekawy skrypt na PW.

edytowane przez rumuna

Opublikowano

Anwaser Update - Odpowiedź na pytanie dotyczące Fightera. Zapraszam do Lektury.

edytowane przez rumuna

  • 2 tygodnie później...
Opublikowano

Mam pytanie .

 

Robię wszystko jak trzeba z tymi skryptami i nic niechce się zapisać jako". java"

Proszę o pomoc ;(.

Nic,

  • 1 miesiąc temu...
Opublikowano

Dorzucam mojego tut'a z innym bardzo dobrym botem Bot

 

 

a Tobie leci +

 

ten twój bot jest lewy nie klikajcie w to!

 

A co do rs bota...

Wielki + za Tuta!

130242193251468659.gif
  • 5 tygodni później...
  • 3 tygodnie później...
Opublikowano

prosiłbym żebyś stworzył takiego PROOO ścinacza yewek który jest dosłownie zapięty na ostatni guzik, bede dawał ci mnóstwo + czy co chcesz

 

 

albo jakiś pro fighter który np: bije krówki po uzbieraniu np: 10k cowhide sellnał je gdy na rynku bedzie najlepsza cena a potem np: zbierał dalej, nie wiem obojętne ale musze zrobić sobie dropka który zarabia, co polecacie? bić coś na bocie czy ścinac na bocie np: yewki, ale to ma byc f2p

 

 

@edit

 

Chciałbym przeprosić że nie dałem oceny

 

oto ona: 99999/10

 

komentarz:

 

świetny bot i cieszę się że na świecie są osoby z takimi umiejętnościami i pomysłami, oby tak dalej.

CPU: Intel Core i7 6770K @ 4,0GHz
GPU: Zotac GTX 780Ti AMP Edition
RAM: Kingston 2x8GB

Case: Cooler Master HAF X

  • 1 miesiąc temu...
  • 2 miesiące temu...
Opublikowano

Fajny bo fajny tut dziękuje leci plus i nic w nim nie brakuje !! :D

  • 3 tygodnie później...
  • 3 miesiące temu...
  • 4 tygodnie później...
Opublikowano

Bardzo fajnie i zwięźle opisałeś co i jak , dla tak zielonych graczy jak ja :D Dosłownie wszystko zrozumiałem co i jak , a jeżeli tak ograniczony człowiek jak ja był wstanie zrozumieć , to myślę że bardziej inteligentni koledzy od runescape tym bardziej skapują ;D

Masz tego plusika... ;D

"Nie ma wakacji, nie ma weekendów, nie ma urodzin, ZERO dni wolnych, bo każdy dzień jest ważny!"

  • 1 miesiąc temu...
  • 2 tygodnie później...
  • 3 tygodnie później...
  • 1 miesiąc temu...
Opublikowano

Czy ten bot nadal działa tak jak działał? Nie pojawiają się u mnie te pliki , do których można ładować ręcznie skrypty ;/ W ogóle to oprócz samego RsBot'a to nie ma żadnego pliku. Wie ktoś może co jest grane? Z góry dzięki za pomoc.

Zarchiwizowany

Ten temat przebywa obecnie w archiwum. Dodawanie nowych odpowiedzi zostało zablokowane.

×
×
  • Dodaj nową pozycję...