All pastes #371453 Raw Edit

Unnamed

public java v1 · immutable
#371453 ·published 2007-02-25 10:18 UTC
rendered paste body
import impsoft.nexus.bots.color.constants.Areas;import impsoft.nexus.bots.color.constants.Compass;import impsoft.nexus.bots.color.constants.Info;import impsoft.nexus.bots.color.listeners.ChatListener;import impsoft.nexus.bots.color.methods.ColorScript;import impsoft.nexus.bots.color.methods.GameScreenMethods;import impsoft.nexus.bots.color.scriptobjects.MiniMap;import impsoft.nexus.bots.color.scriptobjects.NPCChat;import impsoft.nexus.bots.color.scriptobjects.RGB;import impsoft.nexus.bots.color.scriptobjects.RGBCluster;import impsoft.nexus.bots.color.scriptobjects.Timer;import impsoft.nexus.bots.color.scriptobjects.XY;import java.awt.Rectangle;public class IMPRimmington extends ColorScript implements ChatListener {	public String[] commands = new String[] { "power copper", "bank copper",			"bank iron" };	public String author = "ruler";	int mode = -1;	boolean playerIsMiningRock = true;	public void chat(String message) {		if (playerIsMiningRock && message.contains("manage")) {			playerIsMiningRock = false;		}	}	public void combatCheck() throws InterruptedException {		if (inCombat()) {			walk(Compass.NORTH, 30);			walk(Compass.NORTH, 30);			walk(Compass.NORTH, 30);			walk(Compass.NORTH, 30);			walk(Compass.SOUTH, 30);			walk(Compass.SOUTH, 30);			walk(Compass.SOUTH, 30);			walk(Compass.SOUTH, 30);			walkToOre();		}	}	public boolean bank;	public RockRGBCluster ore;	public RGBCluster pickAxeHead = new RGBCluster(new RGB[] {			new RGB(45, 31, 0), new RGB(52, 35, 0) }, this);	public RGBCluster bankBooth = new RGBCluster(new RGB[] {			new RGB(27, 21, 9), new RGB(100, 77, 45), new RGB(103, 84, 47) },			this);	public boolean doStart(String cmd, String[] args) {		bank = cmd.contains("bank");		if (cmd.contains("copper")) {			ore = new RockRGBCluster(new RGB[] { new RGB(161, 100, 58),					new RGB(179, 112, 66) }, this) {				public void walkToFromMapSymbol() throws InterruptedException {					walkTowardAColorOnMM(60, 0, new RGB(59, 49, 61));				}			};		} else {			ore = new RockRGBCluster(new RGB[] { new RGB(92, 58, 43),					new RGB(76, 46, 34), new RGB(99, 61, 9) }, this) {				public void walkToFromMapSymbol() throws InterruptedException {					walk(Compass.WEST, 60);				}			};		}		return true;	}	public void fixAxe() throws InterruptedException {		Timer t = new Timer(120000);		while (!t.isUp()) {			pickAxeHead.gatherNewPoints(100);			if (pickAxeHead.doTopTextAndMenu("Take", "Take")) {				doActionAtInventory("head", "Use", 1);				doActionAtInventory("handle", "Use", 1);			} else {				Rectangle items[] = getItemsOnMinimap();				if (items.length > 0) {					Rectangle closest = items[0];					for (int i = 1; i < items.length; i++) {						if (distance(Areas.MINI_MAP_CENTER, items[i]) < distance(								Areas.MINI_MAP_CENTER, closest)) {							closest = items[i];						}					}					mouseClickLeft(closest);					sleep(2000);					while (isMoving() || isMapFlagUp()) {						sleep(500);					}				}			}		}	}	public boolean inCombat() {		RGB fightColor = new RGB(65280);		Rectangle searchZone = new Rectangle(217, 129, 80, 80);		return (numRGBs(getColorArray2d(), fightColor, searchZone) > 0);	}	public boolean walkToSymbol(short[][][] symbol) throws InterruptedException {		XY mine = findSymbol(symbol);		if (mine != null) {			MMClick(mine);			return true;		}		return false;	}	public void walkToOre() throws InterruptedException {		Timer t = new Timer(20000);		while (!t.isUp()) {			if (walkToSymbol(MiniMap.SYMBOL_MINING_SPOT)) {				info("Found Mine Symbol");				ore.walkToFromMapSymbol();			} else {				error("Failed to find Mine Symbol");			}		}	}	@Override	public void script() throws InterruptedException {		while (!isLoggedin()) {			debug("not logged in");			sleep(3000);		}		if (walkToSymbol(MiniMap.SYMBOL_BANK)) {			walkToMine();		} else {			walkToOre();		}		while (true) {			if (!isLoggedin()) {				debug("not logged in");				sleep(3000);				continue;			}			setTab(Info.TAB_INVENTORY);			if (inventoryCount() == 28) {				if (bank) {					walkToBank();					Timer t = new Timer(2000);					while (!t.isUp()) {						bankBooth.gatherNewPoints(10);						if (bankBooth.doTopTextAndMenu("Bank", "quickly")) {							doActionAtInventory(new String[] { "pickaxe" },									"All", 28);						}					}					walkToMine();				} else {					doActionAtInventory(new String[] { "pickaxe" }, "Drop", 28);				}			}			setTab(Info.TAB_INVENTORY);			while (inventoryCount() != 28) {				ore.gatherNewPoints(10);				if (ore.doTopTextAndMenu("Mine", "Mine")) {					sleep(defaultmaxAgeInMillisecs * 5);					while (isMoving() || isMapFlagUp())						sleep(defaultmaxAgeInMillisecs * 7);					combatCheck();					NPCChat chat = getNPCChat(2000);					if (chat != null && chat.contains("You need")) {						warn("Missing Axe head");						fixAxe();					}					playerIsMiningRock = true;					Timer t = new Timer(random(15000, 25000));					while (!t.isUp() && playerIsMiningRock) {						sleep(defaultmaxAgeInMillisecs * 3);						combatCheck();					}				} else {					warn("Could not Find Rock");					sleep(defaultmaxAgeInMillisecs * 20);				}				combatCheck();			}			sleep(defaultmaxAgeInMillisecs * 2);		}	}	public void walkToBank() throws InterruptedException {		Timer t = new Timer(20000);		while (!t.isUp()) {			if (walkToSymbol(MiniMap.SYMBOL_MINING_SPOT)) {				info("Found Mine Symbol");			} else {				error("Failed to find Mine Symbol");			}		}		info("Clicking rock");		walkTowardAColorOnMM(60, 0, new RGB(43, 41, 45));		walkTowardARoadOnMM(50, 0, new RGB(100, 90, 90));		followARoadOnMM(60, -20, new RGB(100, 90, 90));		followARoadOnMM(40, -110, new RGB(100, 90, 90));		followARoadOnMM(160, -25, new RGB(100, 90, 90));		followARoadOnMM(100, -10, new RGB(120, 110, 95));		Timer t2 = new Timer(20000);		while (!t2.isUp()) {			if (walkToSymbol(MiniMap.SYMBOL_BANK)) {				info("Found Bank Symbol");			} else {				error("Failed to find Bank Symbol");			}		}	}	public void walkToMine() throws InterruptedException {		Timer t2 = new Timer(20000);		while (!t2.isUp()) {			if (walkToSymbol(MiniMap.SYMBOL_BANK)) {				info("Found Bank Symbol");			} else {				error("Failed to find Bank Symbol");			}		}		walkTowardAColorOnMM(-65, 25, new RGB(241, 0, 0));		followARoadOnMM(-105, -10, new RGB(120, 110, 95));		log("Should be at Fally Gate");		followARoadOnMM(-160, 15, new RGB(100, 90, 90));		log("Should be Next to Chickens");		followARoadOnMM(-50, 100, new RGB(100, 90, 90));		log("Should be A a cross Road");		followARoadOnMM(-60, 20, new RGB(100, 90, 90));		log("Clicking rock");		walkTowardAColorOnMM(-60, 0, new RGB(43, 41, 45));		log("Should be At Mine");		walkToOre();	}}abstract class RockRGBCluster extends RGBCluster {	public abstract void walkToFromMapSymbol() throws InterruptedException;	public RockRGBCluster(RGB[] rgbs, GameScreenMethods methods) {		super(rgbs, methods);	}	@Override	public void gatherNewPoints(int points) {		super.gatherNewPoints(points);		removeRedundantPoints(4);		removePointsNearColor(new RGB(148, 140, 115));	}}