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
697 B
23 lines
697 B
2 years ago
|
package org.openrs2.protocol.login.downstream
|
||
|
|
||
|
import io.netty.buffer.ByteBuf
|
||
|
import org.openrs2.crypto.StreamCipher
|
||
|
import org.openrs2.protocol.FixedPacketCodec
|
||
|
import javax.inject.Singleton
|
||
|
|
||
|
@Singleton
|
||
|
public class SwitchWorldCodec : FixedPacketCodec<LoginResponse.SwitchWorld>(
|
||
|
type = LoginResponse.SwitchWorld::class.java,
|
||
|
opcode = 101,
|
||
|
length = 2
|
||
|
) {
|
||
|
override fun decode(input: ByteBuf, cipher: StreamCipher): LoginResponse.SwitchWorld {
|
||
|
val id = input.readUnsignedShort()
|
||
|
return LoginResponse.SwitchWorld(id)
|
||
|
}
|
||
|
|
||
|
override fun encode(input: LoginResponse.SwitchWorld, output: ByteBuf, cipher: StreamCipher) {
|
||
|
output.writeShort(input.id)
|
||
|
}
|
||
|
}
|