All pastes #1362430 Raw Edit

Kanes error.

public text v1 · immutable
#1362430 ·published 2009-03-16 17:54 UTC
rendered paste body
begin
program import java.util.Map;
import com.speljohan.rsbot.script.Script;
import com.speljohan.rsbot.script.wrappers.RSInterface;
import com.speljohan.rsbot.script.wrappers.RSItemTile;
import com.speljohan.rsbot.script.wrappers.RSNPC;
import com.speljohan.rsbot.script.wrappers.RSObject;
import com.speljohan.rsbot.script.wrappers.RSTile;

public class GuildFisher extends Script {
	int[] whirlpools = new int[] { 403, 404, 406, 406 };
	int SPOT = 313;
	int BANK_BOOTH = 2213;
	int STUFF = 311;
	long lastCheck;
	int checkTime;
	int fail= 0;
	int SHARKS = 383;
	RSTile GETTING_STUFF[] = { new RSTile(2594, 3414), new RSTile(2601, 3404),
			new RSTile(2612, 3399) };
	RSTile GOING_FISHING[] = { new RSTile(2587, 3420), new RSTile(2599, 3421) };
	RSTile GOING_BACK[] = reversePath(GOING_FISHING);
	RSTile Back[] = reversePath(GETTING_STUFF);
	RSTile GOING_BACK_FROM_OTHER[] = { new RSTile(2597, 3410),
			new RSTile(2587, 3420) };

	public boolean onStart(Map<String, String> args) {
		return true;
	}

	public double getVersion() {
		return 1.0;
	}

	public String getName() {
		return "Guild Fisher";
	}

	public String getAuthor() {
		return "Killa";
	}

	public String getScriptCategory() {
		return "Killa/Fishing";
	}

	private boolean ON_OTHER_DOCK() {
		return getMyPlayer().getLocation().getY() < 3414;
	}

	void BANKING() {
		if (RSInterface.getInterface(INTERFACE_BANK).isValid()) {
			bank.depositAllExcept(STUFF);
			wait(random(500, 1000));
		} else {
			RSObject BOOTH = findObject(BANK_BOOTH);
			atObject(BOOTH, "uickly");
			wait(random(1000, 2000));
			BANKING();
		}
	}

	void CHECKING() {
		if (getNearestNPCByID(whirlpools) != null
				&& distanceTo(getNearestNPCByID(whirlpools).getLocation()) <= 1) {
			atTile(getMyPlayer().getLocation(), "alk");
		} else {
			wait(random(50, 100));
		}
	}
	void DOOR() {
		if (findObject(916) != null) {
			atObject(findObject(916), "Open");
		} else {
			wait(random(50,100));
		}
	}

	public int loop() {
		setCameraAltitude(true);
		setCompass('N');
		if (getMyPlayer().isMoving())
            return random(0, 150);
		if (getEnergy() >= random(20, 65) && !isRunning()) {
			setRun(true);
			return random(500, 750);
		}
		if (isInventoryFull() && inventoryContainsOneOf(SHARKS)) {
			walkPathMM(randomizePath(GOING_BACK, 2, 2), 20);
		}
		if (isInventoryFull() && inventoryContainsOneOf(SHARKS) && ON_OTHER_DOCK()) {
			walkPathMM(randomizePath(GOING_BACK_FROM_OTHER, 2, 2), 20);
		}
		if (!isInventoryFull() && distanceTo(new RSTile(2585, 3420)) <= 5
				&& inventoryContainsOneOf(STUFF) && !getMyPlayer().isMoving() && getMyPlayer().getAnimation() == -1) {
			walkPathMM(randomizePath(GOING_FISHING, 2, 2), 20);
		}
		if (distanceTo(new RSTile(2585, 3420)) <= 5 && isInventoryFull()
				&& findObject(BANK_BOOTH) != null) {
			BANKING();
		}
		if (!inventoryContainsOneOf(STUFF)) {
			walkPathMM(randomizePath(GETTING_STUFF, 2, 2), 20);
		}
		if (distanceTo(new RSTile(2611, 3399)) <= 5
				&& !inventoryContainsOneOf(STUFF)) {
			setCameraAltitude(false);
			setCompass('s');
			DOOR();
			wait(random(2000, 4000));
			setCameraAltitude(true);
			atTile(new RSTile (2606, 3396), "alk");
			wait(random(5000,10000));
			setCompass('w');
wait(random(500,1000));
			RSItemTile itemTile = getGroundItemByID(STUFF);
			atTile(itemTile, "ake");
		}
		if (getMyPlayer().getLocation().equals(new RSTile(2606, 3396))
				&& inventoryContainsOneOf(STUFF)) {
			walkPathMM(randomizePath(Back, 2, 2), 20);
		}
		if (!isInventoryFull() && inventoryContainsOneOf(STUFF)
				&& getMyPlayer().getAnimation() == -1
				&& !getMyPlayer().isInCombat() && !getMyPlayer().isMoving()) {
			RSNPC PLACE = getNearestNPCByID(SPOT);
			atNPC(PLACE, "poon");
		}
		if (fail >= 10){
			logout();
			stopAllScripts();
		}
		if (getNearestNPCByID(SPOT) != null && getMyPlayer().isInCombat()) {
			walkPathMM(randomizePath(GOING_BACK, 2, 2), 20);
			wait(random(10000, 15000));
		}
		if (findObject(BANK_BOOTH) != null && getMyPlayer().isInCombat()) {
			walkPathMM(randomizePath(GOING_FISHING, 2, 2), 20);
			wait(random(10000, 15000));
		}
		if (getMyPlayer().getAnimation() != -1 && !getMyPlayer().isInCombat()) {
			CHECKING();
			antiBan();
		}
		return (random(250, 300));
	}
	int antiBan() {
		int GambleInt = random(1, 4);

		switch (GambleInt) {
			case 1:
				wait(random(1000, 1500));
				break;

			case 2:
				int x = random(0, 750);
				int y = random(0, 500);
				moveMouse(0, 0, x, y);
				return random(1000, 1500);

			case 3:
				// Is the current tab the inventory?
				if (getCurrentTab() != TAB_INVENTORY) {
					// No, so switch to the inventory tab.
					openTab(TAB_INVENTORY);
					return random(500, 750);
				} else {
					// No, so return
					return random(500, 750);
				}

			case 4:
				// If the player is moving, then abort.
				if (getMyPlayer().isMoving()) {
					return random(750, 1000);
				}

				if (System.currentTimeMillis() - lastCheck >= checkTime) {
					lastCheck = System.currentTimeMillis();
					checkTime = random(60000, 180000);

					if (getCurrentTab() != TAB_STATS) {
						openTab(TAB_STATS);
					}
					moveMouse(663, 292, 50, 28);
					return random(5000, 8000);
				}
		}
		return(random(750,1000));
	}
end.