Add client functions section

This commit is contained in:
PureCS 2018-07-03 08:17:52 -07:00
parent 193f6c119c
commit fb2efe42f6
9 changed files with 242 additions and 242 deletions

24
src/Censorship.md Normal file
View File

@ -0,0 +1,24 @@
# Censorship
Chat message censorship is applied client-side.
Traditionally, the use of bad words does not always result in a punishment,
unless if applied manually by a staff member.
## Process
There are four related cache files which are loaded and used in censorship.
They are as follows:
| Cache file name | Purpose |
|---|---|
| `fragmentsenc.txt` | ? |
| `badenc.txt` | Contains bad words, including variations (e.g. `fuck`, `fok`, etc.). |
| `domainenc.txt` | Contains bad domain names. |
| `tldlist.txt` | Contains possible top-level domain names. |
When an input is received, if bad phrases are found they are replaced
with a sequence of astericks.
Bad phrases are either a bad word, or a combination of a bad domain name and a top-level domain name.

View File

@ -1,85 +1,89 @@
# Class check
The class check originated with the new Runescape engine update which
took place around the 4xx revisions. It gives the Jagex servers the
ability to check the modifiers, update, or fetch the value for a field.
took place around the 4xx revisions.
It gives the Jagex servers the ability to check the modifiers, update,
or fetch the value for a field.
It also gives functionality to invoke a method with parameters and get
it's return value, or check it's modifiers. Each of these
functionalities are described with a request type. A class check request
is built up with many of these request types. Each request is tagged
with an unique id.
it's return value, or check it's modifiers.
Each of these functionalities are described with a request type.
A class check request is built up with many of these request types.
Each request is tagged with an unique id.
== Request Structure ==
## Request format
+-------------------------+ \| amount requests : ubyte \|
+-------------------------+ \| uid : dword \|
+-------------------------+--------------+------------------------+ \|
for each request \| type : ubyte \| type dependent data... \|
+-------------------------+--------------+------------------------+
```
unsigned byte numberOfRequests;
int uid;
byte[] requests_block;
```
== Response Structure ==
The `requests_block` is comprised of multiple requests, each with the following format:
+---------------------+ \| uid : dword \|
+---------------------+----------------------+------------------------+
\| for each request \| response code : byte \| type dependent data... \|
+---------------------+----------------------+------------------------+
\| payload crc : dword \| +---------------------+
```
unsigned byte type;
type-dependent data;
```
== Request Types ==
## Response format
```
int uid;
byte[] responses_block;
short payloadCrc;
```
The `responses_block` is comprised of multiple responses, each with the following format:
```
byte responseCode;
type-dependent data;
```
## Request Types
For request types 0, 2, 4 there will only be one successful response
code and a dword value of the value being requested will be sent. For
request type 1, only the successful response code will be used but no
code and a short value of the value being requested will be sent.
For request type 1, only the successful response code will be used but no
value will be sent back.
{\| border=2px ! Opcode ! Name ! Description \|- ! 0 ! Fetch Numeric
Field ! Fetches the value of a numeric field. \|- ! 1 ! Update Numeric
Field ! Updates the value of a numeric field. \|- ! 2 ! Get Field
Modifiers ! Gets the modifiers of a field. \|- ! 3 ! Invoke Method !
Invokes a method and sends back its return object. \|- ! 4 ! Get Method
Modifiers ! Gets the modifiers of a method. \|}
| Opcode | Name | Description |
|---|---|---|
| 0 | Fetch fumeric field | Fetches the value of a numeric field. |
| 1 | Update numeric field | Updates the value of a numeric field. |
| 2 | Get field modifiers | Gets the modifiers of a field. |
| 3 | Invoke method | Invokes a method and sends back its return object. |
| 4 | Get method modifiers | Gets the modifiers of a method. |
== Return Codes ==
## Return Codes
All the return codes are in descending priority by numerical order. For
opcode 0, there are cases where a numeric value is sent to the server on
fetch requests. This value is always a dword. For a method invoke
request, there isn't a value that is sent to the server. It is just
assumed that there wasn't a return object from the invoked method.
For opcode 0, there are cases where a numeric value is sent to the server
on fetch requests.
This value is always a short.
{\| border=2px ! Opcode ! Name ! On Receive/Response ! Description \|- !
0 ! Successful ! Response ! Successfully executed the request. \|- ! 1 !
Successful - Returned numeric value ! Response ! Successfully executed
the request, and returned a numeric value. \|- ! 2 ! Successful -
Returned string value ! Response ! Successfully executed the request,
and returned a string value. \|- ! 4 ! Successful - Returned object
value ! Response ! Successfully executed the request, and returned an
object value. \|- ! -1 ! ClassNotFoundException ! Receive ! A
ClassNotFoundException was thrown while receiving a request from the
server. \|- ! -2 ! SecurityException ! Receive ! A SecurityException was
thrown while receiving a request from the server. \|- ! -3 !
NullPointerException ! Receive ! A NullPointerException was thrown while
receiving a request from the server. \|- ! -4 ! Exception ! Receive ! An
Exception was thrown while receiving a request from the server. \|- ! -5
! Throwable ! Receive ! An error or exception was thrown while receiving
a request from the server. \|- ! -10 ! ClassNotFoundException ! Response
! A ClassNotFoundException was thrown while responding to a request from
the server. \|- ! -11 ! InvalidClassException ! Response ! An
InvalidClassException was thrown while responding to a request from the
server. \|- ! -12 ! StreamCorruptedException ! Response ! A
StreamCorruptedException was thrown while responding to a request from
the server. \|- ! -13 ! OptionalDataException ! Response ! An
OptionDataException was thrown while responding to a request from the
server. \|- ! -14 ! IllegalAccessException ! Response ! An
IllegalAccessException was thrown while responding to a request from the
server. \|- ! -15 ! IllegalArgumentException ! Response ! An
IllegalArgumentException was thrown while responding to a request from
the server. \|- ! -16 ! InvocationTargetException ! Response ! An
InvocationTargetException was thrown while responding to a request from
the server. \|- ! -17 ! SecurityException ! Response ! A
SecurityException was thrown while responding to a request from the
server. ! \|- ! -18 ! IOException ! Response ! An IOException was thrown
while responding to a request from the server. \|- ! -19 !
NullPointerException ! Response ! A NullPointerException was thrown
while responding to a request from the server. \|- ! -20 ! Exception !
Response ! An Exception was thrown while responding to a request from
the server. \|- ! -21 ! Throwable ! Response ! An error or exception was
thrown while receiving a request from the server. \|}
For a method invoke request, there isn't a value that is sent to the server.
It is just assumed that there wasn't a return object from the invoked method.
| Opcode | Name | On Receive/Response | Description |
|---|---|---|---|
| 0 | Successful | Response | Successfully executed the request. |
| 1 | Successful - Returned numeric value | Response | Successfully executed the request, and returned a numeric value. |
| 2 | Successful - Returned string value | Response | Successfully executed the request, and returned a string value. |
| 4 | Successful - Returned object value | Response | Successfully executed the request, and returned an object value. |
| -1 | ClassNotFoundException | Receive | A ClassNotFoundException was thrown while receiving a request from the server. |
| -2 | SecurityException | Receive | A SecurityException was thrown while receiving a request from the server. |
| -3 | NullPointerException | Receive | A NullPointerException was thrown while receiving a request from the server. |
| -4 | Exception | Receive | An Exception was thrown while receiving a request from the server. |
| -5 | Throwable | Receive | An error or exception was thrown while receiving a request from the server. |
| -10 | ClassNotFoundException | Response | A ClassNotFoundException was thrown while responding to a request from the server. |
| -11 | InvalidClassException | Response | An InvalidClassException was thrown while responding to a request from the server. |
| -12 | StreamCorruptedException | Response | A StreamCorruptedException was thrown while responding to a request from the server. |
| -13 | OptionDataException | Response | An OptionDataException was thrown while responding to a request from the server. |
| -14 | IllegalAccessException | Response | An IllegalAccessException was thrown while responding to a request from the server. |
| -15 | IllegalArgumentException | Response | An IllegalArgumentException was thrown while responding to a request from the server. |
| -16 | InvocationTargetException | Response | An InvocationTargetException was thrown while responding to a request from the server. |
| -17 | SecurityException | Response | A SecurityException was thrown while responding to a request from the server. |
| -18 | IOException | Response | An IOException was thrown while responding to a request from the server. |
| -19 | NullPointerException | Response | A NullPointerException was thrown while responding to a request from the server. |
| -20 | Exception | Response | An Exception was thrown while responding to a request from the server. |
| -21 | Throwable | Response | An error or exception was thrown while receiving a request from the server. |

