Record Class Component

java.lang.Object
java.lang.Record
com.botwithus.bot.api.model.Component
Record Components:
ifaceId - owning interface id; the producer reads the game's 0xFFFF sentinel as -1
compId - this component's id within ifaceId
subId - sub-selector / option index (used by some component types)
type - component type byte from vtable[1](comp); -1 on resolution failure. Different types stash their type-specific fields (text, sprite id, item slot, hidden bit) at different offsets, so this is the dispatch key any per-type read needs. Some known values: type 8 is ButtonComponent.
category - stable, build-independent semantic category code (mirrors the producer's WireCategory); the durable form to query on. Map it with ComponentType.fromCode(int). Prefer this over type — the raw type byte drifts between game builds. 0 (Unknown) when read from a producer that predates this field.
x - absolute client-space x (pixels) — the producer resolves the parent-component chain and the sub-interface mount offset, so this is where the component actually sits in the game's client area, not a parent-relative offset
y - absolute client-space y (pixels); see x
width - post-layout computed width
height - post-layout computed height
rawX - pre-layout raw config x — what the cache stored before CalcPositionFromMode converted it
rawY - pre-layout raw config y
rawW - pre-layout raw config width
rawH - pre-layout raw config height
xPosMode - anchor mode for rawX (0-5; pixel / percent / anchored-from-edge / etc.)
yPosMode - anchor mode for rawY
xSizeMode - interpretation of rawW (0-4; mode 4 = aspect ratio of rawH, see also the unexposed aspect_w/aspect_h numerator/denominator pair on the producer side)
ySizeMode - interpretation of rawH
absScreenPos - flag — when nonzero, position is absolute screen coordinates regardless of parent
text - embedded label text for components that carry one (Button / List / Input / Slider / Carousel / Component19 / RadioGroup / GroupBox plus categories 2 and 9). Empty string when this category doesn't carry text or when the embedded string is empty. Never null.
hidden - tri-state visibility flag: -1 = unsupported (category has no text region — Panel, Grid, Sprite, Box, Line, etc. — until those mechanisms are reverse-engineered); 0 = visible; 1 = hidden. Use isHidden() for a forgiving boolean that treats unsupported as visible.
spriteId - primary visual reference id — sprite id for Sprite, icon sprite for Button (distinct from the button's label text), and similarly for Input. -1 means either the category carries no graphic sub-region (per sub_CA450's dispatch) or the field is set to "none" / 0xFFFFFFFF.
itemId - ModelComponent (cat 4) primary id. For inventory- slot displays this is the displayed item's id; for NPC / object viewer interfaces it's a model_id. -1 for non-ModelComponents. Always prefer the per-tick Snapshot.inventoryAt(...) path for actual backpack/bank reads — that comes from InventoryManager directly without an RPC round-trip and without depending on whether the inventory UI is currently open.
itemAmount - paired with itemId: quantity for inventory slots, animation_id for model viewers. -1 for non-ModelComponents.
triggers - CS2 event triggers bound to this component — the discovery side of trigger firing. Each ComponentTrigger is a (type, scriptId) the engine would run on that input event; pass its type to GameAPI.fireComponentTrigger(int, int, int, int, int). Empty for the vast majority of components, which carry no trigger array. Never null.

public record Component(int ifaceId, int compId, int subId, int type, int category, int x, int y, int width, int height, int rawX, int rawY, int rawW, int rawH, int xPosMode, int yPosMode, int xSizeMode, int ySizeMode, int absScreenPos, String text, int hidden, int spriteId, int itemId, int itemAmount, List<ComponentTrigger> triggers) extends Record
Snapshot of an interface component at the moment the producer answered an RPC. Phase 1 starter set — fields cover identity and base-Component geometry (everything Component::DecodeType writes from the if3 packet plus what LayoutComponents writes back into screen_*). Per-type fields (text, sprite id, item slot, hidden bit, color, font) are not yet here and arrive in later slices once each Component subclass has been mapped.

Lifetime: every GameAPI.getComponent(int, int) call is a fresh pipe round-trip; this record reflects the component state at one specific tick. Don't cache across ticks — Phase 2 will add a version-keyed cache once setter hooks land.

See Also:
  • Constructor Summary

    Constructors
    Constructor
    Description
    Component(int ifaceId, int compId, int subId, int type, int category, int x, int y, int width, int height, int rawX, int rawY, int rawW, int rawH, int xPosMode, int yPosMode, int xSizeMode, int ySizeMode, int absScreenPos, String text, int hidden, int spriteId, int itemId, int itemAmount, List<ComponentTrigger> triggers)
    Creates an instance of a Component record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    Returns the value of the absScreenPos record component.
    int
    Returns the value of the category record component.
    int
    Returns the value of the compId record component.
    final boolean
    Indicates whether some other object is "equal to" this one.
    final int
    Returns a hash code value for this object.
    int
    Returns the value of the height record component.
    int
    Returns the value of the hidden record component.
    int
    Returns the value of the ifaceId record component.
    boolean
    True iff the producer reported this component is hidden (hidden == 1).
    int
    Returns the value of the itemAmount record component.
    int
    Returns the value of the itemId record component.
    int
    Returns the value of the rawH record component.
    int
    Returns the value of the rawW record component.
    int
    Returns the value of the rawX record component.
    int
    Returns the value of the rawY record component.
    int
    Returns the value of the spriteId record component.
    int
    Returns the value of the subId record component.
    Returns the value of the text record component.
    final String
    Returns a string representation of this record class.
    Returns the value of the triggers record component.
    int
    Returns the value of the type record component.
    int
    Returns the value of the width record component.
    int
    x()
    Returns the value of the x record component.
    int
    Returns the value of the xPosMode record component.
    int
    Returns the value of the xSizeMode record component.
    int
    y()
    Returns the value of the y record component.
    int
    Returns the value of the yPosMode record component.
    int
    Returns the value of the ySizeMode record component.

    Methods inherited from class Object

    getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • Component

      public Component(int ifaceId, int compId, int subId, int type, int category, int x, int y, int width, int height, int rawX, int rawY, int rawW, int rawH, int xPosMode, int yPosMode, int xSizeMode, int ySizeMode, int absScreenPos, String text, int hidden, int spriteId, int itemId, int itemAmount, List<ComponentTrigger> triggers)
      Creates an instance of a Component record class.
      Parameters:
      ifaceId - the value for the ifaceId record component
      compId - the value for the compId record component
      subId - the value for the subId record component
      type - the value for the type record component
      category - the value for the category record component
      x - the value for the x record component
      y - the value for the y record component
      width - the value for the width record component
      height - the value for the height record component
      rawX - the value for the rawX record component
      rawY - the value for the rawY record component
      rawW - the value for the rawW record component
      rawH - the value for the rawH record component
      xPosMode - the value for the xPosMode record component
      yPosMode - the value for the yPosMode record component
      xSizeMode - the value for the xSizeMode record component
      ySizeMode - the value for the ySizeMode record component
      absScreenPos - the value for the absScreenPos record component
      text - the value for the text record component
      hidden - the value for the hidden record component
      spriteId - the value for the spriteId record component
      itemId - the value for the itemId record component
      itemAmount - the value for the itemAmount record component
      triggers - the value for the triggers record component
  • Method Details

    • isHidden

      public boolean isHidden()
      True iff the producer reported this component is hidden (hidden == 1).
    • 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. Reference components are compared with Objects::equals(Object,Object); primitive components 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.
    • ifaceId

      public int ifaceId()
      Returns the value of the ifaceId record component.
      Returns:
      the value of the ifaceId record component
    • compId

      public int compId()
      Returns the value of the compId record component.
      Returns:
      the value of the compId record component
    • subId

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

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

      public int category()
      Returns the value of the category record component.
      Returns:
      the value of the category record component
    • x

      public int x()
      Returns the value of the x record component.
      Returns:
      the value of the x record component
    • y

      public int y()
      Returns the value of the y record component.
      Returns:
      the value of the y record component
    • width

      public int width()
      Returns the value of the width record component.
      Returns:
      the value of the width record component
    • height

      public int height()
      Returns the value of the height record component.
      Returns:
      the value of the height record component
    • rawX

      public int rawX()
      Returns the value of the rawX record component.
      Returns:
      the value of the rawX record component
    • rawY

      public int rawY()
      Returns the value of the rawY record component.
      Returns:
      the value of the rawY record component
    • rawW

      public int rawW()
      Returns the value of the rawW record component.
      Returns:
      the value of the rawW record component
    • rawH

      public int rawH()
      Returns the value of the rawH record component.
      Returns:
      the value of the rawH record component
    • xPosMode

      public int xPosMode()
      Returns the value of the xPosMode record component.
      Returns:
      the value of the xPosMode record component
    • yPosMode

      public int yPosMode()
      Returns the value of the yPosMode record component.
      Returns:
      the value of the yPosMode record component
    • xSizeMode

      public int xSizeMode()
      Returns the value of the xSizeMode record component.
      Returns:
      the value of the xSizeMode record component
    • ySizeMode

      public int ySizeMode()
      Returns the value of the ySizeMode record component.
      Returns:
      the value of the ySizeMode record component
    • absScreenPos

      public int absScreenPos()
      Returns the value of the absScreenPos record component.
      Returns:
      the value of the absScreenPos record component
    • text

      public String text()
      Returns the value of the text record component.
      Returns:
      the value of the text record component
    • hidden

      public int hidden()
      Returns the value of the hidden record component.
      Returns:
      the value of the hidden record component
    • spriteId

      public int spriteId()
      Returns the value of the spriteId record component.
      Returns:
      the value of the spriteId record component
    • itemId

      public int itemId()
      Returns the value of the itemId record component.
      Returns:
      the value of the itemId record component
    • itemAmount

      public int itemAmount()
      Returns the value of the itemAmount record component.
      Returns:
      the value of the itemAmount record component
    • triggers

      public List<ComponentTrigger> triggers()
      Returns the value of the triggers record component.
      Returns:
      the value of the triggers record component