Class GroundLoot

java.lang.Object
privbot.restock.GroundLoot

public final class GroundLoot extends Object
Picks up ground items by name fragment and proves each pickup: Take, then wait for the inventory count of that id to rise. A full inventory with no stack of that id leaves the item and says so; nothing is dropped or eaten to make room. Looting by name, reusable by any plugin. One instance per plugin; script worker only. Rows: loot_seen, loot_pickup, loot_confirmed, loot_skipped, loot_failed.
  • Field Details

    • MAX_TAKE_FAILURES

      public static final int MAX_TAKE_FAILURES
      A Take that never lands is tried this many times, then that item is left (it may belong to someone else).
      See Also:
  • Constructor Details

    • GroundLoot

      public GroundLoot(int radiusTiles, int confirmMs)
      Parameters:
      radiusTiles - how far from the player to look
      confirmMs - how long a Take may take to show in the inventory (it includes the walk to the item)
  • Method Details

    • picked

      public int picked()
    • newDrop

      public void newDrop()
      Forgets what was seen and skipped (a new kill, a new Start); the picked total stays until reset().
    • reset

      public void reset()
    • wanted

      public List<GroundLoot.Ground> wanted(PrivTaskContext ctx, List<String> fragments, RestockHost host)
      The wanted ground items in reach that were not skipped, nearest first. Any thread (one client-thread read).
    • takeOne

      public GroundLoot.Outcome takeOne(PrivTaskContext ctx, List<String> fragments, RestockHost host)
      Takes the nearest wanted item and confirms it by the inventory count of its id rising. Script worker.