Class WidgetPackets


  • public class WidgetPackets
    extends java.lang.Object
    A high-level utility class for sending widget-related game packets. This class abstracts the complexity of constructing and sending packets related to widget (interface) interactions, such as clicking buttons. It uses a PacketClient provider to send the low-level packets, which are defined by the PacketFactory.
    • Constructor Summary

      Constructors 
      Constructor Description
      WidgetPackets()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void queueResumeCount​(int id)
      Queues the RESUME_COUNTDIALOG packet, sent in response to a numerical input dialog (e.g., "How many?" or "Enter amount").
      void queueResumeObj​(int value)
      Queues the RESUME_OBJDIALOG packet, typically sent as a continuation packet after selecting an option in a multi-choice dialog, where the value represents an item ID or object ID relevant to the dialog option.
      void queueWidgetSubAction​(net.runelite.api.widgets.Widget widget, java.lang.String menu, java.lang.String action)
      Queues a widget sub-action packet by identifying the specific sub-action and menu options associated with a given widget.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • WidgetPackets

        public WidgetPackets()
    • Method Detail

      • queueWidgetSubAction

        public void queueWidgetSubAction​(net.runelite.api.widgets.Widget widget,
                                         java.lang.String menu,
                                         java.lang.String action)
        Queues a widget sub-action packet by identifying the specific sub-action and menu options associated with a given widget.

        This method identifies the indices of both a sub-action (from item definitions) and a specific menu option (from the widget's actions). If matches for both the sub-action and menu option are found, it sends a low-level packet to perform the action.

        Only executes if the widget and its associated item ID are valid, while the sub-actions and menu options must contain the desired action and menu option.

        Parameters:
        widget - The Widget instance on which the action is to be performed. This is the target widget for the queued action.
        menu - A case-insensitive @<String> representing the menu action text to search for (e.g., "Use", "Examine").
        action - A case-insensitive @<String> representing the sub-action text to search for (e.g., "Clean", "Equip").
      • queueResumeCount

        public void queueResumeCount​(int id)
        Queues the RESUME_COUNTDIALOG packet, sent in response to a numerical input dialog (e.g., "How many?" or "Enter amount").
        Parameters:
        id - The integer value entered by the player.
      • queueResumeObj

        public void queueResumeObj​(int value)
        Queues the RESUME_OBJDIALOG packet, typically sent as a continuation packet after selecting an option in a multi-choice dialog, where the value represents an item ID or object ID relevant to the dialog option.
        Parameters:
        value - The numerical value associated with the dialog option.