A console based modular client for Realm of the Mad God built with Node.js and TypeScript.
This software was originally written by Thomas Crane and you can find the original version for flash here
All credit goes to Thomas for writing this and the only commits I am making are to allow the project keep working with the RotMG Unity client.
The following changes have been made to nrelay to port it over to Unity:
- The auto-updater has been completely removed as there is now no way to download the current Unity client and parse the assets
- Because of the above, the
--no-update
,--force-update
and--update-from
arguments have been removed - The incoming and outgoing RC4 cipher keys have changed in the realmlib library
- All HTTP requests made to the appspot now use the same headers as the Unity client, mainly the
User-Agent
and theX-Unity-Version
to avoid clients being banned - DECA's CompressedInt type has been added to the realmlib library and some packet structures have been updated accordingly
- Added the
QUEUE_INFO
packet due to servers now possibly having a player queue - the client will now wait a reasonable time before trying to reconnect - Various other packets have been added and updated
The documentation in this repository consists mostly of guides and tutorials about how to use nrelay and its components, and how to create plugins. All of the docs can be found in the docs folder.
There is also extensive inline API documentation, which can be viewed on the docs website.
Make sure you have Nodejs v12+ installed before running nrelay.
- Install the nrelay cli:
npm install -g nrelay-cli
- Create a new nrelay project:
nrelay new my-new-project
- Navigate to the project folder:
cd my-new-project
When you create a new nrelay project, you will need to set up your accounts.json
file. It will be generated for you, but only contains an example account.
The contents of the file will resemble the following.
[
{
"alias": "Main Client",
"guid": "example@email.com",
"password": "password1",
"serverPref": "Australia"
}
]
To use your own account, simply replace the guid
and password
values with your own account's email and password.
If you have multiple accounts which you want to run at the same time, you can add them by duplicating the segment in the curly braces { ... }
. E.g.
[
{
"alias": "Main Client",
"guid": "first.account@email.com",
"password": "SecretPassWord11",
"serverPref": "AsiaSouthEast"
},
{
"alias": "Secondary Client",
"guid": "second.account@email.com",
"password": "Password22",
"serverPref": "USSouth"
}
]
nrelay supports the use of SOCKSv4, SOCKSv4a, and SOCKSv5 proxies to route client connections through. Proxies can be added in the account config as a property of the account
If a proxy is specified, nrelay will route all traffic including the initial web request to get the character lists. Because of this, there may be greater delays when using proxies.
The proxy a client is using can also be changed during runtime by using the Client.setProxy(proxy: IProxy): void
method.
nrelay has a built in Local Server which can be used to transfer data between nrelay and another process, such as KRelay. If you are interested in using the local server, take a look at the local server guide.
After setting up the accounts.json
file, nrelay is ready to go. To run nrelay, use the command nrelay run
in the console. If you have setup your accounts.json
properly (and used the correct credentials) you should see an output similar to this
C:\Documents> nrelay run
[17:25:23 | NRelay] Starting...
...
[17:25:26 | Main Client] Authorized account
[17:25:26 | Main Client] Starting connection to AsiaSouthEast
[17:25:26 | Main Client] Connected to server!
[17:25:26 | Main Client] Connecting to Nexus
[17:25:27 | Main Client] Connected!
The alias
property in the account config is optional. If one is not specified, the log will use a censored email instead
[17:25:26 | f***@e***.com] Authorized account
[17:25:26 | f***@e***.com] Starting connection to AsiaSouthEast
[17:25:26 | f***@e***.com] Connected to server!
Using the nrelay
command in the CLI there are several arguments you can pass:
Run the current nrelay project
Create a new nrelay project folder
Compile the TypeScript inside the /src
folder into JavaScript
Create an index.js
file which can be ran the usual way with Node - not using the nrelay CLI
Check the current folder is a valid nrelay project and fix any issues
Update the nrelay-cli to the newest version
There are other extra command line arguments which can be provided when starting nrelay to change the behaviour:
This will print the nrelay version number to the console and exit.
This will start nrelay in debug mode. Debug mode provides a higher detail of logging. It is not recommended to use debug mode unless you are experiencing errors and need more info.
This will stop nrelay from writing to the log file.
This will stop nrelay from loading any plugins.
To start nrelay without checking for updates or log file writing:
nrelay run --no-update --no-log
To start nrelay in verbose mode and not load any plugins:
nrelay run --debug --no-plugins
To print the version number:
nrelay -v
Whenever any changes are made to the plugins, they will need to be recompiled in order for the changes to take effect.
To recompile the plugins simply use
nrelay build
If this doesn't work, you will need to install the TypeScript compiler:
npm install -g typescript
Then to compile everything in the plugin folder:
tsc
This project uses the following open source software:
- Il2CppInspector - to decompile the Unity client and parse the assets/code
- ghidra - to reverse engineer the unity client