Class InventoryEntity
- java.lang.Object
-
- com.kraken.api.core.AbstractEntity<ContainerItem>
-
- com.kraken.api.query.container.inventory.InventoryEntity
-
- All Implemented Interfaces:
Interactable<ContainerItem>
public class InventoryEntity extends AbstractEntity<ContainerItem>
-
-
Field Summary
-
Fields inherited from class com.kraken.api.core.AbstractEntity
ctx, raw
-
-
Constructor Summary
Constructors Constructor Description InventoryEntity(Context ctx, ContainerItem raw)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancombineWith(ContainerItem other)Uses one inventory item on another.booleandrop()Drops the item from the inventory.intgetId()The item ID for the wrapped game entityjava.lang.StringgetName()The game entities name.booleanhasAction(java.lang.String action)Returns true if the inventory item has the specified action.booleaninteract(java.lang.String action)Interacts with the entity using the given action verb.booleanuseOn(ContainerItem other)Uses one item in the inventory on the other.booleanuseOn(net.runelite.api.GameObject gameObject)Uses one item in the inventory on a Game object.booleanuseOn(net.runelite.api.NPC npc)Uses one item in the inventory on an NPC.-
Methods inherited from class com.kraken.api.core.AbstractEntity
equals, hashCode, isNull, raw
-
-
-
-
Constructor Detail
-
InventoryEntity
public InventoryEntity(Context ctx, ContainerItem 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.
-
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
-
getId
public int getId()
Description copied from interface:InteractableThe item ID for the wrapped game entity- Returns:
- int Item id
-
hasAction
public boolean hasAction(java.lang.String action)
Returns true if the inventory item has the specified action. i.e "Swordfish" will have the action "Eat", "Drop", and "Examine" but not "Drink"- Parameters:
action- The action to check for- Returns:
- True if the item has the action and false otherwise
-
combineWith
public boolean combineWith(ContainerItem other)
Uses one inventory item on another.- Parameters:
other- The other inventory item to be used on.- Returns:
- True if the combination action was successful and false otherwise
-
useOn
public boolean useOn(ContainerItem other)
Uses one item in the inventory on the other. This is a shallow wrapper aroundcombineWith()- Parameters:
other- The other inventory item to be used on.- Returns:
- True if the use on item was successful and false otherwise
-
useOn
public boolean useOn(net.runelite.api.NPC npc)
Uses one item in the inventory on an NPC.- Parameters:
npc- The NPC to use the inventory item on.- Returns:
- True if the use on item was successful and false otherwise
-
useOn
public boolean useOn(net.runelite.api.GameObject gameObject)
Uses one item in the inventory on a Game object.- Parameters:
gameObject- The GameObject to use the inventory item on.- Returns:
- True if the use on item was successful and false otherwise
-
drop
public boolean drop()
Drops the item from the inventory.- Returns:
- True if the item was successfully dropped, false otherwise.
-
-