Add InitGameConnection codec

Signed-off-by: Graham <gpe@openrs2.org>
Graham 3 years ago
parent 8ff91b5ee2
commit 3edc5f1907
  1. 2
      protocol/src/main/kotlin/org/openrs2/protocol/Protocol.kt
  2. 20
      protocol/src/main/kotlin/org/openrs2/protocol/login/InitGameConnectionCodec.kt
  3. 1
      protocol/src/main/kotlin/org/openrs2/protocol/login/LoginRequest.kt

@ -2,6 +2,7 @@ package org.openrs2.protocol
import org.openrs2.protocol.login.ClientOutOfDateCodec
import org.openrs2.protocol.login.InitCrossDomainConnectionCodec
import org.openrs2.protocol.login.InitGameConnectionCodec
import org.openrs2.protocol.login.InitJaggrabConnectionCodec
import org.openrs2.protocol.login.InitJs5RemoteConnectionCodec
import org.openrs2.protocol.login.IpLimitCodec
@ -32,6 +33,7 @@ public class Protocol(vararg codecs: PacketCodec<*>) {
public companion object {
public val LOGIN_UPSTREAM: Protocol = Protocol(
InitGameConnectionCodec,
InitJs5RemoteConnectionCodec,
InitJaggrabConnectionCodec,
RequestWorldListCodec,

@ -0,0 +1,20 @@
package org.openrs2.protocol.login
import io.netty.buffer.ByteBuf
import org.openrs2.crypto.StreamCipher
import org.openrs2.protocol.PacketCodec
public object InitGameConnectionCodec : PacketCodec<LoginRequest.InitGameConnection>(
opcode = 14,
length = 1,
type = LoginRequest.InitGameConnection::class.java
) {
override fun decode(input: ByteBuf, cipher: StreamCipher): LoginRequest.InitGameConnection {
val usernameHash = input.readUnsignedByte().toInt()
return LoginRequest.InitGameConnection(usernameHash)
}
override fun encode(input: LoginRequest.InitGameConnection, output: ByteBuf, cipher: StreamCipher) {
output.writeByte(input.usernameHash)
}
}

@ -3,6 +3,7 @@ package org.openrs2.protocol.login
import org.openrs2.protocol.Packet
public sealed class LoginRequest : Packet {
public data class InitGameConnection(public val usernameHash: Int) : LoginRequest()
public data class InitJs5RemoteConnection(public val build: Int) : LoginRequest()
public object InitJaggrabConnection : LoginRequest()
public data class RequestWorldList(public val checksum: Int) : LoginRequest()

Loading…
Cancel
Save