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.
24 lines
839 B
24 lines
839 B
package org.openrs2.protocol.login.upstream
|
|
|
|
import io.netty.buffer.ByteBuf
|
|
import jakarta.inject.Inject
|
|
import jakarta.inject.Singleton
|
|
import org.bouncycastle.crypto.params.RSAPrivateCrtKeyParameters
|
|
import org.openrs2.crypto.StreamCipher
|
|
import org.openrs2.protocol.VariableShortPacketCodec
|
|
|
|
@Singleton
|
|
public class GameLoginCodec @Inject constructor(
|
|
private val key: RSAPrivateCrtKeyParameters,
|
|
) : VariableShortPacketCodec<LoginRequest.GameLogin>(
|
|
type = LoginRequest.GameLogin::class.java,
|
|
opcode = 16,
|
|
) {
|
|
override fun decode(input: ByteBuf, cipher: StreamCipher): LoginRequest.GameLogin {
|
|
return LoginRequest.GameLogin(GameLoginPayload.read(input, key))
|
|
}
|
|
|
|
override fun encode(input: LoginRequest.GameLogin, output: ByteBuf, cipher: StreamCipher) {
|
|
input.payload.write(output, key)
|
|
}
|
|
}
|
|
|