RS2:317

From RuneWiki
Login Screen

Revision 317 of RuneScape 2 came out around May 5th, 2005, just after Barrows was released.

Welcome Screen
Game World using 319 cache

There is no known 317 cache available -- the popular ones that claim to be 317 are typically 333, 369, or 377. 317 did not have farming, so if you see farming in your skill interfaces, that would be an immediate indicator.

There are 84 client opcodes and 73 server opcodes in this revision.

Pre-World

Opcode Purpose
14 Login handshake
15 On-demand
16 Login exchange
18 Reconnection exchange

World

Client Opcodes

Opcode Bytes Name Description Type Structure
0 0 Idle Sent when there are no actions being performed by the player for this cycle. NOTHING
3 1 Focus change Sent when the game client window goes out of focus. FIXED BYTE
4 NA Chat Sent when the player enters a chat message. VARIABLE BYTE BYTE, BYTE(S), BYTE(S), REVERSEDATAA
14 8 Item-on-player Sent when a player uses an item on another player. FIXED SHORTA, SHORT, SHORT, LESHORT
16 6 Item Action 2 Sent when a player uses an item. This is an alternate item option. FIXED SHORTA, LESHORTA, LESHORTA
17 2 NPC action 2 Sent when a player clicks the second option of an NPC. FIXED LESHORTA
18 2 NPC action 4 Sent when a player clicks the fourth option of an NPC. FIXED LESHORTA
21 2 NPC action 3 Sent when a player clicks the third option of an NPC. FIXED SHORT
23 6 Unknown FIXED LESHORT, LESHORT, LESHORT
25 12 Item-on-floor item Sent when a player uses an item on another item thats on the floor. FIXED LESHORT, LESHORTA, SHORT, SHORTA, LESHORTA, SHORT
35 8 Magic-on-object Sent when a player uses magic on an object. FIXED LESHORT, SHORTA, SHORTA, LESHORT
36 4 Movement anti-cheat Sent to validate walking. FIXED INT
39 2 Follow Sent when a player clicks the follow option on another player. FIXED LESHORT
40 2 NpcDialogue Dialogue FIXED SHORT
41 6 Equip item Sent when a player equips an item. FIXED SHORT, SHORTA, SHORTA
43 6 Bank-10 Sent when a player banks 10 of a certain item. FIXED LESHORT, SHORTA, SHORTA
45 NA Flagged account Sent when a players account is flagged. VARIABLE BYTE (SHORT) / (TRIBYTE) / (INT)
53 12 Item-on-item Sent when a player uses an item with another item. FIXED SHORT, SHORTA, LESHORTA, SHORT, LESHORT, SHORT
57 8 Item-on-NPC Sent when a player uses an item on an NPC. FIXED SHORTA, SHORTA, LESHORT, SHORTA
60 8 Typing onto interface Sent while typing onto an interface FIXED LONG
70 6 Object action 3 Sent when the player clicks the third action available for an object. FIXED LESHORT, SHORT, LESHORTA
72 2 Attack NPC Sent when a player attacks an NPC. FIXED SHORTA
73 2 Trade request Sent when a player requests a trade with another player. FIXED LESHORT
74 8 Remove ignore Sent when a player removes a player from their ignore list. FIXED LONG
75 6 Item action 3 Sent when a player clicks the third option of an item. FIXED LESHORTA, LESHORT, SHORTA
77 NA Unknown VARIABLE BYTE BYTE, BYTE, BYTE, (SHORT), BYTE, BYTE, BYTE, SHORT, SHORT
78 0 Unknown NOTHING
79 6 Light item Sent when a player attempts to light logs on fire. FIXED LESHORT, SHORT, SHORTA
85 1 Anti-cheat Sent to validate npc option 4. (client action 478) FIXED BYTE
86 4 Camera movement Sent when the player moves the camera. FIXED SHORT, SHORTA
87 6 Drop item Sent when a player wants to drop an item onto the ground. FIXED SHORTA, SHORT, SHORTA
95 3 Privacy options Sent when a player changes their privacy options (i.e. public chat). FIXED BYTE, BYTE, BYTE
98 NA World action movement Sent when the player should walk somewhere according to a certain action performed, such as clicking an object. VARIABLE BYTE BYTE, LESHORT, (BYTES), LESHORT, NBYTE
101 13 Design screen Sent when a player is choosing their character design options. FIXED BYTE, 7X BYTE, 5X BYTE
103 NA Player command Sent when the player enters a command in the chat box (e.g. "::command") VARIABLE BYTE JSTRING
117 6 Bank-5 Sent when a player banks 5 of a certain item. FIXED LESHORTA, LESHORTA, LESHORT
120 3 Unknown FIXED
121 0 Loading finished Sent when the client finishes loading a map region. NOTHING
122 6 Item action 1 Sent when the player clicks the first option of an item, such as "Bury" for bones. FIXED LESHORTA, SHORTA, LESHORT
126 NA Private message Sent when a player sends a private message to another player. VARIABLE BYTE LONG, (CODEC)
128 2 Accept challenge Sent when a player accepts another players duel request. FIXED SHORT
129 6 Bank-All Sent when a player banks all of a certain item that they have in their inventory. FIXED SHORTA, SHORT, SHORTA
130 0 Close window Sent when a player presses the close, exit or cancel button on an interface. NOTHING
131 4 Magic-on-NPC Sent when a player uses magic on an npc. FIXED LESHORTA, SHORTA
132 6 Object action 1 Sent when the player clicks the first option of an object, such as "Cut" for trees. FIXED LESHORTA, SHORT, SHORTA
133 8 Add ignore Sent when a player adds a player to their ignore list. FIXED LONG
135 6 Bank-X items part-1 Sent when a player requests to bank an X amount of items. FIXED LESHORT, SHORTA, LESHORT
136 0 Anti-cheat Sent with client action 561, 6 has to do with player option 1 NOTHING
139 2 Trade answer Sent when a player answers a trade request from another player. FIXED SHORT
145 6 Unequip item Sent when a player unequips an item. FIXED SHORTA, SHORTA, SHORTA
148 0 Unknown NOTHING
150 0 Unknown NOTHING
152 1 Anti-cheat Sent to validate npc option 3 (client action 965) FIXED BYTE
153 2 Player option 2 Sent when a moderator or administrator selects the second option of a player. FIXED LESHORT
155 2 NPC action 1 Sent when a player clicks first option of an NPC, such as "Talk." FIXED LESHORT
156 6 Unknown FIXED SHORTA, LESHORT, LESHORTA
164 NA World movement Sent when the player walks regularly. VARIABLE BYTE BYTE, LESHORT, (BYTES), LESHORT, NBYTE
165 NA Unknown VARIABLE BYTE BYTE, BYTE, SHORT, BYTE, SHORT, BYTE, SHORT, BYTE, (SHORT), (BYTE)
181 8 Magic-on-ground item Sent when a player uses a spell on a ground item. FIXED LESHORT, SHORT, LESHORT, SHORTA
183 3 Anti-cheat Validates clicking object option 4 FIXED TRIBYTE
185 2 Button click Sent when a player clicks an in-game button. FIXED SHORT
188 8 Add friend Sent when a player adds a friend to their friend list. FIXED LONG
189 1 Anti-cheat Validates player option 2 FIXED BYTE
192 12 Item-on-object Sent when a a player uses an item on an object. FIXED SHORT, LESHORT, LESHORTA, LESHORT, LESHORTA, SHORT
200 2 Anti-cheat Validates banking options FIXED SHORT
202 0 Idle logout Sent when the player has become idle and should be logged out. NOTHING
208 4 Bank-X items part-2 Sent when a player enters an X amount of items they want to bank. FIXED INT
210 4 Region change Sent when a player enters a new map region. FIXED INT
214 7 Move item Sent when a player moves an item from one slot to another. FIXED LESHORTA, NBYTE, LETSHORTA, LESHORT
215 8 Remove friend Sent when a player removes a friend from their friend list. FIXED LONG
218 10 Report player Sent when a player reports another player. FIXED LONG, BYTE, BYTE
226 NA Unknown VARIABLE BYTE SHORT, BYTE, SHORT, BYTE, (SHORT), BYTE, SHORT, SHORT, SHORT, SHORT
228 6 Object option 4 Sent when a player uses the 4th option of an object. FIXED SHORTA, SHORTA, SHORT
230 1 Anti-cheat Validates NPC option 2 FIXED BYTE
234 6 Object option 2 Sent when a player uses the 2nd option of an object. FIXED LESHORTA, SHORTA, LESHORTA
236 6 Pickup ground item Sent when the player picks up an item from the ground. FIXED LESHORT, SHORT, LESHORT
237 8 Magic-on-item Sent when a player casts magic on the items in their inventory. FIXED SHORT, SHORTA, SHORT, SHORTA
238 1 Unknown FIXED BYTE
241 4 Mouse click Sent when the player clicks somewhere on the game screen. FIXED INT
246 NA Anti-cheat VARIABLE BYTE (BYTE), BYTE, SHORT, BYTE, BYTE, SHORT, (SHORT), (SHORT), BYTE
248 NA Minimap movement 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. VARIABLE BYTE BYTE, LESHORT, (BYTES), LESHORT, NBYTE
249 4 Magic-on-player Sent when a player attempts to cast magic on another player. FIXED SHORTA, LESHORT
252 6 Object action 2 Sent when the player clicks the second option available for an object. FIXED LESHORTA, LESHORT, SHORTA
253 6 Ground item action Sent when the player clicks the first option for a ground item (I.E. 'Light Logs') FIXED LESHORT, LESHORTA, SHORTA

