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 <gpe@openrs2.org>
Graham 2 years ago
parent 827e6262a9
commit f31b2519f9
  1. 56
      protocol/src/main/kotlin/org/openrs2/protocol/ProtocolModule.kt
  2. 10
      protocol/src/main/kotlin/org/openrs2/protocol/login/downstream/BadSessionIdCodec.kt
  3. 10
      protocol/src/main/kotlin/org/openrs2/protocol/login/downstream/BannedCodec.kt
  4. 10
      protocol/src/main/kotlin/org/openrs2/protocol/login/downstream/ClientMembersOnlyCodec.kt
  5. 22
      protocol/src/main/kotlin/org/openrs2/protocol/login/downstream/DisallowedByScriptCodec.kt
  6. 10
      protocol/src/main/kotlin/org/openrs2/protocol/login/downstream/DuplicateCodec.kt
  7. 22
      protocol/src/main/kotlin/org/openrs2/protocol/login/downstream/ExchangeSessionKeyCodec.kt
  8. 10
      protocol/src/main/kotlin/org/openrs2/protocol/login/downstream/ForcePasswordChangeCodec.kt
  9. 10
      protocol/src/main/kotlin/org/openrs2/protocol/login/downstream/FullscreenMembersOnlyCodec.kt
  10. 22
      protocol/src/main/kotlin/org/openrs2/protocol/login/downstream/HopBlockedCodec.kt
  11. 10
      protocol/src/main/kotlin/org/openrs2/protocol/login/downstream/InvalidLoginPacketCodec.kt
  12. 10
      protocol/src/main/kotlin/org/openrs2/protocol/login/downstream/InvalidLoginServerCodec.kt
  13. 10
      protocol/src/main/kotlin/org/openrs2/protocol/login/downstream/InvalidSaveCodec.kt
  14. 10
      protocol/src/main/kotlin/org/openrs2/protocol/login/downstream/InvalidUsernameOrPasswordCodec.kt
  15. 10
      protocol/src/main/kotlin/org/openrs2/protocol/login/downstream/IpBlockedCodec.kt
  16. 10
      protocol/src/main/kotlin/org/openrs2/protocol/login/downstream/LockedCodec.kt
  17. 27
      protocol/src/main/kotlin/org/openrs2/protocol/login/downstream/LoginResponse.kt
  18. 10
      protocol/src/main/kotlin/org/openrs2/protocol/login/downstream/LoginServerLoadErrorCodec.kt
  19. 10
      protocol/src/main/kotlin/org/openrs2/protocol/login/downstream/LoginServerOfflineCodec.kt
  20. 10
      protocol/src/main/kotlin/org/openrs2/protocol/login/downstream/MapMembersOnlyCodec.kt
  21. 10
      protocol/src/main/kotlin/org/openrs2/protocol/login/downstream/NeedMembersAccountCodec.kt
  22. 10
      protocol/src/main/kotlin/org/openrs2/protocol/login/downstream/NoReplyFromLoginServerCodec.kt
  23. 10
      protocol/src/main/kotlin/org/openrs2/protocol/login/downstream/ReconnectOkCodec.kt
  24. 10
      protocol/src/main/kotlin/org/openrs2/protocol/login/downstream/ServiceUnavailableCodec.kt
  25. 10
      protocol/src/main/kotlin/org/openrs2/protocol/login/downstream/ShowVideoAdCodec.kt
  26. 22
      protocol/src/main/kotlin/org/openrs2/protocol/login/downstream/SwitchWorldCodec.kt
  27. 10
      protocol/src/main/kotlin/org/openrs2/protocol/login/downstream/TooManyAttemptsCodec.kt
  28. 10
      protocol/src/main/kotlin/org/openrs2/protocol/login/downstream/UnknownReplyFromLoginServerCodec.kt
  29. 10
      protocol/src/main/kotlin/org/openrs2/protocol/login/downstream/UpdateInProgressCodec.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(

@ -0,0 +1,10 @@
package org.openrs2.protocol.login.downstream
import org.openrs2.protocol.EmptyPacketCodec
import javax.inject.Singleton
@Singleton
public class BadSessionIdCodec : EmptyPacketCodec<LoginResponse.BadSessionId>(
packet = LoginResponse.BadSessionId,
opcode = 10
)

@ -0,0 +1,10 @@
package org.openrs2.protocol.login.downstream
import org.openrs2.protocol.EmptyPacketCodec
import javax.inject.Singleton
@Singleton
public class BannedCodec : EmptyPacketCodec<LoginResponse.Banned>(
packet = LoginResponse.Banned,
opcode = 4
)

@ -0,0 +1,10 @@
package org.openrs2.protocol.login.downstream
import org.openrs2.protocol.EmptyPacketCodec
import javax.inject.Singleton
@Singleton
public class ClientMembersOnlyCodec : EmptyPacketCodec<LoginResponse.ClientMembersOnly>(
packet = LoginResponse.ClientMembersOnly,
opcode = 30
)

@ -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<LoginResponse.DisallowedByScript>(
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)
}
}

