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's0xFFFFsentinel as-1compId- this component's id withinifaceIdsubId- sub-selector / option index (used by some component types)type- component type byte fromvtable[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'sWireCategory); the durable form to query on. Map it withComponentType.fromCode(int). Prefer this overtype— the rawtypebyte 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 offsety- absolute client-space y (pixels); seexwidth- post-layout computed widthheight- post-layout computed heightrawX- pre-layout raw config x — what the cache stored beforeCalcPositionFromModeconverted itrawY- pre-layout raw config yrawW- pre-layout raw config widthrawH- pre-layout raw config heightxPosMode- anchor mode forrawX(0-5; pixel / percent / anchored-from-edge / etc.)yPosMode- anchor mode forrawYxSizeMode- interpretation ofrawW(0-4; mode 4 = aspect ratio ofrawH, see also the unexposedaspect_w/aspect_hnumerator/denominator pair on the producer side)ySizeMode- interpretation ofrawHabsScreenPos- flag — when nonzero, position is absolute screen coordinates regardless of parenttext- 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.- 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. UseisHidden()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.-1means 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.-1for non-ModelComponents. Always prefer the per-tickSnapshot.inventoryAt(...)path for actual backpack/bank reads — that comes fromInventoryManagerdirectly without an RPC round-trip and without depending on whether the inventory UI is currently open.itemAmount- paired withitemId: quantity for inventory slots, animation_id for model viewers.-1for non-ModelComponents.triggers- CS2 event triggers bound to this component — the discovery side of trigger firing. EachComponentTriggeris a (type, scriptId) the engine would run on that input event; pass itstypetoGameAPI.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
ConstructorsConstructorDescriptionComponent(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 aComponentrecord class. -
Method Summary
Modifier and TypeMethodDescriptionintReturns the value of theabsScreenPosrecord component.intcategory()Returns the value of thecategoryrecord component.intcompId()Returns the value of thecompIdrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.intheight()Returns the value of theheightrecord component.inthidden()Returns the value of thehiddenrecord component.intifaceId()Returns the value of theifaceIdrecord component.booleanisHidden()True iff the producer reported this component is hidden (hidden == 1).intReturns the value of theitemAmountrecord component.intitemId()Returns the value of theitemIdrecord component.intrawH()Returns the value of therawHrecord component.intrawW()Returns the value of therawWrecord component.intrawX()Returns the value of therawXrecord component.intrawY()Returns the value of therawYrecord component.intspriteId()Returns the value of thespriteIdrecord component.intsubId()Returns the value of thesubIdrecord component.text()Returns the value of thetextrecord component.final StringtoString()Returns a string representation of this record class.triggers()Returns the value of thetriggersrecord component.inttype()Returns the value of thetyperecord component.intwidth()Returns the value of thewidthrecord component.intx()Returns the value of thexrecord component.intxPosMode()Returns the value of thexPosModerecord component.intReturns the value of thexSizeModerecord component.inty()Returns the value of theyrecord component.intyPosMode()Returns the value of theyPosModerecord component.intReturns the value of theySizeModerecord component.
-
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 aComponentrecord class.- Parameters:
ifaceId- the value for theifaceIdrecord componentcompId- the value for thecompIdrecord componentsubId- the value for thesubIdrecord componenttype- the value for thetyperecord componentcategory- the value for thecategoryrecord componentx- the value for thexrecord componenty- the value for theyrecord componentwidth- the value for thewidthrecord componentheight- the value for theheightrecord componentrawX- the value for therawXrecord componentrawY- the value for therawYrecord componentrawW- the value for therawWrecord componentrawH- the value for therawHrecord componentxPosMode- the value for thexPosModerecord componentyPosMode- the value for theyPosModerecord componentxSizeMode- the value for thexSizeModerecord componentySizeMode- the value for theySizeModerecord componentabsScreenPos- the value for theabsScreenPosrecord componenttext- the value for thetextrecord componenthidden- the value for thehiddenrecord componentspriteId- the value for thespriteIdrecord componentitemId- the value for theitemIdrecord componentitemAmount- the value for theitemAmountrecord componenttriggers- the value for thetriggersrecord component
-
-
Method Details
-
isHidden
public boolean isHidden()True iff the producer reported this component is hidden (hidden == 1). -
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. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with thecomparemethod from their corresponding wrapper classes. -
ifaceId
-
compId
-
subId
-
type
-
category
-
x
-
y
-
width
-
height
-
rawX
-
rawY
-
rawW
-
rawH
-
xPosMode
-
yPosMode
-
xSizeMode
-
ySizeMode
-
absScreenPos
public int absScreenPos()Returns the value of theabsScreenPosrecord component.- Returns:
- the value of the
absScreenPosrecord component
-
text
-
spriteId
-
itemId
-
itemAmount
public int itemAmount()Returns the value of theitemAmountrecord component.- Returns:
- the value of the
itemAmountrecord component
-
triggers
-