From fa41b48f1a3acdfa1da159c882ff13bfe65d746d Mon Sep 17 00:00:00 2001 From: Graham Date: Tue, 26 Jul 2022 22:41:04 +0100 Subject: [PATCH] Add all create responses Signed-off-by: Graham --- .../org/openrs2/protocol/ProtocolModule.kt | 53 +++++++++++++++++++ .../downstream/CannotCreateAtThisTimeCodec.kt | 10 ++++ .../create/downstream/CountryInvalidCodec.kt | 10 ++++ .../downstream/CreateClientOutOfDateCodec.kt | 10 ++++ .../create/downstream/CreateDownstream.kt | 8 +++ .../create/downstream/CreateIpLimitCodec.kt | 10 ++++ .../create/downstream/CreateOkCodec.kt | 8 +++ .../create/downstream/CreateResponse.kt | 30 +++++++++++ .../downstream/CreateServerFullCodec.kt | 10 ++++ .../downstream/CreateServerOfflineCodec.kt | 10 ++++ .../downstream/DateOfBirthFutureCodec.kt | 10 ++++ .../downstream/DateOfBirthInvalidCodec.kt | 10 ++++ .../downstream/DateOfBirthLastYearCodec.kt | 10 ++++ .../downstream/DateOfBirthThisYearCodec.kt | 10 ++++ .../create/downstream/EmailInvalid1Codec.kt | 10 ++++ .../create/downstream/EmailInvalid2Codec.kt | 10 ++++ .../create/downstream/EmailInvalidCodec.kt | 10 ++++ .../create/downstream/NameInvalidCodec.kt | 10 ++++ .../create/downstream/NameSuggestionsCodec.kt | 45 ++++++++++++++++ .../create/downstream/NameUnavailableCodec.kt | 10 ++++ .../downstream/PasswordGuessable1Codec.kt | 10 ++++ .../downstream/PasswordGuessableCodec.kt | 10 ++++ .../downstream/PasswordInvalidCharsCodec.kt | 10 ++++ .../downstream/PasswordInvalidLengthCodec.kt | 10 ++++ .../downstream/PasswordSimilarToName1Codec.kt | 10 ++++ .../downstream/PasswordSimilarToName2Codec.kt | 10 ++++ .../downstream/PasswordSimilarToNameCodec.kt | 10 ++++ 27 files changed, 364 insertions(+) create mode 100644 protocol/src/main/kotlin/org/openrs2/protocol/create/downstream/CannotCreateAtThisTimeCodec.kt create mode 100644 protocol/src/main/kotlin/org/openrs2/protocol/create/downstream/CountryInvalidCodec.kt create mode 100644 protocol/src/main/kotlin/org/openrs2/protocol/create/downstream/CreateClientOutOfDateCodec.kt create mode 100644 protocol/src/main/kotlin/org/openrs2/protocol/create/downstream/CreateDownstream.kt create mode 100644 protocol/src/main/kotlin/org/openrs2/protocol/create/downstream/CreateIpLimitCodec.kt create mode 100644 protocol/src/main/kotlin/org/openrs2/protocol/create/downstream/CreateOkCodec.kt create mode 100644 protocol/src/main/kotlin/org/openrs2/protocol/create/downstream/CreateResponse.kt create mode 100644 protocol/src/main/kotlin/org/openrs2/protocol/create/downstream/CreateServerFullCodec.kt create mode 100644 protocol/src/main/kotlin/org/openrs2/protocol/create/downstream/CreateServerOfflineCodec.kt create mode 100644 protocol/src/main/kotlin/org/openrs2/protocol/create/downstream/DateOfBirthFutureCodec.kt create mode 100644 protocol/src/main/kotlin/org/openrs2/protocol/create/downstream/DateOfBirthInvalidCodec.kt create mode 100644 protocol/src/main/kotlin/org/openrs2/protocol/create/downstream/DateOfBirthLastYearCodec.kt create mode 100644 protocol/src/main/kotlin/org/openrs2/protocol/create/downstream/DateOfBirthThisYearCodec.kt create mode 100644 protocol/src/main/kotlin/org/openrs2/protocol/create/downstream/EmailInvalid1Codec.kt create mode 100644 protocol/src/main/kotlin/org/openrs2/protocol/create/downstream/EmailInvalid2Codec.kt create mode 100644 protocol/src/main/kotlin/org/openrs2/protocol/create/downstream/EmailInvalidCodec.kt create mode 100644 protocol/src/main/kotlin/org/openrs2/protocol/create/downstream/NameInvalidCodec.kt create mode 100644 protocol/src/main/kotlin/org/openrs2/protocol/create/downstream/NameSuggestionsCodec.kt create mode 100644 protocol/src/main/kotlin/org/openrs2/protocol/create/downstream/NameUnavailableCodec.kt create mode 100644 protocol/src/main/kotlin/org/openrs2/protocol/create/downstream/PasswordGuessable1Codec.kt create mode 100644 protocol/src/main/kotlin/org/openrs2/protocol/create/downstream/PasswordGuessableCodec.kt create mode 100644 protocol/src/main/kotlin/org/openrs2/protocol/create/downstream/PasswordInvalidCharsCodec.kt create mode 100644 protocol/src/main/kotlin/org/openrs2/protocol/create/downstream/PasswordInvalidLengthCodec.kt create mode 100644 protocol/src/main/kotlin/org/openrs2/protocol/create/downstream/PasswordSimilarToName1Codec.kt create mode 100644 protocol/src/main/kotlin/org/openrs2/protocol/create/downstream/PasswordSimilarToName2Codec.kt create mode 100644 protocol/src/main/kotlin/org/openrs2/protocol/create/downstream/PasswordSimilarToNameCodec.kt diff --git a/protocol/src/main/kotlin/org/openrs2/protocol/ProtocolModule.kt b/protocol/src/main/kotlin/org/openrs2/protocol/ProtocolModule.kt index 0eab31d1..378ca750 100644 --- a/protocol/src/main/kotlin/org/openrs2/protocol/ProtocolModule.kt +++ b/protocol/src/main/kotlin/org/openrs2/protocol/ProtocolModule.kt @@ -6,6 +6,31 @@ import com.google.inject.TypeLiteral import com.google.inject.multibindings.Multibinder import org.openrs2.buffer.BufferModule import org.openrs2.crypto.CryptoModule +import org.openrs2.protocol.create.downstream.CannotCreateAtThisTimeCodec +import org.openrs2.protocol.create.downstream.CountryInvalidCodec +import org.openrs2.protocol.create.downstream.CreateClientOutOfDateCodec +import org.openrs2.protocol.create.downstream.CreateDownstream +import org.openrs2.protocol.create.downstream.CreateIpLimitCodec +import org.openrs2.protocol.create.downstream.CreateOkCodec +import org.openrs2.protocol.create.downstream.CreateServerFullCodec +import org.openrs2.protocol.create.downstream.CreateServerOfflineCodec +import org.openrs2.protocol.create.downstream.DateOfBirthFutureCodec +import org.openrs2.protocol.create.downstream.DateOfBirthInvalidCodec +import org.openrs2.protocol.create.downstream.DateOfBirthLastYearCodec +import org.openrs2.protocol.create.downstream.DateOfBirthThisYearCodec +import org.openrs2.protocol.create.downstream.EmailInvalid1Codec +import org.openrs2.protocol.create.downstream.EmailInvalid2Codec +import org.openrs2.protocol.create.downstream.EmailInvalidCodec +import org.openrs2.protocol.create.downstream.NameInvalidCodec +import org.openrs2.protocol.create.downstream.NameSuggestionsCodec +import org.openrs2.protocol.create.downstream.NameUnavailableCodec +import org.openrs2.protocol.create.downstream.PasswordGuessable1Codec +import org.openrs2.protocol.create.downstream.PasswordGuessableCodec +import org.openrs2.protocol.create.downstream.PasswordInvalidCharsCodec +import org.openrs2.protocol.create.downstream.PasswordInvalidLengthCodec +import org.openrs2.protocol.create.downstream.PasswordSimilarToName1Codec +import org.openrs2.protocol.create.downstream.PasswordSimilarToName2Codec +import org.openrs2.protocol.create.downstream.PasswordSimilarToNameCodec import org.openrs2.protocol.js5.downstream.Js5ClientOutOfDateCodec import org.openrs2.protocol.js5.downstream.Js5IpLimitCodec import org.openrs2.protocol.js5.downstream.Js5OkCodec @@ -60,6 +85,34 @@ public object ProtocolModule : AbstractModule() { install(BufferModule) install(CryptoModule) + bindProtocol( + CreateDownstream::class.java, + CreateOkCodec::class.java, + CreateServerOfflineCodec::class.java, + CreateServerFullCodec::class.java, + CreateIpLimitCodec::class.java, + DateOfBirthInvalidCodec::class.java, + DateOfBirthFutureCodec::class.java, + DateOfBirthThisYearCodec::class.java, + DateOfBirthLastYearCodec::class.java, + CountryInvalidCodec::class.java, + NameUnavailableCodec::class.java, + NameSuggestionsCodec::class.java, + NameInvalidCodec::class.java, + PasswordInvalidLengthCodec::class.java, + PasswordInvalidCharsCodec::class.java, + PasswordGuessableCodec::class.java, + PasswordGuessable1Codec::class.java, + PasswordSimilarToNameCodec::class.java, + PasswordSimilarToName1Codec::class.java, + PasswordSimilarToName2Codec::class.java, + CreateClientOutOfDateCodec::class.java, + CannotCreateAtThisTimeCodec::class.java, + EmailInvalidCodec::class.java, + EmailInvalid1Codec::class.java, + EmailInvalid2Codec::class.java + ) + bindProtocol( Js5RemoteDownstream::class.java, Js5OkCodec::class.java, diff --git a/protocol/src/main/kotlin/org/openrs2/protocol/create/downstream/CannotCreateAtThisTimeCodec.kt b/protocol/src/main/kotlin/org/openrs2/protocol/create/downstream/CannotCreateAtThisTimeCodec.kt new file mode 100644 index 00000000..81250e66 --- /dev/null +++ b/protocol/src/main/kotlin/org/openrs2/protocol/create/downstream/CannotCreateAtThisTimeCodec.kt @@ -0,0 +1,10 @@ +package org.openrs2.protocol.create.downstream + +import org.openrs2.protocol.EmptyPacketCodec +import javax.inject.Singleton + +@Singleton +public class CannotCreateAtThisTimeCodec : EmptyPacketCodec( + packet = CreateResponse.CannotCreateAtThisTime, + opcode = 38 +) diff --git a/protocol/src/main/kotlin/org/openrs2/protocol/create/downstream/CountryInvalidCodec.kt b/protocol/src/main/kotlin/org/openrs2/protocol/create/downstream/CountryInvalidCodec.kt new file mode 100644 index 00000000..74320038 --- /dev/null +++ b/protocol/src/main/kotlin/org/openrs2/protocol/create/downstream/CountryInvalidCodec.kt @@ -0,0 +1,10 @@ +package org.openrs2.protocol.create.downstream + +import org.openrs2.protocol.EmptyPacketCodec +import javax.inject.Singleton + +@Singleton +public class CountryInvalidCodec : EmptyPacketCodec( + packet = CreateResponse.CountryInvalid, + opcode = 14 +) diff --git a/protocol/src/main/kotlin/org/openrs2/protocol/create/downstream/CreateClientOutOfDateCodec.kt b/protocol/src/main/kotlin/org/openrs2/protocol/create/downstream/CreateClientOutOfDateCodec.kt new file mode 100644 index 00000000..e885d73c --- /dev/null +++ b/protocol/src/main/kotlin/org/openrs2/protocol/create/downstream/CreateClientOutOfDateCodec.kt @@ -0,0 +1,10 @@ +package org.openrs2.protocol.create.downstream + +import org.openrs2.protocol.EmptyPacketCodec +import javax.inject.Singleton + +@Singleton +public class CreateClientOutOfDateCodec : EmptyPacketCodec( + packet = CreateResponse.ClientOutOfDate, + opcode = 37 +) diff --git a/protocol/src/main/kotlin/org/openrs2/protocol/create/downstream/CreateDownstream.kt b/protocol/src/main/kotlin/org/openrs2/protocol/create/downstream/CreateDownstream.kt new file mode 100644 index 00000000..8f0f1e97 --- /dev/null +++ b/protocol/src/main/kotlin/org/openrs2/protocol/create/downstream/CreateDownstream.kt @@ -0,0 +1,8 @@ +package org.openrs2.protocol.create.downstream + +import javax.inject.Qualifier + +@Qualifier +@Retention(AnnotationRetention.RUNTIME) +@Target(AnnotationTarget.FIELD, AnnotationTarget.VALUE_PARAMETER, AnnotationTarget.FUNCTION) +public annotation class CreateDownstream diff --git a/protocol/src/main/kotlin/org/openrs2/protocol/create/downstream/CreateIpLimitCodec.kt b/protocol/src/main/kotlin/org/openrs2/protocol/create/downstream/CreateIpLimitCodec.kt new file mode 100644 index 00000000..9d6221b8 --- /dev/null +++ b/protocol/src/main/kotlin/org/openrs2/protocol/create/downstream/CreateIpLimitCodec.kt @@ -0,0 +1,10 @@ +package org.openrs2.protocol.create.downstream + +import org.openrs2.protocol.EmptyPacketCodec +import javax.inject.Singleton + +@Singleton +public class CreateIpLimitCodec : EmptyPacketCodec( + packet = CreateResponse.IpLimit, + opcode = 9 +) diff --git a/protocol/src/main/kotlin/org/openrs2/protocol/create/downstream/CreateOkCodec.kt b/protocol/src/main/kotlin/org/openrs2/protocol/create/downstream/CreateOkCodec.kt new file mode 100644 index 00000000..da0447e7 --- /dev/null +++ b/protocol/src/main/kotlin/org/openrs2/protocol/create/downstream/CreateOkCodec.kt @@ -0,0 +1,8 @@ +package org.openrs2.protocol.create.downstream + +import org.openrs2.protocol.EmptyPacketCodec + +public class CreateOkCodec : EmptyPacketCodec( + packet = CreateResponse.Ok, + opcode = 2 +) diff --git a/protocol/src/main/kotlin/org/openrs2/protocol/create/downstream/CreateResponse.kt b/protocol/src/main/kotlin/org/openrs2/protocol/create/downstream/CreateResponse.kt new file mode 100644 index 00000000..10f48eac --- /dev/null +++ b/protocol/src/main/kotlin/org/openrs2/protocol/create/downstream/CreateResponse.kt @@ -0,0 +1,30 @@ +package org.openrs2.protocol.create.downstream + +import org.openrs2.protocol.Packet + +public sealed class CreateResponse : Packet { + public object Ok : CreateResponse() + public object CreateServerOffline : CreateResponse() + public object ServerFull : CreateResponse() + public object IpLimit : CreateResponse() + public object DateOfBirthInvalid : CreateResponse() + public object DateOfBirthFuture : CreateResponse() + public object DateOfBirthThisYear : CreateResponse() + public object DateOfBirthLastYear : CreateResponse() + public object CountryInvalid : CreateResponse() + public object NameUnavailable : CreateResponse() + public data class NameSuggestions(val names: List) : CreateResponse() + public object NameInvalid : CreateResponse() + public object PasswordInvalidLength : CreateResponse() + public object PasswordInvalidChars : CreateResponse() + public object PasswordGuessable : CreateResponse() + public object PasswordGuessable1 : CreateResponse() + public object PasswordSimilarToName : CreateResponse() + public object PasswordSimilarToName1 : CreateResponse() + public object PasswordSimilarToName2 : CreateResponse() + public object ClientOutOfDate : CreateResponse() + public object CannotCreateAtThisTime : CreateResponse() + public object EmailInvalid : CreateResponse() + public object EmailInvalid1 : CreateResponse() + public object EmailInvalid2 : CreateResponse() +} diff --git a/protocol/src/main/kotlin/org/openrs2/protocol/create/downstream/CreateServerFullCodec.kt b/protocol/src/main/kotlin/org/openrs2/protocol/create/downstream/CreateServerFullCodec.kt new file mode 100644 index 00000000..345d0b75 --- /dev/null +++ b/protocol/src/main/kotlin/org/openrs2/protocol/create/downstream/CreateServerFullCodec.kt @@ -0,0 +1,10 @@ +package org.openrs2.protocol.create.downstream + +import org.openrs2.protocol.EmptyPacketCodec +import javax.inject.Singleton + +@Singleton +public class CreateServerFullCodec : EmptyPacketCodec( + packet = CreateResponse.ServerFull, + opcode = 7 +) diff --git a/protocol/src/main/kotlin/org/openrs2/protocol/create/downstream/CreateServerOfflineCodec.kt b/protocol/src/main/kotlin/org/openrs2/protocol/create/downstream/CreateServerOfflineCodec.kt new file mode 100644 index 00000000..846ba014 --- /dev/null +++ b/protocol/src/main/kotlin/org/openrs2/protocol/create/downstream/CreateServerOfflineCodec.kt @@ -0,0 +1,10 @@ +package org.openrs2.protocol.create.downstream + +import org.openrs2.protocol.EmptyPacketCodec +import javax.inject.Singleton + +@Singleton +public class CreateServerOfflineCodec : EmptyPacketCodec( + packet = CreateResponse.CreateServerOffline, + opcode = 3 +) diff --git a/protocol/src/main/kotlin/org/openrs2/protocol/create/downstream/DateOfBirthFutureCodec.kt b/protocol/src/main/kotlin/org/openrs2/protocol/create/downstream/DateOfBirthFutureCodec.kt new file mode 100644 index 00000000..3224dc2d --- /dev/null +++ b/protocol/src/main/kotlin/org/openrs2/protocol/create/downstream/DateOfBirthFutureCodec.kt @@ -0,0 +1,10 @@ +package org.openrs2.protocol.create.downstream + +import org.openrs2.protocol.EmptyPacketCodec +import javax.inject.Singleton + +@Singleton +public class DateOfBirthFutureCodec : EmptyPacketCodec( + packet = CreateResponse.DateOfBirthFuture, + opcode = 11 +) diff --git a/protocol/src/main/kotlin/org/openrs2/protocol/create/downstream/DateOfBirthInvalidCodec.kt b/protocol/src/main/kotlin/org/openrs2/protocol/create/downstream/DateOfBirthInvalidCodec.kt new file mode 100644 index 00000000..6d3dac0f --- /dev/null +++ b/protocol/src/main/kotlin/org/openrs2/protocol/create/downstream/DateOfBirthInvalidCodec.kt @@ -0,0 +1,10 @@ +package org.openrs2.protocol.create.downstream + +import org.openrs2.protocol.EmptyPacketCodec +import javax.inject.Singleton + +@Singleton +public class DateOfBirthInvalidCodec : EmptyPacketCodec( + packet = CreateResponse.DateOfBirthInvalid, + opcode = 10 +) diff --git a/protocol/src/main/kotlin/org/openrs2/protocol/create/downstream/DateOfBirthLastYearCodec.kt b/protocol/src/main/kotlin/org/openrs2/protocol/create/downstream/DateOfBirthLastYearCodec.kt new file mode 100644 index 00000000..e8aa4905 --- /dev/null +++ b/protocol/src/main/kotlin/org/openrs2/protocol/create/downstream/DateOfBirthLastYearCodec.kt @@ -0,0 +1,10 @@ +package org.openrs2.protocol.create.downstream + +import org.openrs2.protocol.EmptyPacketCodec +import javax.inject.Singleton + +@Singleton +public class DateOfBirthLastYearCodec : EmptyPacketCodec( + packet = CreateResponse.DateOfBirthLastYear, + opcode = 13 +) diff --git a/protocol/src/main/kotlin/org/openrs2/protocol/create/downstream/DateOfBirthThisYearCodec.kt b/protocol/src/main/kotlin/org/openrs2/protocol/create/downstream/DateOfBirthThisYearCodec.kt new file mode 100644 index 00000000..2543a195 --- /dev/null +++ b/protocol/src/main/kotlin/org/openrs2/protocol/create/downstream/DateOfBirthThisYearCodec.kt @@ -0,0 +1,10 @@ +package org.openrs2.protocol.create.downstream + +import org.openrs2.protocol.EmptyPacketCodec +import javax.inject.Singleton + +@Singleton +public class DateOfBirthThisYearCodec : EmptyPacketCodec( + packet = CreateResponse.DateOfBirthThisYear, + opcode = 12 +) diff --git a/protocol/src/main/kotlin/org/openrs2/protocol/create/downstream/EmailInvalid1Codec.kt b/protocol/src/main/kotlin/org/openrs2/protocol/create/downstream/EmailInvalid1Codec.kt new file mode 100644 index 00000000..822f5709 --- /dev/null +++ b/protocol/src/main/kotlin/org/openrs2/protocol/create/downstream/EmailInvalid1Codec.kt @@ -0,0 +1,10 @@ +package org.openrs2.protocol.create.downstream + +import org.openrs2.protocol.EmptyPacketCodec +import javax.inject.Singleton + +@Singleton +public class EmailInvalid1Codec : EmptyPacketCodec( + packet = CreateResponse.EmailInvalid1, + opcode = 42 +) diff --git a/protocol/src/main/kotlin/org/openrs2/protocol/create/downstream/EmailInvalid2Codec.kt b/protocol/src/main/kotlin/org/openrs2/protocol/create/downstream/EmailInvalid2Codec.kt new file mode 100644 index 00000000..6bb53877 --- /dev/null +++ b/protocol/src/main/kotlin/org/openrs2/protocol/create/downstream/EmailInvalid2Codec.kt @@ -0,0 +1,10 @@ +package org.openrs2.protocol.create.downstream + +import org.openrs2.protocol.EmptyPacketCodec +import javax.inject.Singleton + +@Singleton +public class EmailInvalid2Codec : EmptyPacketCodec( + packet = CreateResponse.EmailInvalid2, + opcode = 43 +) diff --git a/protocol/src/main/kotlin/org/openrs2/protocol/create/downstream/EmailInvalidCodec.kt b/protocol/src/main/kotlin/org/openrs2/protocol/create/downstream/EmailInvalidCodec.kt new file mode 100644 index 00000000..0733842a --- /dev/null +++ b/protocol/src/main/kotlin/org/openrs2/protocol/create/downstream/EmailInvalidCodec.kt @@ -0,0 +1,10 @@ +package org.openrs2.protocol.create.downstream + +import org.openrs2.protocol.EmptyPacketCodec +import javax.inject.Singleton + +@Singleton +public class EmailInvalidCodec : EmptyPacketCodec( + packet = CreateResponse.EmailInvalid, + opcode = 41 +) diff --git a/protocol/src/main/kotlin/org/openrs2/protocol/create/downstream/NameInvalidCodec.kt b/protocol/src/main/kotlin/org/openrs2/protocol/create/downstream/NameInvalidCodec.kt new file mode 100644 index 00000000..bea29668 --- /dev/null +++ b/protocol/src/main/kotlin/org/openrs2/protocol/create/downstream/NameInvalidCodec.kt @@ -0,0 +1,10 @@ +package org.openrs2.protocol.create.downstream + +import org.openrs2.protocol.EmptyPacketCodec +import javax.inject.Singleton + +@Singleton +public class NameInvalidCodec : EmptyPacketCodec( + packet = CreateResponse.NameInvalid, + opcode = 22 +) diff --git a/protocol/src/main/kotlin/org/openrs2/protocol/create/downstream/NameSuggestionsCodec.kt b/protocol/src/main/kotlin/org/openrs2/protocol/create/downstream/NameSuggestionsCodec.kt new file mode 100644 index 00000000..bed7919d --- /dev/null +++ b/protocol/src/main/kotlin/org/openrs2/protocol/create/downstream/NameSuggestionsCodec.kt @@ -0,0 +1,45 @@ +package org.openrs2.protocol.create.downstream + +import io.netty.buffer.ByteBuf +import org.openrs2.crypto.StreamCipher +import org.openrs2.protocol.PacketCodec +import org.openrs2.util.Base37 + +public class NameSuggestionsCodec : PacketCodec( + type = CreateResponse.NameSuggestions::class.java, + opcode = 21 +) { + override fun decode(input: ByteBuf, cipher: StreamCipher): CreateResponse.NameSuggestions { + val names = mutableListOf() + while (input.readableBytes() >= 8) { + names += Base37.decodeLowerCase(input.readLong()) + } + return CreateResponse.NameSuggestions(names) + } + + override fun encode(input: CreateResponse.NameSuggestions, output: ByteBuf, cipher: StreamCipher) { + for (name in input.names) { + output.writeLong(Base37.encode(name)) + } + } + + override fun isLengthReadable(input: ByteBuf): Boolean { + return input.isReadable + } + + override fun readLength(input: ByteBuf): Int { + return input.readUnsignedByte().toInt() * 8 + } + + override fun writeLengthPlaceholder(output: ByteBuf) { + output.writeZero(1) + } + + override fun setLength(output: ByteBuf, index: Int, written: Int) { + require(written % 8 != 0) { + "Name suggestions payload length must be a multiple of 8" + } + + output.setByte(index, written / 8) + } +} diff --git a/protocol/src/main/kotlin/org/openrs2/protocol/create/downstream/NameUnavailableCodec.kt b/protocol/src/main/kotlin/org/openrs2/protocol/create/downstream/NameUnavailableCodec.kt new file mode 100644 index 00000000..b7cade24 --- /dev/null +++ b/protocol/src/main/kotlin/org/openrs2/protocol/create/downstream/NameUnavailableCodec.kt @@ -0,0 +1,10 @@ +package org.openrs2.protocol.create.downstream + +import org.openrs2.protocol.EmptyPacketCodec +import javax.inject.Singleton + +@Singleton +public class NameUnavailableCodec : EmptyPacketCodec( + packet = CreateResponse.NameUnavailable, + opcode = 20 +) diff --git a/protocol/src/main/kotlin/org/openrs2/protocol/create/downstream/PasswordGuessable1Codec.kt b/protocol/src/main/kotlin/org/openrs2/protocol/create/downstream/PasswordGuessable1Codec.kt new file mode 100644 index 00000000..0122258b --- /dev/null +++ b/protocol/src/main/kotlin/org/openrs2/protocol/create/downstream/PasswordGuessable1Codec.kt @@ -0,0 +1,10 @@ +package org.openrs2.protocol.create.downstream + +import org.openrs2.protocol.EmptyPacketCodec +import javax.inject.Singleton + +@Singleton +public class PasswordGuessable1Codec : EmptyPacketCodec( + packet = CreateResponse.PasswordGuessable1, + opcode = 33 +) diff --git a/protocol/src/main/kotlin/org/openrs2/protocol/create/downstream/PasswordGuessableCodec.kt b/protocol/src/main/kotlin/org/openrs2/protocol/create/downstream/PasswordGuessableCodec.kt new file mode 100644 index 00000000..b113de58 --- /dev/null +++ b/protocol/src/main/kotlin/org/openrs2/protocol/create/downstream/PasswordGuessableCodec.kt @@ -0,0 +1,10 @@ +package org.openrs2.protocol.create.downstream + +import org.openrs2.protocol.EmptyPacketCodec +import javax.inject.Singleton + +@Singleton +public class PasswordGuessableCodec : EmptyPacketCodec( + packet = CreateResponse.PasswordGuessable, + opcode = 32 +) diff --git a/protocol/src/main/kotlin/org/openrs2/protocol/create/downstream/PasswordInvalidCharsCodec.kt b/protocol/src/main/kotlin/org/openrs2/protocol/create/downstream/PasswordInvalidCharsCodec.kt new file mode 100644 index 00000000..e1fe8645 --- /dev/null +++ b/protocol/src/main/kotlin/org/openrs2/protocol/create/downstream/PasswordInvalidCharsCodec.kt @@ -0,0 +1,10 @@ +package org.openrs2.protocol.create.downstream + +import org.openrs2.protocol.EmptyPacketCodec +import javax.inject.Singleton + +@Singleton +public class PasswordInvalidCharsCodec : EmptyPacketCodec( + packet = CreateResponse.PasswordInvalidChars, + opcode = 31 +) diff --git a/protocol/src/main/kotlin/org/openrs2/protocol/create/downstream/PasswordInvalidLengthCodec.kt b/protocol/src/main/kotlin/org/openrs2/protocol/create/downstream/PasswordInvalidLengthCodec.kt new file mode 100644 index 00000000..8aaec4b7 --- /dev/null +++ b/protocol/src/main/kotlin/org/openrs2/protocol/create/downstream/PasswordInvalidLengthCodec.kt @@ -0,0 +1,10 @@ +package org.openrs2.protocol.create.downstream + +import org.openrs2.protocol.EmptyPacketCodec +import javax.inject.Singleton + +@Singleton +public class PasswordInvalidLengthCodec : EmptyPacketCodec( + packet = CreateResponse.PasswordInvalidLength, + opcode = 30 +) diff --git a/protocol/src/main/kotlin/org/openrs2/protocol/create/downstream/PasswordSimilarToName1Codec.kt b/protocol/src/main/kotlin/org/openrs2/protocol/create/downstream/PasswordSimilarToName1Codec.kt new file mode 100644 index 00000000..07fd4e0e --- /dev/null +++ b/protocol/src/main/kotlin/org/openrs2/protocol/create/downstream/PasswordSimilarToName1Codec.kt @@ -0,0 +1,10 @@ +package org.openrs2.protocol.create.downstream + +import org.openrs2.protocol.EmptyPacketCodec +import javax.inject.Singleton + +@Singleton +public class PasswordSimilarToName1Codec : EmptyPacketCodec( + packet = CreateResponse.PasswordSimilarToName1, + opcode = 35 +) diff --git a/protocol/src/main/kotlin/org/openrs2/protocol/create/downstream/PasswordSimilarToName2Codec.kt b/protocol/src/main/kotlin/org/openrs2/protocol/create/downstream/PasswordSimilarToName2Codec.kt new file mode 100644 index 00000000..d5014a2d --- /dev/null +++ b/protocol/src/main/kotlin/org/openrs2/protocol/create/downstream/PasswordSimilarToName2Codec.kt @@ -0,0 +1,10 @@ +package org.openrs2.protocol.create.downstream + +import org.openrs2.protocol.EmptyPacketCodec +import javax.inject.Singleton + +@Singleton +public class PasswordSimilarToName2Codec : EmptyPacketCodec( + packet = CreateResponse.PasswordSimilarToName2, + opcode = 36 +) diff --git a/protocol/src/main/kotlin/org/openrs2/protocol/create/downstream/PasswordSimilarToNameCodec.kt b/protocol/src/main/kotlin/org/openrs2/protocol/create/downstream/PasswordSimilarToNameCodec.kt new file mode 100644 index 00000000..c098a07c --- /dev/null +++ b/protocol/src/main/kotlin/org/openrs2/protocol/create/downstream/PasswordSimilarToNameCodec.kt @@ -0,0 +1,10 @@ +package org.openrs2.protocol.create.downstream + +import org.openrs2.protocol.EmptyPacketCodec +import javax.inject.Singleton + +@Singleton +public class PasswordSimilarToNameCodec : EmptyPacketCodec( + packet = CreateResponse.PasswordSimilarToName, + opcode = 34 +)