public boolean useInteract() { if (Inventory.getCount(craftable.getRawID()) > 0) { RSItem[] items = Inventory.find(craftable.getRawID()); int size = items.length; RSItem item = items[General.random(0, size)]; if (item.click("Use")) { RSObject oa[] = Objects.findNearest(station.getMaxDist(), station.getID()); if (oa != null && oa.length > 0) { RSObject o = oa[0]; if (o.isOnScreen()) { o.click(station.getOption()); General.sleep(400, 800); } } } } return false; }
/** * Waits a certain amount of time until we have no more willow logs * * @param startAmount starting amount * @param ms time to wait * @return true if current amount lower than start amount */ private boolean waitSellWillows(int startAmount, int ms) { long t = System.currentTimeMillis(); while (Timing.timeFromMark(t) < ms) { if (Inventory.find(willowID).length < startAmount) { return true; } General.sleep(ms / 20, ms / 10); } return false; }
/** * Sells the willow logs to the general store * * @return True if sold all logs */ public boolean sellWillows() { RSItem[] willows = Inventory.find(willowID); while (isStoreOpen() && willows.length > 0) { // Check if we are hovering willow logs already String uptext = Game.getUptext(); if (uptext != null && uptext.contains("willow")) { Mouse.click(3); waitSellOption(willows.length, General.random(1500, 2000)); } else { // Selling based on optimal index int index = generateIndex(willows.length); willows[index].click("Sell 10"); } // Wait until we sell, update progress waitSellWillows(willows.length, General.random(2000, 3000)); willows = Inventory.find(willowID); } return willows.length == 0; }
@Override public void run() { // Count slots used for not-bones vs how many bananas worth of bones we have int slotsUsed = 0; int potentialBananas = 0; RSItem[] items = Inventory.getAll(); for (RSItem item : items) { // If this isn't a bone count it if (item.getID() < 6904 || item.getID() > 6907) { slotsUsed++; } else { // Item id bone amount // 6904 1 // 6905 2 // 6906 3 // 6907 4 potentialBananas += 1 + item.getID() - 6904; } } int slotsAvailable = 28 - slotsUsed; RSItem[] food = Inventory.find(1963); // If have bananas/peaches, deposit them, else collect bones if (food.length > 0) { // Heal and then deposit float eatHealth = m_settings.m_eatHealth * Skills.getActualLevel(SKILLS.HITPOINTS); float eatTo = m_settings.m_eatTo * Skills.getActualLevel(SKILLS.HITPOINTS); if (food.length > 0 && Skills.getCurrentLevel(SKILLS.HITPOINTS) < eatHealth) { // Eat while (food.length > 0 && Skills.getCurrentLevel(SKILLS.HITPOINTS) < eatTo) { food[0].click("Eat"); m_script.sleep(300, 600); food = Inventory.find(1963); } } else { // Deposit RSObject[] objs = Objects.findNearest(50, "Food chute"); if (objs.length > 0) { while (!objs[0].isOnScreen()) { Walking.blindWalkTo(objs[0]); m_script.sleep(250); } objs[0].click("Deposit"); m_script.sleep(1200); } } } else { // If we have more than a full load of bananas worth of bones, cast bones to peaches if (potentialBananas >= slotsAvailable) { // Cast bones to peaches Magic.selectSpell("Bones to Bananas"); } else { // Collect bananas RSObject[] bonePiles = Objects.findNearest(10725, 10726, 10727, 10728); if (bonePiles.length > 0) { while (!bonePiles[0].isOnScreen()) { Walking.blindWalkTo(bonePiles[0]); m_script.sleep(250); } bonePiles[0].click("Grab"); m_script.sleep(150); } } } }