mirror of
https://github.com/moparisthebest/rswiki-book
synced 2024-11-16 06:05:03 -05:00
Update MediaWiki page '135 Protocol'
This commit is contained in:
parent
9707f9cdc0
commit
6c113ffcf2
@ -9,38 +9,56 @@ This page refers to the RSC #135 client revision.
|
|||||||
?
|
?
|
||||||
|
|
||||||
== '''Reference''' ==
|
== '''Reference''' ==
|
||||||
A lot of times, Util.longForName is referenced in the packets following:
|
Player usernames are encoded and decoded as a long with the following methods:
|
||||||
<pre>
|
<pre>
|
||||||
public static long longForName(String arg0) {
|
public static long encode_37(String s) {
|
||||||
String s = "";
|
String s1 = "";
|
||||||
for (int i = 0; i < arg0.length(); i++) {
|
for (int i = 0; i < s.length(); i++) {
|
||||||
char c = arg0.charAt(i);
|
char c = s.charAt(i);
|
||||||
if (c >= 'a' && c <= 'z')
|
if (c >= 'a' && c <= 'z')
|
||||||
s = s + c;
|
s1 = s1 + c;
|
||||||
else if (c >= 'A' && c <= 'Z')
|
else if (c >= 'A' && c <= 'Z')
|
||||||
s = s + (char) ((c + 97) - 65);
|
s1 = s1 + (char) ((c + 97) - 65);
|
||||||
else if (c >= '0' && c <= '9')
|
else if (c >= '0' && c <= '9')
|
||||||
s = s + c;
|
s1 = s1 + c;
|
||||||
else
|
else
|
||||||
s = s + ' ';
|
s1 = s1 + ' ';
|
||||||
}
|
}
|
||||||
|
s1 = s1.trim();
|
||||||
s = s.trim();
|
if (s1.length() > 12)
|
||||||
if (s.length() > 12)
|
s1 = s1.substring(0, 12);
|
||||||
s = s.substring(0, 12);
|
|
||||||
long l = 0L;
|
long l = 0L;
|
||||||
for (int j = 0; j < s.length(); j++) {
|
for (int j = 0; j < s1.length(); j++) {
|
||||||
char c1 = s.charAt(j);
|
char c1 = s1.charAt(j);
|
||||||
l *= 37L;
|
l *= 37L;
|
||||||
if (c1 >= 'a' && c1 <= 'z')
|
if (c1 >= 'a' && c1 <= 'z')
|
||||||
l += (1 + c1) - 97;
|
l += (1 + c1) - 97;
|
||||||
else if (c1 >= '0' && c1 <= '9')
|
else if (c1 >= '0' && c1 <= '9')
|
||||||
l += (27 + c1) - 48;
|
l += (27 + c1) - 48;
|
||||||
}
|
}
|
||||||
|
|
||||||
return l;
|
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>
|
</pre>
|
||||||
|
|
||||||
== '''Packets''' ==
|
== '''Packets''' ==
|
||||||
Some 135 packets are documented ahead. First you will find the packets' body, then you will find a table (for easier reading)
|
Some 135 packets are documented ahead. First you will find the packets' body, then you will find a table (for easier reading)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user