Client packet sizes - Shadowrs/osrs-refactor-revision-1 GitHub Wiki
How to find a client packet size
Search for putopcode usage in rsbuffer. The method which uses the isaac key method. Find all uses in the client's source code.
Sample packet:
static final void method17() {
client.secureBuf.putOpcode(185);
client.secureBuf.writebyte(0);
}
These methods write information into the rsbuffer's backing, a byte array which is sent through the internet to the server, then deciphered into an understandable action.
putopcode - this number is the packet id (185) writebyte - writes a byte with value '0'
By having a decent knowledge of the structure of all of the packets, you can mix and match structures until you find out what type of action the packet represents, such as clicking an object, player, npc, button or walking to a Tile.
How to work out a packet's size
The size is how many bytes in total, excluding the opcode, the packet is. If a packet contains:
- byte, byte, byte, the size is 3
- A byte, short, byte is 4
- An Int, byte, Int is 9
- An Int, Short, byte is 7
- A long, byte is 9
Data type sizes
Type | Bytes |
---|---|
Byte | 1 |
Short | 2 |
Int | 4 |
Long | 8 |
tri-byte | 3 |
Fixed-size packet example
if (var0 == 1) {
client.secureBuf.putOpcode(63);
client.secureBuf.writeInt(var1); // 4 bytes
client.secureBuf.writeShort(var2); // 2 bytes
// total 6
}
Var-byte and var-short packet sizes
When a packet contains non-fixed length information such as a String, the size is dynamic. In order for the server to be able to tell the actual size, an extra byte or short indicating the size.
An example of a variable-size packet:
opcode(90) string("hello") -- 5 bytes, one for each character string("hellomate") - 9 bytes.
so opcode 90 can be any length depending on how many character there are in the string.
Non-fixed -- aka variable packet example
client.secureBuf.putOpcode(41);
client.secureBuf.writebyte(GameBuf.lengthOf(string)); // the size of this variable-length packet.
client.secureBuf.writeString(string);
Client packet sizes
These are sent to the server when you interact with the client. Here are most packets. I haven't gone through the 53 uses in class78 or the 11 uses in class46.
Total identified: 26/90
Packet ID | Size | Contents |
---|---|---|
185 | 1 | |
30 | varbyte | |
176 | varbyte | game world wakling |
60 | varbyte | minimap walking |
214 | varbyte | unknown walking |
71 | 13 | Appearance - makeover mage |
246 | 2 | ? |
78 | 2 | ? |
111 | 2 | ? |
119 | 2 | ? |
41 | varbyte | ? |
228 | ? | flush secondary buffer? |
63 | 6 | ? |
87 | 6 | ? |
238 | 6 | ? |
240 | 6 | ? |
153 | 6 | ? |
232 | 6 | ? |
231 | varbyte | add ignore |
203 | varbyte | add friend |
72 | varbyte | classcheck packet (antiban/cheat) |
161 | 4 | mouse click |
79 | 4 | ? |
178 | 1 | window in focus value 0 or 1 |
2 | 9 | ? |
38 | ? | ? |
228 | ? | ? |