import impsoft.ibot.methods.RGB; import impsoft.ibot.methods.RGBXY; import impsoft.ibot.methods.Script; import impsoft.ibot.methods.XY; import java.awt.Rectangle; import java.util.ArrayList; import impsoft.ibot.Areas; import impsoft.ibot.Info; public class Fallybanker extends Script { private RGB bank = new RGB(244, 218, 93); private RGB booth = new RGB(119, 96, 67); public int[][] menuBalackBar; private XY matches; public static double version = 2.1; public static String[] commands = new String[] { " " }; public String author = "rikioh"; public String description = "banking demo"; public boolean doStart(String cmd, String[] args) { // Create a black line 100 X 1 if (menuBalackBar == null) { menuBalackBar = new int[100][1]; for (int x = 0; x < menuBalackBar.length; x++) { for (int y = 0; y < menuBalackBar[x].length; y++) { menuBalackBar[x][y] = 0; } } } return true; } public void script() throws InterruptedException { while (true) { XY bankMiniMap = getMiniMapBank(); if (bankMiniMap != null) { // Bank Symbol log("Found Bank Symbol!"); mouseClickLeft(bankMiniMap.x, bankMiniMap.y); log("Moving to Bank Symbol"); sleep(10000); XY booth = getBankBooth(); if (booth != null) { log("Found Bank Booth!"); // mouseMove(booth); // sleep(800); // if (getTopText().indexOf("booth") != -1) { log("Clicking Bank Booth"); mouseClickRight(booth); sleep(1000); int loop = 0; while (findXYs(Areas.GAME, menuBalackBar, 1).length == 0) { sleep(100); loop++; if (loop > 20) { log("Failed to find menu"); return; } } //White text XY OpenBankk = findGameText("quickly", Areas.GAME, new RGB( 255, 255, 255), 1, 1, 1); //Yellow Text if (OpenBankk == null) { OpenBankk = findGameText("quickly", Areas.GAME, new RGB(255, 255, 1), 1, 1, 1); } if (OpenBankk != null) { mouseClickLeft(OpenBankk); sleep(2000); doAllInventory(new String[] { "axe" }, "All"); // mouseMove(486, 41, 2000); // // mouseClickLeft(486, 41, 2000); } // } } } sleep(1000); } } public XY getMiniMapBank() { return findXYspiral(Areas.MINI_MAP, 50, 25, bank, 60, 60, 60); } public XY getBankBooth() { return findXYspiral(Areas.GAME, Areas.GAME.x + Areas.GAME.width / 2, Areas.GAME.y + Areas.GAME.height / 2, booth, 3, 3, 3); } /** * * @param invIndex * The index you want to bring the menu up on * @param Action * The name of the thing that comes up in the menu, dont have * spaces plz! * @author ruler * @throws InterruptedException */ public void doInventory(int invIndex, String Action) throws InterruptedException { Rectangle inventorySpot = Info.getInventoryRectangle(invIndex); int currentMouseX = currentMouseX(); int currentMouseY = currentMouseY(); if (inventorySpot.contains(currentMouseX, currentMouseY)) { mouseClickRight(currentMouseX, currentMouseY); } else { mouseClickRight(inventorySpot); } /* * The text can be either White 0,0,0 or Yellow 255,255,0 so instead i * just set the tolerance for red to 255 So the Red values doesn't * matter; */ int loop = 0; while (findXYs(Areas.INVENTORY, menuBalackBar, 1).length == 0) { sleep(100); loop++; if (loop > 20) { log("Failed to find menu"); return; } } XY wordDrop = findGameText(Action, Areas.INVENTORY, new RGB(255, 255, 255), 1, 1, 255); if (wordDrop != null) { Rectangle dropButton = new Rectangle(wordDrop.x, wordDrop.y, 30, 8); mouseClickLeft(dropButton); sleep(500); } else { // This should not happen in thoery but this is a fail safe XY wordCancel = findGameText("Cancel", Areas.INVENTORY, new RGB( 255, 255, 255), 1, 1, 255); if (wordCancel != null) { Rectangle cancelButton = new Rectangle(wordCancel.x, wordCancel.y, 30, 8); mouseClickLeft(cancelButton); sleep(500); } } } /** * * @param ignoreItemNames * The item names you dont want to do this action to * @param Action * The name of the thing that comes up in the menu, dont have * spaces plz! * @author ruler * @throws InterruptedException */ public void doAllInventory(String ignoreItemNames[], String Action) throws InterruptedException { // Check Tab to make sure we are in the inventory if not switch to the // Inventory if (getTab() != Info.TAB_INVENTORY && getTab() != -1) { setTab(Info.TAB_INVENTORY); } for (int i = 1; i < 29; i++) { // if no item is in the slot skip this slot; int loop = 0; while (itemExist(i)) { mouseMove(Info.getInventoryRectangle(i)); String topText = getTopText().trim(); if (topText.indexOf(" ") != -1 && topText.indexOf("/") != -1) { // This determines the items name from the topText String item = topText.substring(topText.indexOf(" "), topText.indexOf("/")).trim(); if (item.length() > 1) { // We dont want to drop our pickaxe boolean ignore = false; if (ignoreItemNames != null) for (int ignoreIndex = 0; ignoreIndex < ignoreItemNames.length; ignoreIndex++) { if (topText .indexOf(ignoreItemNames[ignoreIndex]) != -1) { ignore = true; } } if (ignore) { break; } else { // if (topText.indexOf(Action) == -1) { log("Found a \"" + item + "\" in Inventory Slot " + i + " '" + Action + "ing'"); doInventory(i, Action); if (itemExist(i)) { i--; } break; } } } loop++; if (loop > 10) { log("loop>10"); break; } sleep(300); } } } }