342 Protocol
Contents
- 1 Login Protocol
- 2 Game Protocol
Login Protocol
The Login Protocol for the 342 is very similar in structure to that of the 317 (and other versions). The login is comprised of four stages in which the client and server switch in regards to which one is reading and which one is writing.
Variables:
The login process has a lot of variable data, compiled here is a list of the variables and their different values.
Name Hash
A hash of the player name, thought to be used to select an appropriate login server. This has no use in current private servers.
Return Code
The return code is a code used to identify which part of login the session is currently at.
Value | 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 | N/A |
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." |
22 | "Malformed login packet. Please try again." |
None of the above | "Unexpected server response. Please try using a different world." |
Server Session Key
The server-session-key is one of two ciphers used to encrypt the game protocol, using the ISAAC algorithms.
"Data File Version"
Unknown, quoted from a Winterlove private server.
User ID
The ID of the user.
Username
The username of the player, used to identify their account.
Password
The password of the player account, used so only they can log into their account.
Client Session Key
The client-session-key is one of two ciphers used to encrypt the game protocol, using the ISAAC algorithms.
Connect Status
The status of the connection.
Value | Status |
---|---|
16 | Signifies that the connection is new. |
18 | Signifies that the session is reconnecting a previously lost connection. |
Size
The size of the unencrypted login packet, used to determine how many bytes need to be read from the stream by the server.
Client Version
The memory-version of the game client.
Client Version Value: 0
Signifies that the client is a low-memory client.
Client Version Value: 1
Signifies that the client is a high-memory client.
CRC Values
Unknown.
Player Status
The in-game player status - player, player moderator, or administrator.
Value | Status |
---|---|
0 | Signifies that this player is a normal player. |
1 | Signifies that this player is a player moderator. |
2 | Signifies that this player is an administrator. |
Flagged
If set to 1, information about mouse movements etc. are sent to the server. Suspected bot accounts are flagged.
Login Process:
Stage 1: Client -> Server
Type | Value |
---|---|
ubyte | 14 |
ubyte | "name hash" |
Stage 2: Server -> Client
Type | Value |
---|---|
byte | 0 |
byte | 0 |
byte | 0 |
byte | 0 |
byte | 0 |
byte | 0 |
byte | 0 |
byte | 0 |
byte | "return code" |
long | "server session key" |
Stage 3: Client -> Server
Type | Value |
byte | "connect status" |
byte | "size" |
byte | 255 |
short | 342 |
byte | "client version" |
int | "crc values"[0] |
int | "crc values"[1] |
int | "crc values"[2] |
int | "crc values"[3] |
int | "crc values"[4] |
int | "crc values"[5] |
int | "crc values"[6] |
int | "crc values"[7] |
int | "crc values"[8] |
byte | 10 |
int | "datafileversion"[0] |
int | "datafileversion"[1] |
int | "datafileversion"[2] |
int | "datafileversion"[3] |
int | "user id" |
string | "username" |
string | "password" |
long | "client session key" |
long | "server session key" |
Stage 4: Server -> Client
Type | Value |
byte | "return code" |
byte | "player status" |
byte | "flagged" |
Game Protocol
(needs to be documented)
Server -> Client Packets
Opcode | Type | Length (bytes) | Name | Description |
---|---|---|---|---|
98 | VARIABLE_BYTE | N/A | Send message | Sends a server message (e.g. 'Welcome to RuneScape') or trade/duel request. |
99 | VARIABLE_SHORT | N/A | 342:Update players | Sends the player update block. |
128 | FIXED | 0 | Logout | Disconnects the client from the server. |
Client -> Server Packets
Opcode | Type | Length (bytes) | Name | Description |
---|