Class GameObjectPackets
- java.lang.Object
-
- com.kraken.api.core.packet.entity.GameObjectPackets
-
public class GameObjectPackets extends java.lang.ObjectA high-level utility class for sending packets related toTileObject(Game Object) interactions to the game server.This class handles actions like clicking on doors, trees, or banks, as well as "use-on" actions (e.g., using an item on an object). It abstracts the low-level packet construction and world coordinate calculations.
-
-
Constructor Summary
Constructors Constructor Description GameObjectPackets()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidqueueObjectAction(int actionFieldNo, int objectId, int worldPointX, int worldPointY, boolean ctrlDown)Queues the low-level packet to perform a generic action click on a tile object.voidqueueObjectAction(net.runelite.api.TileObject object, boolean ctrlDown, java.lang.String... actionlist)Queues a tile object action by matching a human-readable action string (e.g., "Chop", "Open", "Bank").voidqueueWidgetOnTileObject(int objectId, int worldPointX, int worldPointY, int sourceSlot, int sourceItemId, int sourceWidgetId, boolean ctrlDown)Queues the raw packet for using a widget (typically an item) on a tile object.voidqueueWidgetOnTileObject(net.runelite.api.widgets.Widget widget, net.runelite.api.TileObject object)Queues the packet for using a specificWidget(or item it represents) on a targetTileObject.
-
-
-
Method Detail
-
queueObjectAction
public void queueObjectAction(int actionFieldNo, int objectId, int worldPointX, int worldPointY, boolean ctrlDown)Queues the low-level packet to perform a generic action click on a tile object.This method sends one of the
OPLOCpackets (e.g.,OPLOC1throughOPLOC10), where the action is determined by theactionFieldNo.- Parameters:
actionFieldNo- The 1-based index of the action to execute (1-10).objectId- The ID of the target object.worldPointX- The X coordinate of the object's location in the world.worldPointY- The Y coordinate of the object's location in the world.ctrlDown- If true, indicates the control key was held down.
-
queueObjectAction
public void queueObjectAction(net.runelite.api.TileObject object, boolean ctrlDown, java.lang.String... actionlist)Queues a tile object action by matching a human-readable action string (e.g., "Chop", "Open", "Bank").This is a high-level convenience method that determines the target object's world coordinates, checks the object's available actions, finds a match for
actionlist, and sends the correct low-levelOPLOCpacket.- Parameters:
object- The targetTileObject(e.g., GameObject, WallObject).ctrlDown- If true, indicates the control key was held down.actionlist- A varargs list of action strings to search for (case-insensitive).
-
queueWidgetOnTileObject
public void queueWidgetOnTileObject(int objectId, int worldPointX, int worldPointY, int sourceSlot, int sourceItemId, int sourceWidgetId, boolean ctrlDown)Queues the raw packet for using a widget (typically an item) on a tile object.This method sends the
OPLOCT(Use Widget on Location/Object) packet, which includes the coordinates of the target object and the details of the source item/widget.- Parameters:
objectId- The ID of the target object.worldPointX- The X coordinate of the object's location in the world.worldPointY- The Y coordinate of the object's location in the world.sourceSlot- The slot index of the item being used (e.g., inventory slot).sourceItemId- The ID of the item being used.sourceWidgetId- The ID of the parent widget containing the item (e.g., inventory widget ID).ctrlDown- If true, indicates the control key was held down.
-
queueWidgetOnTileObject
public void queueWidgetOnTileObject(net.runelite.api.widgets.Widget widget, net.runelite.api.TileObject object)Queues the packet for using a specificWidget(or item it represents) on a targetTileObject.This is a convenience method that first calculates the target object's world coordinates and then calls the raw
queueWidgetOnTileObjectmethod with the source widget's details.- Parameters:
widget- The sourceWidgetcontaining the item or action to be used on the object.object- The targetTileObject.
-
-