Class TradeVerb

java.lang.Object
privbot.hooks.shop.TradeVerb

public final class TradeVerb extends Object
Resolves which action to click in order to open a shop.

Servers label this inconsistently — Trade, Shop, Shop-with, Buy. When the user leaves the interaction field blank we pick from the entity's live action list by preference order. When the user supplies an override we honour it verbatim, but still match it against what the entity actually exposes so a typo produces a readable failure instead of a dispatch that silently does nothing.

  • Method Details

    • normalize

      public static String normalize(String value)
      Lowercases and turns hyphens/underscores into spaces, collapsing runs of whitespace, so "Shop-with", "Shop with" and "SHOP_WITH" all compare equal.
    • resolve

      public static String resolve(String[] available, String override)
      Parameters:
      available - the entity's live action strings (may be null or contain nulls)
      override - user-supplied verb, or null/blank to auto-detect
      Returns:
      the exact string from available to dispatch, or null when there is no match
    • candidates

      public static List<String> candidates(String override)
      Ordered verbs to try when the entity's action list cannot be read directly — game objects are resolved by asking the object helper for each candidate in turn.
      Returns:
      a single-element list holding the override when set, else the full preference order