Open-source multiplayer game server compatible with the RuneScape client
https://www.openrs2.org/
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
722 B
23 lines
722 B
package org.openrs2.protocol
|
|
|
|
import io.netty.buffer.ByteBuf
|
|
|
|
internal object VariableShortOptimisedPacketCodec : PacketCodec<VariableShortOptimisedPacket>(
|
|
type = VariableShortOptimisedPacket::class.java,
|
|
opcode = 4,
|
|
length = PacketLength.VARIABLE_SHORT
|
|
) {
|
|
override fun decode(input: ByteBuf): VariableShortOptimisedPacket {
|
|
val value = ByteArray(input.readableBytes())
|
|
input.readBytes(value)
|
|
return VariableShortOptimisedPacket(value)
|
|
}
|
|
|
|
override fun encode(input: VariableShortOptimisedPacket, output: ByteBuf) {
|
|
output.writeBytes(input.value)
|
|
}
|
|
|
|
override fun getLength(input: VariableShortOptimisedPacket): Int {
|
|
return input.value.size
|
|
}
|
|
}
|
|
|