import impsoft.nexus.bots.color.constants.Areas; import impsoft.nexus.bots.color.constants.Compass; 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.methods.SortMethods; 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.walking.Path; import impsoft.nexus.bots.color.scriptobjects.walking.RoadTile; import impsoft.nexus.bots.color.scriptobjects.walking.SymbolTile; import impsoft.nexus.bots.color.scriptobjects.walking.Tile; import java.awt.Rectangle; class AxeHeadFinder extends RGBCluster { public AxeHeadFinder(GameScreenMethods methods) { super(new RGB[] { new RGB(45, 31, 0), new RGB(52, 35, 0) }, methods); } public boolean fix() throws InterruptedException { theScript.warn("Missing Axe head"); Timer t = new Timer(120000); while (!t.isUp()) { gatherNewPoints(100); if (doTopTextAndMenu("Take", "Take")) { theScript.doActionAtInventory("head", "Use", 1); theScript.doActionAtInventory("handle", "Use", 1); return true; } else { Rectangle items[] = theScript.getItemsOnMinimap(); if (items.length > 0) { items = SortMethods.orderAccordingToClosestToRectangle( items, Areas.MINI_MAP_CENTER); theScript.mouseClickLeft(items[0]); Thread.sleep(2000); while (theScript.isMoving() || theScript.isMapFlagUp()) { Thread.sleep(500); } } } } return false; } } class BankBooth extends RGBCluster { public BankBooth(GameScreenMethods methods) { super(new RGB[] { new RGB(27, 21, 9), new RGB(100, 77, 45), new RGB(103, 84, 47) }, methods); } public boolean bank() throws InterruptedException { Timer t = new Timer(20000); while (!t.isUp()) { gatherNewPoints(10); if (doTopTextAndMenu("Bank", "quickly")) { theScript.doActionAtInventory(new String[] { "pickaxe" }, "All", 28); return true; } } return false; } } public class IMPRimmington extends ColorScript implements ChatListener { public String[] commands = new String[] { "power copper", "bank copper", "bank iron" }; public String author = "ruler"; boolean isPlayerIsMiningRock = true; private boolean SETTING_BANK; private Rock theRock; private AxeHeadFinder theAxeHeadFinder; private BankBooth theBankBooth; Path toMine; private void axeHeadCheck() throws InterruptedException { NPCChat chat = getNPCChat(100); if (chat != null && chat.contains("You need") && !chat.contains("level")) { theAxeHeadFinder.fix(); } } public void chat(String message) { if (isPlayerIsMiningRock && message.contains("manage")) { isPlayerIsMiningRock = false; } } private void combatCheck() throws InterruptedException { if (inCombat()) { walkInDirection(Compass.NORTH, 200); walkInDirection(Compass.SOUTH, 200); walkToOre(); } } @Override public boolean doStart(String cmd, String[] args) { theBankBooth = new BankBooth(this); toMine = new Path(this); /* toMine.add(new SymbolTile(0, 0, MiniMap.SYMBOL_BANK)); toMine.add(new RoadTile(-38, -13)); toMine.add(new RoadTile(-38 - 10, -13 - 279)); toMine.add(new RoadTile(-38 - 10 - 108, -13 - 279 - 44)); toMine.add(new RoadTile(-38 - 10 - 108 - 11, -13 - 279 - 44 - 51)); toMine.add(new Tile(-38 - 10 - 108 - 11 + 4, -13 - 279 - 44 - 51 - 41)); toMine.add(new SymbolTile(-38 - 10 - 108 - 11 + 4 + 10, -13 - 279 - 44 - 51 - 41 - 47, MiniMap.SYMBOL_MINING_SPOT)); */ toMine = new Path(this); toMine.add(new SymbolTile(0, 0, MiniMap.SYMBOL_BANK)); toMine.add(new RoadTile(-38, -13)); toMine.add(new RoadTile(-48, -292)); toMine.add(new RoadTile(-156, -336)); toMine.add(new RoadTile(-167, -387)); toMine.add(new Tile(-163, -479)); toMine.add(new SymbolTile(-153, -526, MiniMap.SYMBOL_MINING_SPOT)); SETTING_BANK = cmd.contains("bank"); if (cmd.contains("copper")) { theRock = new Rock(new RGB[] { new RGB(161, 100, 58), new RGB(179, 112, 66) }, this) { @Override public void walkToFromMapSymbol() throws InterruptedException { walkInDirection(Compass.NORTH, random(20,40)); } }; } else { theRock = new Rock(new RGB[] { new RGB(89, 55, 42) }, this) { @Override public void walkToFromMapSymbol() throws InterruptedException { walkInDirection(Compass.WEST, random(20,40)); } }; } return true; } private boolean inCombat() { RGB fightColor = new RGB(65280); Rectangle searchZone = new Rectangle(217, 129, 80, 80); return (numRGBs(getColorArray2d(), fightColor, searchZone) > 0); } @Override public void script() throws InterruptedException { // script loop int noRock=0; while (true) { if (!isLoggedin()) { debug("not logged in"); sleep(3000); continue; } walkToOre(); if (inventoryCount() == 28) { if (SETTING_BANK) { toMine.walkFromEndToStart(); theBankBooth.bank(); toMine.walkFromStartToEnd(); } else { doActionAtInventory(new String[] { "pickaxe" }, "Drop", 28); } } while (inventoryCount() != 28) { if (theRock.mine()) { isPlayerIsMiningRock = true; sleep(defaultmaxAgeInMillisecs * 5); while (isMoving() || isMapFlagUp()) { axeHeadCheck(); combatCheck(); sleep(defaultmaxAgeInMillisecs * 10); } Timer t = new Timer(random(15000, 25000)); while (!t.isUp() && isPlayerIsMiningRock) { axeHeadCheck(); combatCheck(); sleep(defaultmaxAgeInMillisecs * 10); } noRock=0; } else { noRock++; warn("Could not Find Rock"); if(noRock>10){ walkToOre(); } sleep(defaultmaxAgeInMillisecs * 20); } combatCheck(); } sleep(defaultmaxAgeInMillisecs * 2); } } private void walkToOre() throws InterruptedException { toMine.walkToEndTile(); theRock.walkToFromMapSymbol(); } } abstract class Rock extends RGBCluster { public Rock(RGB[] rgbs, GameScreenMethods methods) { super(rgbs, methods); } @Override public void gatherNewPoints(int points) { super.gatherNewPoints(points); removeRedundantPoints(4); // anti-gas removePointsNearColor(new RGB(148, 140, 115), 3, 3, 3); } public boolean mine() throws InterruptedException { gatherNewPoints(10); return doTopTextAndMenu("Mine", "Mine"); } public abstract void walkToFromMapSymbol() throws InterruptedException; }