Class SustainOutcome

java.lang.Object
privbot.mechanics.SustainOutcome

public final class SustainOutcome extends Object
What one call of ctx.sustain.maintain did. Plain immutable data.

What it proves: SustainOutcome.Kind.ACTED means the named item's carried count dropped within 1200 ms of the click, so something was really consumed. SustainOutcome.Kind.NOTHING means everything needed was read and nothing was due. SustainOutcome.Kind.OUT_OF means a need was read and nothing carried can meet it; reason() says which ("food" for hitpoints, "boost" for a boost that is due but has no dose carried), so a plugin can tell a missing dose from being out of food. SustainOutcome.Kind.FAILED means the click was refused or the count did not drop, so nothing is known to have been consumed.

A combo eat sends the combo food's click straight after the first food's; comboLanded() says whether the combo food's count dropped too. It is only meaningful when a combo was attempted (ACTED after an Eat with a combo food in the plan and carried); everywhere else it is false.

Unreadable looks like: SustainOutcome.Kind.UNREADABLE means the inventory, hitpoints or max hitpoints could not be read, or the inventory could not be read to confirm a click. It is not NOTHING and not FAILED.

Thread rule: immutable, safe on any thread.

  • Method Details

    • acted

      public static SustainOutcome acted(String item, String reason)
      An item was consumed (proved by its count dropping); no combo was involved or it did not land.
    • acted

      public static SustainOutcome acted(String item, String reason, boolean comboLanded)
      An item was consumed (proved by its count dropping).
      Parameters:
      comboLanded - whether a combo food sent with it was consumed too (false when none was sent)
    • nothing

      public static SustainOutcome nothing(String reason)
      Nothing was due.
    • outOf

      public static SustainOutcome outOf(String what)
      A need was read and nothing carried meets it; what is "food" or "boost".
    • unreadable

      public static SustainOutcome unreadable(String why)
      Something needed could not be read.
    • unreadable

      public static SustainOutcome unreadable(String item, String why)
      An item was clicked but the inventory could not be read to see whether it was consumed.
    • failed

      public static SustainOutcome failed(String item, String why)
      An item was chosen but not shown to be consumed.
    • kind

      public SustainOutcome.Kind kind()
      Returns:
      the kind of outcome
    • item

      public String item()
      Returns:
      for ACTED the first item consumed; for FAILED, or UNREADABLE after a click, the item that was clicked (null when none was chosen); otherwise null
    • reason

      public String reason()
      Returns:
      a short plain-words reason (never null); for OUT_OF it is "food" or "boost"
    • comboLanded

      public boolean comboLanded()
      Returns:
      true when a combo food was sent with the first Eat and its count dropped too. Only meaningful when a combo was attempted; false otherwise, including every outcome that is not ACTED
    • toString

      public String toString()
      Overrides:
      toString in class Object