mirror of
https://github.com/moparisthebest/rswiki-book
synced 2024-12-24 16:28:52 -05:00
420 lines
9.9 KiB
Plaintext
420 lines
9.9 KiB
Plaintext
[[Category RSC]]
|
|
This page refers to the RSC #135 client revision.
|
|
|
|
|
|
== '''Packet structure''' ==
|
|
?
|
|
|
|
== '''Login''' ==
|
|
?
|
|
|
|
== '''Reference''' ==
|
|
Player usernames can be encoded and decoded as a long with the following methods:
|
|
<pre>
|
|
public static long encode_37(String s) {
|
|
String s1 = "";
|
|
for (int i = 0; i < s.length(); i++) {
|
|
char c = s.charAt(i);
|
|
if (c >= 'a' && c <= 'z')
|
|
s1 = s1 + c;
|
|
else if (c >= 'A' && c <= 'Z')
|
|
s1 = s1 + (char) ((c + 97) - 65);
|
|
else if (c >= '0' && c <= '9')
|
|
s1 = s1 + c;
|
|
else
|
|
s1 = s1 + ' ';
|
|
}
|
|
s1 = s1.trim();
|
|
if (s1.length() > 12)
|
|
s1 = s1.substring(0, 12);
|
|
long l = 0L;
|
|
for (int j = 0; j < s1.length(); j++) {
|
|
char c1 = s1.charAt(j);
|
|
l *= 37L;
|
|
if (c1 >= 'a' && c1 <= 'z')
|
|
l += (1 + c1) - 97;
|
|
else if (c1 >= '0' && c1 <= '9')
|
|
l += (27 + c1) - 48;
|
|
}
|
|
return l;
|
|
}
|
|
|
|
public static String decode_37(long l) {
|
|
String s = "";
|
|
while (l != 0L) {
|
|
int i = (int) (l % 37L);
|
|
l /= 37L;
|
|
if (i == 0) {
|
|
s = " " + s;
|
|
} else if (i < 27) {
|
|
if (l % 37L == 0L)
|
|
s = (char) ((i + 65) - 1) + s;
|
|
else
|
|
s = (char) ((i + 97) - 1) + s;
|
|
} else {
|
|
s = (char) ((i + 48) - 27) + s;
|
|
}
|
|
}
|
|
return s;
|
|
}
|
|
</pre>
|
|
|
|
== '''Packets''' ==
|
|
The packet opcodes are unchanged from previous revisions, presumably this was before the protocol was being regularly modified to deter the developers of bots such as [[AutoRune]]. The payload/structure is quite similar to most other RSC revisions.
|
|
|
|
=== '''Incoming Data''' ===
|
|
'''TODO:'''
|
|
{| class="wikitable"
|
|
|-
|
|
! Name
|
|
! Opcode
|
|
! Payload
|
|
! Description
|
|
|-
|
|
|}
|
|
|
|
{| class="wikitable"
|
|
|-
|
|
! Login Response
|
|
! Description
|
|
|-
|
|
|}
|
|
|
|
{| class="wikitable"
|
|
|-
|
|
! Newplayer Response
|
|
! Description
|
|
|-
|
|
|}
|
|
|
|
=== '''Outgoing Data''' ===
|
|
'''TODO: Dueling, document 254'''
|
|
{| class="wikitable"
|
|
|-
|
|
! Name
|
|
! Opcode
|
|
! Payload
|
|
! Description
|
|
|-
|
|
! Disconnect
|
|
| 1 ||
|
|
* None
|
|
| Sends the disconnect packet
|
|
|-
|
|
! Newplayer (Registration)
|
|
| 2 ||
|
|
* Short - The client's revision number (135)
|
|
* Long - Long representation of the username
|
|
* Short - Referrer ID
|
|
** Integer.parseInt(getParameter("referrerid"));
|
|
* Line-RSA - Password, server session ID, bigintegers
|
|
* Int - The "ranseed" value
|
|
| Registers a new user.
|
|
|-
|
|
! Login
|
|
| 0 or 19 ||
|
|
* Short - The client's revision number (135)
|
|
* Long - Long representation of the username
|
|
* Line-RSA - Password, server session ID, bigintegers
|
|
* Int - The "ranseed" value
|
|
| Logs the player in. The opcode is 19 when the player is reconnecting after being disconnected.
|
|
|-
|
|
! Logout
|
|
| 6 ||
|
|
* None
|
|
| Sends the logout packet to the server
|
|
|-
|
|
! Admin Command
|
|
| 7 ||
|
|
* String - The command
|
|
| Sends a command to the server to be executed
|
|
|-
|
|
! Report Abuse
|
|
| 10 ||
|
|
* Long - The long representation of the username of the user to report
|
|
| Sends an abuse report to the server
|
|
|-
|
|
! Add Friend
|
|
| 26 ||
|
|
* Long - long representation of username
|
|
| Adds a user to your friends list
|
|
|-
|
|
! Remove Friend
|
|
| 27 ||
|
|
* Long - The long representation of the username of the user to report
|
|
| Removes a user from your friends list
|
|
|-
|
|
! Send Message
|
|
| 28 ||
|
|
* Long - The long representation of the username of the user to send the message to
|
|
* Byte[] - A byte array containing the bytes of the message to send to the user
|
|
| Sends a message to the specified user
|
|
|-
|
|
! Ignore User
|
|
| 29 ||
|
|
* Long - The long representation of the username of the user to ignore
|
|
| Adds a user to your ignore list
|
|
|-
|
|
! Walk to Tile
|
|
| 255 ||
|
|
* Short - (start_x + area_x). The initial position.
|
|
* Short - (start_y + area_y)
|
|
* Byte... - (route_x[i] - start_x)
|
|
* Byte... - (route_y[i] - start_y)
|
|
| Variable length. Walks to a tile. The number of steps can be calculated by dividing the available data by 2.
|
|
|-
|
|
! Walk to Entity
|
|
| 215 ||
|
|
* The same as 255.
|
|
| Variable length. Walks to an entity. The number of steps can be calculated by dividing the available data by 2.
|
|
|-
|
|
! Acknowledge Players
|
|
| 254 ||
|
|
* Short - Size?
|
|
* Short... - The player's server index
|
|
* Short... - ???
|
|
| Variable length. Informs the server of new players. Why?
|
|
|-
|
|
! Drop Item
|
|
| 251 ||
|
|
* Short - The slot of the item to drop
|
|
| Drops the specified item on the ground
|
|
|-
|
|
! Cast on Item
|
|
| 220 ||
|
|
* Short - The slot of the item to cast a spell on
|
|
* Short - The id of the spell to cast
|
|
| Casts a spell (such as High Alchemy) on the specified item
|
|
|-
|
|
! Use with Item
|
|
| 240 ||
|
|
* Short - The slot of the first item to use
|
|
* Short - The slot of the second item to use
|
|
| Uses an item in the player's inventory with another item in the player's inventory
|
|
|-
|
|
! Remove Item
|
|
| 248 ||
|
|
* Short - The slot of the item to unequip
|
|
| Unequips the specified inventory item
|
|
|-
|
|
! Wear Item
|
|
| 249 ||
|
|
* Short - The slot of the item to equip
|
|
| Equips the specified inventory item
|
|
|-
|
|
! Item Command
|
|
| 246 ||
|
|
* Short - The slot of the item to use
|
|
| Buries, eats, etc the specified inventory item
|
|
|-
|
|
! Select Option
|
|
| 237 ||
|
|
* Byte - The position of the option in the dialog_options array
|
|
| Selects an option in a dialog (dialog referring to, for example, the menu displayed when certing)
|
|
|-
|
|
! Combat Style
|
|
| 231 ||
|
|
* Byte - The position of the combat style in the list
|
|
| Sets the player's combat style.
|
|
* 0 - Controlled
|
|
* 1 - Aggressive
|
|
* 2 - Accurate
|
|
* 3 - Defensive
|
|
|-
|
|
! Close Bank
|
|
| 207 ||
|
|
* None
|
|
| Informs the server that the player has closed the banking interface.
|
|
|-
|
|
! Withdraw Item
|
|
| 206 ||
|
|
* Short - The ID of the item to withdraw
|
|
* Short - The amount of the specified item to withdraw
|
|
| Withdraws a single type of item from the player's bank.
|
|
|-
|
|
! Deposit Item
|
|
| 205 ||
|
|
* Short - The ID of the item to deposit
|
|
* Short - The amount of the specified item to deposit
|
|
| Deposits a single type of item into the player's bank.
|
|
|-
|
|
! Disable Prayer
|
|
| 211 ||
|
|
* Byte - The ID of the prayer to disable
|
|
| Disables a prayer.
|
|
|-
|
|
! Enable Prayer
|
|
| 212 ||
|
|
* Byte - The ID of the prayer to enable
|
|
| Enables a prayer.
|
|
|-
|
|
! Confirm Trade
|
|
| 202 ||
|
|
* None
|
|
| Confirms the trade offer.
|
|
|-
|
|
! Accept Trade
|
|
| 232 ||
|
|
* None
|
|
| Accepts the trade offer.
|
|
|-
|
|
! Decline Trade
|
|
| 233 ||
|
|
* None
|
|
| Declines the trade offer.
|
|
|-
|
|
! Trade Update
|
|
| 234 ||
|
|
* Byte - The amount of traded items to send to the server
|
|
* Short... - The id of the item
|
|
* Int... - The amount/stack size of the item
|
|
| Variable length. Updates the trade offer.
|
|
|-
|
|
! Cast on GItem
|
|
| 224* ||
|
|
* Short - The item's X coordinate
|
|
* Short - The item's Y coordinate
|
|
* Short - The item's ID
|
|
* Short - The spell's ID
|
|
| Casts a spell on an item on the ground.
|
|
|-
|
|
! Use with GItem
|
|
| 250* ||
|
|
* Short - The item's X coordinate
|
|
* Short - The item's Y coordinate
|
|
* Short - The item's ID
|
|
* Short - The inventory slot
|
|
| Uses an item in the player's inventory with an item on the ground.
|
|
|-
|
|
! Take GItem
|
|
| 252* ||
|
|
* Short - The item's X coordinate
|
|
* Short - The item's Y coordinate
|
|
* Short - The item's ID
|
|
| Picks up an item on the ground.
|
|
|-
|
|
! Cast on Boundary
|
|
| 223* ||
|
|
* Short - The bound's X coordinate
|
|
* Short - The bound's Y coordinate
|
|
* Byte - The bound's direction
|
|
* Short - The spell's ID
|
|
| Casts a spell on a boundary (or 'wall object').
|
|
|-
|
|
! Use with Boundary
|
|
| 239* ||
|
|
* Short - The bound's X coordinate
|
|
* Short - The bound's Y coordinate
|
|
* Byte - The bound's direction
|
|
* Short - The inventory slot
|
|
| Uses an item in the player's inventory with a boundary (or 'wall object').
|
|
|-
|
|
! Boundary Cmd 1
|
|
| 238* ||
|
|
* Short - The bound's X coordinate
|
|
* Short - The bound's Y coordinate
|
|
* Byte - The bound's direction
|
|
| Performs the primary action (usually 'open') on a boundary (or 'wall object').
|
|
|-
|
|
! Boundary Cmd 2
|
|
| 229* ||
|
|
* Short - The bound's X coordinate
|
|
* Short - The bound's Y coordinate
|
|
* Byte - The bound's direction
|
|
| Performs the secondary action (usually 'close' or 'picklock') on a boundary (or 'wall object').
|
|
|-
|
|
! Cast on Object
|
|
| 222* ||
|
|
* Short - The object's X coordinate
|
|
* Short - The object's Y coordinate
|
|
* Short - The spell's ID
|
|
| Casts a spell on an object. Unused?
|
|
|-
|
|
! Use with Object
|
|
| 241* ||
|
|
* Short - The object's X coordinate
|
|
* Short - The object's Y coordinate
|
|
* Short - The inventory slot
|
|
| Uses an item in the player's inventory with an object.
|
|
|-
|
|
! Object Cmd 1
|
|
| 241* ||
|
|
* Short - The object's X coordinate
|
|
* Short - The object's Y coordinate
|
|
| Performs the primary action on an object (for example, 'mine').
|
|
|-
|
|
! Object Cmd 2
|
|
| 230* ||
|
|
* Short - The object's X coordinate
|
|
* Short - The object's Y coordinate
|
|
| Performs the secondary action on an object (for example, 'prospect').
|
|
|-
|
|
! Cast on NPC
|
|
| 225* ||
|
|
* Short - The NPC's server index
|
|
* Short - The spell's ID
|
|
| Casts a spell on a non-player character.
|
|
|-
|
|
! Use with NPC
|
|
| 243* ||
|
|
* Short - The NPC's server index
|
|
* Short - The inventory slot
|
|
| Uses an item in the player's inventory with a non-player character.
|
|
|-
|
|
! Talk to NPC
|
|
| 245* ||
|
|
* Short - The NPC's server index
|
|
| Starts talking to a non-player character.
|
|
|-
|
|
! Attack NPC
|
|
| 244* ||
|
|
* Short - The NPC's server index
|
|
| Starts attacking a non-player character.
|
|
|-
|
|
! NPC Cmd 2
|
|
| 195* ||
|
|
* Short - The NPC's server index
|
|
| Performs the secondary action on a non-player character, usually 'pickpocket'.
|
|
|-
|
|
! Cast on Player
|
|
| 226* ||
|
|
* Short - The player's server index
|
|
* Short - The spell's ID
|
|
| Casts a spell on another player.
|
|
|-
|
|
! Use with Player
|
|
| 219* ||
|
|
* Short - The player's server index
|
|
* Short - The inventory slot
|
|
| Uses an item (for example, a Gnomeball, or a Christmas cracker) on another player.
|
|
|-
|
|
! Attack Player
|
|
| 228* ||
|
|
* Short - The player's server index
|
|
| Starts attacking another player.
|
|
|-
|
|
! Trade Player
|
|
| 235 ||
|
|
* Short - The player's server index
|
|
| Sends a trade request to another player.
|
|
|-
|
|
! Follow Player
|
|
| 214 ||
|
|
* Short - The player's server index
|
|
| Starts following another player.
|
|
|-
|
|
! Duel Player
|
|
| 204 ||
|
|
* Short - The player's server index
|
|
| Sends a duel request to another player.
|
|
|-
|
|
! RuntimeException
|
|
| 17 ||
|
|
* String - The text of the error.
|
|
| Sent when the client throws an exception while processing data sent by the server.
|
|
|}
|
|
|
|
Notes:
|
|
|
|
* "ranseed" does not seed anything. RSC135 does not use ISAAC ciphering. It is an applet parameter or read from uid.dat. Presumably, it was used to identify players connecting from the same computer.
|
|
* Opcodes marked with * are preceded by 215. |