Class RestockCycle

java.lang.Object
privbot.restock.RestockCycle

public final class RestockCycle extends Object
One restock trip as a stage machine: IDLE --begin--> HOME -> POOL -> BANK -> RETURNING -> IDLE. The routine is the between-fight one on Elorin (Home teleport, Drink-from the Healing font, Last-preset at the bank, the teleport menu's "Previous" back to the activity), first built inside a boss plugin and lifted here so any plugin can run it with RestockRunner.

Pure state: the stage, the failures on it, the trips made and why the current one began. A step whose confirmation fails MAX_FAILURES times ends in STOPPED with the reason, and the plugin stops automation. Every method is synchronized: the tick thread starts trips, the script worker advances them, the HUD reads them.

  • Field Details

    • MAX_FAILURES

      public static final int MAX_FAILURES
      A confirmation that failed this many times on one stage stops the trip with its reason.
      See Also:
  • Constructor Details

    • RestockCycle

      public RestockCycle()
  • Method Details

    • stage

      public RestockCycle.Stage stage()
    • active

      public boolean active()
    • stopped

      public boolean stopped()
    • stageSince

      public long stageSince()
    • tripStartedAt

      public long tripStartedAt()
    • failures

      public int failures()
    • trips

      public int trips()
    • reason

      public String reason()
      Why the current (or last) trip began.
    • stopReason

      public String stopReason()
    • reset

      public void reset(long now)
      A new Start: idle, counts cleared.
    • begin

      public boolean begin(String why, long now)
      Begins a trip from IDLE. Returns false while one is under way or the cycle is stopped.
    • advance

      public RestockCycle.Stage advance(long now)
      The current stage's step was confirmed: the next stage. RETURNING ends the trip (IDLE, one more trip counted).
    • fail

      public boolean fail(String why, long now)
      The current stage's confirmation failed. Returns true when that was the MAX_FAILURESth: the cycle is then STOPPED with the reason. Ignored while idle or stopped.
    • stopNow

      public void stopNow(String why, long now)
      Stops at once with the reason (no retry would help).
    • label

      public String label()
      The HUD's line: the stage, and the stop reason once stopped.