Server Opcodes

Opcode Type Length Name Description
1 FIXED 0 Animation reset Resets all animations in the immediate area.
4
8
24 FIXED 1 Flash sidebar Causes a sidebar icon to start flashing.
27
34
35 FIXED 4 Camera shake Causes the camera to shake.
36
44
50 FIXED 9 Send add friend Sends a friend to the friend list.
53
60
61
64
65
68 FIXED 0 Reset button state Resets the button state for all buttons.
70
71 FIXED 3 Send sidebar interface Assigns an interface to one of the tabs in the game sidebar.
72
73 FIXED 4 Load map region Loads a new map region.
74
75
78
79 FIXED 4 Scroll position Sets the scrollbar position of an interface.
81 VARIABLE Player update Updates local player(s).
84
85
87
97 FIXED 2 Show interface Displays a normal interface.
99 FIXED 1 Minimap State Sets the mini map's state.
101
104
105
106
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.'
117
121
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.
142
147
151
156
160
164 FIXED 2 Chat interface Shows an interface in the chat box.
166
171
174
176 FIXED 10 Open welcome screen Displays the welcome screen.
177
185
187
196 VARIABLE_BYTE N/A Send private message Sends a private message to another player.
200
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.
215
218
219 FIXED 0 Clear screen Clears the screen of all open interfaces.
221 FIXED 1 Friends list status Friends list load status.
230
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.
254

