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
791 B
23 lines
791 B
package org.openrs2.protocol.login.upstream
|
|
|
|
import io.netty.buffer.ByteBuf
|
|
import org.openrs2.crypto.StreamCipher
|
|
import org.openrs2.protocol.FixedPacketCodec
|
|
import org.openrs2.util.Base37
|
|
import javax.inject.Singleton
|
|
|
|
@Singleton
|
|
public class CreateCheckNameCodec : FixedPacketCodec<LoginRequest.CreateCheckName>(
|
|
type = LoginRequest.CreateCheckName::class.java,
|
|
opcode = 21,
|
|
length = 8
|
|
) {
|
|
override fun decode(input: ByteBuf, cipher: StreamCipher): LoginRequest.CreateCheckName {
|
|
val username = Base37.decodeLowerCase(input.readLong())
|
|
return LoginRequest.CreateCheckName(username)
|
|
}
|
|
|
|
override fun encode(input: LoginRequest.CreateCheckName, output: ByteBuf, cipher: StreamCipher) {
|
|
output.writeLong(Base37.encode(input.username))
|
|
}
|
|
}
|
|
|