2012-11-07 08:54:36 -05:00
[[Category RSC]]
This page refers to the RSC #135 client revision.
== '''Packet structure''' ==
?
== '''Login''' ==
?
2012-11-08 12:55:34 -05:00
=='''Reference'''==
A lot of times, Util.longForName is referenced in the packets following:
<pre>
public static long longForName(String arg0) {
String s = "";
for (int i = 0; i < arg0.length(); i++) {
char c = arg0.charAt(i);
if (c >= 'a' && c <= 'z')
s = s + c;
else if (c >= 'A' && c <= 'Z')
s = s + (char) ((c + 97) - 65);
else if (c >= '0' && c <= '9')
s = s + c;
else
s = s + ' ';
}
s = s.trim();
if (s.length() > 12)
s = s.substring(0, 12);
long l = 0L;
for (int j = 0; j < s.length(); j++) {
char c1 = s.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;
}
</pre>
2012-11-07 08:54:36 -05:00
== '''Incoming Data''' ==
'''TODO:'''
<pre>
</pre>
== '''Outgoing Data''' ==
<pre>
2012-11-08 12:58:29 -05:00
(ns rsc.rsc135.packets
(:require [jagex.Util])
2012-11-07 08:54:36 -05:00
(:use [jagex.client.SocketStream]))
;; Opcode: 2
(defn newplayer [stream]
(doto stream
(.begin-packet 2)
(.put-int16 ???)
(.put-int64 (Util/long-for-name username))
(.put-int16 referrerid)
(.putline-rsa password server-session-id key-a key-b) ; keys for RSA?
(.flush)
(.read) ; newplayer response
(.end-packet)))
;; Opcode: 6
2012-11-07 09:52:56 -05:00
(defn logout [stream]
2012-11-07 08:54:36 -05:00
(doto stream
(.begin-packet 6)
(.end-packet)))
2012-11-08 11:05:41 -05:00
;; Opcode: 7
(defn send-command [stream command] ; sends command to server e.g ::home, command arg is (.substring command 2)
(doto stream
2012-11-08 12:46:13 -05:00
(.begin-packet 7)
2012-11-08 11:05:41 -05:00
(.putline command)
(.end-packet)))
2012-11-07 08:54:36 -05:00
;; Opcode: 10
(defn report-abuse [stream username]
(let [name (.substring username 12)
2012-11-08 10:53:03 -05:00
l5 (Util/long-for-name name)]
2012-11-07 08:54:36 -05:00
(doto stream
(.begin-packet 10)
(.put-int64 l5)
(.end-packet))))
2012-11-07 17:16:38 -05:00
;; Opcode: 26
(defn add-friend [stream name] ; name is string represenation of username
(doto stream
(.begin-packet 26)
(.put-int64 (Util/long-for-name name)
(.end-packet)))
2012-11-07 08:54:36 -05:00
;; Opcode: 27
2012-11-07 17:16:38 -05:00
(defn remove-friend [stream name] ; name is long represenation of username (i.e Util/long-for-name username)
2012-11-07 08:54:36 -05:00
(doto stream
(.begin-packet 27)
(.put-int64 name)
(.end-packet)))
2012-11-07 17:16:38 -05:00
2012-11-08 10:51:40 -05:00
;; Opcode: 28
;; name is long representation of username, message is byte representation of message (.getBytes message), length is length of message (maximum length is 200)
(defn send-message [stream name message length]
2012-11-08 10:53:03 -05:00
(doto stream
(.begin-packet 28)
(.put-int64 username)
(.read-bytes message 0 length)
(.end-packet)))
2012-11-08 10:51:40 -05:00
2012-11-07 17:16:38 -05:00
;; Opcode: 29
(defn add-ignore [stream username] ; username is string representation of username
2012-11-08 12:55:34 -05:00
(let [name (Util/long-for-name username)]
2012-11-07 17:16:38 -05:00
(doto stream
(.begin-packet 29)
(.put-int64 name)
(.end-packet))))
2012-11-07 08:54:36 -05:00
</pre>
2012-11-08 12:10:49 -05:00
{| class="wikitable"
2012-11-08 12:01:18 -05:00
|+ Outgoing Packets
2012-11-08 11:56:46 -05:00
|-
2012-11-08 12:01:18 -05:00
! Name
! Opcode
! Payload
2012-11-08 12:08:49 -05:00
! Description
2012-11-08 11:56:46 -05:00
|-
2012-11-08 12:05:17 -05:00
! Newplayer (Registration)
| 2 ||
2012-11-08 12:51:37 -05:00
* Short - Unknown
* Long - Long represenation of username
* Short - Referrer ID
2012-11-08 12:05:17 -05:00
** Integer.parseInt(getParameter("referrerid"));
2012-11-08 12:51:37 -05:00
* Line-RSA - Password, server session ID, bigintegers
2012-11-08 12:08:49 -05:00
| Registers a new user (probably not used in private servers)
|-
! Logout
| 6 ||
2012-11-08 12:10:49 -05:00
* None
2012-11-08 12:08:49 -05:00
| Sends the logout packet to the server
2012-11-08 12:05:53 -05:00
|-
2012-11-08 12:51:37 -05:00
! Execute Command
2012-11-08 12:46:13 -05:00
| 7 ||
* String - The command
| Sends a command to the server to be executed
|-
2012-11-08 12:51:37 -05:00
! Report Abuse
| 10 ||
* Long - The long representation of the username of the user to report
| Sends an abuse report to the server
|-
! Add Friend
2012-11-08 12:01:18 -05:00
| 26 ||
2012-11-08 12:05:17 -05:00
* Long - long represenation of username
2012-11-08 12:08:49 -05:00
| Adds a user to your friends list
2012-11-08 12:51:37 -05:00
|-
! 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
2012-11-08 12:01:18 -05:00
|}