Add initial login codecs required to negotiate a JS5 connection

Signed-off-by: Graham <gpe@openrs2.org>
Graham 4 years ago
parent 7b9964461f
commit 7b4f2903fd
  1. 8
      protocol/src/main/kotlin/org/openrs2/protocol/login/ClientOutOfDateCodec.kt
  2. 19
      protocol/src/main/kotlin/org/openrs2/protocol/login/InitJs5RemoteConnectionCodec.kt
  3. 8
      protocol/src/main/kotlin/org/openrs2/protocol/login/IpLimitCodec.kt
  4. 8
      protocol/src/main/kotlin/org/openrs2/protocol/login/Js5OkCodec.kt
  5. 7
      protocol/src/main/kotlin/org/openrs2/protocol/login/LoginRequest.kt
  6. 10
      protocol/src/main/kotlin/org/openrs2/protocol/login/LoginResponse.kt
  7. 8
      protocol/src/main/kotlin/org/openrs2/protocol/login/ServerFullCodec.kt

@ -0,0 +1,8 @@
package org.openrs2.protocol.login
import org.openrs2.protocol.EmptyPacketCodec
public object ClientOutOfDateCodec : EmptyPacketCodec<LoginResponse.ClientOutOfDate>(
packet = LoginResponse.ClientOutOfDate,
opcode = 6
)

@ -0,0 +1,19 @@
package org.openrs2.protocol.login
import io.netty.buffer.ByteBuf
import org.openrs2.protocol.PacketCodec
public object InitJs5RemoteConnectionCodec : PacketCodec<LoginRequest.InitJs5RemoteConnection>(
type = LoginRequest.InitJs5RemoteConnection::class.java,
opcode = 15,
length = 4
) {
override fun decode(input: ByteBuf): LoginRequest.InitJs5RemoteConnection {
val version = input.readInt()
return LoginRequest.InitJs5RemoteConnection(version)
}
override fun encode(input: LoginRequest.InitJs5RemoteConnection, output: ByteBuf) {
output.writeInt(input.version)
}
}

@ -0,0 +1,8 @@
package org.openrs2.protocol.login
import org.openrs2.protocol.EmptyPacketCodec
public object IpLimitCodec : EmptyPacketCodec<LoginResponse.IpLimit>(
packet = LoginResponse.IpLimit,
opcode = 9
)

@ -0,0 +1,8 @@
package org.openrs2.protocol.login
import org.openrs2.protocol.EmptyPacketCodec
public object Js5OkCodec : EmptyPacketCodec<LoginResponse.Js5Ok>(
packet = LoginResponse.Js5Ok,
opcode = 0
)

@ -0,0 +1,7 @@
package org.openrs2.protocol.login
import org.openrs2.protocol.Packet
public sealed class LoginRequest : Packet {
public class InitJs5RemoteConnection(public val version: Int) : LoginRequest()
}

@ -0,0 +1,10 @@
package org.openrs2.protocol.login
import org.openrs2.protocol.Packet
public sealed class LoginResponse : Packet {
public object Js5Ok : LoginResponse()
public object ClientOutOfDate : LoginResponse()
public object ServerFull : LoginResponse()
public object IpLimit : LoginResponse()
}

@ -0,0 +1,8 @@
package org.openrs2.protocol.login
import org.openrs2.protocol.EmptyPacketCodec
public object ServerFullCodec : EmptyPacketCodec<LoginResponse.ServerFull>(
packet = LoginResponse.ServerFull,
opcode = 7
)
Loading…
Cancel
Save