7
src/Client-functions.md Normal file
View File

@ -0,0 +1,7 @@
# Client functions
This section will describe the following:
- [Map region system](./Map-Region-System.html)
- [Censorship](./Censorship.html)
- [Mouse coordinate tracking](./Mouse-coordinate-tracking.html)
- [Class-Check](./Class-Check.html)

View File

@ -2,7 +2,7 @@
A source of documentation for the RSC/RS2/RS3 protocols and related systems.
### Navigation
## Navigation
* [About](About.html)
* [Rules](Rules.html)
* [IRC](IRC.html)
@ -10,17 +10,12 @@ A source of documentation for the RSC/RS2/RS3 protocols and related systems.
* [DMCA Policy](DMCA-Policy.html)
* [Privacy Policy](Privacy-policy.html)
### Game Protocol
* [[RSC|Category RSC]] (2001 - 2004)
* [[RS2|Category RS2]] (2004 - 2013)
* [[RS3|Category RS3]] (2013 - present)
## Game Protocol
* RSC (2001 - 2004)
* RS2 (2004 - 2013)
* RS3 (2013 - present)
### Cache
## Cache
* [JAGGRAB protocol](./JAGGRAB-Protocol.html)
* [Ondemand protocol](./Ondemand-Protocol.html)
* [Archive format](./Archive-Format.html)
### Miscellaneous
* [[Custom Data Types|Data Types]]
* [[Map Region System]]

