Package com.kraken.api.query.widget
Class WidgetEntity
- java.lang.Object
-
- com.kraken.api.core.AbstractEntity<net.runelite.api.widgets.Widget>
-
- com.kraken.api.query.widget.WidgetEntity
-
- All Implemented Interfaces:
Interactable<net.runelite.api.widgets.Widget>
public class WidgetEntity extends AbstractEntity<net.runelite.api.widgets.Widget>
-
-
Field Summary
-
Fields inherited from class com.kraken.api.core.AbstractEntity
ctx, raw
-
-
Constructor Summary
Constructors Constructor Description WidgetEntity(Context ctx, net.runelite.api.widgets.Widget raw)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intgetId()The item ID for the wrapped game entityjava.lang.StringgetName()The game entities name.booleaninteract(java.lang.String action)Interacts with the entity using the given action verb.booleaninteract(java.lang.String menu, java.lang.String action)Interacts with a widget by invoking a specified menu and action.booleanisVisible()Checks if the widget is currently visible.booleanmatches(java.lang.String search, boolean exact)Checks if the widget text, name, or actions match the input.booleanuseOn(net.runelite.api.GameObject gameObject)Uses a widget on a Game Object (i.e.booleanuseOn(net.runelite.api.NPC npc)Uses a widget on an NPC (i.e.booleanuseOn(net.runelite.api.widgets.Widget destinationWidget)Uses a widget on another widget.-
Methods inherited from class com.kraken.api.core.AbstractEntity
equals, hashCode, isNull, raw
-
-
-
-
Constructor Detail
-
WidgetEntity
public WidgetEntity(Context ctx, net.runelite.api.widgets.Widget raw)
-
-
Method Detail
-
getName
public java.lang.String getName()
Description copied from interface:InteractableThe game entities name.- Returns:
- The name of the game entity i.e. NPC name for NPC's, item name for ContainerItem's, and GameObject name for various game objects.
-
getId
public int getId()
Description copied from interface:InteractableThe item ID for the wrapped game entity- Returns:
- int Item id
-
matches
public boolean matches(java.lang.String search, boolean exact)Checks if the widget text, name, or actions match the input.- Parameters:
search- The search string to matchexact- True if only exact matches of the search string should be accepted- Returns:
- true if there is a match within the search string for a specific widget and false otherwise
-
interact
public boolean interact(java.lang.String action)
Description copied from interface:InteractableInteracts with the entity using the given action verb.- Parameters:
action- The menu action to trigger (e.g., "Attack", "Talk-to", "Take")- Returns:
- true if the interaction packet was successfully queued/sent
-
interact
public boolean interact(java.lang.String menu, java.lang.String action)Interacts with a widget by invoking a specified menu and action.This method attempts to perform an interaction on a widget identified by its underlying raw representation. If the raw widget is
null, the method will immediately returnfalse. Otherwise, it delegates the interaction process to the interaction manager.- Parameters:
menu- The menu option to be selected during the interaction. For example, this could represent a contextual menu option like "Use" or "Examine".action- The specific action to be invoked within the selected menu option. This typically represents the intended effect of the interaction, such as "Wield".- Returns:
trueif the interaction process was initiated successfully;falseif the underlying widget wasnulland no action was performed.
-
isVisible
public boolean isVisible()
Checks if the widget is currently visible.A widget is considered visible if it is not marked as hidden in its underlying raw state.
- Returns:
trueif the widget is visible;falseotherwise.
-
useOn
public boolean useOn(net.runelite.api.widgets.Widget destinationWidget)
Uses a widget on another widget. (i.e. High Alchemy)- Parameters:
destinationWidget- The destination widget to use this entity on- Returns:
- True if the action is successful and false otherwise.
-
useOn
public boolean useOn(net.runelite.api.NPC npc)
Uses a widget on an NPC (i.e. Crumble Undead Spell on the Undead Spawn from Vorkath)- Parameters:
npc- NPC to use the widget on.- Returns:
- True if the action was successful and false otherwise.
-
useOn
public boolean useOn(net.runelite.api.GameObject gameObject)
Uses a widget on a Game Object (i.e. Bones on the Chaos Altar)- Parameters:
gameObject- The Game Object to use the widget on.- Returns:
- True if the action was successful and false otherwise.
-
-