Player Updating

The player updating process consists of 4 parts:

  • a. Our player movement updates
  • b. Other player movement updates
  • c. Player list updating
    • c.a. Apperance updating
    • c.b. Location updating
  • d. Player update block flag-based updates

Our player movement updates

The client begins by reading 1 bit. This bit tells the client whether or not it is currently updating 'our player', or the player the client is controlling.

If it's not updating our player, it exits and goes onto step b. If it is, it then reads 2 bits. The value is called the movement update type.

There are 4 recognized movement update types:

  • Type 0 basically tells the client there is nothing to update for our player, just add its index to the local updating list.
  • Type 1 tells the client you moved in one direction. The client reads 3 bits, which represents the direction you moved in, and then 1 bit, which states whether further update is required. If so, it adds it to the updating list. This is used in walking.
  • Type 2 functions in much of the same way as its previous, only this time it reads two 3 bit values. The first represents the player's last direction, and the second it's current direction. Trailing behind it is also the 1 bit 'update required' flag as type 1. This is used in running.
  • Type 3 on the other hand is different. It reads in 2 bits which represents our player's plane, or its level of height, in the game world.

Only 0-3 inclusive are appropriate planes supported by the client. It then reads 1 bit, which describes whether or not to clear the awaiting-waypoint queue, basically to stop client from further queued stepping, such as used in teleporting. After this, it reads the 'update required' bit, and checks to see if further update is required. Directly after, it reads two 7 bit quantities, representing the new relative X and relative Y coordinates of our player to our current map region's origin. It then sets our players position to the plane, x, and y positions as told to.

