Record Class OpenInterface

java.lang.Object
java.lang.Record
com.botwithus.bot.api.snapshot.OpenInterface
Record Components:
id - the interface id, as GameSnapshot.isInterfaceOpen(int) takes it
type - the open type, 0..7
clientOpened - whether a client script, not a server packet, opened it

public record OpenInterface(int id, int type, boolean clientOpened) extends Record
One open sub-interface as the snapshot publishes it (wire v23): its id, how the client opened it, and whether a client script rather than the server did the opening.

type() is the client's own open type, not a decoded category, so a value this class has no name for is still carried faithfully. The ones that have been observed:

  • TYPE_MODAL (0): the bank, dialogue and choice boxes. A modal closes when the player moves, and it does not block queued actions.
  • TYPE_OVERLAY (1): HUD panels and the XP counter.
  • TYPE_CLIENT_CHILD (3): a child opened by a client script, which closes along with its parent. Seen with clientOpened() set.
  • TYPE_UNKNOWN (7): the client's type was above 6 and the producer clamped it.

This is a plain value copied out of the snapshot, so unlike the snapshot itself it is safe to keep past the tick.

  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final int
    Bit 3 of a wire flags byte.
    static final int
    A child opened by a client script, closed along with its parent.
    static final int
    Bits 0-2 of a wire flags byte: the open type.
    static final int
    Closes when the player moves; the bank and dialogues.
    static final int
    HUD panels and other persistent overlays.
    static final int
    The client's type was out of the publishable range.
  • Constructor Summary

    Constructors
    Constructor
    Description
    OpenInterface(int id, int type, boolean clientOpened)
    Creates an instance of a OpenInterface record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Returns the value of the clientOpened record component.
    final boolean
    Indicates whether some other object is "equal to" this one.
    fromWire(int id, int flags)
    Decodes one wire flags byte for interface id.
    final int
    Returns a hash code value for this object.
    int
    id()
    Returns the value of the id record component.
    boolean
    Whether this is a modal: it closes when the player moves.
    boolean
    Whether this is a persistent overlay such as a HUD panel.
    boolean
    Whether the producer could not publish the client's type.
    final String
    Returns a string representation of this record class.
    int
    Returns the value of the type record component.

    Methods inherited from class Object

    getClass, notify, notifyAll, wait, wait, wait
  • Field Details

    • TYPE_MASK

      public static final int TYPE_MASK
      Bits 0-2 of a wire flags byte: the open type. Mirrors kOpenIfaceTypeMask.
      See Also:
    • FLAG_CLIENT_OPENED

      public static final int FLAG_CLIENT_OPENED
      Bit 3 of a wire flags byte. Mirrors kOpenIfaceFlagClientOpened.
      See Also:
    • TYPE_MODAL

      public static final int TYPE_MODAL
      Closes when the player moves; the bank and dialogues.
      See Also:
    • TYPE_OVERLAY

      public static final int TYPE_OVERLAY
      HUD panels and other persistent overlays.
      See Also:
    • TYPE_CLIENT_CHILD

      public static final int TYPE_CLIENT_CHILD
      A child opened by a client script, closed along with its parent.
      See Also:
    • TYPE_UNKNOWN

      public static final int TYPE_UNKNOWN
      The client's type was out of the publishable range. Mirrors kOpenIfaceTypeUnknown.
      See Also:
  • Constructor Details

    • OpenInterface

      public OpenInterface(int id, int type, boolean clientOpened)
      Creates an instance of a OpenInterface record class.
      Parameters:
      id - the value for the id record component
      type - the value for the type record component
      clientOpened - the value for the clientOpened record component
  • Method Details

    • fromWire

      public static OpenInterface fromWire(int id, int flags)
      Decodes one wire flags byte for interface id. Reserved bits 4-7 are ignored, so a producer that starts using them cannot change what type() or clientOpened() report.
      Parameters:
      id - the interface id from the same index of the id array
      flags - the unsigned flags byte, 0..255
    • isModal

      public boolean isModal()
      Whether this is a modal: it closes when the player moves.
    • isOverlay

      public boolean isOverlay()
      Whether this is a persistent overlay such as a HUD panel.
    • isTypeUnknown

      public boolean isTypeUnknown()
      Whether the producer could not publish the client's type.
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with the compare method from their corresponding wrapper classes.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • id

      public int id()
      Returns the value of the id record component.
      Returns:
      the value of the id record component
    • type

      public int type()
      Returns the value of the type record component.
      Returns:
      the value of the type record component
    • clientOpened

      public boolean clientOpened()
      Returns the value of the clientOpened record component.
      Returns:
      the value of the clientOpened record component