Class BankSeen

java.lang.Object
privbot.hooks.BankSeen

public final class BankSeen extends Object
The bank contents the player last saw, so AI Builder can answer "what is in my bank" without the bank being open.

JVM-wide: every plugin loads its own copy of shared-lib, so the snapshot lives in javax.swing.UIManager under KEY as JDK types only (Object[]{Long at, Object[][] rows}, each row {String name, Integer qty, Integer slot}), immutable once published. Every copy captures into and reads the same one.

Only a read taken while the bank was really drawn may be captured; the bank facade's scan, which captures it, checks that. An empty or null capture is never stored: it is what a closed bank reads as, and it must not replace a good snapshot. A genuinely emptied bank therefore keeps its last non-empty snapshot until the player sees it again with items in it (the scan cannot tell an empty bank from a closed one either). Rows with a blank name are dropped, and a capture where more than half the rows are blank is skipped whole.

Belongs to one account: SessionAccount clears it when a different account is seen logged in.

Never throws into a caller.

  • Method Details

    • capture

      public static void capture(List<Object[]> nameQtySlot, long nowMs)
      Stores a snapshot. nameQtySlot rows are {String name, Number qty, Number slot}. Null, empty or unusable input is ignored.
    • last

      public static Map<String,Object> last()
      null before any capture, else {at, items:[{name, qty, slot}]}.
    • clear

      public static void clear()
      Forgets the snapshot: another account logged in (SessionAccount).
    • resetForTest

      public static void resetForTest()
      Test hook: forgets the snapshot.