Other player movement updates

The client begins by reading an 8 bit value telling the client how many players there are to update. It then enters a loop for each player there is to update.

Inside this loop, the client reads 1 bit. This is the movement update required flag. If the flag is 0, it sets the current updating player's last update cycle time to the current game logic loop cycle time, and adds the player to the local player list. If the flag is not 0, it then reads the movement update type, which is a 2 bit quantity.

The following known types are:

  • 0, the client updates the current player's last update cycle time, adds the current player to the local player list, and adds it to the updating list.
  • 1, the client updates the current player's last update cycle time and adds the current player to the local player list as well, but also reads in 3 bit quantity. This represents the current player's direction it walked to. It then reads the a 1 bit value that specifies whether or not to add the player to the updating list.
  • 2, the client does the exact same thing as the type 2 update, except it reads in two of the 3 bit quantities. The first represents the current player's last direction, and the second its current direction running.
  • 3, the client queues to remove the player from the list of players to be updated but it is possible such as in the instances for when players teleport to add them back to the list of players to be updated during the populate update.

Player list updating

The next step in the player updating procedure is the player list updating, or where the client recieves data on every player in its local list, such as appearance and location relative to ours. The client loops through a process for each player in the updating.

The client reads an 11 bit quantity from the buffer, which is the next player in the updated list to be informed about. The clietn then checks if it has a cached buffer for that player's updating, and if it does, it updates the player appearance.

Appearance updating

Appearance updating starts off by first reading an unsigned byte that represents the current player's gender. Then it reads another unsigned byte that represents the player's over-head icon id. This is used with prayer icons above heads. Next, a loop occurs 12 times to read equipment data.

In the loop, the client reads an unsigned byte that is the equipment slot's item id high byte. If it is 0, the player's equpment slot has no item. If it is not 0, another unsigned byte is read the merged with the previous to create the equipment's item id. If the id is 65535 (written as a -1 signed short), then the player's appearance is that of an NPC. The client reads in an unsigned short representing the NPC's id and sets the player's definition to that NPC's.

After the equipment loop, it loops 5 times, once for each type of coloured body part. In each loop, the client reads an unsigned short and assigns it as the color of the current loop idx (which represents the body part).

Finally, after the color loop, the client reads 7 unsigned shorts representing animation indices; the animations belong to:

  • Standing still
  • Turning while standing
  • Walking
  • Turning around (backwards)
  • Turning a quarter-way clockwise
  • Turning a quarter-way counter clockwise
  • Running

After these animation indices are read, a long representing the player's name is read, an unsigned byte representing the combat level, and an unsigned short representing the players skill level (for things where players arent ranked by levels, such as where it states <player name> (skill <skill>) as an action menu text).

Location updating

