Class NPCPackets


  • public class NPCPackets
    extends java.lang.Object
    Utility class for creating and queuing npc packets.
    • Constructor Summary

      Constructors 
      Constructor Description
      NPCPackets()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static RSPacketBufferNode createItemOnNpcPacket​(int id, int itemWidgetId, int itemId, int itemSlot, boolean ctrlDown)
      Creates a packet buffer node for creating an item on an NPC.
      static RSPacketBufferNode createNpcFifthActionPacket​(int id, boolean ctrlDown)
      Creates a packet buffer node for sending NPC fifth action packet.
      static RSPacketBufferNode createNpcFirstActionPacket​(int id, boolean ctrlDown)
      Creates a packet buffer node for an NPC's first action.
      static RSPacketBufferNode createNpcFourthActionPacket​(int id, boolean ctrlDown)
      Creates a packet for performing the fourth action on an NPC.
      static RSPacketBufferNode createNpcSecondActionPacket​(int id, boolean ctrlDown)
      Creates a packet for performing a second action on an NPC.
      static RSPacketBufferNode createNpcThirdActionPacket​(int id, boolean ctrlDown)
      Creates a packet for interacting with an NPC using the third action option.
      static RSPacketBufferNode createSpellOnNpcPacket​(int id, int spellWidgetId, boolean ctrlDown)
      Creates a spell on an NPC packet.
      static RSPacketBufferNode createWidgetOnNpc​(int id, int sourceWidgetId, int sourceItemId, int sourceSlot, boolean ctrlDown)
      Creates a packet buffer node for creating a widget on an NPC.
      static void npcAction​(NPC npc, java.lang.String action, boolean ctrlDown)
      Executes a specific action on an NPC based on the given action string and modifier key.
      static void npcFifthOption​(NPC npc, boolean ctrlDown)
      Executes the fifth option for the specified NPC.
      static void npcFirstOption​(NPC npc, boolean ctrlDown)
      Executes the first option on the specified NPC with the option to hold down the control key.
      static void npcFourthOption​(NPC npc, boolean ctrlDown)
      Executes the fourth option for the given NPC, optionally with the control key held down.
      static void npcSecondOption​(NPC npc, boolean ctrlDown)
      Sends the second option packet of the NPC to the server, indicating that the specific NPC has been interacted with.
      static void npcThirdOption​(NPC npc, boolean ctrlDown)
      Sends the third option packet for the given NPC with the specified control button state.
      static void queueItemOnNpcPacket​(int id, int itemWidgetId, int itemId, int itemSlot, boolean ctrlDown)
      Queues a packet to create and send an item on an NPC with the specified parameters.
      static void queueNPCAction1Packet​(int id, boolean ctrlDown)
      Queues and sends the first action packet for an NPC with the specified id.
      static void queueNPCAction2Packet​(int id, boolean ctrlDown)
      Queues a Second Action packet for the non-playable character with the specified ID.
      static void queueNPCAction3Packet​(int id, boolean ctrlDown)
      Queues the NPC action packet with the given id and whether ctrl key is pressed.
      static void queueNPCAction4Packet​(int id, boolean ctrlDown)
      Queues an NPC action packet with the specified ID and control key state.
      static void queueNPCAction5Packet​(int id, boolean ctrlDown)
      Queues and sends a fifth action packet for the specified NPC.
      static void queueSpellOnNpcPacket​(int id, int spellWidgetId, boolean ctrlDown)
      Queues and sends a spell on an NPC packet.
      static void spellOnNpc​(int widgetId, NPC npc, boolean b)
      Sends a spell on an NPC.
      • Methods inherited from class java.lang.Object

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

      • NPCPackets

        public NPCPackets()
    • Method Detail

      • npcFirstOption

        public static void npcFirstOption​(NPC npc,
                                          boolean ctrlDown)
        Executes the first option on the specified NPC with the option to hold down the control key.
        Parameters:
        npc - the NPC object to interact with
        ctrlDown - true if the control key should be held down, false otherwise
      • npcSecondOption

        public static void npcSecondOption​(NPC npc,
                                           boolean ctrlDown)
        Sends the second option packet of the NPC to the server, indicating that the specific NPC has been interacted with.
        Parameters:
        npc - the NPC to interact with
        ctrlDown - indicates if the control key was held down while interacting
      • npcThirdOption

        public static void npcThirdOption​(NPC npc,
                                          boolean ctrlDown)
        Sends the third option packet for the given NPC with the specified control button state.
        Parameters:
        npc - the NPC to perform the action on
        ctrlDown - true if the control button is pressed, false otherwise
      • npcFourthOption

        public static void npcFourthOption​(NPC npc,
                                           boolean ctrlDown)
        Executes the fourth option for the given NPC, optionally with the control key held down.
        Parameters:
        npc - The NPC to perform the action on.
        ctrlDown - True if the control key is being held down, false otherwise.
      • npcFifthOption

        public static void npcFifthOption​(NPC npc,
                                          boolean ctrlDown)
        Executes the fifth option for the specified NPC.
        Parameters:
        npc - the NPC object to perform the action on
        ctrlDown - true if the control key is held down, false otherwise
      • npcAction

        public static void npcAction​(NPC npc,
                                     java.lang.String action,
                                     boolean ctrlDown)
        Executes a specific action on an NPC based on the given action string and modifier key.
        Parameters:
        npc - the NPC on which the action should be performed
        action - the specific action to be performed on the NPC
        ctrlDown - true if the CTRL key is held down, false otherwise
      • spellOnNpc

        public static void spellOnNpc​(int widgetId,
                                      NPC npc,
                                      boolean b)
        Sends a spell on an NPC.
        Parameters:
        widgetId - the ID of the widget for the spell
        npc - the NPC to target
        b - if true, the spell will be queued; if false, it won't be queued
      • queueItemOnNpcPacket

        public static void queueItemOnNpcPacket​(int id,
                                                int itemWidgetId,
                                                int itemId,
                                                int itemSlot,
                                                boolean ctrlDown)
        Queues a packet to create and send an item on an NPC with the specified parameters.
        Parameters:
        id - the id of the NPC
        itemWidgetId - the widget id of the item
        itemId - the id of the item
        itemSlot - the slot of the item
        ctrlDown - true if the control key is down, false otherwise
      • queueSpellOnNpcPacket

        public static void queueSpellOnNpcPacket​(int id,
                                                 int spellWidgetId,
                                                 boolean ctrlDown)
        Queues and sends a spell on an NPC packet.
        Parameters:
        id - The ID of the NPC to cast the spell on.
        spellWidgetId - The ID of the spell widget.
        ctrlDown - Whether the control key is pressed down.
      • queueNPCAction1Packet

        public static void queueNPCAction1Packet​(int id,
                                                 boolean ctrlDown)
        Queues and sends the first action packet for an NPC with the specified id.
        Parameters:
        id - the id of the NPC
        ctrlDown - a boolean value representing whether or not the CTRL key is being held down
      • queueNPCAction2Packet

        public static void queueNPCAction2Packet​(int id,
                                                 boolean ctrlDown)
        Queues a Second Action packet for the non-playable character with the specified ID.
        Parameters:
        id - the ID of the non-playable character
        ctrlDown - true if the Ctrl key is currently held down, false otherwise
      • queueNPCAction3Packet

        public static void queueNPCAction3Packet​(int id,
                                                 boolean ctrlDown)
        Queues the NPC action packet with the given id and whether ctrl key is pressed.
        Parameters:
        id - the id of the NPC
        ctrlDown - true if ctrl key is pressed, false otherwise
      • queueNPCAction4Packet

        public static void queueNPCAction4Packet​(int id,
                                                 boolean ctrlDown)
        Queues an NPC action packet with the specified ID and control key state.
        Parameters:
        id - the ID of the NPC
        ctrlDown - whether the control key is currently being held down
      • queueNPCAction5Packet

        public static void queueNPCAction5Packet​(int id,
                                                 boolean ctrlDown)
        Queues and sends a fifth action packet for the specified NPC.
        Parameters:
        id - the ID of the NPC
        ctrlDown - true if the control key is pressed, false otherwise
      • createItemOnNpcPacket

        public static RSPacketBufferNode createItemOnNpcPacket​(int id,
                                                               int itemWidgetId,
                                                               int itemId,
                                                               int itemSlot,
                                                               boolean ctrlDown)
        Creates a packet buffer node for creating an item on an NPC.
        Parameters:
        id - the NPC ID
        itemWidgetId - the widget ID of the item
        itemId - the ID of the item
        itemSlot - the slot of the item
        ctrlDown - a boolean indicating if the control key is pressed down
        Returns:
        the created RSPacketBufferNode
      • createWidgetOnNpc

        public static RSPacketBufferNode createWidgetOnNpc​(int id,
                                                           int sourceWidgetId,
                                                           int sourceItemId,
                                                           int sourceSlot,
                                                           boolean ctrlDown)
        Creates a packet buffer node for creating a widget on an NPC.
        Parameters:
        id - the ID of the NPC
        sourceWidgetId - the ID of the source widget
        sourceItemId - the ID of the source item
        sourceSlot - the source slot
        ctrlDown - whether the control key is pressed down
        Returns:
        the packet buffer node
      • createSpellOnNpcPacket

        public static RSPacketBufferNode createSpellOnNpcPacket​(int id,
                                                                int spellWidgetId,
                                                                boolean ctrlDown)
        Creates a spell on an NPC packet.
        Parameters:
        id - the ID of the NPC
        spellWidgetId - the ID of the spell widget
        ctrlDown - true if control key is being held down, false otherwise
        Returns:
        the created RSPacketBufferNode object
      • createNpcFirstActionPacket

        public static RSPacketBufferNode createNpcFirstActionPacket​(int id,
                                                                    boolean ctrlDown)
        Creates a packet buffer node for an NPC's first action.
        Parameters:
        id - the ID of the NPC
        ctrlDown - true if the control key is pressed, false otherwise
        Returns:
        the packet buffer node for the NPC's first action
      • createNpcSecondActionPacket

        public static RSPacketBufferNode createNpcSecondActionPacket​(int id,
                                                                     boolean ctrlDown)
        Creates a packet for performing a second action on an NPC.
        Parameters:
        id - the ID of the NPC
        ctrlDown - true if the Ctrl key is down, false otherwise
        Returns:
        the created RSPacketBufferNode object
      • createNpcThirdActionPacket

        public static RSPacketBufferNode createNpcThirdActionPacket​(int id,
                                                                    boolean ctrlDown)
        Creates a packet for interacting with an NPC using the third action option.
        Parameters:
        id - the ID of the NPC to interact with
        ctrlDown - true if the control key is pressed, false otherwise
        Returns:
        the prepared packet for sending the NPC third action command
      • createNpcFourthActionPacket

        public static RSPacketBufferNode createNpcFourthActionPacket​(int id,
                                                                     boolean ctrlDown)
        Creates a packet for performing the fourth action on an NPC.
        Parameters:
        id - The ID of the NPC.
        ctrlDown - Whether the control key is held down.
        Returns:
        The packet buffer node.
      • createNpcFifthActionPacket

        public static RSPacketBufferNode createNpcFifthActionPacket​(int id,
                                                                    boolean ctrlDown)
        Creates a packet buffer node for sending NPC fifth action packet.
        Parameters:
        id - the ID of the NPC
        ctrlDown - whether control key is pressed down or not
        Returns:
        the created packet buffer node