Jump to content

Withdrawing Items Using Names


Illumi

Recommended Posts

public boolean withdraw(final String name, final int amount) {
    if (!client.getBank().isOpen()) {
        return false;
    }
    return client.getBank().withdraw(getIdForName(name), amount);
}

public int getIdForName(final String name) {
    int id = 0;
    for (Item item : client.getBank().getItems()) {
         if (item != null && item.getName().equals(name)) {
             id = item.getId();
         }
    }
    return id;
}

Example:

withdraw("Trout", 1);
Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...