Record Class OpenInterface
java.lang.Object
java.lang.Record
com.botwithus.bot.api.snapshot.OpenInterface
- Record Components:
id- the interface id, asGameSnapshot.isInterfaceOpen(int)takes ittype- the open type,0..7clientOpened- whether a client script, not a server packet, opened it
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 withclientOpened()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
FieldsModifier and TypeFieldDescriptionstatic final intBit 3 of a wire flags byte.static final intA child opened by a client script, closed along with its parent.static final intBits 0-2 of a wire flags byte: the open type.static final intCloses when the player moves; the bank and dialogues.static final intHUD panels and other persistent overlays.static final intThe client's type was out of the publishable range. -
Constructor Summary
ConstructorsConstructorDescriptionOpenInterface(int id, int type, boolean clientOpened) Creates an instance of aOpenInterfacerecord class. -
Method Summary
Modifier and TypeMethodDescriptionbooleanReturns the value of theclientOpenedrecord component.final booleanIndicates whether some other object is "equal to" this one.static OpenInterfacefromWire(int id, int flags) Decodes one wire flags byte for interfaceid.final inthashCode()Returns a hash code value for this object.intid()Returns the value of theidrecord component.booleanisModal()Whether this is a modal: it closes when the player moves.booleanWhether this is a persistent overlay such as a HUD panel.booleanWhether the producer could not publish the client's type.final StringtoString()Returns a string representation of this record class.inttype()Returns the value of thetyperecord component.
-
Field Details
-
TYPE_MASK
public static final int TYPE_MASKBits 0-2 of a wire flags byte: the open type. MirrorskOpenIfaceTypeMask.- See Also:
-
FLAG_CLIENT_OPENED
public static final int FLAG_CLIENT_OPENEDBit 3 of a wire flags byte. MirrorskOpenIfaceFlagClientOpened.- See Also:
-
TYPE_MODAL
public static final int TYPE_MODALCloses when the player moves; the bank and dialogues.- See Also:
-
TYPE_OVERLAY
public static final int TYPE_OVERLAYHUD panels and other persistent overlays.- See Also:
-
TYPE_CLIENT_CHILD
public static final int TYPE_CLIENT_CHILDA child opened by a client script, closed along with its parent.- See Also:
-
TYPE_UNKNOWN
public static final int TYPE_UNKNOWNThe client's type was out of the publishable range. MirrorskOpenIfaceTypeUnknown.- See Also:
-
-
Constructor Details
-
OpenInterface
public OpenInterface(int id, int type, boolean clientOpened) Creates an instance of aOpenInterfacerecord class.- Parameters:
id- the value for theidrecord componenttype- the value for thetyperecord componentclientOpened- the value for theclientOpenedrecord component
-
-
Method Details
-
fromWire
Decodes one wire flags byte for interfaceid. Reserved bits 4-7 are ignored, so a producer that starts using them cannot change whattype()orclientOpened()report.- Parameters:
id- the interface id from the same index of the id arrayflags- 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
-
hashCode
-
equals
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 thecomparemethod from their corresponding wrapper classes. -
id
-
type
-
clientOpened
public boolean clientOpened()Returns the value of theclientOpenedrecord component.- Returns:
- the value of the
clientOpenedrecord component
-