Add CreateCheckDateOfBirthCountry packet

Graham 2 years ago
parent 9e969d8dfa
commit 7c6ccbf556
  1. 2
      protocol/src/main/kotlin/org/openrs2/protocol/ProtocolModule.kt
  2. 30
      protocol/src/main/kotlin/org/openrs2/protocol/login/upstream/CreateCheckDateOfBirthCountryCodec.kt
  3. 5
      protocol/src/main/kotlin/org/openrs2/protocol/login/upstream/LoginRequest.kt

@ -13,6 +13,7 @@ import org.openrs2.protocol.login.downstream.Js5OkCodec
import org.openrs2.protocol.login.downstream.LoginDownstream 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.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
@ -32,6 +33,7 @@ public object ProtocolModule : AbstractModule() {
InitGameConnectionCodec::class.java, InitGameConnectionCodec::class.java,
InitJs5RemoteConnectionCodec::class.java, InitJs5RemoteConnectionCodec::class.java,
InitJaggrabConnectionCodec::class.java, InitJaggrabConnectionCodec::class.java,
CreateCheckDateOfBirthCountryCodec::class.java,
RequestWorldListCodec::class.java, RequestWorldListCodec::class.java,
CheckWorldSuitabilityCodec::class.java, CheckWorldSuitabilityCodec::class.java,
InitCrossDomainConnectionCodec::class.java InitCrossDomainConnectionCodec::class.java

@ -0,0 +1,30 @@
package org.openrs2.protocol.login.upstream
import io.netty.buffer.ByteBuf
import org.openrs2.crypto.StreamCipher
import org.openrs2.protocol.PacketCodec
import java.time.LocalDate
import javax.inject.Singleton
@Singleton
public class CreateCheckDateOfBirthCountryCodec : PacketCodec<LoginRequest.CreateCheckDateOfBirthCountry>(
type = LoginRequest.CreateCheckDateOfBirthCountry::class.java,
opcode = 20,
length = 6
) {
override fun decode(input: ByteBuf, cipher: StreamCipher): LoginRequest.CreateCheckDateOfBirthCountry {
val day = input.readUnsignedByte().toInt()
val month = input.readUnsignedByte().toInt() + 1
val year = input.readUnsignedShort()
val country = input.readUnsignedShort()
return LoginRequest.CreateCheckDateOfBirthCountry(LocalDate.of(year, month, day), country)
}
override fun encode(input: LoginRequest.CreateCheckDateOfBirthCountry, output: ByteBuf, cipher: StreamCipher) {
output.writeByte(input.dateOfBirth.dayOfMonth)
output.writeByte(input.dateOfBirth.monthValue - 1)
output.writeShort(input.dateOfBirth.year)
output.writeShort(input.country)
}
}

@ -1,11 +1,16 @@
package org.openrs2.protocol.login.upstream package org.openrs2.protocol.login.upstream
import org.openrs2.protocol.Packet import org.openrs2.protocol.Packet
import java.time.LocalDate
public sealed class LoginRequest : Packet { public sealed class LoginRequest : Packet {
public data class InitGameConnection(public val usernameHash: Int) : LoginRequest() public data class InitGameConnection(public val usernameHash: Int) : LoginRequest()
public data class InitJs5RemoteConnection(public val build: Int) : LoginRequest() public data class InitJs5RemoteConnection(public val build: Int) : LoginRequest()
public object InitJaggrabConnection : LoginRequest() public object InitJaggrabConnection : LoginRequest()
public data class CreateCheckDateOfBirthCountry(
public val dateOfBirth: LocalDate,
public val country: Int
) : 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