rswiki-book/135-Protocol.mediawiki

111 lines
2.3 KiB
Plaintext
Raw Normal View History

2012-11-07 08:54:36 -05:00
[[Category RSC]]
This page refers to the RSC #135 client revision.
== '''Packet structure''' ==
?
== '''Login''' ==
?
== '''Incoming Data''' ==
'''TODO:'''
<pre>
</pre>
<table border="1" cellpadding="3" cellspacing="3">
<tr>
<td><b>opcode</b></td>
<td><b>usage</b></td>
<td><b>size</b></td>
<td><b>payload</b></td>
</tr>
<tr>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
</table>
== '''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
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)))
;; 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
(let [name (Util/name-for-long username)]
(doto stream
(.begin-packet 29)
(.put-int64 name)
(.end-packet))))
2012-11-07 08:54:36 -05:00
</pre>
<table border="1" cellpadding="3" cellspacing="3">
<tr>
<td><b>opcode</b></td>
<td><b>usage</b></td>
<td><b>size</b></td>
<td><b>payload</b></td>
</tr>
<tr>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
</table>