Class Bank

java.lang.Object
com.valhalla.sdk.api.methods.Bank

public final class Bank extends Object
Queries the bank container and submits capability-gated bank-interface actions.

Queries read an immutable BankSnapshot. While the bank container is loaded, the facade also refreshes a history cache. When the container is no longer loaded and history use is enabled, item queries can therefore describe the last loaded bank rather than the current interface. Call isLoaded() when a decision requires live bank data, and use resetCache() when stale history must not be considered.

Action methods fail closed. They return false when the active client does not advertise Capabilities.BANK_ACTIONS, when an argument or required item cannot be resolved, or when the runtime rejects the requested operation. A true result means that the request was accepted for dispatch, or that the requested state was already observed; it does not prove that a later game tick completed the action. Scripts should confirm completion from a subsequent bank or inventory snapshot.

The current native runtime supports close, default-quantity, withdraw, deposit, empty-containers, deposit-all-inventory, and deposit-all-equipment requests. Opening the bank, changing tabs or modes, toggling placeholders, dragging, scrolling, and searching are represented by this forward-compatible facade but currently return false unless the requested state is already satisfied. Native amount dispatch currently accepts 1, 5, 10, and ALL; other positive amounts and ALL_BUT_ONE fail closed.

  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final int
    Sentinel amount requesting the complete available stack.
    static final int
    Sentinel amount requesting all but one item.
  • Method Summary

    Modifier and Type
    Method
    Description
    static boolean
    Adds an item amount to an existing history cache.
    static List<Item>
    all()
    Returns every captured bank entry, including placeholders.
    static List<Item>
    all(Filter<Item> filter)
    Returns usable bank entries accepted by a filter.
    static int
    Returns the number of optional bank tabs reported by the snapshot.
    static int
    Returns the captured bank-container capacity.
    static boolean
    Submits a request to close the bank interface.
    static boolean
    contains(int id)
    Reports whether a usable entry has an identifier.
    static boolean
    contains(int... ids)
    Reports whether a usable entry matches any primitive identifier.
    static boolean
    contains(Filter<Item> filter)
    Reports whether a usable entry is accepted by a filter.
    static boolean
    contains(Integer... ids)
    Reports whether a usable entry matches any boxed identifier.
    static boolean
    Reports whether the bank contains a supported value representation.
    static boolean
    Reports whether a usable entry has an exact captured name, ignoring case.
    static boolean
    contains(String... names)
    Reports whether a usable entry matches any exact captured name, ignoring case.
    static boolean
    containsAll(int... ids)
    Reports whether every primitive identifier is present as a usable entry.
    static boolean
    Reports whether every boxed identifier is present as a usable entry.
    static boolean
    containsAll(String... names)
    Reports whether every exact name is present as a usable entry, ignoring case.
    static boolean
    Reports whether every supported value in a collection is present.
    static int
    count(int id)
    Returns the total captured amount for a usable item identifier.
    static int
    count(int... ids)
    Returns the total captured amount for any primitive identifier.
    static int
    Counts captured container entries assigned to a bank tab.
    static int
    count(Filter<Item> filter)
    Returns the total captured amount of usable entries accepted by a filter.
    static int
    count(Integer... ids)
    Returns the total captured amount for any boxed identifier.
    static int
    count(String name)
    Returns the total captured amount for an exact item name, ignoring case.
    static int
    count(String... names)
    Returns the total captured amount for any exact item name, ignoring case.
    static boolean
    deposit(int id)
    Submits a one-item deposit by identifier.
    static boolean
    deposit(int id, int amount)
    Submits a deposit by identifier and amount.
    static boolean
    deposit(Item item)
    Submits a one-item deposit using an inventory item's captured identifier and slot.
    static boolean
    deposit(Item item, int amount)
    Submits a deposit using an inventory item's captured identifier and slot.
    static boolean
    deposit(Filter<Item> filter)
    Submits a one-item deposit for the first inventory entry accepted by a filter.
    static boolean
    deposit(Filter<Item> filter, int amount)
    Submits a deposit for the first inventory entry accepted by a filter.
    static boolean
    Submits a one-item deposit by exact captured inventory name, ignoring case.
    static boolean
    deposit(String name, int amount)
    Submits a deposit by exact captured inventory name, ignoring case.
    static boolean
    depositAll(int id)
    Submits a full-stack deposit by identifier.
    static boolean
    Submits a full-stack deposit using an inventory item's captured slot.
    static boolean
    Submits a full-stack deposit for the first inventory entry accepted by a filter.
    static boolean
    Submits a full-stack deposit by exact captured inventory name, ignoring case.
    static boolean
    Submits the bank interface's deposit-all-equipment action.
    static boolean
    depositAllExcept(int... ids)
    Submits full-stack deposits for every inventory entry except allowed identifiers.
    static boolean
    Submits full-stack deposits for inventory entries rejected by a keep filter.
    static boolean
    Submits full-stack deposits for every inventory entry except allowed names.
    static boolean
    Submits the bank interface's deposit-all-inventory action.
    static boolean
    depositSlot(int slot, int amount)
    Submits a deposit by inventory slot when inventory snapshots are unavailable.
    static boolean
    drag(int fromSlot, int toSlot)
    Requests an item drag between bank-container slots.
    static boolean
    Submits the bank interface's empty-containers action.
    static int
    Returns the capacity not represented by captured entries.
    static List<Item>
    except(Filter<Item> filter)
    Returns usable bank entries rejected by a filter.
    static int
    Returns the number of captured occupied entries, including placeholders.
    static Optional<Item>
    get(int id)
    Finds the first usable entry with an item-definition identifier.
    static Optional<Item>
    get(int... ids)
    Finds the first usable entry matching any primitive identifier.
    static Optional<Item>
    get(Filter<Item> filter)
    Finds the first usable entry accepted by a filter.
    static Optional<Item>
    get(Integer... ids)
    Finds the first usable entry matching any boxed identifier.
    static Optional<Item>
    get(String name)
    Finds the first usable entry whose captured name equals a value, ignoring case.
    static Optional<Item>
    get(String... names)
    Finds the first usable entry matching any captured name, ignoring case.
    static List<Item>
    Returns the immutable last-loaded bank-entry cache.
    Returns the current bank tab as a typed value.
    static int
    Returns the current bank-tab identifier.
    static int
    Returns the captured custom withdraw-X amount.
    Returns the captured default quantity-button selection.
    static int
    Returns the lowest slot not represented in the captured container.
    static int
    Returns the lowest occupied captured slot.
    static int
    getIdForSlot(int slot)
    Returns the identifier captured in a slot.
    static Optional<Item>
    getItemInSlot(int slot)
    Finds the captured entry in a zero-based bank-container slot.
    static long
    Returns the client tick associated with the last history-cache update.
    static long
    Returns when the history cache was last replaced.
    static long
    Returns the client tick attached to the latest bank snapshot.
    static int
    Returns the item-count threshold for preferring bank search.
    static String
    getNameForSlot(int slot)
    Returns the name captured in a slot.
    static BankMode
    Returns the captured item-rearrangement mode.
    static int
    getRow(Item item)
    Returns the zero-based eight-column bank-grid row containing an item.
    static int
    Returns the captured bank scroll height.
    static int
    getSlot(int id)
    Finds the slot of the first usable entry with an identifier.
    static int
    getSlot(Filter<Item> filter)
    Finds the slot of the first usable entry accepted by a filter.
    static int
    Finds the slot of the first usable entry with an exact name, ignoring case.
    static int
    getTab(int slot)
    Returns the tab identifier captured for a slot.
    static int
    getTab(Item item)
    Returns an item's captured tab identifier.
    static BankMode
    Returns the captured withdrawal mode.
    static boolean
    Returns the local always-open-tab preference.
    static boolean
    Reports whether the bank history cache contains any entries.
    static boolean
    Reports whether no captured bank entries exist.
    static boolean
    Reports whether the captured entry count meets or exceeds captured capacity.
    static boolean
    Reports whether live bank-container contents are loaded.
    static boolean
    Reports whether the bank interface is open.
    static boolean
    Reports whether the bank search interface is open.
    static boolean
    isSlotEmpty(int slot)
    Reports whether no captured entry occupies a slot.
    static boolean
    isSlotFull(int slot)
    Reports whether a captured entry occupies a slot.
    static boolean
    Reports whether an item's slot lies within the captured visible-slot range.
    static boolean
    Reports whether an item is outside the captured visible-slot range.
    static boolean
    Reports whether an item's slot follows the captured visible range.
    static boolean
    Reports whether an item's slot precedes the captured visible range.
    static boolean
    onlyContains(int... ids)
    Reports whether every usable entry matches one of the supplied identifiers.
    static boolean
    Reports whether every usable entry is accepted by a filter.
    static boolean
    onlyContains(String... names)
    Reports whether every usable entry matches an allowed exact name, ignoring case.
    static boolean
    Requests that a bank interface be opened.
    static boolean
    openTab(int tab)
    Requests a bank tab by numeric identifier.
    static boolean
    Requests a typed bank tab.
    static boolean
    Reports whether the snapshot has bank placeholders enabled.
    static void
    Resets bank history unless cache retention is enabled.
    static void
    reset(boolean full)
    Resets bank facade state.
    static void
    Clears all bank-history entries and their update timestamps.
    static boolean
    scroll(int id)
    Requests that an identified bank entry become visible using click-style scrolling.
    static boolean
    scroll(int id, BankScroll type)
    Requests that an identified bank entry become visible.
    static boolean
    scroll(Filter<Item> filter)
    Requests that the first filtered bank entry become visible using click-style scrolling.
    static boolean
    scroll(Filter<Item> filter, BankScroll type)
    Requests that the first filtered bank entry become visible.
    static boolean
    scroll(String name)
    Requests that a named bank entry become visible using click-style scrolling.
    static boolean
    scroll(String name, BankScroll type)
    Requests that a named bank entry become visible.
    static boolean
    searchItem(String itemName)
    Requests a bank search for an item name.
    static void
    setAlwaysOpenTab(boolean enabled)
    Sets the local always-open-tab preference.
    static boolean
    Requests the bank's default quantity-button selection.
    static void
    Sets the item-count threshold for higher-level bank-search logic.
    static boolean
    Requests swap or insert rearrangement mode.
    static void
    setRetainBankCache(boolean retain)
    Controls whether ordinary facade resets preserve the history cache.
    static void
    setSearchItem(boolean enabled)
    Sets whether higher-level script logic should prefer bank search.
    static void
    setUseBankHistoryCache(boolean enabled)
    Controls whether item queries fall back to bank history when live data is unloaded.
    static boolean
    Requests item or note withdrawal mode.
    static boolean
    Reports whether non-full resets retain bank history.
    static boolean
    Reports whether higher-level script logic should prefer bank search.
    static boolean
    slotContains(int slot, int... ids)
    Reports whether the entry in a slot matches any primitive identifier.
    static boolean
    slotContains(int slot, Item item)
    Reports whether the entry in a slot equals an item snapshot.
    static boolean
    slotContains(int slot, Filter<Item> filter)
    Reports whether the entry in a slot is accepted by a filter.
    static boolean
    slotContains(int slot, String... names)
    Reports whether the entry in a slot matches any exact name, ignoring case.
    static boolean
    slotNameContains(int slot, String substring)
    Reports whether a slot's captured name contains text, ignoring case.
    static boolean
    togglePlaceholders(boolean enabled)
    Requests a bank-placeholder setting.
    static void
    Replaces history with the current snapshot when the bank is reported open.
    static void
    Replaces history with caller-supplied entries when the bank is reported open.
    static boolean
    withdraw(int id)
    Submits a one-item withdrawal by identifier.
    static boolean
    withdraw(int id, int amount)
    Submits a withdrawal by identifier and amount.
    static boolean
    withdraw(Item item)
    Submits a one-item withdrawal using an item's captured identifier and slot.
    static boolean
    withdraw(Item item, int amount)
    Submits a withdrawal using an item's captured identifier and slot.
    static boolean
    withdraw(Filter<Item> filter)
    Submits a one-item withdrawal for the first usable entry accepted by a filter.
    static boolean
    withdraw(Filter<Item> filter, int amount)
    Submits a withdrawal for the first usable entry accepted by a filter.
    static boolean
    Submits a one-item withdrawal by exact captured name, ignoring case.
    static boolean
    withdraw(String name, int amount)
    Submits a withdrawal by exact captured name, ignoring case.
    static boolean
    withdrawAll(int id)
    Submits a full-stack withdrawal by identifier.
    static boolean
    Submits a full-stack withdrawal using an item's captured identifier and slot.
    static boolean
    Submits a full-stack withdrawal for the first entry accepted by a filter.
    static boolean
    Submits a full-stack withdrawal by exact captured name, ignoring case.
    static boolean
    withdrawSlot(int slot, int amount)
    Submits a withdrawal by container slot when item snapshots are unavailable.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • ALL

      public static final int ALL
      Sentinel amount requesting the complete available stack.
      See Also:
    • ALL_BUT_ONE

      public static final int ALL_BUT_ONE
      Sentinel amount requesting all but one item.

      The facade recognizes this value, but the current native bank adapter does not dispatch it and action methods consequently return false.

      See Also:
  • Method Details

    • all

      public static List<Item> all()
      Returns every captured bank entry, including placeholders.

      The returned list is immutable. It can be the last loaded history snapshot when live bank data is unavailable and history use is enabled.

      Returns:
      immutable captured bank entries
    • all

      public static List<Item> all(Filter<Item> filter)
      Returns usable bank entries accepted by a filter.

      Placeholder entries are excluded before the filter is evaluated.

      Parameters:
      filter - predicate applied to each non-placeholder entry
      Returns:
      immutable list of matching entries
      Throws:
      NullPointerException - if filter is null
    • except

      public static List<Item> except(Filter<Item> filter)
      Returns usable bank entries rejected by a filter.
      Parameters:
      filter - predicate identifying entries to exclude
      Returns:
      immutable list of non-placeholder entries not accepted by the filter
      Throws:
      NullPointerException - if filter is null
    • get

      public static Optional<Item> get(int id)
      Finds the first usable entry with an item-definition identifier.
      Parameters:
      id - item-definition identifier
      Returns:
      the first matching non-placeholder entry, or an empty optional
    • get

      public static Optional<Item> get(int... ids)
      Finds the first usable entry matching any primitive identifier.
      Parameters:
      ids - item-definition identifiers; null produces an empty result
      Returns:
      the first matching non-placeholder entry, or an empty optional
    • get

      public static Optional<Item> get(Integer... ids)
      Finds the first usable entry matching any boxed identifier.
      Parameters:
      ids - item-definition identifiers; null array elements are ignored and a null array produces an empty result
      Returns:
      the first matching non-placeholder entry, or an empty optional
    • get

      public static Optional<Item> get(String name)
      Finds the first usable entry whose captured name equals a value, ignoring case.
      Parameters:
      name - exact item name; null produces an empty result
      Returns:
      the first matching non-placeholder entry, or an empty optional
    • get

      public static Optional<Item> get(String... names)
      Finds the first usable entry matching any captured name, ignoring case.
      Parameters:
      names - exact item names; null elements are ignored and a null array produces an empty result
      Returns:
      the first matching non-placeholder entry, or an empty optional
    • get

      public static Optional<Item> get(Filter<Item> filter)
      Finds the first usable entry accepted by a filter.
      Parameters:
      filter - predicate applied to each non-placeholder entry
      Returns:
      the first accepted entry, or an empty optional
      Throws:
      NullPointerException - if filter is null
    • getItemInSlot

      public static Optional<Item> getItemInSlot(int slot)
      Finds the captured entry in a zero-based bank-container slot.

      Unlike filtered queries, this method can return a placeholder.

      Parameters:
      slot - zero-based bank-container slot
      Returns:
      the entry in the slot, or an empty optional for a negative or empty slot
    • contains

      public static boolean contains(int id)
      Reports whether a usable entry has an identifier.
      Parameters:
      id - item-definition identifier
      Returns:
      true when a matching non-placeholder entry exists
    • contains

      public static boolean contains(int... ids)
      Reports whether a usable entry matches any primitive identifier.
      Parameters:
      ids - item-definition identifiers
      Returns:
      true when any identifier matches; false for a null or empty array
    • contains

      public static boolean contains(Integer... ids)
      Reports whether a usable entry matches any boxed identifier.
      Parameters:
      ids - item-definition identifiers; null elements are ignored
      Returns:
      true when any identifier matches; false for a null or empty array
    • contains

      public static boolean contains(String name)
      Reports whether a usable entry has an exact captured name, ignoring case.
      Parameters:
      name - exact item name
      Returns:
      true when a matching non-placeholder entry exists
    • contains

      public static boolean contains(String... names)
      Reports whether a usable entry matches any exact captured name, ignoring case.
      Parameters:
      names - exact item names; null elements are ignored
      Returns:
      true when any name matches; false for a null or empty array
    • contains

      public static boolean contains(Filter<Item> filter)
      Reports whether a usable entry is accepted by a filter.
      Parameters:
      filter - predicate applied to each non-placeholder entry
      Returns:
      true when the filter accepts at least one entry
      Throws:
      NullPointerException - if filter is null
    • contains

      public static boolean contains(Object value)
      Reports whether the bank contains a supported value representation.

      Supported values are Item, Integer, and String. Other values, including null, produce false.

      Parameters:
      value - item snapshot, boxed identifier, or exact item name
      Returns:
      true when the represented usable entry exists
    • containsAll

      public static boolean containsAll(int... ids)
      Reports whether every primitive identifier is present as a usable entry.
      Parameters:
      ids - item-definition identifiers
      Returns:
      false for a null array; otherwise true only when every identifier is present, including vacuous truth for an empty array
    • containsAll

      public static boolean containsAll(Integer... ids)
      Reports whether every boxed identifier is present as a usable entry.
      Parameters:
      ids - item-definition identifiers
      Returns:
      false for a null array or null element; otherwise true only when every identifier is present
    • containsAll

      public static boolean containsAll(String... names)
      Reports whether every exact name is present as a usable entry, ignoring case.
      Parameters:
      names - exact item names
      Returns:
      false for a null array or null element; otherwise true only when every name is present
    • containsAll

      public static boolean containsAll(Collection<?> values)
      Reports whether every supported value in a collection is present.
      Parameters:
      values - item snapshots, boxed identifiers, or names
      Returns:
      false for a null collection or unsupported element; otherwise true only when every represented item is present
    • onlyContains

      public static boolean onlyContains(int... ids)
      Reports whether every usable entry matches one of the supplied identifiers.

      Placeholders are ignored. An empty bank therefore returns true.

      Parameters:
      ids - allowed item-definition identifiers
      Returns:
      false for a null array; otherwise whether all usable entries are allowed
    • onlyContains

      public static boolean onlyContains(String... names)
      Reports whether every usable entry matches an allowed exact name, ignoring case.
      Parameters:
      names - allowed exact item names; null elements never match
      Returns:
      false for a null array; otherwise whether all usable entries are allowed
    • onlyContains

      public static boolean onlyContains(Filter<Item> filter)
      Reports whether every usable entry is accepted by a filter.
      Parameters:
      filter - predicate defining allowed entries
      Returns:
      true when all non-placeholder entries are accepted
      Throws:
      NullPointerException - if filter is null
    • count

      public static int count(int id)
      Returns the total captured amount for a usable item identifier.
      Parameters:
      id - item-definition identifier
      Returns:
      summed stack amount, capped at Integer.MAX_VALUE
    • count

      public static int count(int... ids)
      Returns the total captured amount for any primitive identifier.
      Parameters:
      ids - item-definition identifiers
      Returns:
      summed stack amount, capped at Integer.MAX_VALUE; zero for a null array
    • count

      public static int count(Integer... ids)
      Returns the total captured amount for any boxed identifier.
      Parameters:
      ids - item-definition identifiers; null elements are ignored
      Returns:
      summed stack amount, capped at Integer.MAX_VALUE; zero for a null array
    • count

      public static int count(String name)
      Returns the total captured amount for an exact item name, ignoring case.
      Parameters:
      name - exact item name
      Returns:
      summed stack amount, capped at Integer.MAX_VALUE; zero for null
    • count

      public static int count(String... names)
      Returns the total captured amount for any exact item name, ignoring case.
      Parameters:
      names - exact item names; null elements are ignored
      Returns:
      summed stack amount, capped at Integer.MAX_VALUE; zero for a null array
    • count

      public static int count(Filter<Item> filter)
      Returns the total captured amount of usable entries accepted by a filter.
      Parameters:
      filter - predicate applied to each non-placeholder entry
      Returns:
      summed stack amount, capped at Integer.MAX_VALUE
      Throws:
      NullPointerException - if filter is null
    • count

      public static int count(BankTab tab)
      Counts captured container entries assigned to a bank tab.

      This counts occupied entries, not stack amounts, and includes placeholders.

      Parameters:
      tab - bank tab to inspect
      Returns:
      number of captured entries assigned to the tab
      Throws:
      NullPointerException - if tab is null
    • capacity

      public static int capacity()
      Returns the captured bank-container capacity.
      Returns:
      captured bank-container capacity
    • fullSlotCount

      public static int fullSlotCount()
      Returns the number of captured occupied entries, including placeholders.
      Returns:
      captured entry count
    • emptySlotCount

      public static int emptySlotCount()
      Returns the capacity not represented by captured entries.
      Returns:
      non-negative estimated empty-slot count
    • isEmpty

      public static boolean isEmpty()
      Reports whether no captured bank entries exist.
      Returns:
      whether no captured bank entries exist
    • isFull

      public static boolean isFull()
      Reports whether the captured entry count meets or exceeds captured capacity.
      Returns:
      whether the captured bank is full
    • getFirstFullSlot

      public static int getFirstFullSlot()
      Returns the lowest occupied captured slot.
      Returns:
      lowest occupied slot, or -1 when no entry exists
    • getFirstEmptySlot

      public static int getFirstEmptySlot()
      Returns the lowest slot not represented in the captured container.
      Returns:
      lowest empty slot, or -1 when every slot is occupied
    • getIdForSlot

      public static int getIdForSlot(int slot)
      Returns the identifier captured in a slot.
      Parameters:
      slot - zero-based bank-container slot
      Returns:
      item-definition identifier, or -1 when the slot is absent
    • getNameForSlot

      public static String getNameForSlot(int slot)
      Returns the name captured in a slot.
      Parameters:
      slot - zero-based bank-container slot
      Returns:
      captured item name, or an empty string when the slot is absent
    • getSlot

      public static int getSlot(int id)
      Finds the slot of the first usable entry with an identifier.
      Parameters:
      id - item-definition identifier
      Returns:
      zero-based bank slot, or -1 when not found
    • getSlot

      public static int getSlot(String name)
      Finds the slot of the first usable entry with an exact name, ignoring case.
      Parameters:
      name - exact item name
      Returns:
      zero-based bank slot, or -1 when not found
    • getSlot

      public static int getSlot(Filter<Item> filter)
      Finds the slot of the first usable entry accepted by a filter.
      Parameters:
      filter - predicate applied to non-placeholder entries
      Returns:
      zero-based bank slot, or -1 when not found
      Throws:
      NullPointerException - if filter is null
    • isSlotEmpty

      public static boolean isSlotEmpty(int slot)
      Reports whether no captured entry occupies a slot.
      Parameters:
      slot - zero-based bank-container slot
      Returns:
      true when the slot is absent, including for a negative slot
    • isSlotFull

      public static boolean isSlotFull(int slot)
      Reports whether a captured entry occupies a slot.
      Parameters:
      slot - zero-based bank-container slot
      Returns:
      true when an entry, including a placeholder, occupies the slot
    • slotContains

      public static boolean slotContains(int slot, int... ids)
      Reports whether the entry in a slot matches any primitive identifier.
      Parameters:
      slot - zero-based bank-container slot
      ids - item-definition identifiers
      Returns:
      true when the occupied slot matches any identifier
    • slotContains

      public static boolean slotContains(int slot, String... names)
      Reports whether the entry in a slot matches any exact name, ignoring case.
      Parameters:
      slot - zero-based bank-container slot
      names - exact item names; null elements are ignored
      Returns:
      true when the occupied slot matches any name
    • slotContains

      public static boolean slotContains(int slot, Filter<Item> filter)
      Reports whether the entry in a slot is accepted by a filter.

      Unlike the general filtered queries, a placeholder is passed to the filter.

      Parameters:
      slot - zero-based bank-container slot
      filter - predicate applied to the captured entry
      Returns:
      true when the slot is occupied and the filter accepts its entry
      Throws:
      NullPointerException - if filter is null
    • slotContains

      public static boolean slotContains(int slot, Item item)
      Reports whether the entry in a slot equals an item snapshot.
      Parameters:
      slot - zero-based bank-container slot
      item - complete item snapshot to compare
      Returns:
      true when the occupied slot equals item
    • slotNameContains

      public static boolean slotNameContains(int slot, String substring)
      Reports whether a slot's captured name contains text, ignoring case.
      Parameters:
      slot - zero-based bank-container slot
      substring - text fragment to find
      Returns:
      true when an occupied slot's name contains the fragment
    • getRow

      public static int getRow(Item item)
      Returns the zero-based eight-column bank-grid row containing an item.
      Parameters:
      item - captured bank entry
      Returns:
      zero-based bank-grid row
      Throws:
      NullPointerException - if item is null
    • getTab

      public static int getTab(Item item)
      Returns an item's captured tab identifier.
      Parameters:
      item - captured bank entry
      Returns:
      tab identifier from 0 through 9
      Throws:
      NullPointerException - if item is null
    • getTab

      public static int getTab(int slot)
      Returns the tab identifier captured for a slot.
      Parameters:
      slot - zero-based bank-container slot
      Returns:
      tab identifier from 0 through 9; 0 when the slot is absent
    • availableTabs

      public static int availableTabs()
      Returns the number of optional bank tabs reported by the snapshot.
      Returns:
      optional bank-tab count from 0 through 9
    • getCurrentTab

      public static int getCurrentTab()
      Returns the current bank-tab identifier.
      Returns:
      current bank-tab identifier from 0 through 9
    • getCurrentBankTab

      public static Optional<BankTab> getCurrentBankTab()
      Returns the current bank tab as a typed value.
      Returns:
      current typed bank tab, or an empty optional for an unrecognized identifier
    • getScrollHeight

      public static int getScrollHeight()
      Returns the captured bank scroll height.
      Returns:
      non-negative bank scroll height reported by the snapshot
    • getCustomWithdrawAmount

      public static int getCustomWithdrawAmount()
      Returns the captured custom withdraw-X amount.
      Returns:
      non-negative custom withdraw-X amount reported by the snapshot
    • getWithdrawMode

      public static BankMode getWithdrawMode()
      Returns the captured withdrawal mode.
      Returns:
      captured withdrawal mode
    • getRearrangeMode

      public static BankMode getRearrangeMode()
      Returns the captured item-rearrangement mode.
      Returns:
      captured item-rearrangement mode
    • getDefaultQuantity

      public static BankQuantitySelection getDefaultQuantity()
      Returns the captured default quantity-button selection.
      Returns:
      captured default quantity-button selection
    • placeHoldersEnabled

      public static boolean placeHoldersEnabled()
      Reports whether the snapshot has bank placeholders enabled.
      Returns:
      whether bank placeholders are enabled
    • isSearchItem

      public static boolean isSearchItem()
      Reports whether the bank search interface is open.
      Returns:
      whether the snapshot reports the search interface open
    • isOpen

      public static boolean isOpen()
      Reports whether the bank interface is open.
      Returns:
      whether the bank interface is reported open
    • isLoaded

      public static boolean isLoaded()
      Reports whether live bank-container contents are loaded.
      Returns:
      true when item queries represent the currently loaded container
    • getLastUpdatedTick

      public static long getLastUpdatedTick()
      Returns the client tick attached to the latest bank snapshot.
      Returns:
      non-negative client tick
    • isSlotVisible

      public static boolean isSlotVisible(Item item)
      Reports whether an item's slot lies within the captured visible-slot range.
      Parameters:
      item - captured bank entry
      Returns:
      true when visibility bounds are known and contain the item slot
      Throws:
      NullPointerException - if item is null
    • needToScroll

      public static boolean needToScroll(Item item)
      Reports whether an item is outside the captured visible-slot range.

      This returns true when the adapter has no visibility bounds.

      Parameters:
      item - captured bank entry
      Returns:
      whether the item is not currently reported visible
      Throws:
      NullPointerException - if item is null
    • needToScrollUp

      public static boolean needToScrollUp(Item item)
      Reports whether an item's slot precedes the captured visible range.
      Parameters:
      item - captured bank entry
      Returns:
      true when known visibility bounds place the item above the viewport
      Throws:
      NullPointerException - if item is null
    • needToScrollDown

      public static boolean needToScrollDown(Item item)
      Reports whether an item's slot follows the captured visible range.
      Parameters:
      item - captured bank entry
      Returns:
      true when known visibility bounds place the item below the viewport
      Throws:
      NullPointerException - if item is null
    • isCached

      public static boolean isCached()
      Reports whether the bank history cache contains any entries.
      Returns:
      whether at least one captured entry is cached
    • getBankHistoryCache

      public static List<Item> getBankHistoryCache()
      Returns the immutable last-loaded bank-entry cache.
      Returns:
      immutable cached entries; possibly empty
    • getLastBankHistoryCacheTime

      public static long getLastBankHistoryCacheTime()
      Returns when the history cache was last replaced.
      Returns:
      local epoch time in milliseconds, or zero before the first update
    • getLastBankHistoryCacheTick

      public static long getLastBankHistoryCacheTick()
      Returns the client tick associated with the last history-cache update.
      Returns:
      non-negative client tick, or zero before the first update
    • setUseBankHistoryCache

      public static void setUseBankHistoryCache(boolean enabled)
      Controls whether item queries fall back to bank history when live data is unloaded.

      Disabling fallback does not clear an existing cache.

      Parameters:
      enabled - whether unloaded item queries may use cached history
    • setRetainBankCache

      public static void setRetainBankCache(boolean retain)
      Controls whether ordinary facade resets preserve the history cache.

      A full reset or an explicit resetCache() still clears it.

      Parameters:
      retain - whether non-full resets should retain history
    • shouldRetainBankCache

      public static boolean shouldRetainBankCache()
      Reports whether non-full resets retain bank history.
      Returns:
      whether cache retention is enabled
    • resetCache

      public static void resetCache()
      Clears all bank-history entries and their update timestamps.
    • reset

      public static void reset()
      Resets bank history unless cache retention is enabled.
      See Also:
    • reset

      public static void reset(boolean full)
      Resets bank facade state.

      A full reset always clears history and restores the local open-tab/search preferences to their defaults. A non-full reset honors cache retention.

      Parameters:
      full - whether to clear history regardless of retention and restore preferences
    • updateCache

      public static void updateCache()
      Replaces history with the current snapshot when the bank is reported open.

      This method has no effect while the bank is closed.

    • updateCache

      public static void updateCache(Collection<Item> items)
      Replaces history with caller-supplied entries when the bank is reported open.
      Parameters:
      items - entries to copy into the immutable history cache
      Throws:
      NullPointerException - if items is null
    • addToBankHistoryCache

      public static boolean addToBankHistoryCache(Item item)
      Adds an item amount to an existing history cache.

      An entry with the same identifier has its amount increased, capped at Integer.MAX_VALUE; otherwise the supplied entry is appended. The cache must already be non-empty, so this method cannot initialize history.

      Parameters:
      item - item snapshot to merge
      Returns:
      true after a merge; false when no cache exists
      Throws:
      NullPointerException - if item is null
    • open

      public static boolean open()
      Requests that a bank interface be opened.

      The current native bank adapter cannot discover or open a nearby banker, booth, or chest. Consequently this method returns true only when the bank snapshot already reports open, and otherwise fails closed.

      Returns:
      true when already open or when a supporting runtime accepts the request
    • close

      public static boolean close()
      Submits a request to close the bank interface.
      Returns:
      true when the native runtime accepts the close request
    • openTab

      public static boolean openTab(int tab)
      Requests a bank tab by numeric identifier.
      Parameters:
      tab - tab identifier from 0 through 9
      Returns:
      true when that tab is already current or a supporting runtime accepts the request; false for an invalid identifier
    • openTab

      public static boolean openTab(BankTab tab)
      Requests a typed bank tab.

      The current native adapter does not dispatch tab changes, so a non-current tab fails closed.

      Parameters:
      tab - bank tab to select
      Returns:
      true when the tab is already current or a supporting runtime accepts the request
      Throws:
      NullPointerException - if tab is null
    • setWithdrawMode

      public static boolean setWithdrawMode(BankMode mode)
      Requests item or note withdrawal mode.

      The current native adapter does not dispatch mode changes, so a valid mode succeeds only when it is already observed.

      Parameters:
      mode - BankMode.ITEM or BankMode.NOTE
      Returns:
      true when the valid mode is already selected or a supporting runtime accepts the request
      Throws:
      NullPointerException - if mode is null
    • setRearrangeMode

      public static boolean setRearrangeMode(BankMode mode)
      Requests swap or insert rearrangement mode.

      The current native adapter does not dispatch mode changes, so a valid mode succeeds only when it is already observed.

      Parameters:
      mode - BankMode.SWAP or BankMode.INSERT
      Returns:
      true when the valid mode is already selected or a supporting runtime accepts the request
      Throws:
      NullPointerException - if mode is null
    • setDefaultQuantity

      public static boolean setDefaultQuantity(BankQuantitySelection selection)
      Requests the bank's default quantity-button selection.

      The current native adapter accepts one, five, ten, and all. The custom-X selection fails closed unless it is already selected.

      Parameters:
      selection - default quantity to select
      Returns:
      true when already selected or when the native runtime accepts the request
      Throws:
      NullPointerException - if selection is null
    • togglePlaceholders

      public static boolean togglePlaceholders(boolean enabled)
      Requests a bank-placeholder setting.

      The current native adapter does not dispatch this toggle, so the method succeeds only when the requested value is already observed.

      Parameters:
      enabled - desired placeholder setting
      Returns:
      true when already in the requested state or a supporting runtime accepts the request
    • drag

      public static boolean drag(int fromSlot, int toSlot)
      Requests an item drag between bank-container slots.

      The current native adapter does not dispatch drag requests.

      Parameters:
      fromSlot - zero-based source bank slot
      toSlot - zero-based destination bank slot
      Returns:
      true only when a supporting runtime accepts valid slots
    • emptyContainers

      public static boolean emptyContainers()
      Submits the bank interface's empty-containers action.
      Returns:
      true when the native runtime accepts the request
    • withdraw

      public static boolean withdraw(int id)
      Submits a one-item withdrawal by identifier.
      Parameters:
      id - item-definition identifier
      Returns:
      true when the native runtime accepts the resolved-slot request
    • withdraw

      public static boolean withdraw(int id, int amount)
      Submits a withdrawal by identifier and amount.

      The item must resolve to a usable captured bank entry. Although positive amounts are valid at facade level, the current native adapter accepts only 1, 5, 10, and ALL.

      Parameters:
      id - item-definition identifier
      amount - positive requested amount, ALL, or ALL_BUT_ONE
      Returns:
      true when the native runtime accepts the request
    • withdraw

      public static boolean withdraw(String name)
      Submits a one-item withdrawal by exact captured name, ignoring case.
      Parameters:
      name - exact item name
      Returns:
      true when a usable entry resolves and the runtime accepts the request
    • withdraw

      public static boolean withdraw(String name, int amount)
      Submits a withdrawal by exact captured name, ignoring case.
      Parameters:
      name - exact item name
      amount - positive requested amount, ALL, or ALL_BUT_ONE
      Returns:
      true when a usable entry resolves and the runtime accepts the request
    • withdraw

      public static boolean withdraw(Filter<Item> filter)
      Submits a one-item withdrawal for the first usable entry accepted by a filter.
      Parameters:
      filter - predicate selecting a bank entry
      Returns:
      true when an entry resolves and the runtime accepts the request
      Throws:
      NullPointerException - if filter is null
    • withdraw

      public static boolean withdraw(Filter<Item> filter, int amount)
      Submits a withdrawal for the first usable entry accepted by a filter.
      Parameters:
      filter - predicate selecting a bank entry
      amount - positive requested amount, ALL, or ALL_BUT_ONE
      Returns:
      true when an entry resolves and the runtime accepts the request
      Throws:
      NullPointerException - if filter is null
    • withdrawAll

      public static boolean withdrawAll(int id)
      Submits a full-stack withdrawal by identifier.
      Parameters:
      id - item-definition identifier
      Returns:
      true when the runtime accepts the resolved-slot request
    • withdrawAll

      public static boolean withdrawAll(String name)
      Submits a full-stack withdrawal by exact captured name, ignoring case.
      Parameters:
      name - exact item name
      Returns:
      true when the runtime accepts the resolved-slot request
    • withdrawAll

      public static boolean withdrawAll(Filter<Item> filter)
      Submits a full-stack withdrawal for the first entry accepted by a filter.
      Parameters:
      filter - predicate selecting a bank entry
      Returns:
      true when the runtime accepts the resolved-slot request
      Throws:
      NullPointerException - if filter is null
    • withdraw

      public static boolean withdraw(Item item)
      Submits a one-item withdrawal using an item's captured identifier and slot.
      Parameters:
      item - captured bank entry
      Returns:
      true when the runtime accepts the request
    • withdraw

      public static boolean withdraw(Item item, int amount)
      Submits a withdrawal using an item's captured identifier and slot.

      The caller is responsible for ensuring the snapshot still describes the current bank layout.

      Parameters:
      item - captured bank entry
      amount - positive requested amount, ALL, or ALL_BUT_ONE
      Returns:
      true when the runtime accepts the request
    • withdrawAll

      public static boolean withdrawAll(Item item)
      Submits a full-stack withdrawal using an item's captured identifier and slot.
      Parameters:
      item - captured bank entry
      Returns:
      true when the runtime accepts the request
    • withdrawSlot

      public static boolean withdrawSlot(int slot, int amount)
      Submits a withdrawal by container slot when item snapshots are unavailable.

      If the slot has no captured item, the request carries identifier -1; the current native adapter uses the slot and can still accept it.

      Parameters:
      slot - zero-based bank-container slot
      amount - positive requested amount, ALL, or ALL_BUT_ONE
      Returns:
      true when the native runtime accepts the request
    • deposit

      public static boolean deposit(int id)
      Submits a one-item deposit by identifier.
      Parameters:
      id - item-definition identifier
      Returns:
      true when a matching inventory slot resolves and the runtime accepts it
    • deposit

      public static boolean deposit(int id, int amount)
      Submits a deposit by identifier and amount.

      The identifier must resolve to a captured inventory entry. Although positive amounts are valid at facade level, the current native adapter accepts only 1, 5, 10, and ALL.

      Parameters:
      id - item-definition identifier
      amount - positive requested amount, ALL, or ALL_BUT_ONE
      Returns:
      true when a matching inventory slot resolves and the runtime accepts it
    • deposit

      public static boolean deposit(String name)
      Submits a one-item deposit by exact captured inventory name, ignoring case.
      Parameters:
      name - exact item name
      Returns:
      true when an inventory entry resolves and the runtime accepts it
    • deposit

      public static boolean deposit(String name, int amount)
      Submits a deposit by exact captured inventory name, ignoring case.
      Parameters:
      name - exact item name
      amount - positive requested amount, ALL, or ALL_BUT_ONE
      Returns:
      true when an inventory entry resolves and the runtime accepts it
    • deposit

      public static boolean deposit(Filter<Item> filter)
      Submits a one-item deposit for the first inventory entry accepted by a filter.
      Parameters:
      filter - predicate selecting an inventory entry
      Returns:
      true when an entry resolves and the runtime accepts it
      Throws:
      NullPointerException - if filter is null
    • deposit

      public static boolean deposit(Filter<Item> filter, int amount)
      Submits a deposit for the first inventory entry accepted by a filter.
      Parameters:
      filter - predicate selecting an inventory entry
      amount - positive requested amount, ALL, or ALL_BUT_ONE
      Returns:
      true when an entry resolves and the runtime accepts it
      Throws:
      NullPointerException - if filter is null
    • deposit

      public static boolean deposit(Item item)
      Submits a one-item deposit using an inventory item's captured identifier and slot.
      Parameters:
      item - captured inventory entry
      Returns:
      true when the runtime accepts the request
    • deposit

      public static boolean deposit(Item item, int amount)
      Submits a deposit using an inventory item's captured identifier and slot.

      The caller is responsible for ensuring the snapshot still describes the current inventory layout.

      Parameters:
      item - captured inventory entry
      amount - positive requested amount, ALL, or ALL_BUT_ONE
      Returns:
      true when the runtime accepts the request
    • depositAll

      public static boolean depositAll(int id)
      Submits a full-stack deposit by identifier.
      Parameters:
      id - item-definition identifier
      Returns:
      true when an inventory slot resolves and the runtime accepts it
    • depositAll

      public static boolean depositAll(String name)
      Submits a full-stack deposit by exact captured inventory name, ignoring case.
      Parameters:
      name - exact item name
      Returns:
      true when an inventory slot resolves and the runtime accepts it
    • depositAll

      public static boolean depositAll(Filter<Item> filter)
      Submits a full-stack deposit for the first inventory entry accepted by a filter.
      Parameters:
      filter - predicate selecting an inventory entry
      Returns:
      true when an entry resolves and the runtime accepts it
      Throws:
      NullPointerException - if filter is null
    • depositAll

      public static boolean depositAll(Item item)
      Submits a full-stack deposit using an inventory item's captured slot.
      Parameters:
      item - captured inventory entry
      Returns:
      true when the runtime accepts the request
    • depositSlot

      public static boolean depositSlot(int slot, int amount)
      Submits a deposit by inventory slot when inventory snapshots are unavailable.
      Parameters:
      slot - zero-based inventory slot
      amount - positive requested amount, ALL, or ALL_BUT_ONE
      Returns:
      true when the native runtime accepts the request
    • depositAllItems

      public static boolean depositAllItems()
      Submits the bank interface's deposit-all-inventory action.
      Returns:
      true when the native runtime accepts the request
    • depositAllEquipment

      public static boolean depositAllEquipment()
      Submits the bank interface's deposit-all-equipment action.
      Returns:
      true when the native runtime accepts the request
    • depositAllExcept

      public static boolean depositAllExcept(int... ids)
      Submits full-stack deposits for every inventory entry except allowed identifiers.
      Parameters:
      ids - identifiers to retain in inventory
      Returns:
      false for a null array or any rejected deposit request; otherwise true, including when nothing needs depositing
    • depositAllExcept

      public static boolean depositAllExcept(String... names)
      Submits full-stack deposits for every inventory entry except allowed names.
      Parameters:
      names - exact names to retain, compared ignoring case; null elements never match
      Returns:
      false for a null array or any rejected deposit request; otherwise true, including when nothing needs depositing
    • depositAllExcept

      public static boolean depositAllExcept(Filter<Item> keep)
      Submits full-stack deposits for inventory entries rejected by a keep filter.

      When every occupied inventory slot is to be deposited, this uses the deposit-all-inventory action. Multiple accepted requests still require later snapshot confirmation; the return value does not prove completion.

      Parameters:
      keep - predicate returning true for entries to retain
      Returns:
      true when nothing needs depositing or all requests are accepted
      Throws:
      NullPointerException - if keep is null
    • scroll

      public static boolean scroll(int id)
      Requests that an identified bank entry become visible using click-style scrolling.
      Parameters:
      id - item-definition identifier
      Returns:
      true when the entry is already visible or a supporting runtime accepts the request
    • scroll

      public static boolean scroll(int id, BankScroll type)
      Requests that an identified bank entry become visible.

      The current native adapter does not dispatch scrolling, so an off-screen entry fails closed.

      Parameters:
      id - item-definition identifier
      type - preferred scrolling input
      Returns:
      true when the resolved entry is already visible or a supporting runtime accepts the request
      Throws:
      NullPointerException - if type is null
    • scroll

      public static boolean scroll(String name)
      Requests that a named bank entry become visible using click-style scrolling.
      Parameters:
      name - exact captured item name, compared ignoring case
      Returns:
      true when the entry is already visible or a supporting runtime accepts the request
    • scroll

      public static boolean scroll(String name, BankScroll type)
      Requests that a named bank entry become visible.
      Parameters:
      name - exact captured item name, compared ignoring case
      type - preferred scrolling input
      Returns:
      true when the resolved entry is already visible or a supporting runtime accepts the request
      Throws:
      NullPointerException - if type is null and an item resolves
    • scroll

      public static boolean scroll(Filter<Item> filter)
      Requests that the first filtered bank entry become visible using click-style scrolling.
      Parameters:
      filter - predicate selecting a usable bank entry
      Returns:
      true when the entry is already visible or a supporting runtime accepts the request
      Throws:
      NullPointerException - if filter is null
    • scroll

      public static boolean scroll(Filter<Item> filter, BankScroll type)
      Requests that the first filtered bank entry become visible.
      Parameters:
      filter - predicate selecting a usable bank entry
      type - preferred scrolling input
      Returns:
      true when the resolved entry is already visible or a supporting runtime accepts the request
      Throws:
      NullPointerException - if filter or, after an item resolves, type is null
    • searchItem

      public static boolean searchItem(String itemName)
      Requests a bank search for an item name.

      The current native adapter does not dispatch search requests.

      Parameters:
      itemName - non-blank search text
      Returns:
      true only when a supporting runtime accepts the request
    • isAlwaysOpenTab

      public static boolean isAlwaysOpenTab()
      Returns the local always-open-tab preference.

      The facade stores this author preference but does not itself open tabs.

      Returns:
      local always-open-tab preference
    • setAlwaysOpenTab

      public static void setAlwaysOpenTab(boolean enabled)
      Sets the local always-open-tab preference.
      Parameters:
      enabled - preference value for higher-level script logic
    • setSearchItem

      public static void setSearchItem(boolean enabled)
      Sets whether higher-level script logic should prefer bank search.

      This preference does not itself submit a search action.

      Parameters:
      enabled - whether search should be preferred
    • shouldSearchItems

      public static boolean shouldSearchItems()
      Reports whether higher-level script logic should prefer bank search.
      Returns:
      whether bank search is preferred
    • getMinimumItemToSearch

      public static int getMinimumItemToSearch()
      Returns the item-count threshold for preferring bank search.
      Returns:
      non-negative item-count threshold
    • setMinimumItemToSearch

      public static void setMinimumItemToSearch(int amount)
      Sets the item-count threshold for higher-level bank-search logic.
      Parameters:
      amount - threshold; negative values are stored as zero