Difference between revisions of "317 Protocol"

From RuneWiki
Jump to navigationJump to search
(Blanked the page)
Line 1: Line 1:
 +
{{stub}}
 +
{{cleanup}}
  
 +
== Login Protocol ==
 +
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.
 +
<br/>
 +
===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.
 +
 +
====Server Session Key====
 +
The server-session-key is one of two ciphers used to encrypt the game protocol, using the ISAAC algorithms.
 +
<br/>
 +
===="Data File Version"====
 +
<!-- Colby -->
 +
The CRC checks for the cache files.
 +
<br/>
 +
 +
====User ID====
 +
The ID of the user.
 +
<br/>
 +
====Username====
 +
The username of the player, used to identify their account.
 +
<br/>
 +
====Password====
 +
The password of the player account, used so only they can log into their account.
 +
<br/>
 +
====Client Session Key====
 +
The client-session-key is one of two ciphers used to encrypt the game protocol, using the ISAAC algorithms.
 +
<br/>
 +
====Connect Status====
 +
The status of the connection.
 +
{|border=2
 +
! 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.
 +
<br/>
 +
====Client Version====
 +
The memory-version of the game client.
 +
{|border=2
 +
! Value
 +
! Status
 +
|-
 +
| 0
 +
| Signifies the client is a low-memory client.
 +
|-
 +
| 1
 +
| Signifies that the client is a high-memory client.
 +
|-
 +
|}
 +
 +
====CRC Values====
 +
9 4-byte values, Each containing the CRC of their respective cache files. Used by the server to verify client is up to date.
 +
<br/>
 +
 +
====Player Status====
 +
The in-game player status - player, player moderator, or administrator.
 +
<br/>
 +
{|border=2
 +
! 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.
 +
<br/>
 +
====Response Codes====
 +
At the beginning and end of the login procedure, we send different values to the client to allow or deny a login. The various values show different messages on the login box on the client or do something internally.
 +
<br/>
 +
{| border=2
 +
! 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
 +
| See the [[#Regarding response code 15|notes below]].
 +
|-
 +
| 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."
 +
|-
 +
|}
 +
 +
==== Regarding response code 15 ====
 +
On the server, players are not unregistered for quite some time. This can be best witnessed when the client forcefully closes the connection while in combat. If you're quick enough before the player dies or kills the NPC, login attempts during that time return that the account is already logged in. This probably explains why the message says "try again in 60 seconds", and they just reused the response when the player is truly logged in.
 +
 +
Going along with this "players aren't offline yet" idea, when the client experiences some lag and performs a reconnect, it sends byte 18 as it's [[#Connect_Status|connection type]] to the server.
 +
 +
The server most likely saves this as a boolean (reconnect = var == 18;). When the login is entirely validated, meaning the password's are okay and the server isn't full, it can either send back the normal response, 2, or 15.
 +
 +
But why 15? If you look at the client code, you'll see that the chat messages aren't cleared. If you've ever had a poor connection you've noticed that your chat stays there upon a reconnect, and this is exactly why.
 +
<!-- thanks to Colby for this contribution-->
 +
When you implement response code 15 though, you do NOT need to send the "player status" or the "flagged" bytes.
 +
 +
===Login Process:===
 +
====Stage 1: Client -> Server====
 +
{| border=2
 +
|-
 +
! Data Type
 +
! Value
 +
|-
 +
| ubyte
 +
| 14
 +
|-
 +
| ubyte
 +
| "name hash"
 +
|-
 +
|}
 +
<br/>
 +
 +
====Stage 2: Server -> Client====
 +
{| border=2
 +
|-
 +
! Data Type
 +
! Value
 +
|-
 +
| byte
 +
| 0
 +
|-
 +
| byte
 +
| 0
 +
|-
 +
| byte
 +
| 0
 +
|-
 +
| byte
 +
| 0
 +
|-
 +
| byte
 +
| 0
 +
|-
 +
| byte
 +
| 0
 +
|-
 +
| byte
 +
| 0
 +
|-
 +
| byte
 +
| 0
 +
|-
 +
| byte
 +
| "response code"
 +
|-
 +
| [[QWord|long]]
 +
| "server session key"
 +
|-
 +
|}
 +
<br/>
 +
 +
====Stage 3: Client -> Server====
 +
{| border=2
 +
|-
 +
! Data Type
 +
! Value
 +
|-
 +
| byte
 +
| "connect status"
 +
|-
 +
| byte
 +
| "size"
 +
|-
 +
| byte
 +
| 255
 +
|-
 +
| [[Word|short]]
 +
| 317
 +
|-
 +
| byte
 +
| "client version"
 +
|-
 +
| [[DWord|int]]
 +
| "crc values"[0]
 +
|-
 +
| [[DWord|int]]
 +
| "crc values"[1]
 +
|-
 +
| [[DWord|int]]
 +
| "crc values"[2]
 +
|-
 +
| [[DWord|int]]
 +
| "crc values"[3]
 +
|-
 +
| [[DWord|int]]
 +
| "crc values"[4]
 +
|-
 +
| [[DWord|int]]
 +
| "crc values"[5]
 +
|-
 +
| [[DWord|int]]
 +
| "crc values"[6]
 +
|-
 +
| [[DWord|int]]
 +
| "crc values"[7]
 +
|-
 +
| [[DWord|int]]
 +
| "crc values"[8]
 +
|-
 +
| byte
 +
| 10
 +
|-
 +
| [[QWord|long]]
 +
| "client session key"
 +
|-
 +
| [[QWord|long]]
 +
| "server session key"
 +
|-
 +
| [[DWord|int]]
 +
| "user id"
 +
|-
 +
| [[RS String|RS String]]
 +
| "username"
 +
|-
 +
| [[RS String|RS String]]
 +
| "password"
 +
|-
 +
|}
 +
<br/>
 +
 +
====Stage 4: Server -> Client====
 +
{| border=2
 +
|-
 +
! Data Type
 +
! Value
 +
|-
 +
| byte
 +
| "response code"
 +
|-
 +
| byte
 +
| "player status"
 +
|-
 +
| byte
 +
| "flagged"
 +
|-
 +
|}
 +
<br/>
 +
 +
==Game Protocol==
 +
The game protocol is the in-game communication of player actions between the server and client.
 +
<br/>
 +
===Server -> Client Packets===
 +
 +
{| border=2
 +
|-
 +
! Opcode
 +
! Type
 +
! Length (bytes)
 +
! Name
 +
! Description
 +
|-
 +
| 1
 +
| FIXED
 +
| 0
 +
| [[317:Animation reset|Animation reset]]
 +
| Resets all animations in the immediate area.
 +
|-
 +
| 24
 +
| FIXED
 +
| 1
 +
| [[317:Flash sidebar|Flash sidebar]]
 +
| Causes a sidebar icon to start flashing.
 +
|-
 +
| 35
 +
| FIXED
 +
| 4
 +
| [[317:Camera shake|Camera shake]]
 +
| Causes the camera to shake.
 +
|-
 +
| 50
 +
| FIXED
 +
| 9
 +
| [[317:Send add friend|Send add friend]]
 +
| Sends a friend to the friend list.
 +
|-
 +
| 68
 +
| FIXED
 +
| 0
 +
| [[317:Reset button state|Reset button state]]
 +
| Resets the button state for all buttons.
 +
|-
 +
| 71
 +
| FIXED
 +
| 3
 +
| [[317:Send sidebar interface|Send sidebar interface]]
 +
| Assigns an interface to one of the tabs in the game sidebar.
 +
|-
 +
| 73
 +
| FIXED
 +
| 4
 +
| [[317:Load map region|Load map region]]
 +
| Loads a new map region.
 +
|-
 +
| 79
 +
| FIXED
 +
| 4
 +
| [[317:Scroll position|Scroll position]]
 +
| Sets the scrollbar position of an interface.
 +
|-
 +
| 97
 +
| FIXED
 +
| 2
 +
| [[317:Show interface|Show interface]]
 +
| Displays a normal interface.
 +
|-
 +
| 99
 +
| FIXED
 +
| 1
 +
| [[317:Minimap State|Minimap State]]
 +
| Sets the mini map's state.
 +
|-
 +
| 107
 +
| FIXED
 +
| 0
 +
| [[317:Reset camera|Reset camera]]
 +
| Resets the camera position.
 +
|-
 +
| 109
 +
| FIXED
 +
| 0
 +
| [[317:Logout|Logout]]
 +
| Disconnects the client from the server.
 +
|-
 +
| 110
 +
| FIXED
 +
| 1
 +
| [[317:Run energy|Run energy]]
 +
| Sends the players run energy level.
 +
|-
 +
| 114
 +
| FIXED
 +
| 2
 +
| [[317:System update|System update]]
 +
| Sends how many seconds until a 'System Update.'
 +
|-
 +
| 122
 +
| FIXED
 +
| 4
 +
| [[317:Interface color|Interface color]]
 +
| Changes the color of an interface.
 +
|-
 +
| 126
 +
| VARIABLE_SHORT
 +
| N/A
 +
| [[317:Send text|Send text]]
 +
| Attaches text to an interface.
 +
|-
 +
| 134
 +
| FIXED
 +
| 6
 +
| [[317:Skill level|Skill level]]
 +
| Sends a skill level to the client.
 +
|-
 +
| 164
 +
| FIXED
 +
| 2
 +
| [[317:Chat interface|Chat interface]]
 +
| Shows an interface in the chat box.
 +
|-
 +
| 176
 +
| FIXED
 +
| 10
 +
| [[317:Open welcome screen|Open welcome screen]]
 +
| Displays the welcome screen.
 +
|-
 +
| 196
 +
| VARIABLE_BYTE
 +
| N/A
 +
| [[317:Send private message|Send private message]]
 +
| Sends a private message to another player.
 +
|-
 +
| 206
 +
| FIXED
 +
| 3
 +
| [[317:Chat settings|Chat settings]]
 +
| Sends the chat privacy settings.
 +
|-
 +
| 208
 +
| FIXED
 +
| 2
 +
| [[317:Walkable interface|Walkable interface]]
 +
| Displays an interface in walkable mode.
 +
|-
 +
| 214
 +
| VARIABLE_SHORT(?)
 +
| N/A
 +
| [[317:Initialize Ignore List|Initialize Ignore List]]
 +
| Sends and hashes each player's name on the ignore list.
 +
|-
 +
| 219
 +
| FIXED
 +
| 0
 +
| [[317:Clear screen|Clear screen]]
 +
| Clears the screen of all open interfaces.
 +
|-
 +
| 221
 +
| FIXED
 +
| 1
 +
| [[Friends list status|Friends list status]]
 +
| Friends list load status.
 +
|-
 +
| 240
 +
| FIXED
 +
| 2
 +
| [[317:Weight|Weight]]
 +
| Sends the players weight amount.
 +
|-
 +
| 241
 +
| VARIABLE_SHORT
 +
| N/A
 +
| [[317:Construct map region|Construct map region]]
 +
| Constructs a dynamic map region using a palette of 8*8 tiles.
 +
|-
 +
| 246
 +
| FIXED
 +
| 6
 +
| [[317:Interface item|Interface item]]
 +
| Displays an item model inside an interface.
 +
|-
 +
| 248
 +
| FIXED
 +
| 4
 +
| [[317:Child frame|Child frame]]
 +
| Attaches an interface within an interface.
 +
|-
 +
| 249
 +
| FIXED
 +
| 3
 +
| [[317:Initialize player|Initialize player]]
 +
| Sends the player's membership status and their current index on the server's player list.
 +
|-
 +
| 253
 +
| VARIABLE_BYTE
 +
| N/A
 +
| [[317:Send message|Send message]]
 +
| Sends a server message (e.g. 'Welcome to RuneScape') or trade/duel request.
 +
|-
 +
|}
 +
 +
===Client -> Server Packets===
 +
 +
{| border=2
 +
|-
 +
! Opcode
 +
! Type
 +
! Length (bytes)
 +
! Name
 +
! Description
 +
|-
 +
| 0
 +
| FIXED
 +
| 0
 +
| [[317:Idle|Idle]]
 +
| Sent when there are no actions being performed by the player for this cycle.
 +
|-
 +
| 3
 +
| FIXED
 +
| 1
 +
| [[317:Focus change|Focus change]]
 +
| Sent when the game client window goes out of focus.
 +
|-
 +
| 4
 +
| VARIABLE BYTE
 +
| N/A
 +
| [[317:Chat|Chat]]
 +
| Sent when the player enters a chat message.
 +
|-
 +
| 14
 +
| FIXED
 +
| 8
 +
| [[317:Item on player|Item on player]]
 +
| Sent when a player uses an item on another player.
 +
|-
 +
| 17
 +
| FIXED
 +
| 2
 +
| [[317:NPC action 2|NPC action 2]]
 +
| Sent when a player clicks the second option of an NPC.
 +
|-
 +
| 21
 +
| FIXED
 +
| 2
 +
| [[317:NPC action 3|NPC action 3]]
 +
| Sent when a player clicks the third option of an NPC.
 +
|-
 +
| 25
 +
| FIXED
 +
| 10
 +
| [[317:Item on floor|Item on floor]]
 +
| Sent when a player uses an item on another item thats on the floor.
 +
|-
 +
| 39
 +
| FIXED
 +
| 2
 +
| [[317:Follow|Follow]]
 +
| Sent when a player clicks the follow option on another player.
 +
|-
 +
| 40
 +
| FIXED
 +
| N/A
 +
| [[317:NPC Dialogue|NpcDialogue]]
 +
| N/A
 +
|-
 +
| 41
 +
| FIXED
 +
| 6
 +
| [[317:Equip item|Equip item]]
 +
| Sent when a player equips an item.
 +
|-
 +
| 43
 +
| FIXED
 +
| 6
 +
| [[317:Bank 10 items|Bank 10 items]]
 +
| Sent when a player banks 10 of a certain item.
 +
|-
 +
| 53
 +
| FIXED
 +
| 4
 +
| [[317:Item on item|Item on item]]
 +
| Sent when a player uses an item with another item.
 +
|-
 +
| 70
 +
| FIXED
 +
| 6
 +
| [[317:Object action 3|Object action 3]]
 +
| Sent when the player clicks the third action available for an object.
 +
|-
 +
| 72
 +
| FIXED
 +
| 2
 +
| [[317:Attack (NPC)|Attack (NPC)]]
 +
| Sent when a player attacks an NPC.
 +
|-
 +
| 73
 +
| FIXED
 +
| 2
 +
| [[317:Trade request|Trade request]]
 +
| Sent when a player requests a trade with another player.
 +
|-
 +
| 74
 +
| FIXED
 +
| 8
 +
| [[317:Remove ignore|Remove ignore]]
 +
| Sent when a player removes a player from their ignore list.
 +
|-
 +
| 79
 +
| FIXED
 +
| 6
 +
| [[317:Light item|Light item]]
 +
| Sent when a player attempts to light logs on fire.
 +
|-
 +
| 86
 +
| FIXED
 +
| 4
 +
| [[317:Camera movement|Camera movement]]
 +
| Sent when the player moves the camera.
 +
|-
 +
| 87
 +
| FIXED
 +
| 6
 +
| [[317:Drop item|Drop item]]
 +
| Sent when a player wants to drop an item onto the ground.
 +
|-
 +
| 95
 +
| FIXED
 +
| 3
 +
| [[317:Privacy options|Privacy options]]
 +
| Sent when a player changes their privacy options (i.e. public chat).
 +
|-
 +
| 98
 +
| VARIABLE_BYTE
 +
| N/A
 +
| [[317:Walk on command|Walk on command]]
 +
| Sent when the player should walk somewhere according to a certain action performed, such as clicking an object.
 +
|-
 +
| 101
 +
| FIXED
 +
| 13
 +
| [[317:Design screen|Design screen]]
 +
| Sent when a player is choosing their character design options.
 +
|-
 +
| 103
 +
| VARIABLE_BYTE
 +
| N/A
 +
| [[317:Player command|Player command]]
 +
| Sent when the player enters a command in the chat box (e.g. "::command")
 +
|-
 +
| 117
 +
| FIXED
 +
| 6
 +
| [[317:Bank 5 items|Bank 5 items]]
 +
| Sent when a player banks 5 of a certain item.
 +
|-
 +
| 121
 +
| FIXED
 +
| 0
 +
| [[317:Loading finished|Loading finished]]
 +
| Sent when the client finishes loading a map region.
 +
|-
 +
| 122
 +
| FIXED
 +
| 6
 +
| [[317:Item action 1|Item action 1]]
 +
| Sent when the player clicks the first option of an item, such as "Bury" for bones.
 +
|-
 +
| 126
 +
| VARIABLE BYTE
 +
| N/A
 +
| [[317:Private message|Private message]]
 +
| Sent when a player sends a private message to another player.
 +
|-
 +
| 129
 +
| FIXED
 +
| 6
 +
| [[317:Bank all items|Bank all items]]
 +
| Sent when a player banks all of a certain item that they have in their inventory.
 +
|-
 +
| 130
 +
| FIXED
 +
| 0
 +
| [[317:Close window|Close window]]
 +
| Sent when a player presses the close, exit or cancel button on an interface.
 +
|-
 +
| 132
 +
| FIXED
 +
| 6
 +
| [[317:Object action 1|Object action 1]]
 +
| Sent when the player clicks the first option of an object, such as "Cut" for trees.
 +
|-
 +
| 133
 +
| FIXED
 +
| 8
 +
| [[317:Add ignore|Add ignore]]
 +
| Sent when a player adds a player to their ignore list.
 +
|-
 +
| 135
 +
| FIXED
 +
| 6
 +
| [[317:Bank X items part-1|Bank X items part-1]]
 +
| Sent when a player requests to bank an X amount of items.
 +
|-
 +
| 139
 +
| FIXED
 +
| 2
 +
| [[317:Trade answer|Trade answer]]
 +
| Sent when a player answers a trade request from another player.
 +
|-
 +
| 145
 +
| FIXED
 +
| 6
 +
| [[317:Unequip item|Unequip item]]
 +
| Sent when a player unequips an item.
 +
|-
 +
| 155
 +
| FIXED
 +
| 2
 +
| [[317:NPC action 1|NPC action 1]]
 +
| Sent when a player clicks first option of an NPC, such as "Talk."
 +
|-
 +
| 164
 +
| VARIABLE_BYTE
 +
| N/A
 +
| [[317:Regular walk|Regular walk]]
 +
| Sent when the player walks regularly.
 +
|-
 +
| 185
 +
| FIXED
 +
| 2
 +
| [[317:Button click|Button click]]
 +
| Sent when a player clicks an in-game button.
 +
|-
 +
| 188
 +
| FIXED
 +
| 8
 +
| [[317:Add friend|Add friend]]
 +
| Sent when a player adds a friend to their friend list.
 +
|-
 +
| 192
 +
| FIXED
 +
| 12
 +
| [[317:Item on object|Item on object]]
 +
| Sent when a a player uses an item on an object.
 +
|-
 +
| 202
 +
| FIXED
 +
| 0
 +
| [[317:Idle logout|Idle logout]]
 +
| Sent when the player has become idle and should be logged out.
 +
|-
 +
| 208
 +
| FIXED
 +
| 4
 +
| [[317:Bank X items part-2|Bank X items part-2]]
 +
| Sent when a player enters an X amount of items they want to bank.
 +
|-
 +
| 210
 +
| FIXED
 +
| 0
 +
| [[317:Region change|Region change]]
 +
| Sent when a player enters a new map region.
 +
|-
 +
| 214
 +
| FIXED
 +
| 7
 +
| [[317:Move item|Move item]]
 +
| Sent when a player moves an item from one slot to another.
 +
|-
 +
| 215
 +
| FIXED
 +
| 8
 +
| [[317:Remove friend|Remove friend]]
 +
| Sent when a player removes a friend from their friend list.
 +
|-
 +
| 218
 +
| FIXED
 +
| 8
 +
| [[317:Report player|Report player]]
 +
| Sent when a player reports another player.
 +
|-
 +
| 236
 +
| FIXED
 +
| 6
 +
| [[317:Pickup ground item|Pickup ground item]]
 +
| Sent when the player picks up an item from the ground.
 +
|-
 +
| 237
 +
| FIXED
 +
| 8
 +
| [[317:Magic on items|Magic on items]]
 +
| Sent when a player casts magic on the items in their inventory.
 +
|-
 +
| 241
 +
| FIXED
 +
| 4
 +
| [[317:Mouse click|Mouse click]]
 +
| Sent when the player clicks somewhere on the game screen.
 +
|-
 +
| 248
 +
| VARIABLE_BYTE
 +
| N/A
 +
| [[317:Map walk|Map walk]]
 +
| Sent when the player walks using the map. Has 14 additional (assumed to be anticheat) bytes added to the end of it that are ignored.
 +
|-
 +
| 252
 +
| FIXED
 +
| 6
 +
| [[317:Object action 2|Object action 2]]
 +
| Sent when the player clicks the second option available for an object.
 +
|-
 +
| 253
 +
| FIXED
 +
| 6
 +
| [[317:Ground Item Action|Ground Item Action]]
 +
| Sent when the player clicks the first option for a ground item (I.E. 'Light Logs')
 +
|-
 +
|}

Revision as of 21:23, 28 March 2010

Stub

This article is a stub. You can help RuneWiki by expanding it.

Cleanup

This article requires cleaning up to adhere to our quality standards. You can help RuneWiki by improving it.


Login Protocol

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.

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"

The CRC checks for the cache files.

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.

Value Status
0 Signifies the client is a low-memory client.
1 Signifies that the client is a high-memory client.

CRC Values

9 4-byte values, Each containing the CRC of their respective cache files. Used by the server to verify client is up to date.

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.

Response Codes

At the beginning and end of the login procedure, we send different values to the client to allow or deny a login. The various values show different messages on the login box on the client or do something internally.

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 See the notes below.
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."

Regarding response code 15

On the server, players are not unregistered for quite some time. This can be best witnessed when the client forcefully closes the connection while in combat. If you're quick enough before the player dies or kills the NPC, login attempts during that time return that the account is already logged in. This probably explains why the message says "try again in 60 seconds", and they just reused the response when the player is truly logged in.

Going along with this "players aren't offline yet" idea, when the client experiences some lag and performs a reconnect, it sends byte 18 as it's connection type to the server.

The server most likely saves this as a boolean (reconnect = var == 18;). When the login is entirely validated, meaning the password's are okay and the server isn't full, it can either send back the normal response, 2, or 15.

But why 15? If you look at the client code, you'll see that the chat messages aren't cleared. If you've ever had a poor connection you've noticed that your chat stays there upon a reconnect, and this is exactly why. When you implement response code 15 though, you do NOT need to send the "player status" or the "flagged" bytes.

Login Process:

Stage 1: Client -> Server

Data Type Value
ubyte 14
ubyte "name hash"


Stage 2: Server -> Client

Data Type Value
byte 0
byte 0
byte 0
byte 0
byte 0
byte 0
byte 0
byte 0
byte "response code"
long "server session key"


Stage 3: Client -> Server

Data Type Value
byte "connect status"
byte "size"
byte 255
short 317
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
long "client session key"
long "server session key"
int "user id"
RS String "username"
RS String "password"


Stage 4: Server -> Client

Data Type Value
byte "response code"
byte "player status"
byte "flagged"


Game Protocol

The game protocol is the in-game communication of player actions between the server and client.

Server -> Client Packets

Opcode Type Length (bytes) Name Description
1 FIXED 0 Animation reset Resets all animations in the immediate area.
24 FIXED 1 Flash sidebar Causes a sidebar icon to start flashing.
35 FIXED 4 Camera shake Causes the camera to shake.
50 FIXED 9 Send add friend Sends a friend to the friend list.
68 FIXED 0 Reset button state Resets the button state for all buttons.
71 FIXED 3 Send sidebar interface Assigns an interface to one of the tabs in the game sidebar.
73 FIXED 4 Load map region Loads a new map region.
79 FIXED 4 Scroll position Sets the scrollbar position of an interface.
97 FIXED 2 Show interface Displays a normal interface.
99 FIXED 1 Minimap State Sets the mini map's state.
107 FIXED 0 Reset camera Resets the camera position.
109 FIXED 0 Logout Disconnects the client from the server.
110 FIXED 1 Run energy Sends the players run energy level.
114 FIXED 2 System update Sends how many seconds until a 'System Update.'
122 FIXED 4 Interface color Changes the color of an interface.
126 VARIABLE_SHORT N/A Send text Attaches text to an interface.
134 FIXED 6 Skill level Sends a skill level to the client.
164 FIXED 2 Chat interface Shows an interface in the chat box.
176 FIXED 10 Open welcome screen Displays the welcome screen.
196 VARIABLE_BYTE N/A Send private message Sends a private message to another player.
206 FIXED 3 Chat settings Sends the chat privacy settings.
208 FIXED 2 Walkable interface Displays an interface in walkable mode.
214 VARIABLE_SHORT(?) N/A Initialize Ignore List Sends and hashes each player's name on the ignore list.
219 FIXED 0 Clear screen Clears the screen of all open interfaces.
221 FIXED 1 Friends list status Friends list load status.
240 FIXED 2 Weight Sends the players weight amount.
241 VARIABLE_SHORT N/A Construct map region Constructs a dynamic map region using a palette of 8*8 tiles.
246 FIXED 6 Interface item Displays an item model inside an interface.
248 FIXED 4 Child frame Attaches an interface within an interface.
249 FIXED 3 Initialize player Sends the player's membership status and their current index on the server's player list.
253 VARIABLE_BYTE N/A Send message Sends a server message (e.g. 'Welcome to RuneScape') or trade/duel request.

Client -> Server Packets

Opcode Type Length (bytes) Name Description
0 FIXED 0 Idle Sent when there are no actions being performed by the player for this cycle.
3 FIXED 1 Focus change Sent when the game client window goes out of focus.
4 VARIABLE BYTE N/A Chat Sent when the player enters a chat message.
14 FIXED 8 Item on player Sent when a player uses an item on another player.
17 FIXED 2 NPC action 2 Sent when a player clicks the second option of an NPC.
21 FIXED 2 NPC action 3 Sent when a player clicks the third option of an NPC.
25 FIXED 10 Item on floor Sent when a player uses an item on another item thats on the floor.
39 FIXED 2 Follow Sent when a player clicks the follow option on another player.
40 FIXED N/A NpcDialogue N/A
41 FIXED 6 Equip item Sent when a player equips an item.
43 FIXED 6 Bank 10 items Sent when a player banks 10 of a certain item.
53 FIXED 4 Item on item Sent when a player uses an item with another item.
70 FIXED 6 Object action 3 Sent when the player clicks the third action available for an object.
72 FIXED 2 Attack (NPC) Sent when a player attacks an NPC.
73 FIXED 2 Trade request Sent when a player requests a trade with another player.
74 FIXED 8 Remove ignore Sent when a player removes a player from their ignore list.
79 FIXED 6 Light item Sent when a player attempts to light logs on fire.
86 FIXED 4 Camera movement Sent when the player moves the camera.
87 FIXED 6 Drop item Sent when a player wants to drop an item onto the ground.
95 FIXED 3 Privacy options Sent when a player changes their privacy options (i.e. public chat).
98 VARIABLE_BYTE N/A Walk on command Sent when the player should walk somewhere according to a certain action performed, such as clicking an object.
101 FIXED 13 Design screen Sent when a player is choosing their character design options.
103 VARIABLE_BYTE N/A Player command Sent when the player enters a command in the chat box (e.g. "::command")
117 FIXED 6 Bank 5 items Sent when a player banks 5 of a certain item.
121 FIXED 0 Loading finished Sent when the client finishes loading a map region.
122 FIXED 6 Item action 1 Sent when the player clicks the first option of an item, such as "Bury" for bones.
126 VARIABLE BYTE N/A Private message Sent when a player sends a private message to another player.
129 FIXED 6 Bank all items Sent when a player banks all of a certain item that they have in their inventory.
130 FIXED 0 Close window Sent when a player presses the close, exit or cancel button on an interface.
132 FIXED 6 Object action 1 Sent when the player clicks the first option of an object, such as "Cut" for trees.
133 FIXED 8 Add ignore Sent when a player adds a player to their ignore list.
135 FIXED 6 Bank X items part-1 Sent when a player requests to bank an X amount of items.
139 FIXED 2 Trade answer Sent when a player answers a trade request from another player.
145 FIXED 6 Unequip item Sent when a player unequips an item.
155 FIXED 2 NPC action 1 Sent when a player clicks first option of an NPC, such as "Talk."
164 VARIABLE_BYTE N/A Regular walk Sent when the player walks regularly.
185 FIXED 2 Button click Sent when a player clicks an in-game button.
188 FIXED 8 Add friend Sent when a player adds a friend to their friend list.
192 FIXED 12 Item on object Sent when a a player uses an item on an object.
202 FIXED 0 Idle logout Sent when the player has become idle and should be logged out.
208 FIXED 4 Bank X items part-2 Sent when a player enters an X amount of items they want to bank.
210 FIXED 0 Region change Sent when a player enters a new map region.
214 FIXED 7 Move item Sent when a player moves an item from one slot to another.
215 FIXED 8 Remove friend Sent when a player removes a friend from their friend list.
218 FIXED 8 Report player Sent when a player reports another player.
236 FIXED 6 Pickup ground item Sent when the player picks up an item from the ground.
237 FIXED 8 Magic on items Sent when a player casts magic on the items in their inventory.
241 FIXED 4 Mouse click Sent when the player clicks somewhere on the game screen.
248 VARIABLE_BYTE N/A Map walk Sent when the player walks using the map. Has 14 additional (assumed to be anticheat) bytes added to the end of it that are ignored.
252 FIXED 6 Object action 2 Sent when the player clicks the second option available for an object.
253 FIXED 6 Ground Item Action Sent when the player clicks the first option for a ground item (I.E. 'Light Logs')