@ -0,0 +1,10 @@
package org.openrs2.protocol.login.downstream
import org.openrs2.protocol.EmptyPacketCodec
import javax.inject.Singleton
@Singleton
public class DuplicateCodec : EmptyPacketCodec<LoginResponse.Duplicate>(
packet = LoginResponse.Duplicate,
opcode = 5
)

@ -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<LoginResponse.ExchangeSessionKey>(
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)
}
}

@ -0,0 +1,10 @@
package org.openrs2.protocol.login.downstream
import org.openrs2.protocol.EmptyPacketCodec
import javax.inject.Singleton
@Singleton
public class ForcePasswordChangeCodec : EmptyPacketCodec<LoginResponse.ForcePasswordChange>(
packet = LoginResponse.ForcePasswordChange,
opcode = 11
)

@ -0,0 +1,10 @@
package org.openrs2.protocol.login.downstream
import org.openrs2.protocol.EmptyPacketCodec
import javax.inject.Singleton
@Singleton
public class FullscreenMembersOnlyCodec : EmptyPacketCodec<LoginResponse.FullscreenMembersOnly>(
packet = LoginResponse.FullscreenMembersOnly,
opcode = 19
)

@ -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<LoginResponse.HopBlocked>(
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)
}
}

@ -0,0 +1,10 @@
package org.openrs2.protocol.login.downstream
import org.openrs2.protocol.EmptyPacketCodec
import javax.inject.Singleton
@Singleton
public class InvalidLoginPacketCodec : EmptyPacketCodec<LoginResponse.InvalidLoginPacket>(
packet = LoginResponse.InvalidLoginPacket,
opcode = 22
)

@ -0,0 +1,10 @@
package org.openrs2.protocol.login.downstream
import org.openrs2.protocol.EmptyPacketCodec
import javax.inject.Singleton
@Singleton
public class InvalidLoginServerCodec : EmptyPacketCodec<LoginResponse.InvalidLoginServer>(
packet = LoginResponse.InvalidLoginServer,
opcode = 20
)

@ -0,0 +1,10 @@
package org.openrs2.protocol.login.downstream
import org.openrs2.protocol.EmptyPacketCodec
import javax.inject.Singleton
@Singleton
public class InvalidSaveCodec : EmptyPacketCodec<LoginResponse.InvalidSave>(
packet = LoginResponse.InvalidSave,
opcode = 13
)

@ -0,0 +1,10 @@
package org.openrs2.protocol.login.downstream
import org.openrs2.protocol.EmptyPacketCodec
import javax.inject.Singleton
@Singleton
public class InvalidUsernameOrPasswordCodec : EmptyPacketCodec<LoginResponse.InvalidUsernameOrPassword>(
packet = LoginResponse.InvalidUsernameOrPassword,
opcode = 3
)

@ -0,0 +1,10 @@
package org.openrs2.protocol.login.downstream
import org.openrs2.protocol.EmptyPacketCodec
import javax.inject.Singleton
@Singleton
public class IpBlockedCodec : EmptyPacketCodec<LoginResponse.IpBlocked>(
packet = LoginResponse.IpBlocked,
opcode = 26
)

@ -0,0 +1,10 @@
package org.openrs2.protocol.login.downstream
import org.openrs2.protocol.EmptyPacketCodec
import javax.inject.Singleton
@Singleton
public class LockedCodec : EmptyPacketCodec<LoginResponse.Locked>(
packet = LoginResponse.Locked,
opcode = 18
)

@ -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()
}

@ -0,0 +1,10 @@
package org.openrs2.protocol.login.downstream
import org.openrs2.protocol.EmptyPacketCodec
import javax.inject.Singleton
@Singleton
public class LoginServerLoadErrorCodec : EmptyPacketCodec<LoginResponse.LoginServerLoadError>(
packet = LoginResponse.LoginServerLoadError,
opcode = 24
)

@ -0,0 +1,10 @@
package org.openrs2.protocol.login.downstream
import org.openrs2.protocol.EmptyPacketCodec
import javax.inject.Singleton
@Singleton
public class LoginServerOfflineCodec : EmptyPacketCodec<LoginResponse.LoginServerOffline>(
packet = LoginResponse.LoginServerOffline,
opcode = 8
)

@ -0,0 +1,10 @@
package org.openrs2.protocol.login.downstream
import org.openrs2.protocol.EmptyPacketCodec
import javax.inject.Singleton
@Singleton
public class MapMembersOnlyCodec : EmptyPacketCodec<LoginResponse.MapMembersOnly>(
packet = LoginResponse.MapMembersOnly,
opcode = 17
)

@ -0,0 +1,10 @@
package org.openrs2.protocol.login.downstream
import org.openrs2.protocol.EmptyPacketCodec
import javax.inject.Singleton
@Singleton
public class NeedMembersAccountCodec : EmptyPacketCodec<LoginResponse.NeedMembersAccount>(
packet = LoginResponse.NeedMembersAccount,
opcode = 12
)

@ -0,0 +1,10 @@
package org.openrs2.protocol.login.downstream
import org.openrs2.protocol.EmptyPacketCodec
import javax.inject.Singleton
@Singleton
public class NoReplyFromLoginServerCodec : EmptyPacketCodec<LoginResponse.NoReplyFromLoginServer>(
packet = LoginResponse.NoReplyFromLoginServer,
opcode = 23
)

@ -0,0 +1,10 @@
package org.openrs2.protocol.login.downstream
import org.openrs2.protocol.EmptyPacketCodec
import javax.inject.Singleton
@Singleton
public class ReconnectOkCodec : EmptyPacketCodec<LoginResponse.ReconnectOk>(
packet = LoginResponse.ReconnectOk,
opcode = 15
)

@ -0,0 +1,10 @@
package org.openrs2.protocol.login.downstream
import org.openrs2.protocol.EmptyPacketCodec
import javax.inject.Singleton
@Singleton
public class ServiceUnavailableCodec : EmptyPacketCodec<LoginResponse.ServiceUnavailable>(
packet = LoginResponse.ServiceUnavailable,
opcode = 27
)

@ -0,0 +1,10 @@
package org.openrs2.protocol.login.downstream
import org.openrs2.protocol.EmptyPacketCodec
import javax.inject.Singleton
@Singleton
public class ShowVideoAdCodec : EmptyPacketCodec<LoginResponse.ShowVideoAd>(
packet = LoginResponse.ShowVideoAd,
opcode = 1
)

@ -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<LoginResponse.SwitchWorld>(
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)
}
}

@ -0,0 +1,10 @@
package org.openrs2.protocol.login.downstream
import org.openrs2.protocol.EmptyPacketCodec
import javax.inject.Singleton
@Singleton
public class TooManyAttemptsCodec : EmptyPacketCodec<LoginResponse.TooManyAttempts>(
packet = LoginResponse.TooManyAttempts,
opcode = 16
)

@ -0,0 +1,10 @@
package org.openrs2.protocol.login.downstream
import org.openrs2.protocol.EmptyPacketCodec
import javax.inject.Singleton
@Singleton
public class UnknownReplyFromLoginServerCodec : EmptyPacketCodec<LoginResponse.UnknownReplyFromLoginServer>(
packet = LoginResponse.UnknownReplyFromLoginServer,
opcode = 25
)

@ -0,0 +1,10 @@
package org.openrs2.protocol.login.downstream
import org.openrs2.protocol.EmptyPacketCodec
import javax.inject.Singleton
@Singleton
public class UpdateInProgressCodec : EmptyPacketCodec<LoginResponse.UpdateInProgress>(
packet = LoginResponse.UpdateInProgress,
opcode = 14
)
Loading…
Cancel
Save