RS2:317:Client:Login Exchange

From RuneWiki
Reconnection handshake
Sent when a client has missed 1-2 ticks from the server and determines it has been disconnected from the server.
Opcode 18
Type Variable
Length N/A
Login handshake
Sent after the initial login handshake.
Opcode 16
Type Variable
Length N/A

This packet determines if a client can and should connect to the server.

Incoming Packet Structure

Data Type Purpose Summary
Byte Packet length How many bytes the server should expect to read.
Byte Magic number This should be 255.
Word Client version This should be 317.
Byte Client memory type Determines if the client is lowmem (1) or highmem (0) so the server knows what interfaces to send, and if any sound effects or music should be sent as they play.
DWord CRC CRC for Index 0, Archive 0
DWord CRC CRC for Index 0, Archive 1
DWord CRC CRC for Index 0, Archive 2
DWord CRC CRC for Index 0, Archive 3
DWord CRC CRC for Index 0, Archive 4
DWord CRC CRC for Index 0, Archive 5
DWord CRC CRC for Index 0, Archive 6
DWord CRC CRC for Index 0, Archive 7
DWord CRC CRC for Index 0, Archive 8
Byte RSA Length The remaining bytes are RSA-encrypted by default.
Byte Magic number This should be 10.
QWord ISAAC Client half of ISAAC cipher (decrypt)
QWord ISAAC Server half of ISAAC cipher (encrypt)
DWord UID A unique ID tied to uid.dat in the cache. This tracks the same "install" across any number of accounts.
JString Username
JString Password

Outgoing Packet Structure

Response Types

Used by the 9th byte of the handshake response, and first byte of the exchange response.

Type Response
-1 Waits for 2000ms and tries again while counting failures.
0 Exchanges session keys, player name, password, etc.
1 Waits for 2000ms and tries again.
2 Client made a successful login.
3 "Invalid username or password."
4 "Your account has been disabled. Please check your message-center for details."
5 "Your account is already logged in. Try again in 60 secs..."
6 "RuneScape has been updated! Please reload this page."
7 "This world is full. Please use a different world."
8 "Unable to connect. Login server offline."
9 "Login limit exceeded. Too many connections from your address."
10 "Unable to connect. Bad session id."
11 "Login server rejected session. Please try again."
12 "You need a members account to login to this world. Please subscribe, or use a different world."
13 "Could not complete login. Please try using a different world."
14 "The server is being updated. Please wait 1 minute and try again."
15 Client made a successful re-connection.
16 "Login attempts exceeded. Please wait 1 minute and try again."
17 "You are standing in a members-only area. To play on this world move to a free area first."
20 "Invalid loginserver requested. Please try using a different world."
21 "You have only just left another world. Your profile will be transferred in: (number) seconds."
None of the above "Unexpected server response. Please try using a different world."

Response Type 2

Data Type Purpose Summary
Byte Response This lets the client know to continue loading the game.
Byte Player rights The player's access level; normal (0), PMod (1), or JMod (2).
Byte Player flagged Determines if the client should be sending extra information about a client's actions, typically if they've been suspected of cheating.

A successful response (2) will load the game frame and begin reading/writing world packets.

Response Type 15

Data Type Purpose Summary
Byte Response This lets the client know to continue loading the game and reuse any existing data the client may have cached in memory.

A re-connection response (15) will re-use whatever the client had previously loaded, including and not limited to: player rights, player flagged, and chat history.

Response Type 21

Data Type Purpose Summary
Byte Response "You have only just left another world. Your profile will be transferred in: (number) seconds."
Byte Timer The seconds value to fill in for (number).

Other Response Types

Data Type Purpose Summary
Byte Response This lets the client know what error it should display.

Something went wrong during the login process, notify the client.