After the appearance updating, the client starts to update that player's location relative to our player. The player is added to the local player list and it's last update cycle time. It then reads a 1 bit quantity that defines whether or not the client has a chunk in the player update block list. If it does, it adds it to the updating list. The next bit states whether or not to discard the awaiting-waypoint queue, such as when teleporting. It then reads to 5 bit values that determine the players relative X and Y coordinates to our player. The local player area is 16x16, so if the delta of the two coordinates is > 15, 32 is subtracted from it to signify the player is on the other side of ours. The client then sets the player's position, ending the player list updating process.

Update block flag-based updating

The following is what most people think of when they say 'update mask' and 'update flag'. This process of the updating procedure is very important. It begins with looping through ALL players in the local player update list, reading an unsigned byte which from now on will be called the update flag. All further updates are seen to be 'included' by comparing a bitwise mask to this flag. If the flag has the bits for 0x40 all on, this signifies that the flag was too large for a simple unsigned byte and reads in another unsigned byte, which it uses as the upper unsigned byte, therefore the update flag is an unsigned little-endian short. The client then passes off the data to a helper method which processes all updates this flag signifies.

Inside this method, many different bitwise masks are compared to the player's flag, and if the mask is set, logic is performed. These masks are frequently called update masks. A list of player update masks are below:

  • 0x400: The 0x400 mask is used to update the player so they appear to be asynchronously animating and walking. This mask is often used for the Agility skill. The data associated goes in order of: byte (type C) which is the first location's X coordinate value, byte (type S) which is the first location's Y coordinate value, byte (type S) which is the second location's X coordinate value, byte (type C) the second location's Y coordinate value. After the locations are written, there is a required movement speed which is written as a short which marks how fast to move from position 1 to position 2. Another short (type A) is written as the movement speed going from position 2 to position 1. Finally one byte is written to end the mask block, which marks the direction.
  • 0x100: The 0x100 mask is responsible for player graphics updating. The data associated is a little-endian unsigned short which represents the graphics id, and an int which is the graphics delay.
  • 0x8: Animations are handled by the 0x8 mask. The payload for this update is a little-endian unsigned short that is the animation id, and an unsigned inversed byte (Special C) which states the animation's delay.
  • 0x4: The beloved 0x4 mask takes care of forced player text that is only displayed above the player's model. The only data associated with this is a jagex ASCII string with a terminator of 10.
  • 0x80: Unlike the previous, the 0x80 mask handles normal player chat text. The client will read a little-endian unsigned short which holds chat text attributes. It holds the text color and chat effects. Next, the client reads an unsigned byte which states the player's priveleges (normal player, player moderator, moderator, staff) to give the chatter's name a crown. Right behind it trails an unsigned inversed byte that gives chat text length in bytes. Trailing afterwards is dictionary-compressed chat text. All chat text characters become indexes into a valid character table and are written as nibbles (4 bit quantities).
  • 0x1: Updating the player's current interacting-entity is done via mask 0x1. The entity id is written as a little-endian unsigned short.
  • 0x10: The 0x10 mask updates appearance of the player in exact same way as in updating player list. Only difference is that appearance is updated from a set-sized buffer filled from the current buffer. An unsigned inversed byte is read first which describes appearance buffer size, and the buffer is filled.
  • 0x2: Facing coordinate updating is signified by the 0x2 mask. The player's facing-towards X and Y are set to read values; specifically, an unsigned lower-inverted short and little-endian unsigned short, respectively.
  • 0x20: Notifying client's of a player's health is done via the 0x20 mask. The hitpoint damage done to the player is sent as an unsigned byte, followed by the hit type as a positive inverted byte. The player's current and max health are read as an unsigned inverted byte and unsigned byte, respectively.
  • 0x200: The 0x200 mask acts in the same way as the 0x20 mask and is most likely associated with special attacks from weapons that have the ability to hit twice at the same time. Hitpoint damage is an unsigned byte, the hit type an unsigned inverted byte, and the current and maximum health being an unsigned byte and unsigned inverted byte, respectively.

After the client processes every single player in the update player list, it ends player updating.