Thread: Packet Help

Results 1 to 4 of 4
  1. #1 Packet Help 
    Banned
    Join Date
    Feb 2012
    Posts
    12
    Thanks given
    1
    Thanks received
    1
    Rep Power
    0
    Hell so im more of a client guy and i never worked with packets before but anyways

    So today was adding a new drop option so i decided to make a new packet for it


    So i did the following

    i went to where my other droppacket is called and added this


    Code:
    packetId[90] = new DropItemAll();

    NOTE: The drop all method is the same as my drop packet


    and i extended it here

    and added this client sided for the clicking option

    Code:
    if (comp == 1135) {
    			stream.createFrame(90);
    			stream.method432(i1);
    			stream.writeWord(componentId);
    			stream.method432(j);
    			atInventoryLoopCycle = 0;
    			atInventoryInterface = componentId;
    			atInventoryIndex = j;
    			atInventoryInterfaceType = 2;
    			if (RSInterface.interfaceCache[componentId].parentID == openInterfaceID)
    				atInventoryInterfaceType = 1;
    			if (RSInterface.interfaceCache[componentId].parentID == backDialogID)
    				atInventoryInterfaceType = 3;
    		}

    now when i go to use the option i get this error

    Code:
    java.lang.ArrayIndexOutOfBoundsException: 0
    	at server.util.Stream.readUnsignedWordA(Stream.java:87)
    	at server.model.players.packets.DropItemAll.processPacket(DropItemAll.java:15)
    	at server.model.players.PacketHandler.processPacket(PacketHandler.java:138)
    	at server.model.players.Client.processQueuedPackets(Client.java:668)
    	at server.core.PlayerHandler.process(PlayerHandler.java:166)
    	at server.Server$2.execute(Server.java:108)
    	at server.core.GameEngine$1.run(GameEngine.java:103)
    	at server.core.GameEngine$5.run(GameEngine.java:176)
    	at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
    	at java.util.concurrent.FutureTask.run(Unknown Source)
    	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(Unknown Source)
    	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown Source)
    	at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    	at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    	at java.lang.Thread.run(Unknown Source)
    Unhandled packet type: 156 - size: 6

    Have i missed something out ill rep if u can help thanks a lot
    Reply With Quote  
     

  2. #2  
    Donator

    Jason's Avatar
    Join Date
    Aug 2009
    Posts
    6,092
    Thanks given
    2,402
    Thanks received
    2,823
    Rep Power
    4550
    Hey,

    The problem is that the default size of an unused packet is 0, and since this has a fixed (predefined) size you must state that where packet size is defined.
    Reply With Quote  
     

  3. #3  
    Banned
    Join Date
    Feb 2012
    Posts
    12
    Thanks given
    1
    Thanks received
    1
    Rep Power
    0
    Quote Originally Posted by Jason View Post
    Hey,

    The problem is that the default size of an unused packet is 0, and since this has a fixed (predefined) size you must state that where packet size is defined.

    hey so in the client i defined it in the array of packetSizes[] but i can not seem to find anything in the server for that

    Code:
    	public static final int[] packetSizes = {
    		0, 0, 0, 0, 6, 0, 0, 0, 4, 0, 
    		0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
    		0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 
    		0, 0, 0, 0, -2, 4, 3, 0, 0, 0, 
    		0, 0, 0, 0, 5, 0, 0, 6, 0, 0, 
    		9, 0, 0, -2, 0, 0, 0, 0, 0, 0, 
    		-2, 1, 0, 0, 2, -2, 0, 0, 0, 0, 
    		6, 3, 2, 4, 2, 4, 0, 0, 0, 4, 
    		0, -2, 0, 0, 7, 2, 0, 6, 0, 0, 
    		0, 0, 0, 0, 0, 0, 0, 2, 0, 1, 
    		0, 2, 0, 0, -1, 4, 1, 0, 0, 0, 
    		1, 0, 0, 0, 2, 0, 0, 15, 0, 0, 
    		0, 4, 4, 0, 0, 0, -2, 0, 0, 0, 
    		0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 
    		0, 0, 2, 0, 0, 0, 0, 14, 0, 0, 
    		0, 4, 0, 0, 0, 0, 3, 0, 0, 0, 
    		4, 0, 0, 0, 2, 0, 6, 0, 0, 0, 
    		0, 3, 0, 0, 5, 0, 10, 6, 0, 0, 
    		0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 
    		0, 0, 0, 0, 0, 0, -1, 0, 0, 0, 
    		4, 0, 0, 0, 0, 0, 3, 0, 2, 0, 
    		0, 0, 0, 0, -2, 7, 0, -2, 2, 0, 
    		0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 
    		8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
    		2, -2, 0, 0, 0, 0, 6, 0, 4, 3, 
    		0, 0, 0, -1, 6, 0, 0,0
    	};

    the big number is the new one i added in the client
    Reply With Quote  
     

  4. #4  
    Donator

    Jason's Avatar
    Join Date
    Aug 2009
    Posts
    6,092
    Thanks given
    2,402
    Thanks received
    2,823
    Rep Power
    4550
    Quote Originally Posted by kill boy 1 View Post
    hey so in the client i defined it in the array of packetSizes[] but i can not seem to find anything in the server for that

    Code:
        public static final int[] packetSizes = {
            0, 0, 0, 0, 6, 0, 0, 0, 4, 0, 
            0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
            0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 
            0, 0, 0, 0, -2, 4, 3, 0, 0, 0, 
            0, 0, 0, 0, 5, 0, 0, 6, 0, 0, 
            9, 0, 0, -2, 0, 0, 0, 0, 0, 0, 
            -2, 1, 0, 0, 2, -2, 0, 0, 0, 0, 
            6, 3, 2, 4, 2, 4, 0, 0, 0, 4, 
            0, -2, 0, 0, 7, 2, 0, 6, 0, 0, 
            0, 0, 0, 0, 0, 0, 0, 2, 0, 1, 
            0, 2, 0, 0, -1, 4, 1, 0, 0, 0, 
            1, 0, 0, 0, 2, 0, 0, 15, 0, 0, 
            0, 4, 4, 0, 0, 0, -2, 0, 0, 0, 
            0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 
            0, 0, 2, 0, 0, 0, 0, 14, 0, 0, 
            0, 4, 0, 0, 0, 0, 3, 0, 0, 0, 
            4, 0, 0, 0, 2, 0, 6, 0, 0, 0, 
            0, 3, 0, 0, 5, 0, 10, 6, 0, 0, 
            0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 
            0, 0, 0, 0, 0, 0, -1, 0, 0, 0, 
            4, 0, 0, 0, 0, 0, 3, 0, 2, 0, 
            0, 0, 0, 0, -2, 7, 0, -2, 2, 0, 
            0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 
            8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
            2, -2, 0, 0, 0, 0, 6, 0, 4, 3, 
            0, 0, 0, -1, 6, 0, 0,0
        };

    the big number is the new one i added in the client
    The index of the array that the value is defined within is also the packet ID number. That being said you created a packet with the ID packetSizes.length - 2 which is not 90. You would replace the size of the packet which is zero with the size of the data being sent (which is not zero) In the 10th row and the 1st column.
    Reply With Quote  
     

  5. Thankful user:



Thread Information
Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)


User Tag List

Similar Threads

  1. Packet Help
    By `Blunt in forum RS2 Server
    Replies: 4
    Last Post: 09-26-2009, 07:37 AM
  2. shard dueling/packet Help
    By Cody. in forum Help
    Replies: 0
    Last Post: 08-20-2009, 05:20 AM
  3. [525] Client streams And packets help
    By Silicity in forum Help
    Replies: 0
    Last Post: 04-20-2009, 10:28 PM
  4. Error Parsing Incoming Packets [HELP]
    By digistr in forum Help
    Replies: 2
    Last Post: 03-24-2009, 01:27 AM
  5. new packet help
    By Colby in forum Help
    Replies: 0
    Last Post: 03-16-2009, 03:28 AM
Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •