Class IfComponent

java.lang.Object
dev.twilite.game.wrapper.IfComponent
All Implemented Interfaces:
Id, Interactable

public class IfComponent extends Object implements Interactable, Id
Interface component/widget wrapper.
  • Constructor Summary

    Constructors
    Constructor
    Description
    IfComponent(dev.twilite.game.internal.memory.RSIfComponent memory)
    Wraps a native interface component provider.
  • Method Summary

    Modifier and Type
    Method
    Description
    Returns the absolute component screen bounds.
    int
    Returns the component client code.
    int
    Returns the component index within its group.
    Returns the generated gameval constant name for Id.id(), or the numeric id as text when no constant is known.
    dynamicChild(int child)
    Returns a dynamic child by index.
    Returns a lazy view over dynamic children.
    int
    Returns the dynamic child index, or -1 for non-dynamic components.
    int
    Returns the interface group id.
    int
    id()
    Returns the packed component id.
    void
    interact(String... options)
    Enqueues the primary component action when no option text is supplied.
    int
    Returns the component item id, or -1 when no item is present.
    int
    Returns the component item stack size.
    Resolves the raw layer component.
    int
    Returns the raw parent layer id.
    int
    Returns the component material id.
    int
    Returns the component model id.
    Returns standardized component name.
    Returns available standardized component menu and sub-menu options.
    Resolves the effective parent layer.
    int
    Returns the resolved parent layer id, including sub-interface parenting.
    Returns the absolute component screen point.
    boolean
    Enqueues the resume/pause-button action.
    boolean
    Enqueues the component use/select action.
    int
    Returns the component sprite id.
    boolean
    Enqueues the component target action.
    Returns standardized component text.
    int
    Returns the component type.
    boolean
    Returns whether the component is visible through its parent chain.

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface dev.twilite.game.trait.Interactable

    option
  • Constructor Details

    • IfComponent

      public IfComponent(dev.twilite.game.internal.memory.RSIfComponent memory)
      Wraps a native interface component provider.
  • Method Details

    • id

      public int id()
      Returns the packed component id.
      Specified by:
      id in interface Id
    • constantName

      public String constantName()
      Description copied from interface: Id
      Returns the generated gameval constant name for Id.id(), or the numeric id as text when no constant is known.

      This is intended for logs and diagnostics where a stable symbolic name is easier to read than a raw number.

      Specified by:
      constantName in interface Id
    • group

      public int group()
      Returns the interface group id.
    • component

      public int component()
      Returns the component index within its group.
    • dynamicIndex

      public int dynamicIndex()
      Returns the dynamic child index, or -1 for non-dynamic components.
    • type

      public int type()
      Returns the component type.
    • clientCode

      public int clientCode()
      Returns the component client code.
    • layerId

      public int layerId()
      Returns the raw parent layer id.
    • parentLayerId

      public int parentLayerId()
      Returns the resolved parent layer id, including sub-interface parenting.
    • layer

      public Optional<IfComponent> layer()
      Resolves the raw layer component.
    • parentLayer

      public Optional<IfComponent> parentLayer()
      Resolves the effective parent layer.
    • point

      public Point point()
      Returns the absolute component screen point.
    • bounds

      public Rectangle bounds()
      Returns the absolute component screen bounds.
    • visible

      public boolean visible()
      Returns whether the component is visible through its parent chain.
    • materialId

      public int materialId()
      Returns the component material id.
    • spriteId

      public int spriteId()
      Returns the component sprite id.
    • modelId

      public int modelId()
      Returns the component model id.
    • text

      public String text()
      Returns standardized component text. Standardized text is tag-stripped, trimmed, and lowercased.
    • name

      public String name()
      Returns standardized component name. Standardized text is tag-stripped, trimmed, and lowercased.
    • options

      public List<MenuOption> options()
      Returns available standardized component menu and sub-menu options. Option text is tag-stripped, trimmed, and lowercased.
      Specified by:
      options in interface Interactable
    • interact

      public void interact(String... options)
      Enqueues the primary component action when no option text is supplied.
      Specified by:
      interact in interface Interactable
    • target

      public boolean target()
      Enqueues the component target action.
      Specified by:
      target in interface Interactable
    • select

      public boolean select()
      Enqueues the component use/select action.
      Specified by:
      select in interface Interactable
    • resumePause

      public boolean resumePause()
      Enqueues the resume/pause-button action.
    • itemId

      public int itemId()
      Returns the component item id, or -1 when no item is present.
    • itemStackSize

      public int itemStackSize()
      Returns the component item stack size.
    • dynamicChildren

      public ComponentView dynamicChildren()
      Returns a lazy view over dynamic children.
    • dynamicChild

      public Optional<IfComponent> dynamicChild(int child)
      Returns a dynamic child by index.