rswiki-book/135-Protocol.mediawiki

140 lines
3.2 KiB
Plaintext

[[Category RSC]]
This page refers to the RSC #135 client revision.
== '''Packet structure''' ==
?
== '''Login''' ==
?
== '''Incoming Data''' ==
'''TODO:'''
<pre>
</pre>
== '''Outgoing Data''' ==
<pre>
(ns rsc.135.packets
(: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
(defn logout [stream]
(doto stream
(.begin-packet 6)
(.end-packet)))
;; Opcode: 7
(defn send-command [stream command] ; sends command to server e.g ::home, command arg is (.substring command 2)
(doto stream
(.begin-packet 7)
(.putline command)
(.end-packet)))
;; Opcode: 10
(defn report-abuse [stream username]
(let [name (.substring username 12)
l5 (Util/long-for-name name)]
(doto stream
(.begin-packet 10)
(.put-int64 l5)
(.end-packet))))
;; 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)))
;; Opcode: 27
(defn remove-friend [stream name] ; name is long represenation of username (i.e Util/long-for-name username)
(doto stream
(.begin-packet 27)
(.put-int64 name)
(.end-packet)))
;; 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]
(doto stream
(.begin-packet 28)
(.put-int64 username)
(.read-bytes message 0 length)
(.end-packet)))
;; Opcode: 29
(defn add-ignore [stream username] ; username is string representation of username
(let [name (Util/name-for-long username)]
(doto stream
(.begin-packet 29)
(.put-int64 name)
(.end-packet))))
</pre>
{| class="wikitable"
|+ Outgoing Packets
|-
! Name
! Opcode
! Payload
! Description
|-
! Newplayer (Registration)
| 2 ||
* Short - Unknown
* Long - Long represenation of username
* Short - Referrer ID
** Integer.parseInt(getParameter("referrerid"));
* Line-RSA - Password, server session ID, bigintegers
| Registers a new user (probably not used in private servers)
|-
! Logout
| 6 ||
* None
| Sends the logout packet to the server
|-
! Execute 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 represenation 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
|}