Package rs.kreme.ksbot.api.wrappers
Class KSItem
- java.lang.Object
-
- rs.kreme.ksbot.api.wrappers.KSItem
-
public class KSItem extends java.lang.Object
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
KSItem.Type
-
Constructor Summary
Constructors Constructor Description KSItem()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
canNote()
Checks if the item can be converted to a noted version.java.lang.String
getAction(java.lang.String... actions)
Checks if the item has a specific action.int
getActionIndex(java.lang.String action)
Gets the index of an action for this item based on its name.java.lang.String[]
getActions()
Gets the actions available for the item.net.runelite.api.ItemComposition
getComp()
Retrieves the item composition (definition) for this item.java.lang.String
getName()
Gets the name of the item.KSItem.Type
getType()
boolean
hasAction(java.lang.String action)
Checks if the item has a specific action.boolean
interact(int option)
Interacts with the item using a specific option (low priority).boolean
interact(int option, net.runelite.api.MenuAction menuAction)
Interacts with the item using a specific option and menu action.boolean
interact(java.lang.String option)
Interacts with the item using a specified action name.boolean
isNoted()
Checks if the item is noted (i.e., a banknote version of an item).java.lang.String
toString()
Provides a string representation of the item, including its name, ID, slot, and widget.
-
-
-
Method Detail
-
getName
public java.lang.String getName()
Gets the name of the item.- Returns:
- the item's name as a String, or
null
if unavailable.
-
getActions
public java.lang.String[] getActions()
Gets the actions available for the item.- Returns:
- an array of Strings representing the available actions, or
null
if none.
-
isNoted
public boolean isNoted()
Checks if the item is noted (i.e., a banknote version of an item).- Returns:
true
if the item is noted,false
otherwise.
-
interact
public boolean interact(int option)
Interacts with the item using a specific option (low priority).- Parameters:
option
- the index of the action to perform.- Returns:
true
if the interaction is triggered successfully.
-
interact
public boolean interact(int option, net.runelite.api.MenuAction menuAction)
Interacts with the item using a specific option and menu action.- Parameters:
option
- the index of the action to perform.menuAction
- the menu action associated with the interaction.- Returns:
true
if the interaction is triggered successfully.
-
interact
public boolean interact(java.lang.String option)
Interacts with the item using a specified action name.- Parameters:
option
- the name of the action to perform (e.g., "Use", "Drop").- Returns:
true
if the interaction is triggered successfully,false
otherwise.
-
getComp
public net.runelite.api.ItemComposition getComp()
Retrieves the item composition (definition) for this item.- Returns:
- the
ItemComposition
object representing the item.
-
canNote
public boolean canNote()
Checks if the item can be converted to a noted version.- Returns:
true
if the item can be noted,false
otherwise.
-
getActionIndex
public int getActionIndex(java.lang.String action)
Gets the index of an action for this item based on its name.- Parameters:
action
- the name of the action to look for (e.g., "Drop").- Returns:
- the index of the action in the action list, or -1 if the action is not found.
-
hasAction
public boolean hasAction(java.lang.String action)
Checks if the item has a specific action.- Parameters:
action
- the name of the action to check (e.g., "Use").- Returns:
true
if the action is available,false
otherwise.
-
getAction
public java.lang.String getAction(java.lang.String... actions)
Checks if the item has a specific action.- Parameters:
action
- the name of the action to check (e.g., "Use").- Returns:
String
if the action is available,null
otherwise.
-
getType
public KSItem.Type getType()
-
toString
public java.lang.String toString()
Provides a string representation of the item, including its name, ID, slot, and widget.- Overrides:
toString
in classjava.lang.Object
- Returns:
- a formatted string describing the item.
-
-