From f31b2519f91b49cda084cdcf01bd800475aa9cc3 Mon Sep 17 00:00:00 2001 From: Graham Date: Tue, 26 Jul 2022 22:22:58 +0100 Subject: [PATCH] Add all login responses except OK OK needs a bit more work as I need to decide where the StaffModLevel enum will live. Signed-off-by: Graham --- .../org/openrs2/protocol/ProtocolModule.kt | 56 ++++++++++++++++++- .../login/downstream/BadSessionIdCodec.kt | 10 ++++ .../protocol/login/downstream/BannedCodec.kt | 10 ++++ .../downstream/ClientMembersOnlyCodec.kt | 10 ++++ .../downstream/DisallowedByScriptCodec.kt | 22 ++++++++ .../login/downstream/DuplicateCodec.kt | 10 ++++ .../downstream/ExchangeSessionKeyCodec.kt | 22 ++++++++ .../downstream/ForcePasswordChangeCodec.kt | 10 ++++ .../downstream/FullscreenMembersOnlyCodec.kt | 10 ++++ .../login/downstream/HopBlockedCodec.kt | 22 ++++++++ .../downstream/InvalidLoginPacketCodec.kt | 10 ++++ .../downstream/InvalidLoginServerCodec.kt | 10 ++++ .../login/downstream/InvalidSaveCodec.kt | 10 ++++ .../InvalidUsernameOrPasswordCodec.kt | 10 ++++ .../login/downstream/IpBlockedCodec.kt | 10 ++++ .../protocol/login/downstream/LockedCodec.kt | 10 ++++ .../login/downstream/LoginResponse.kt | 27 +++++++++ .../downstream/LoginServerLoadErrorCodec.kt | 10 ++++ .../downstream/LoginServerOfflineCodec.kt | 10 ++++ .../login/downstream/MapMembersOnlyCodec.kt | 10 ++++ .../downstream/NeedMembersAccountCodec.kt | 10 ++++ .../downstream/NoReplyFromLoginServerCodec.kt | 10 ++++ .../login/downstream/ReconnectOkCodec.kt | 10 ++++ .../downstream/ServiceUnavailableCodec.kt | 10 ++++ .../login/downstream/ShowVideoAdCodec.kt | 10 ++++ .../login/downstream/SwitchWorldCodec.kt | 22 ++++++++ .../login/downstream/TooManyAttemptsCodec.kt | 10 ++++ .../UnknownReplyFromLoginServerCodec.kt | 10 ++++ .../login/downstream/UpdateInProgressCodec.kt | 10 ++++ 29 files changed, 400 insertions(+), 1 deletion(-) create mode 100644 protocol/src/main/kotlin/org/openrs2/protocol/login/downstream/BadSessionIdCodec.kt create mode 100644 protocol/src/main/kotlin/org/openrs2/protocol/login/downstream/BannedCodec.kt create mode 100644 protocol/src/main/kotlin/org/openrs2/protocol/login/downstream/ClientMembersOnlyCodec.kt create mode 100644 protocol/src/main/kotlin/org/openrs2/protocol/login/downstream/DisallowedByScriptCodec.kt create mode 100644 protocol/src/main/kotlin/org/openrs2/protocol/login/downstream/DuplicateCodec.kt create mode 100644 protocol/src/main/kotlin/org/openrs2/protocol/login/downstream/ExchangeSessionKeyCodec.kt create mode 100644 protocol/src/main/kotlin/org/openrs2/protocol/login/downstream/ForcePasswordChangeCodec.kt create mode 100644 protocol/src/main/kotlin/org/openrs2/protocol/login/downstream/FullscreenMembersOnlyCodec.kt create mode 100644 protocol/src/main/kotlin/org/openrs2/protocol/login/downstream/HopBlockedCodec.kt create mode 100644 protocol/src/main/kotlin/org/openrs2/protocol/login/downstream/InvalidLoginPacketCodec.kt create mode 100644 protocol/src/main/kotlin/org/openrs2/protocol/login/downstream/InvalidLoginServerCodec.kt create mode 100644 protocol/src/main/kotlin/org/openrs2/protocol/login/downstream/InvalidSaveCodec.kt create mode 100644 protocol/src/main/kotlin/org/openrs2/protocol/login/downstream/InvalidUsernameOrPasswordCodec.kt create mode 100644 protocol/src/main/kotlin/org/openrs2/protocol/login/downstream/IpBlockedCodec.kt create mode 100644 protocol/src/main/kotlin/org/openrs2/protocol/login/downstream/LockedCodec.kt create mode 100644 protocol/src/main/kotlin/org/openrs2/protocol/login/downstream/LoginServerLoadErrorCodec.kt create mode 100644 protocol/src/main/kotlin/org/openrs2/protocol/login/downstream/LoginServerOfflineCodec.kt create mode 100644 protocol/src/main/kotlin/org/openrs2/protocol/login/downstream/MapMembersOnlyCodec.kt create mode 100644 protocol/src/main/kotlin/org/openrs2/protocol/login/downstream/NeedMembersAccountCodec.kt create mode 100644 protocol/src/main/kotlin/org/openrs2/protocol/login/downstream/NoReplyFromLoginServerCodec.kt create mode 100644 protocol/src/main/kotlin/org/openrs2/protocol/login/downstream/ReconnectOkCodec.kt create mode 100644 protocol/src/main/kotlin/org/openrs2/protocol/login/downstream/ServiceUnavailableCodec.kt create mode 100644 protocol/src/main/kotlin/org/openrs2/protocol/login/downstream/ShowVideoAdCodec.kt create mode 100644 protocol/src/main/kotlin/org/openrs2/protocol/login/downstream/SwitchWorldCodec.kt create mode 100644 protocol/src/main/kotlin/org/openrs2/protocol/login/downstream/TooManyAttemptsCodec.kt create mode 100644 protocol/src/main/kotlin/org/openrs2/protocol/login/downstream/UnknownReplyFromLoginServerCodec.kt create mode 100644 protocol/src/main/kotlin/org/openrs2/protocol/login/downstream/UpdateInProgressCodec.kt diff --git a/protocol/src/main/kotlin/org/openrs2/protocol/ProtocolModule.kt b/protocol/src/main/kotlin/org/openrs2/protocol/ProtocolModule.kt index e3cd645f..0eab31d1 100644 --- a/protocol/src/main/kotlin/org/openrs2/protocol/ProtocolModule.kt +++ b/protocol/src/main/kotlin/org/openrs2/protocol/ProtocolModule.kt @@ -11,10 +11,37 @@ import org.openrs2.protocol.js5.downstream.Js5IpLimitCodec import org.openrs2.protocol.js5.downstream.Js5OkCodec import org.openrs2.protocol.js5.downstream.Js5RemoteDownstream import org.openrs2.protocol.js5.downstream.Js5ServerFullCodec +import org.openrs2.protocol.login.downstream.BadSessionIdCodec +import org.openrs2.protocol.login.downstream.BannedCodec +import org.openrs2.protocol.login.downstream.ClientMembersOnlyCodec import org.openrs2.protocol.login.downstream.ClientOutOfDateCodec +import org.openrs2.protocol.login.downstream.DisallowedByScriptCodec +import org.openrs2.protocol.login.downstream.DuplicateCodec +import org.openrs2.protocol.login.downstream.ExchangeSessionKeyCodec +import org.openrs2.protocol.login.downstream.ForcePasswordChangeCodec +import org.openrs2.protocol.login.downstream.FullscreenMembersOnlyCodec +import org.openrs2.protocol.login.downstream.HopBlockedCodec +import org.openrs2.protocol.login.downstream.InvalidLoginPacketCodec +import org.openrs2.protocol.login.downstream.InvalidLoginServerCodec +import org.openrs2.protocol.login.downstream.InvalidSaveCodec +import org.openrs2.protocol.login.downstream.InvalidUsernameOrPasswordCodec +import org.openrs2.protocol.login.downstream.IpBlockedCodec import org.openrs2.protocol.login.downstream.IpLimitCodec +import org.openrs2.protocol.login.downstream.LockedCodec import org.openrs2.protocol.login.downstream.LoginDownstream +import org.openrs2.protocol.login.downstream.LoginServerLoadErrorCodec +import org.openrs2.protocol.login.downstream.LoginServerOfflineCodec +import org.openrs2.protocol.login.downstream.MapMembersOnlyCodec +import org.openrs2.protocol.login.downstream.NeedMembersAccountCodec +import org.openrs2.protocol.login.downstream.NoReplyFromLoginServerCodec +import org.openrs2.protocol.login.downstream.ReconnectOkCodec import org.openrs2.protocol.login.downstream.ServerFullCodec +import org.openrs2.protocol.login.downstream.ServiceUnavailableCodec +import org.openrs2.protocol.login.downstream.ShowVideoAdCodec +import org.openrs2.protocol.login.downstream.SwitchWorldCodec +import org.openrs2.protocol.login.downstream.TooManyAttemptsCodec +import org.openrs2.protocol.login.downstream.UnknownReplyFromLoginServerCodec +import org.openrs2.protocol.login.downstream.UpdateInProgressCodec import org.openrs2.protocol.login.upstream.CheckWorldSuitabilityCodec import org.openrs2.protocol.login.upstream.CreateAccountCodec import org.openrs2.protocol.login.upstream.CreateCheckDateOfBirthCountryCodec @@ -56,9 +83,36 @@ public object ProtocolModule : AbstractModule() { bindProtocol( LoginDownstream::class.java, + ExchangeSessionKeyCodec::class.java, + ShowVideoAdCodec::class.java, + InvalidUsernameOrPasswordCodec::class.java, + BannedCodec::class.java, + DuplicateCodec::class.java, ClientOutOfDateCodec::class.java, ServerFullCodec::class.java, - IpLimitCodec::class.java + LoginServerOfflineCodec::class.java, + IpLimitCodec::class.java, + BadSessionIdCodec::class.java, + ForcePasswordChangeCodec::class.java, + NeedMembersAccountCodec::class.java, + InvalidSaveCodec::class.java, + UpdateInProgressCodec::class.java, + ReconnectOkCodec::class.java, + TooManyAttemptsCodec::class.java, + MapMembersOnlyCodec::class.java, + LockedCodec::class.java, + FullscreenMembersOnlyCodec::class.java, + InvalidLoginServerCodec::class.java, + HopBlockedCodec::class.java, + InvalidLoginPacketCodec::class.java, + NoReplyFromLoginServerCodec::class.java, + LoginServerLoadErrorCodec::class.java, + UnknownReplyFromLoginServerCodec::class.java, + IpBlockedCodec::class.java, + ServiceUnavailableCodec::class.java, + DisallowedByScriptCodec::class.java, + ClientMembersOnlyCodec::class.java, + SwitchWorldCodec::class.java ) bindProtocol( diff --git a/protocol/src/main/kotlin/org/openrs2/protocol/login/downstream/BadSessionIdCodec.kt b/protocol/src/main/kotlin/org/openrs2/protocol/login/downstream/BadSessionIdCodec.kt new file mode 100644 index 00000000..f59dea93 --- /dev/null +++ b/protocol/src/main/kotlin/org/openrs2/protocol/login/downstream/BadSessionIdCodec.kt @@ -0,0 +1,10 @@ +package org.openrs2.protocol.login.downstream + +import org.openrs2.protocol.EmptyPacketCodec +import javax.inject.Singleton + +@Singleton +public class BadSessionIdCodec : EmptyPacketCodec( + packet = LoginResponse.BadSessionId, + opcode = 10 +) diff --git a/protocol/src/main/kotlin/org/openrs2/protocol/login/downstream/BannedCodec.kt b/protocol/src/main/kotlin/org/openrs2/protocol/login/downstream/BannedCodec.kt new file mode 100644 index 00000000..eb5dfec0 --- /dev/null +++ b/protocol/src/main/kotlin/org/openrs2/protocol/login/downstream/BannedCodec.kt @@ -0,0 +1,10 @@ +package org.openrs2.protocol.login.downstream + +import org.openrs2.protocol.EmptyPacketCodec +import javax.inject.Singleton + +@Singleton +public class BannedCodec : EmptyPacketCodec( + packet = LoginResponse.Banned, + opcode = 4 +) diff --git a/protocol/src/main/kotlin/org/openrs2/protocol/login/downstream/ClientMembersOnlyCodec.kt b/protocol/src/main/kotlin/org/openrs2/protocol/login/downstream/ClientMembersOnlyCodec.kt new file mode 100644 index 00000000..153d7283 --- /dev/null +++ b/protocol/src/main/kotlin/org/openrs2/protocol/login/downstream/ClientMembersOnlyCodec.kt @@ -0,0 +1,10 @@ +package org.openrs2.protocol.login.downstream + +import org.openrs2.protocol.EmptyPacketCodec +import javax.inject.Singleton + +@Singleton +public class ClientMembersOnlyCodec : EmptyPacketCodec( + packet = LoginResponse.ClientMembersOnly, + opcode = 30 +) diff --git a/protocol/src/main/kotlin/org/openrs2/protocol/login/downstream/DisallowedByScriptCodec.kt b/protocol/src/main/kotlin/org/openrs2/protocol/login/downstream/DisallowedByScriptCodec.kt new file mode 100644 index 00000000..ef473991 --- /dev/null +++ b/protocol/src/main/kotlin/org/openrs2/protocol/login/downstream/DisallowedByScriptCodec.kt @@ -0,0 +1,22 @@ +package org.openrs2.protocol.login.downstream + +import io.netty.buffer.ByteBuf +import org.openrs2.crypto.StreamCipher +import org.openrs2.protocol.FixedPacketCodec +import javax.inject.Singleton + +@Singleton +public class DisallowedByScriptCodec : FixedPacketCodec( + type = LoginResponse.DisallowedByScript::class.java, + opcode = 29, + length = 1 +) { + override fun decode(input: ByteBuf, cipher: StreamCipher): LoginResponse.DisallowedByScript { + val reason = input.readUnsignedByte().toInt() + return LoginResponse.DisallowedByScript(reason) + } + + override fun encode(input: LoginResponse.DisallowedByScript, output: ByteBuf, cipher: StreamCipher) { + output.writeByte(input.reason) + } +} diff --git a/protocol/src/main/kotlin/org/openrs2/protocol/login/downstream/DuplicateCodec.kt b/protocol/src/main/kotlin/org/openrs2/protocol/login/downstream/DuplicateCodec.kt new file mode 100644 index 00000000..8f2d7caf --- /dev/null +++ b/protocol/src/main/kotlin/org/openrs2/protocol/login/downstream/DuplicateCodec.kt @@ -0,0 +1,10 @@ +package org.openrs2.protocol.login.downstream + +import org.openrs2.protocol.EmptyPacketCodec +import javax.inject.Singleton + +@Singleton +public class DuplicateCodec : EmptyPacketCodec( + packet = LoginResponse.Duplicate, + opcode = 5 +) diff --git a/protocol/src/main/kotlin/org/openrs2/protocol/login/downstream/ExchangeSessionKeyCodec.kt b/protocol/src/main/kotlin/org/openrs2/protocol/login/downstream/ExchangeSessionKeyCodec.kt new file mode 100644 index 00000000..0e600af0 --- /dev/null +++ b/protocol/src/main/kotlin/org/openrs2/protocol/login/downstream/ExchangeSessionKeyCodec.kt @@ -0,0 +1,22 @@ +package org.openrs2.protocol.login.downstream + +import io.netty.buffer.ByteBuf +import org.openrs2.crypto.StreamCipher +import org.openrs2.protocol.FixedPacketCodec +import javax.inject.Singleton + +@Singleton +public class ExchangeSessionKeyCodec : FixedPacketCodec( + type = LoginResponse.ExchangeSessionKey::class.java, + opcode = 0, + length = 8 +) { + override fun decode(input: ByteBuf, cipher: StreamCipher): LoginResponse.ExchangeSessionKey { + val key = input.readLong() + return LoginResponse.ExchangeSessionKey(key) + } + + override fun encode(input: LoginResponse.ExchangeSessionKey, output: ByteBuf, cipher: StreamCipher) { + output.writeLong(input.key) + } +} diff --git a/protocol/src/main/kotlin/org/openrs2/protocol/login/downstream/ForcePasswordChangeCodec.kt b/protocol/src/main/kotlin/org/openrs2/protocol/login/downstream/ForcePasswordChangeCodec.kt new file mode 100644 index 00000000..7e74d85d --- /dev/null +++ b/protocol/src/main/kotlin/org/openrs2/protocol/login/downstream/ForcePasswordChangeCodec.kt @@ -0,0 +1,10 @@ +package org.openrs2.protocol.login.downstream + +import org.openrs2.protocol.EmptyPacketCodec +import javax.inject.Singleton + +@Singleton +public class ForcePasswordChangeCodec : EmptyPacketCodec( + packet = LoginResponse.ForcePasswordChange, + opcode = 11 +) diff --git a/protocol/src/main/kotlin/org/openrs2/protocol/login/downstream/FullscreenMembersOnlyCodec.kt b/protocol/src/main/kotlin/org/openrs2/protocol/login/downstream/FullscreenMembersOnlyCodec.kt new file mode 100644 index 00000000..6e4bffb9 --- /dev/null +++ b/protocol/src/main/kotlin/org/openrs2/protocol/login/downstream/FullscreenMembersOnlyCodec.kt @@ -0,0 +1,10 @@ +package org.openrs2.protocol.login.downstream + +import org.openrs2.protocol.EmptyPacketCodec +import javax.inject.Singleton + +@Singleton +public class FullscreenMembersOnlyCodec : EmptyPacketCodec( + packet = LoginResponse.FullscreenMembersOnly, + opcode = 19 +) diff --git a/protocol/src/main/kotlin/org/openrs2/protocol/login/downstream/HopBlockedCodec.kt b/protocol/src/main/kotlin/org/openrs2/protocol/login/downstream/HopBlockedCodec.kt new file mode 100644 index 00000000..1517ed61 --- /dev/null +++ b/protocol/src/main/kotlin/org/openrs2/protocol/login/downstream/HopBlockedCodec.kt @@ -0,0 +1,22 @@ +package org.openrs2.protocol.login.downstream + +import io.netty.buffer.ByteBuf +import org.openrs2.crypto.StreamCipher +import org.openrs2.protocol.FixedPacketCodec +import javax.inject.Singleton + +@Singleton +public class HopBlockedCodec : FixedPacketCodec( + type = LoginResponse.HopBlocked::class.java, + opcode = 21, + length = 1 +) { + override fun decode(input: ByteBuf, cipher: StreamCipher): LoginResponse.HopBlocked { + val time = input.readUnsignedByte().toInt() + return LoginResponse.HopBlocked(time) + } + + override fun encode(input: LoginResponse.HopBlocked, output: ByteBuf, cipher: StreamCipher) { + output.writeByte(input.time) + } +} diff --git a/protocol/src/main/kotlin/org/openrs2/protocol/login/downstream/InvalidLoginPacketCodec.kt b/protocol/src/main/kotlin/org/openrs2/protocol/login/downstream/InvalidLoginPacketCodec.kt new file mode 100644 index 00000000..10c7992f --- /dev/null +++ b/protocol/src/main/kotlin/org/openrs2/protocol/login/downstream/InvalidLoginPacketCodec.kt @@ -0,0 +1,10 @@ +package org.openrs2.protocol.login.downstream + +import org.openrs2.protocol.EmptyPacketCodec +import javax.inject.Singleton + +@Singleton +public class InvalidLoginPacketCodec : EmptyPacketCodec( + packet = LoginResponse.InvalidLoginPacket, + opcode = 22 +) diff --git a/protocol/src/main/kotlin/org/openrs2/protocol/login/downstream/InvalidLoginServerCodec.kt b/protocol/src/main/kotlin/org/openrs2/protocol/login/downstream/InvalidLoginServerCodec.kt new file mode 100644 index 00000000..27642cc7 --- /dev/null +++ b/protocol/src/main/kotlin/org/openrs2/protocol/login/downstream/InvalidLoginServerCodec.kt @@ -0,0 +1,10 @@ +package org.openrs2.protocol.login.downstream + +import org.openrs2.protocol.EmptyPacketCodec +import javax.inject.Singleton + +@Singleton +public class InvalidLoginServerCodec : EmptyPacketCodec( + packet = LoginResponse.InvalidLoginServer, + opcode = 20 +) diff --git a/protocol/src/main/kotlin/org/openrs2/protocol/login/downstream/InvalidSaveCodec.kt b/protocol/src/main/kotlin/org/openrs2/protocol/login/downstream/InvalidSaveCodec.kt new file mode 100644 index 00000000..129f2171 --- /dev/null +++ b/protocol/src/main/kotlin/org/openrs2/protocol/login/downstream/InvalidSaveCodec.kt @@ -0,0 +1,10 @@ +package org.openrs2.protocol.login.downstream + +import org.openrs2.protocol.EmptyPacketCodec +import javax.inject.Singleton + +@Singleton +public class InvalidSaveCodec : EmptyPacketCodec( + packet = LoginResponse.InvalidSave, + opcode = 13 +) diff --git a/protocol/src/main/kotlin/org/openrs2/protocol/login/downstream/InvalidUsernameOrPasswordCodec.kt b/protocol/src/main/kotlin/org/openrs2/protocol/login/downstream/InvalidUsernameOrPasswordCodec.kt new file mode 100644 index 00000000..216d0338 --- /dev/null +++ b/protocol/src/main/kotlin/org/openrs2/protocol/login/downstream/InvalidUsernameOrPasswordCodec.kt @@ -0,0 +1,10 @@ +package org.openrs2.protocol.login.downstream + +import org.openrs2.protocol.EmptyPacketCodec +import javax.inject.Singleton + +@Singleton +public class InvalidUsernameOrPasswordCodec : EmptyPacketCodec( + packet = LoginResponse.InvalidUsernameOrPassword, + opcode = 3 +) diff --git a/protocol/src/main/kotlin/org/openrs2/protocol/login/downstream/IpBlockedCodec.kt b/protocol/src/main/kotlin/org/openrs2/protocol/login/downstream/IpBlockedCodec.kt new file mode 100644 index 00000000..49ddb149 --- /dev/null +++ b/protocol/src/main/kotlin/org/openrs2/protocol/login/downstream/IpBlockedCodec.kt @@ -0,0 +1,10 @@ +package org.openrs2.protocol.login.downstream + +import org.openrs2.protocol.EmptyPacketCodec +import javax.inject.Singleton + +@Singleton +public class IpBlockedCodec : EmptyPacketCodec( + packet = LoginResponse.IpBlocked, + opcode = 26 +) diff --git a/protocol/src/main/kotlin/org/openrs2/protocol/login/downstream/LockedCodec.kt b/protocol/src/main/kotlin/org/openrs2/protocol/login/downstream/LockedCodec.kt new file mode 100644 index 00000000..56e9b241 --- /dev/null +++ b/protocol/src/main/kotlin/org/openrs2/protocol/login/downstream/LockedCodec.kt @@ -0,0 +1,10 @@ +package org.openrs2.protocol.login.downstream + +import org.openrs2.protocol.EmptyPacketCodec +import javax.inject.Singleton + +@Singleton +public class LockedCodec : EmptyPacketCodec( + packet = LoginResponse.Locked, + opcode = 18 +) diff --git a/protocol/src/main/kotlin/org/openrs2/protocol/login/downstream/LoginResponse.kt b/protocol/src/main/kotlin/org/openrs2/protocol/login/downstream/LoginResponse.kt index 8fa2571a..c2ac5a3f 100644 --- a/protocol/src/main/kotlin/org/openrs2/protocol/login/downstream/LoginResponse.kt +++ b/protocol/src/main/kotlin/org/openrs2/protocol/login/downstream/LoginResponse.kt @@ -3,7 +3,34 @@ package org.openrs2.protocol.login.downstream import org.openrs2.protocol.Packet public sealed class LoginResponse : Packet { + public data class ExchangeSessionKey(val key: Long) : LoginResponse() + public object ShowVideoAd : LoginResponse() + public object InvalidUsernameOrPassword : LoginResponse() + public object Banned : LoginResponse() + public object Duplicate : LoginResponse() public object ClientOutOfDate : LoginResponse() public object ServerFull : LoginResponse() + public object LoginServerOffline : LoginResponse() public object IpLimit : LoginResponse() + public object BadSessionId : LoginResponse() + public object ForcePasswordChange : LoginResponse() + public object NeedMembersAccount : LoginResponse() + public object InvalidSave : LoginResponse() + public object UpdateInProgress : LoginResponse() + public object ReconnectOk : LoginResponse() + public object TooManyAttempts : LoginResponse() + public object MapMembersOnly : LoginResponse() + public object Locked : LoginResponse() + public object FullscreenMembersOnly : LoginResponse() + public object InvalidLoginServer : LoginResponse() + public data class HopBlocked(public val time: Int) : LoginResponse() + public object InvalidLoginPacket : LoginResponse() + public object NoReplyFromLoginServer : LoginResponse() + public object LoginServerLoadError : LoginResponse() + public object UnknownReplyFromLoginServer : LoginResponse() + public object IpBlocked : LoginResponse() + public object ServiceUnavailable : LoginResponse() + public data class DisallowedByScript(val reason: Int) : LoginResponse() + public object ClientMembersOnly : LoginResponse() + public data class SwitchWorld(val id: Int) : LoginResponse() } diff --git a/protocol/src/main/kotlin/org/openrs2/protocol/login/downstream/LoginServerLoadErrorCodec.kt b/protocol/src/main/kotlin/org/openrs2/protocol/login/downstream/LoginServerLoadErrorCodec.kt new file mode 100644 index 00000000..d6f0bce4 --- /dev/null +++ b/protocol/src/main/kotlin/org/openrs2/protocol/login/downstream/LoginServerLoadErrorCodec.kt @@ -0,0 +1,10 @@ +package org.openrs2.protocol.login.downstream + +import org.openrs2.protocol.EmptyPacketCodec +import javax.inject.Singleton + +@Singleton +public class LoginServerLoadErrorCodec : EmptyPacketCodec( + packet = LoginResponse.LoginServerLoadError, + opcode = 24 +) diff --git a/protocol/src/main/kotlin/org/openrs2/protocol/login/downstream/LoginServerOfflineCodec.kt b/protocol/src/main/kotlin/org/openrs2/protocol/login/downstream/LoginServerOfflineCodec.kt new file mode 100644 index 00000000..2eb63e39 --- /dev/null +++ b/protocol/src/main/kotlin/org/openrs2/protocol/login/downstream/LoginServerOfflineCodec.kt @@ -0,0 +1,10 @@ +package org.openrs2.protocol.login.downstream + +import org.openrs2.protocol.EmptyPacketCodec +import javax.inject.Singleton + +@Singleton +public class LoginServerOfflineCodec : EmptyPacketCodec( + packet = LoginResponse.LoginServerOffline, + opcode = 8 +) diff --git a/protocol/src/main/kotlin/org/openrs2/protocol/login/downstream/MapMembersOnlyCodec.kt b/protocol/src/main/kotlin/org/openrs2/protocol/login/downstream/MapMembersOnlyCodec.kt new file mode 100644 index 00000000..5de23cfd --- /dev/null +++ b/protocol/src/main/kotlin/org/openrs2/protocol/login/downstream/MapMembersOnlyCodec.kt @@ -0,0 +1,10 @@ +package org.openrs2.protocol.login.downstream + +import org.openrs2.protocol.EmptyPacketCodec +import javax.inject.Singleton + +@Singleton +public class MapMembersOnlyCodec : EmptyPacketCodec( + packet = LoginResponse.MapMembersOnly, + opcode = 17 +) diff --git a/protocol/src/main/kotlin/org/openrs2/protocol/login/downstream/NeedMembersAccountCodec.kt b/protocol/src/main/kotlin/org/openrs2/protocol/login/downstream/NeedMembersAccountCodec.kt new file mode 100644 index 00000000..4aaf8801 --- /dev/null +++ b/protocol/src/main/kotlin/org/openrs2/protocol/login/downstream/NeedMembersAccountCodec.kt @@ -0,0 +1,10 @@ +package org.openrs2.protocol.login.downstream + +import org.openrs2.protocol.EmptyPacketCodec +import javax.inject.Singleton + +@Singleton +public class NeedMembersAccountCodec : EmptyPacketCodec( + packet = LoginResponse.NeedMembersAccount, + opcode = 12 +) diff --git a/protocol/src/main/kotlin/org/openrs2/protocol/login/downstream/NoReplyFromLoginServerCodec.kt b/protocol/src/main/kotlin/org/openrs2/protocol/login/downstream/NoReplyFromLoginServerCodec.kt new file mode 100644 index 00000000..4885081c --- /dev/null +++ b/protocol/src/main/kotlin/org/openrs2/protocol/login/downstream/NoReplyFromLoginServerCodec.kt @@ -0,0 +1,10 @@ +package org.openrs2.protocol.login.downstream + +import org.openrs2.protocol.EmptyPacketCodec +import javax.inject.Singleton + +@Singleton +public class NoReplyFromLoginServerCodec : EmptyPacketCodec( + packet = LoginResponse.NoReplyFromLoginServer, + opcode = 23 +) diff --git a/protocol/src/main/kotlin/org/openrs2/protocol/login/downstream/ReconnectOkCodec.kt b/protocol/src/main/kotlin/org/openrs2/protocol/login/downstream/ReconnectOkCodec.kt new file mode 100644 index 00000000..625f17dc --- /dev/null +++ b/protocol/src/main/kotlin/org/openrs2/protocol/login/downstream/ReconnectOkCodec.kt @@ -0,0 +1,10 @@ +package org.openrs2.protocol.login.downstream + +import org.openrs2.protocol.EmptyPacketCodec +import javax.inject.Singleton + +@Singleton +public class ReconnectOkCodec : EmptyPacketCodec( + packet = LoginResponse.ReconnectOk, + opcode = 15 +) diff --git a/protocol/src/main/kotlin/org/openrs2/protocol/login/downstream/ServiceUnavailableCodec.kt b/protocol/src/main/kotlin/org/openrs2/protocol/login/downstream/ServiceUnavailableCodec.kt new file mode 100644 index 00000000..d913e414 --- /dev/null +++ b/protocol/src/main/kotlin/org/openrs2/protocol/login/downstream/ServiceUnavailableCodec.kt @@ -0,0 +1,10 @@ +package org.openrs2.protocol.login.downstream + +import org.openrs2.protocol.EmptyPacketCodec +import javax.inject.Singleton + +@Singleton +public class ServiceUnavailableCodec : EmptyPacketCodec( + packet = LoginResponse.ServiceUnavailable, + opcode = 27 +) diff --git a/protocol/src/main/kotlin/org/openrs2/protocol/login/downstream/ShowVideoAdCodec.kt b/protocol/src/main/kotlin/org/openrs2/protocol/login/downstream/ShowVideoAdCodec.kt new file mode 100644 index 00000000..81e2b492 --- /dev/null +++ b/protocol/src/main/kotlin/org/openrs2/protocol/login/downstream/ShowVideoAdCodec.kt @@ -0,0 +1,10 @@ +package org.openrs2.protocol.login.downstream + +import org.openrs2.protocol.EmptyPacketCodec +import javax.inject.Singleton + +@Singleton +public class ShowVideoAdCodec : EmptyPacketCodec( + packet = LoginResponse.ShowVideoAd, + opcode = 1 +) diff --git a/protocol/src/main/kotlin/org/openrs2/protocol/login/downstream/SwitchWorldCodec.kt b/protocol/src/main/kotlin/org/openrs2/protocol/login/downstream/SwitchWorldCodec.kt new file mode 100644 index 00000000..1ebc77bb --- /dev/null +++ b/protocol/src/main/kotlin/org/openrs2/protocol/login/downstream/SwitchWorldCodec.kt @@ -0,0 +1,22 @@ +package org.openrs2.protocol.login.downstream + +import io.netty.buffer.ByteBuf +import org.openrs2.crypto.StreamCipher +import org.openrs2.protocol.FixedPacketCodec +import javax.inject.Singleton + +@Singleton +public class SwitchWorldCodec : FixedPacketCodec( + type = LoginResponse.SwitchWorld::class.java, + opcode = 101, + length = 2 +) { + override fun decode(input: ByteBuf, cipher: StreamCipher): LoginResponse.SwitchWorld { + val id = input.readUnsignedShort() + return LoginResponse.SwitchWorld(id) + } + + override fun encode(input: LoginResponse.SwitchWorld, output: ByteBuf, cipher: StreamCipher) { + output.writeShort(input.id) + } +} diff --git a/protocol/src/main/kotlin/org/openrs2/protocol/login/downstream/TooManyAttemptsCodec.kt b/protocol/src/main/kotlin/org/openrs2/protocol/login/downstream/TooManyAttemptsCodec.kt new file mode 100644 index 00000000..7dedf645 --- /dev/null +++ b/protocol/src/main/kotlin/org/openrs2/protocol/login/downstream/TooManyAttemptsCodec.kt @@ -0,0 +1,10 @@ +package org.openrs2.protocol.login.downstream + +import org.openrs2.protocol.EmptyPacketCodec +import javax.inject.Singleton + +@Singleton +public class TooManyAttemptsCodec : EmptyPacketCodec( + packet = LoginResponse.TooManyAttempts, + opcode = 16 +) diff --git a/protocol/src/main/kotlin/org/openrs2/protocol/login/downstream/UnknownReplyFromLoginServerCodec.kt b/protocol/src/main/kotlin/org/openrs2/protocol/login/downstream/UnknownReplyFromLoginServerCodec.kt new file mode 100644 index 00000000..8d5f865f --- /dev/null +++ b/protocol/src/main/kotlin/org/openrs2/protocol/login/downstream/UnknownReplyFromLoginServerCodec.kt @@ -0,0 +1,10 @@ +package org.openrs2.protocol.login.downstream + +import org.openrs2.protocol.EmptyPacketCodec +import javax.inject.Singleton + +@Singleton +public class UnknownReplyFromLoginServerCodec : EmptyPacketCodec( + packet = LoginResponse.UnknownReplyFromLoginServer, + opcode = 25 +) diff --git a/protocol/src/main/kotlin/org/openrs2/protocol/login/downstream/UpdateInProgressCodec.kt b/protocol/src/main/kotlin/org/openrs2/protocol/login/downstream/UpdateInProgressCodec.kt new file mode 100644 index 00000000..33a3b4eb --- /dev/null +++ b/protocol/src/main/kotlin/org/openrs2/protocol/login/downstream/UpdateInProgressCodec.kt @@ -0,0 +1,10 @@ +package org.openrs2.protocol.login.downstream + +import org.openrs2.protocol.EmptyPacketCodec +import javax.inject.Singleton + +@Singleton +public class UpdateInProgressCodec : EmptyPacketCodec( + packet = LoginResponse.UpdateInProgress, + opcode = 14 +)