Class GroundItemPackets
- java.lang.Object
-
- com.kraken.api.core.packet.entity.GroundItemPackets
-
public class GroundItemPackets extends java.lang.ObjectA utility class for sending packets related toTileItem(ground item) interactions to the game server.This class primarily handles picking up ground items (actions) and using items/widgets directly on a ground item. It abstracts the low-level packet construction and world coordinate handling.
-
-
Constructor Summary
Constructors Constructor Description GroundItemPackets()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidqueueGroundItemAction(int actionFieldNo, int objectId, int worldPointX, int worldPointY, boolean ctrlDown)Queues the low-level packet to perform a generic action click on a ground item.voidqueueGroundItemAction(net.runelite.api.TileItem item, net.runelite.api.coords.WorldPoint location, boolean ctrlDown)Queues the packet to perform the default "Take" action (Action 3) on a ground item.voidqueueWidgetOnGroundItem(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 ground item.voidqueueWidgetOnGroundItem(net.runelite.api.TileItem item, net.runelite.api.coords.WorldPoint location, net.runelite.api.widgets.Widget w, boolean ctrlDown)Queues the packet for using a specificWidget(or item it represents) on a targetTileItem.
-
-
-
Method Detail
-
queueGroundItemAction
public void queueGroundItemAction(int actionFieldNo, int objectId, int worldPointX, int worldPointY, boolean ctrlDown)Queues the low-level packet to perform a generic action click on a ground item.This method sends one of the
OPOBJpackets (e.g.,OPOBJ1throughOPOBJ5, depending on the packet factory implementation). These packets are used for actions like "Take," "Examine," or other option clicks on a ground item.- Parameters:
actionFieldNo- The 1-based index of the action to execute (typically 1-5 for ground items).objectId- The Item ID of the ground item.worldPointX- The X coordinate of the item's location in the world.worldPointY- The Y coordinate of the item's location in the world.ctrlDown- If true, indicates the control key was held down.
-
queueWidgetOnGroundItem
public void queueWidgetOnGroundItem(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 ground item.This method sends the
OPOBJT(Use Widget on Object/Item) packet, which includes the coordinates of the target ground item and the details of the source item/widget.- Parameters:
objectId- The Item ID of the ground item.worldPointX- The X coordinate of the item's location in the world.worldPointY- The Y coordinate of the item'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.
-
queueGroundItemAction
public void queueGroundItemAction(net.runelite.api.TileItem item, net.runelite.api.coords.WorldPoint location, boolean ctrlDown)Queues the packet to perform the default "Take" action (Action 3) on a ground item.This is a convenience method for the most common interaction with a ground item. It uses action index 3, which is conventionally the "Take" option for items.
- Parameters:
item- The targetTileItemobject.location- TheWorldPointlocation of the item on the map.ctrlDown- If true, indicates the control key was held down.
-
queueWidgetOnGroundItem
public void queueWidgetOnGroundItem(net.runelite.api.TileItem item, net.runelite.api.coords.WorldPoint location, net.runelite.api.widgets.Widget w, boolean ctrlDown)Queues the packet for using a specificWidget(or item it represents) on a targetTileItem.This is a convenience method that simplifies sending the
OPOBJTpacket by extracting necessary details from the providedTileItemand sourceWidget.- Parameters:
item- The targetTileItemobject on the ground.location- TheWorldPointlocation of the item on the map.w- The sourceWidgetcontaining the item or action to be used on the ground item.ctrlDown- If true, indicates the control key was held down.
-
-