View File

@ -1,120 +1,150 @@
== Intro == Everyone knows that a coordinate system is in place to
navigate through the Runescape world. That coordinate system is based
off upon three variables, the Absolute X, Y Z coordinates. Before we
continue to talk about how these three variables are used in
calculations lets set down some vocabulary:
# Map region system
== Definitions == ===Tile=== A tile is a representation of an absolute
coordinate.
A coordinate system is used to navigate through the RuneScape
world.
That coordinate system is based upon three variables, the absolute
X-, Y-, and Z-coordinates.
''Example: Varrock Coordinates 3211, 3424 represents one tile.''
## Definitions
===Tile Chunk=== A chunk of tiles, 8 x 8 in size. Also known as a region
before the scope of a region was understood. The chunk is considered a
point so it has X and Y coordinates. There are two forms of a Chunk,
formatted and non; a formatted chunks equation is:
A **tile** is the in-game representation of an absolute coordinate.
int chunkX = (getAbsoluteX() \>\> 3) - 6; int chunkY = (getAbsoluteY()
\>\> 3) - 6;
e.g. The coordinates `(3222, 3222)` represents one tile in the heart
of the Lumbridge castle.
A **chunk of tiles**, 8 x 8 in size.
Also known as a region before the scope of a region was understood.
The chunk is considered a point so it has X and Y coordinates.
There are two forms of a Chunk: formatted and non-formatted,
a formatted chunks equation is:
```java
int chunkX = (getAbsoluteX() >> 3) - 6;
int chunkY = (getAbsoluteY() >> 3) - 6;
```
This centers the chunk on the map, more on that later.
The normal chunk equation is:
int chunkX = (getAbsoluteX() \>\> 3); int chunkY = (getAbsoluteY() \>\>
3);
```java
int chunkX = (getAbsoluteX() >> 3);
int chunkY = (getAbsoluteY() >> 3);
```
''Example: The Coordinates \[3211, 3424\] Chunk X (formatted) is 395 and
the Chunk Y (un-formatted) is 428.''
e.g. For the coordinates `(3211, 3424)`, chunk X (formatted) is 395 and
the chunk Y (un-formatted) is 428.''
===Region=== A region is 64 x 64 in size, or 8 x 8 in chunks. The region
is considered a point so it has X and Y coordinates. The equation for
finding the region the coordinates is within is:
## Region
int regionx = (getUnformattedRegionX() \>\> 3);
//getUnformatedRegionX()/8; int regiony = (getUnformattedRegionY() \>\>
3); //getUnformatedRegionY()/8;
A **region** is 64 x 64 in size, or 8 x 8 in chunks.
The region is considered a point so it has X and Y coordinates.
''Example: The Coordinates \[3211, 3424\] Region X is 50 and the Region
Y is 53.''
The equation for finding the region the coordinates is within is:
```java
int regionX = (getUnformattedRegionX() >> 3); // getUnformatedRegionX() / 8;
int regionY = (getUnformattedRegionY() >> 3); // getUnformatedRegionY() / 8;
```
e.g. For the coordinates `(3211, 3424)`, region X is 50, and the
region Y is 53.
Note: The Region X and Region Y coordinates are traditionally not used
in server location calculations; but practical region systems should use
this calculation for many purposes.
===Map=== There is no calculation for a map, and there is no Map X or
Map Y. A Map is, however, a 104 x 104 area made up of 13 x 13 chunks.
Why is the number not even you may ask? Because it has a center. The
\[7, 7\] map chunk of the map is the center, and is also the formatted
chunk. When a region update is called by the server, a new map is
called, but you must understand that the formatted chunk never changes;
the tiles in the map, however, are updated and trimmed. When the player
moves out of the formatted chunk, the map is re-positioned to make that
chunk the center yet again. As I said, a new update is not needed every
time the player enters a new region, but when the range of +- 32 from
the point in the center of the chunk is reached, an update is required
to update the map to the new objects so that the 'black space' or fog is
not reached. Confused?
## Map
===Diagram=== \[http://i.imgur.com/C3huO.png External Image\]
There is no calculation for a map, and there is no Map X or Map Y.
The active chunk is the chunk in which the player resides. The definite
rendering chunks are the chunks in which will be rendered on the players
screen no matter where they are in the active chunk. The indefinite
rendering chunks are the chunks in which depending on where the player
is within the active chunk they may be rendered or not. Remember this
depends on the +- distance of 32 from the players absolute position. The
queue chunks are pre-loaded chunks in which after the active chunk is
moved may be disposed of or activated depending upon the direction in
which the active chunk changes.
A Map is, however, a 104 x 104 area made up of 13 x 13 chunks.
Why is the number not even you may ask?
Because it has a center.
The `(7, 7)` map chunk of the map is the center, and is also the formatted
chunk.
==Loading==
When a region update is called by the server, a new map is called, but you
must understand that the formatted chunk never changes; the tiles in the
map, however, are updated and trimmed.
When the player moves out of the formatted chunk, the map is re-positioned
to make that chunk the center yet again.
As stated, a new update is not needed every time the player enters a
new region, but when the range of +- 32 from the point in the center of
the chunk is reached, an update is required to update the map to the
new objects so that the 'black space' or fog is not reached. Confused?
These were the regions loaded for the coordinates \[3183, 3217\]:
## Diagram
\[http://i.imgur.com/ydl78.png External Image\]
![Diagram](./img/map-region-system-diagram.png)
The active chunk is the chunk in which the player resides.
The definite rendering chunks are the chunks in which will be rendered
on the players screen no matter where they are in the active chunk.
The indefinite rendering chunks are the chunks in which depending on
where the player is within the active chunk they may be rendered or not.
Remember this depends on the +- distance of 32 from the players
absolute position. The queue chunks are pre-loaded chunks in whichafter the
active chunk is moved may be disposed of or activated depending upon the
direction in which the active chunk changes.
## Loading
The following were the regions loaded for the coordinates `(3183, 3217)`:
![Loading diagram](./img/map-region-system-loading.png)
If you can imagine a puzzle, a 64 x 64 piece does not fit equally within
the 104 x 104 area. So bits of each region are taken that are within the
104 x 104 map area.
the 104 x 104 area.
So, bits of each region are taken that are within the 104 x 104 map area.
The amount of regions that are to be loaded can be calculated this way:
Please note that Region X and Region Y are not formatted.
int amt = 0; for(int i21 = (player.getLocation().getRegionX() - 6) / 8;
i21 \<= (player.getLocation().getRegionX() + 6) / 8; i21++) { for(int
k23 = (player.getLocation().getRegionY() - 6) / 8; k23 \<=
(player.getLocation().getRegionY() + 6) / 8; k23++) amt++; }
```java
int amt = 0;
for (int i21 = (player.getLocation().getRegionX() - 6) / 8; i21 <= (player.getLocation().getRegionX() + 6) / 8; i21++) {
for (int k23 = (player.getLocation().getRegionY() - 6) / 8; k23 <= (player.getLocation().getRegionY() + 6) / 8; k23++)
amt++;
}
```
Along with this, the base X and base Y of each of the region can be
calculated:
for(int i21 = (player.getLocation().getRegionX() - 6) / 8; i21 \<=
(player.getLocation().getRegionX() + 6) / 8; i21++) { for(int k23 =
(player.getLocation().getRegionY() - 6) / 8; k23 \<=
(player.getLocation().getRegionY() + 6) / 8; k23++)
System.out.println(i21+\" X "+(i21 \<\< 6)+","+k23+" Y \"+(k23 \<\<
6));;; }
```java
for (int i21 = (player.getLocation().getRegionX() - 6) / 8; i21 <= (player.getLocation().getRegionX() + 6) / 8; i21++) {
for (int k23 = (player.getLocation().getRegionY() - 6) / 8; k23 <= (player.getLocation().getRegionY() + 6) / 8; k23++)
System.out.println(i21 + " X " + (i21 << 6) + "," + k23 + " Y " + (k23 << 6));;;
}
```
The 'X' and 'Y' coordinates represents the coordinates of the region as
depicted in the diagram. After the regions are loaded they are trimmed
to the tiles that are necessary.
Well hope this gave you some idea of how regions are loaded and such,
tell me if you need explanation on anything.
## Example Location class
Heres an example of a location class that I wrote, sorry for the lack of
comments. If you read everything then this should make sense:
The following is an example Location class written by sinisoul.
It is not heavily commented due to it being a very simple class,
and it should be easy to follow if you read this section in full.
package net.forge.content.world.node; /\*\* \* RuneForge \| 317 \*
Location.java \* @version 1.0.0 \* @author SiniSoul (SiniSoul\@live.com)
\*/ public final class Location {
```java
package net.forge.content.world.node;
/**
* RuneForge (317)
* @version 1.0.0
* @author SiniSoul (SiniSoul@live.com)
*/
public final class Location {
/**
* The Tile X and Y coordinates.
*/
private int tilex = 0,
private int tilex = 0,
tiley = 0;
/**
@ -128,174 +158,96 @@ Location.java \* @version 1.0.0 \* @author SiniSoul (SiniSoul\@live.com)
private int chunkx = 0,
chunky = 0;
/**
*
* @param tilex
*/
public void setTileX(int tilex) {
this.tilex = (tilex & 0xFFFF);
}
/**
*
* @return
*/
public int getTileX() {
return tilex;
}
/**
*
* @param tilex
*/
public void setTileY(int tiley) {
this.tiley = (tiley & 0xFFFF);
}
/**
*
* @return
*/
public int getTileY() {
return tiley;
}
/**
*
* @param formated If the chunk is formatted for map positioning or
* @param formatted If the chunk is formatted for map positioning or
* other formatted chunk comparison.
* @return
*/
public int calculateChunkX(boolean formated) {
return formated ? (getTileX() >> 3) - 6 : (getTileX() >> 3);
public int calculateChunkX(boolean formatted) {
return formatted ? (getTileX() >> 3) - 6 : (getTileX() >> 3);
}
/**
*
* @param formated If the chunk is formatted for map positioning or
* @param formatted If the chunk is formatted for map positioning or
* other formatted chunk comparison.
* @return
*/
public int calculateChunkY(boolean formated) {
return formated ? (getTileY() >> 3) - 6 : (getTileY() >> 3);
public int calculateChunkY(boolean formatted) {
return formatted ? (getTileY() >> 3) - 6 : (getTileY() >> 3);
}
/**
*
*/
public void updateChunkX() {
this.chunkx = calculateChunkX(true);
}
/**
*
*/
public void updateChunkY() {
this.chunkx = calculateChunkY(true);
}
/**
*
* @return
*/
public int getChunkX() {
return chunkx;
}
/**
*
* @return
*/
public int getMapLocalX() {
return getTileX() - (getChunkX() << 3);
}
/**
*
* @return
*/
public int getChunkY() {
return chunky;
}
/**
*
* @return
*/
public int getMapLocalY() {
return getTileX() - (getChunkY() << 3);
}
/**
*
* @param height
*/
public void setHeight(int height) {
this.height = (height & 0x3);
}
/**
*
* @return
*/
public int getHeight() {
return height;
}
/**
*
* @return
*/
public int getRegionX() {
return calculateChunkX(false) >> 3;
}
/**
*
* @return
*/
public int getRegionLocalX() {
return getTileX() - (getRegionX() << 6);
}
/**
*
* @return
*/
public int getRegionY() {
return calculateChunkY(false) >> 3;
}
/**
*
* @return
*/
public int getRegionLocalY() {
return getTileY() - (getRegionY() << 6);
}
/**
*
* @param tilex
* @param tiley
* @param height
*/
public void set(int tilex, int tiley, int height) {
setTileX(tilex);
setTileY(tiley);
setHeight(height);
}
/**
*
* @param tilex
* @param tiley
* @param height
*/
public Location(int tilex, int tiley, int height) {
set(tilex, tiley, height);
updateChunkX();
updateChunkY();
}
}
```

View File

@ -0,0 +1,16 @@
# Mouse coordinate tracking
There is a mechanicsm of mouse coordinate tracking within the client.
This records the `(x, y)` coordinates of the mouse, and sends them
back to the server each tick.
When the client connects with the server, after it receives
the player privilege, it receives a byte denoting whether or not
the client should send these coordinates to the server periodically.
## Packet structure
```
byte opcode = 45;
byte dummy = 0;
byte[] mouse_data;
```

View File

@ -18,9 +18,11 @@
- [Ondemand protocol](./Ondemand-Protocol.md)
- [Archive format](./Archive-Format.md)
- [OB3](./OB3.md)
- [Class-Check](./Class-Check.md)
- [Map-Region-System](./Map-Region-System.md)
- [RS-String](./RS-String.md)
- [Client functions](./Client-functions.md)
- [Map region system](./Map-Region-System.md)
- [Censorship](./Censorship.md)
- [Mouse coordinate tracking](./Mouse-coordinate-tracking.md)
- [Class-Check](./Class-Check.md)
- [Template-Packet](./Template-Packet.md)
- [135-Protocol](./135-Protocol.md)
- [194-Clear-screen](./194-Clear-screen.md)

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB