Ejemplo n.º 1
0
  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;
  }
Ejemplo n.º 2
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);
        }
      }
    }
  }