Add CREATE_CHECK_NAME packet

Graham 2 years ago
parent 7c6ccbf556
commit 537b158928
  1. 2
      protocol/src/main/kotlin/org/openrs2/protocol/ProtocolModule.kt
  2. 23
      protocol/src/main/kotlin/org/openrs2/protocol/login/upstream/CreateCheckNameCodec.kt
  3. 1
      protocol/src/main/kotlin/org/openrs2/protocol/login/upstream/LoginRequest.kt

@ -14,6 +14,7 @@ import org.openrs2.protocol.login.downstream.LoginDownstream
import org.openrs2.protocol.login.downstream.ServerFullCodec import org.openrs2.protocol.login.downstream.ServerFullCodec
import org.openrs2.protocol.login.upstream.CheckWorldSuitabilityCodec import org.openrs2.protocol.login.upstream.CheckWorldSuitabilityCodec
import org.openrs2.protocol.login.upstream.CreateCheckDateOfBirthCountryCodec import org.openrs2.protocol.login.upstream.CreateCheckDateOfBirthCountryCodec
import org.openrs2.protocol.login.upstream.CreateCheckNameCodec
import org.openrs2.protocol.login.upstream.InitCrossDomainConnectionCodec import org.openrs2.protocol.login.upstream.InitCrossDomainConnectionCodec
import org.openrs2.protocol.login.upstream.InitGameConnectionCodec import org.openrs2.protocol.login.upstream.InitGameConnectionCodec
import org.openrs2.protocol.login.upstream.InitJaggrabConnectionCodec import org.openrs2.protocol.login.upstream.InitJaggrabConnectionCodec
@ -34,6 +35,7 @@ public object ProtocolModule : AbstractModule() {
InitJs5RemoteConnectionCodec::class.java, InitJs5RemoteConnectionCodec::class.java,
InitJaggrabConnectionCodec::class.java, InitJaggrabConnectionCodec::class.java,
CreateCheckDateOfBirthCountryCodec::class.java, CreateCheckDateOfBirthCountryCodec::class.java,
CreateCheckNameCodec::class.java,
RequestWorldListCodec::class.java, RequestWorldListCodec::class.java,
CheckWorldSuitabilityCodec::class.java, CheckWorldSuitabilityCodec::class.java,
InitCrossDomainConnectionCodec::class.java InitCrossDomainConnectionCodec::class.java

@ -0,0 +1,23 @@
package org.openrs2.protocol.login.upstream
import io.netty.buffer.ByteBuf
import org.openrs2.crypto.StreamCipher
import org.openrs2.protocol.PacketCodec
import org.openrs2.util.Base37
import javax.inject.Singleton
@Singleton
public class CreateCheckNameCodec : PacketCodec<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))
}
}

@ -11,6 +11,7 @@ public sealed class LoginRequest : Packet {
public val dateOfBirth: LocalDate, public val dateOfBirth: LocalDate,
public val country: Int public val country: Int
) : LoginRequest() ) : LoginRequest()
public data class CreateCheckName(public val username: String) : LoginRequest()
public data class RequestWorldList(public val checksum: Int) : LoginRequest() public data class RequestWorldList(public val checksum: Int) : LoginRequest()
public data class CheckWorldSuitability( public data class CheckWorldSuitability(
public val build: Int, public val build: Int,

Loading…
Cancel
Save