Code Monkey home page Code Monkey logo

nrelay's Introduction

nrelay

A console based modular client for Realm of the Mad God built with Node.js and TypeScript.

Upgrading to v8? Check out the migration guide.

Contents

Docs

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.

Install

Prerequisites

Make sure you have Nodejs installed before running nrelay.

  1. Install the nrelay cli.
npm install -g nrelay-cli
  1. Create a new nrelay project.
nrelay new my-new-project

Setup

When you create a new nrelay project, you will need to set up your accounts.json file. It has been generated for you, but currently only contains an example account.

The current contents of the file will resemble the following.

[
  {
    "alias": "Main Client",
    "guid": "[email protected]",
    "password": "password10",
    "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": "[email protected]",
    "password": "SecretPassWord11",
    "serverPref": "AsiaSouthEast"
  },
  {
    "alias": "Secondary Client",
    "guid": "[email protected]",
    "password": "Password22",
    "serverPref": "USSouth"
  }
]

Using proxies

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

{
    "alias": "Main Client",
    "guid": "[email protected]",
    "password": "SecretPassWord11",
    "serverPref": "AsiaSouthEast",
    "proxy": {
        "host": "127.0.0.1",  // The ip of the proxy.
        "port": 8080,         // The port of the proxy. Use a number here, e.g. 8080 not "8080".
        "type": 5,            // The type of the proxy. Use 5 for SOCKSv5 and 4 for SOCKSv4 or SOCKSv4a.
        "userId": "username", // The username for the proxy, if one is required.
        "password": "secret"  // The password for the proxy, if one is required.
    }
}

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.

Using the Local Server

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.

Run

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
[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!

Command line arguments

There are several command line arguments which can be provided when starting nrelay to change the behaviour.

--version or -v

This will print the nrelay version number to the console and exit.

--debug

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.

--no-update

This will stop nrelay from checking for updates when it starts.

--no-log

This will stop nrelay from writing to the log file.

--no-plugins

This will stop nrelay from loading any plugins.

--force-update

This will force nrelay to download the latest client and assets.

--update-from="filepath"

This will update the packet ids using the client at the given filepath.

If filepath is a path to a file (e.g. C:\clients\myclient.swf), then the directory containing the swf will be used to store the decompiled scripts. If filepath is a path to a directory, (e.g. C:\clients), then nrelay will assume a file called client.swf exists in the directory, and will use the directory to store the decompiled scripts.

Please note that filepath should always be an absolute path to either a client or a directory containing a client.swf.

Examples

To start nrelay without checking for updates or log file writing, use

nrelay run --no-update --no-log

To start nrelay and force an update, use

nrelay run --force-update

To print the version number, use

nrelay -v

Build

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

Acknowledgements

This project uses the following open source software:

nrelay's People

Contributors

arkzzz avatar ashley-dv avatar brentaureli avatar gravitir314 avatar iremnant avatar lolization avatar stq avatar thomas-crane avatar tripleys avatar urantij avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

nrelay's Issues

Empty Response from server when using proxy

When upgrading to v7, I get empty response from server when connecting...
[10:44:12 | NRelay] Loading ASE

[10:44:12 | AccountService]   Resolving proxy hostname.
[10:44:13 | AccountService]   Proxy hostname resolved!
[10:44:13 | Https]            Establishing proxy for GET request.
[10:44:14 | Https]            Established proxy!
[10:44:14 | ASE]              Empty response from server.
        {
            "alias": "USE3",
            "guid": "***@gmail.com",
            "password": "r***",
            "serverPref": "USEast3",
            "proxy": {
                "host": "proxy-nl.p***.com",
                "port": 1080,
                "type": 5,
                "userId": "***",
                "password": "***"
            }
        }

Proxy works perfectly in v6. Unsure what internals changed

X34 support

Version info

  • nrelay cli version: 1.6.0
  • nrelay version: 8.8.8
  • RotMG version: X34.0.0 1590058708

Plugins

My own, which connects to nexus and goes to quest area.

Steps to reproduce

  1. Start nrelay
  2. Observe player connecting to nexus
  3. Something is wrong

Result

[12:16:24 | Updater]          Updating client and assets...
[12:16:24 | Updater]          Downloading assets...
[12:16:24 | Updater]          Fetching client version...
[12:16:25 | Updater]          Downloading client...
[12:16:25 | Updater]          Updated assets!
[12:16:30 | Updater]          Extracting packets...
[12:16:30 | Updater]          Extracting parameters...
[12:16:30 | Updater]          Updated packets and version!
[12:16:30 | Runtime]          Finished updating!
[12:16:30 | ResourceManager]  Loaded 1973 tiles.
[12:16:30 | ResourceManager]  Loaded 15184 objects.
[12:16:30 | Runtime]          Mapped 99 packet ids.
[12:16:30 | Runtime]          Using build version "X34.0.0"
[12:16:30 | Runtime]          Using client token "XTeP7hERdchV5jrBZEYNebAqDPU6tKU6"
[12:16:30 | LibraryManager]   Loading plugins...
[12:16:30 | LibraryManager]   Loading CollectorPlugin...
[12:16:30 | LibraryManager]   Loaded REDACTED_PLUGIN_NAME
[12:16:30 | Runtime]          Loading REDACTED...
[12:16:30 | AccountService]   Loading server list...
[12:16:30 | AccountService]   Cached server list loaded!
[12:16:30 | AccountService]   Loading character info...
[12:16:31 | AccountService]   Character info loaded!
[12:16:31 | Runtime]          Loaded REDACTED!
[12:16:31 | REDACTED]          Starting connection to EUWest
[12:16:31 | Runtime]          Loading REDACTED...
[12:16:31 | AccountService]   Loading server list...
[12:16:31 | AccountService]   Cached server list loaded!
[12:16:31 | AccountService]   Loading character info...
[12:16:31 | REDACTED]          Connected to EUWest!
[12:16:31 | REDACTED]          Received PacketIO error: The value of "offset" is out of range. It must be >= 0 and <= 101. Received 1039990887

Received failure 13: "Client Token Error"

Hello! I'm trying to start a project that uses NRelay but I'm having trouble getting it to connect. First the client tries to update to version X31.4.1. First I tried to fix this by running "nrelay run --update-from=/path/to/my/client.swf [--force-update]" and then later tried setting the version manually. Neither worked and the bot can not connect to the realm. I also ran nrelay update with no success.

I've tried installing and reinstalling nrelay-cli, etc but nothing seems to do the job.
Thanks for this awesome project and I hope you can help me :)

Version info

  • nrelay version: 8.8.4
  • RotMG version: X33.0.1

Plugins

  • HelloPlugin

Steps to reproduce

  1. Start nrelay

Result

$> nrelay -v
CLI version:    v1.6.0
nrelay version: v8.8.4

$> nrelay run --v
CLI version:    v1.6.0
nrelay version: v8.8.4

$>nrelay run
[00:23:57 | Runtime]          Checking for updates...
[00:23:57 | Updater]          Checking for new versions...
[00:23:57 | ResourceManager]  Loaded 1637 tiles.
[00:23:57 | ResourceManager]  Loaded 14132 objects.
[00:23:57 | Runtime]          Mapped 99 packet ids.
[00:23:57 | Runtime]          Using build version "X33.0.1"
[00:23:57 | Runtime]          Cannot load clientToken. Clients may not be able to connect.
[00:23:57 | LibraryManager]   Loading plugins...
[00:23:57 | LibraryManager]   Loading HelloPlugin...
[00:23:57 | LibraryManager]   Loaded Hello Plugin by tcrane!
[00:23:57 | Runtime]          Loading <username>...
[00:23:57 | AccountService]   Loading server list...
[00:23:57 | AccountService]   Cached server list loaded!
[00:23:57 | AccountService]   Loading character info...
[00:23:57 | AccountService]   Cached character info loaded!
[00:23:57 | Runtime]          Loaded <username>!
[00:23:57 | <username>]          Starting connection to EUNorth2
[00:23:57 | <username>]          Connected to EUNorth2!
[00:23:57 | <username>]          Received failure 13: "Client Token Error"
[00:23:57 | <username>]          Received socket error: read ECONNRESET
[00:23:57 | <username>]          The connection to EUNorth2 was closed.
[00:23:57 | <username>]          Connecting in 1.8 seconds.

Problem with running it

First time it said something about not being able to update packages, now it just says Couldn't load acc-config.json
what do

android startup problem

android@kali:/opt/nrelay$ nrelay
[23:04:21 | NRelay] Starting...
[23:04:21 | NRelay] Checking for updates...
events.js:165
throw er; // Unhandled 'error' event
^

Error: EACCES: permission denied, open '/opt/nrelay/nrelay-log.log'
Emitted 'error' event at:
at fs.open (fs.js:2225:12)
at FSReqWrap.oncomplete (fs.js:153:20)

Help please

error TS2305: Module

Version info

  • nrelay version: newest
  • RotMG version: 31.1.0

Plugins

  • Example key notifier plugin

Steps to reproduce

  1. Run gulp command

Result

src\plugins\notifier.ts(1,10): error TS2305: Module '"C:/Users/Someone/Desktop/nrelay-master/src/core/index"' has no exported member 'Log'.
src\plugins\notifier.ts(1,25): error TS2305: Module '"C:/Users/Someone/Desktop/nrelay-master/src/core/index"' has no exported member 'NrPlugin'.
src\plugins\notifier.ts(1,35): error TS2305: Module '"C:/Users/Someone/Desktop/nrelay-master/src/core/index"' has no exported member 'HookPacket'.
src\plugins\notifier.ts(1,47): error TS2305: Module '"C:/Users/Someone/Desktop/nrelay-master/src/core/index"' has no exported member 'Packet'.
src\plugins\notifier.ts(1,55): error TS2305: Module '"C:/Users/Someone/Desktop/nrelay-master/src/core/index"' has no exported member 'PacketType'.
src\plugins\notifier.ts(1,75): error TS2305: Module '"C:/Users/Someone/Desktop/nrelay-master/src/core/index"' has no exported member 'PluginManager'.
src\plugins\notifier.ts(3,10): error TS2305: Module '"C:/Users/Someone/Desktop/nrelay-master/src/models/server"' has no exported member 'IServer'.

Make char-info.cache usage optional

Hello,

The file char-info.cache.json is used everytime account-service.getCharacterInfo() is executed.
This make the actual API call to /char/list to not occur when the cache exists.

This can be an issue: to load properly the daily reward calendar (at /dailyLogin/fetchCalendar, we need to first hit /char/list or else the calendar XML is not refreshed.

Feature request:
Adding a command line switch to disable the use and creation of char-info.cache.json.
Something like --disable-char-info-cache

In my use case, for each account, this would really hit the /char/list endpoint and then I would get an updated daily reward XML on the /dailyLogin/fetchCalendar endpoint.

Right now, what I'll do is rm the file before launching nrelay.
And that's not super cool :D

Error on server join if character already made - Received failure 0

Version info

  • nrelay version: 8.8.4
  • RotMG version: X33.0.1

Plugins

  • ran with --no-plugin

Steps to reproduce

  1. Create account
  2. Login and create character
  3. Start nrelay

OR

  1. Input account without character
  2. nrelay creates character and connects
  3. Close nrelay
  4. Reopen nrelay
  5. Get error that character doesn't exist
  6. Character does in fact exist causing an infinite loop of trying to create a character

Result

[13:49:58 | Runtime]          Checking for updates...
[13:49:58 | Updater]          Checking for new versions...
[13:49:58 | ResourceManager]  Loaded 1637 tiles.
[13:49:59 | ResourceManager]  Loaded 14132 objects.
[13:49:59 | Runtime]          Mapped 99 packet ids.
[13:49:59 | Runtime]          Using build version "X33.0.1"
[13:49:59 | Runtime]          Using client token ""
[13:49:59 | Runtime]          Plugin loading disabled.
[13:49:59 | Runtime]          Loading o***@***.com...
[13:49:59 | AccountService]   Loading server list...
[13:49:59 | AccountService]   Cached server list loaded!
[13:49:59 | AccountService]   Loading character info...
[13:49:59 | AccountService]   Cached character info loaded!
[13:49:59 | Runtime]          Loaded o***@***.com!
[13:49:59 | o***@***.com]   Starting connection to EUNorth
[13:49:59 | o***@***.com]   Establishing proxy
[13:50:00 | o***@***.com]   Connected to EUNorth!
[13:50:00 | o***@***.com]   Connecting to Nexus
[13:50:01 | o***@***.com]   No active characters. Creating new character.
[13:50:01 | o***@***.com]   The connection to EUNorth was closed.
[13:50:01 | o***@***.com]   Connecting in 0.6 seconds.
[13:50:01 | o***@***.com]   Establishing proxy
[13:50:02 | o***@***.com]   Connected to EUNorth!
[13:50:02 | o***@***.com]   Creating new character
[13:50:03 | o***@***.com]   Received failure 0: "Account already has 1 active characters"
[13:50:03 | o***@***.com]   The connection to EUNorth was closed.
[13:50:03 | o***@***.com]   Connecting in 0.8 seconds.
[13:50:03 | o***@***.com]   Establishing proxy
[13:50:04 | o***@***.com]   Connected to EUNorth!
[13:50:04 | o***@***.com]   Connecting to Nexus
[13:50:05 | o***@***.com]   No active characters. Creating new character.
[13:50:05 | o***@***.com]   The connection to EUNorth was closed.
[13:50:05 | o***@***.com]   Connecting in 0.4 seconds.
[13:50:05 | o***@***.com]   Establishing proxy
[13:50:06 | o***@***.com]   Connected to EUNorth!
[13:50:07 | o***@***.com]   Creating new character
[13:50:07 | o***@***.com]   Received failure 0: "Account already has 1 active characters"
[13:50:07 | o***@***.com]   The connection to EUNorth was closed.

new packet

Version info

  • nrelay version: 7.7.1
  • RotMG version: X32.2.1

Steps to reproduce

  1. Start nrelay

Result

The bot crashes with the error:
> gulp && node index

[14:43:30] Using gulpfile ~\Desktop\nrelay 7\nrelay\gulpfile.js
[14:43:30] Starting 'default'...
[14:43:30] Starting 'clean'...
[14:43:30] Finished 'clean' after 147 ms
[14:43:30] Starting 'ts'...
[14:43:46] Finished 'ts' after 15 s
[14:43:46] Starting 'copy-files'...
[14:43:46] Finished 'copy-files' after 181 ms
[14:43:46] Finished 'default' after 16 s
[14:43:48 | NRelay]           Starting...
[14:43:48 | NRelay]           Checking for updates...
[14:43:49 | Mapper]           Mapped 98 packet ids.
[14:43:49 | ResourceManager]  Loaded 1373 tiles.
[14:43:50 | ResourceManager]  Loaded 9248 objects.
[14:43:50 | PluginManager]    Loaded Realm Joiner Plugin by Ark
[14:43:50 | NRelay]           Loading Medusa
[14:43:52 | NRelay]           Loaded Medusa!
[14:43:52 | Medusa]           Starting connection to USSouth3
[14:43:52 | Medusa]           Connected to USSouth3!
[14:43:52 | Medusa]           Connecting to Nexus
[14:43:53 | Medusa]           Connected!
[14:44:42 | Medusa]           Changing gameId to -3
[14:44:42 | Medusa]           Connected to USSouth3!
[14:44:43 | Medusa]           Connected to NexusPortal.Beholder!
[14:44:43 | Medusa]           Connecting to Realm of the Mad God
[14:44:45 | Medusa]           Connected!
[14:44:45 | PacketIO]         Invalid packet type: REALMHERO_LEFT_MSG
[14:45:32 | Medusa]           Took 1.05 damage. At 627 health.
[14:45:33 | Medusa]           Changing gameId to -3
[14:45:33 | Medusa]           Connected to NexusPortal.Beholder!
[14:45:33 | Medusa]           Connecting to Realm of the Mad God
[14:45:37 | Medusa]           Connected!
[14:45:37 | PacketIO]         Invalid packet type: REALMHERO_LEFT_MSG
[14:45:46 | PacketIO]         Invalid packet type: REALMHERO_LEFT_MSG

Discord.js causes build error

Version info

  • nrelay version: 8.8.4
  • RotMG version: X33.0.1

Plugins

  • Discord Logger (unreleased)
    • Uses features
      • LogLevel
      • Library
      • PacketHook
      • Client
      • Logger
      • TextPacket
      • Server

Steps to reproduce

  1. Write a plugin that imports Discord from 'discord.js'
  2. Attempt to build
  3. Error

Result

nrelay ERR! code Error
nrelay ERR! message Command failed: npm run compile
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! realm@ compile: `tsc -p .`
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the realm@ compile script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\C\AppData\Roaming\npm-cache\_logs\2020-04-30T19_02_02_511Z-debug.log


> realm@ compile C:\Users\C\Desktop\nrelay\realm
> tsc -p .

node_modules/discord.js/typings/index.d.ts(18,30): error TS7016: Could not find a declaration file for module 'ws'. 'C:/Users/C/Desktop/nrelay/realm/node_modules/ws/index.js' implicitly has an 'any' type.
  Try `npm install @types/ws` if it exists or add a new declaration (.d.ts) file containing `declare module 'ws';`


nrelay ERR! Error: Command failed: npm run compile
nrelay ERR! npm ERR! code ELIFECYCLE
nrelay ERR! npm ERR! errno 2
nrelay ERR! npm ERR! realm@ compile: `tsc -p .`
nrelay ERR! npm ERR! Exit status 2
nrelay ERR! npm ERR! 
nrelay ERR! npm ERR! Failed at the realm@ compile script.
nrelay ERR! npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
nrelay ERR!
nrelay ERR! npm ERR! A complete log of this run can be found in:
nrelay ERR! npm ERR!     C:\Users\C\AppData\Roaming\npm-cache\_logs\2020-04-30T19_02_02_511Z-debug.log
nrelay ERR!
nrelay ERR!
nrelay ERR! > realm@ compile C:\Users\C\Desktop\nrelay\realm
nrelay ERR! > tsc -p .
nrelay ERR!
nrelay ERR! node_modules/discord.js/typings/index.d.ts(18,30): error TS7016: Could not find a declaration file for module 'ws'. 'C:/Users/C/Desktop/nrelay/realm/node_modules/ws/index.js' implicitly has an 'any' type.
nrelay ERR!   Try `npm install @types/ws` if it exists or add a new declaration (.d.ts) file containing `declare module 'ws';`
nrelay ERR!
nrelay ERR!     at makeError (C:\Users\C\AppData\Roaming\npm\node_modules\nrelay-cli\node_modules\execa\index.js:174:9)
nrelay ERR!     at Promise.all.then.arr (C:\Users\C\AppData\Roaming\npm\node_modules\nrelay-cli\node_modules\execa\index.js:278:16)
nrelay ERR!     at process._tickCallback (internal/process/next_tick.js:68:7)

Can't enter portals in realm

Version info

  • nrelay version: 7.7.2
  • RotMG version: X31.4.1

Plugins

  • Own plugin
    • Uses features
      • stdlib.PlayerTracker
    • Uses packets
      • UpdatePacket
      • NewTickPacket
      • MapInfoPacket
      • UsePortalPacket

Steps to reproduce

  1. Start nrelay
  2. Go into realm
  3. Go into a portal

Result

The bot nexus with the error:
Invalid key used.

Wasn't sure how to contact anyone for help, so wanted to try here.

I'm working on creating a plugin for nrelay that involves putting items from the inventory into the vault. I didn't see any packets that allows you to move an item from inventory to chest, or getting an item out of a chest to inventory. Is there any help forum for nrelay, or does anyone know how to do this?

Thanks

Unable to connect, retrys connection anyways saying "buildVersion out of date."

Version info

  • nrelay version: 4.3.0
  • RotMG version: X20.1.0

Steps to reproduce

  1. Start nrelay

Result

The bot errors with the error:
[18:59:29 | Main Client]      Connected to USWest!
[18:59:30 | Main Client]      Received socket error: read ECONNRESET
[18:59:30 | Main Client]      The connection to USWest was closed.
[18:59:30 | Main Client]      Connecting in 0.8 seconds.

And doesn't stop repeating. I have a brand new, vanilla copy of this, followed the directions on the README.md exactly, but receive this error. Thank you.

No online docs

docs.nrelay.net seems to be offline..
and "The code in the src/ folder has extensive inline documentation..." with only 1 example... where can i check what the tool is able to... (enter portals/ move/ pick up stuff/etc...)

Pathfinding seemingly not working

Version info

  • nrelay version: 8.8.7
  • RotMG version: X33.1.0

Plugins

  • Test Plugin (unreleased)
    • Uses features
      • client.findPath
      • Point from realmlib/net
    • Uses packets
      • TextPacket

Steps to reproduce

  1. Create a plugin which uses client.findPath
    1.1. Code in question: client.findPath({ x: 151, y: 138 }); in onText hooking to TextPacket
  2. Start nrelay
  3. Wait for client.findPath to be invoked

Result

Pathfinding fails with the error:

[13:44:09 | Main Client]      Error finding path: Cannot set property 'heapIndex' of undefined
[13:44:09 | Main Client]      TypeError: Cannot set property 'heapIndex' of undefined
    at Heap.add (C:\Users\User\test-project\node_modules\nrelay\lib\services\pathfinding\heap.js:23:24)
    at C:\Users\User\test-project\node_modules\nrelay\lib\services\pathfinding\pathfinder.js:32:21
    at new Promise (<anonymous>)
    at Pathfinder.findPath (C:\Users\User\test-project\node_modules\nrelay\lib\services\pathfinding\pathfinder.js:27:16)
    at Client.findPath (C:\Users\User\test-project\node_modules\nrelay\lib\core\client.js:297:25)
    at GuildChatPlugins.onText (C:\Users\User\test-project\lib\guild-chat-plugin.js:23:16)
    at LibraryManager.callHooks (C:\Users\User\test-project\node_modules\nrelay\lib\core\library-manager.js:190:54)
    at PacketIO.<anonymous> (C:\Users\User\test-project\node_modules\nrelay\lib\core\client.js:94:45)
    at PacketIO.emit (events.js:310:20)
    at PacketIO.emitPacket (C:\Users\User\test-project\node_modules\@realmlib\net\lib\packetio.js:144:18)

Very well may be using pathfinding incorrectly, but can't seem to find much documentation on it.

Having an issue starting in console nrelay

Error:

**

Your environment has been set up for using Node.js 10.13.0 (x64) and npm.

C:\Users\x>nrelay
internal/modules/cjs/loader.js:582
throw err;
^

Error: Cannot find module './dist'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:580:15)
at Function.Module._load (internal/modules/cjs/loader.js:506:25)
at Module.require (internal/modules/cjs/loader.js:636:17)
at require (internal/modules/cjs/helpers.js:20:18)
at Object. (C:\Users\carmen\nrelay\index.js:3:17)
at Module._compile (internal/modules/cjs/loader.js:688:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:699:10)
at Module.load (internal/modules/cjs/loader.js:598:32)
at tryModuleLoad (internal/modules/cjs/loader.js:537:12)
at Function.Module._load (internal/modules/cjs/loader.js:529:3)

**

Not sure what I have done wrong, I have done all setup steps, and done the accounts file.

When I attempt to run it in the console (typing nrelay), it pops up with the above error.

I have not setup proxies or local server, not sure if that is required to. But I'll look into doing it sooner or later anyways.

Thanks

Reconnect packet issue with X21.0.0

Version info

  • nrelay version: 6.4.6
  • RotMG version: X21.0.0

Plugins

  • Unnamed (unreleased)
    • Uses packets
      • ReconnectPacket
      • UpdatePacket
      • UsePortalPacket
      • EscapePacket

Steps to reproduce

  1. Start nrelay
  2. Send a UsePortalPacket

Result

The bot crashes with the error:
RangeError: Invalid typed array length: -11008
    at typedArrayConstructByLength (<anonymous>)
    at new Int8Array (native)
    at ReconnectPacket.read (/home/rotmg/nrelay/dist/networking/packets/incoming/reconnect-packet.js:19:20)
    at PacketIO.emitPacket (/home/rotmg/nrelay/dist/networking/packetio.js:123:20)
    at PacketIO.processData (/home/rotmg/nrelay/dist/networking/packetio.js:102:22)

Fix

Server is now sending stats in the reconnect packet. Declare a stats string and change src/networking/packets/incoming/reconnect-packet.ts to:

this.host = this.readString();
this.stats = this.readString();
this.port = this.readInt32();

Add a proxy pool

Summary

The current process for using proxies in nrelay is to add a proxy property to the account which should be connected through a proxy in the accounts.json file. This can be tedious, particularly if there are a lot of accounts, or if the details of the accounts or proxies change frequently. It also requires the user to decide how many accounts they should allow per proxy so as to not defeat the purpose of using proxies in the first place.

Instead of this, nrelay should allow the user to simply specify a large list of proxies (for example in a proxies.json file) and have the runtime evenly distribute accounts across those proxies to ensure none of the proxies are ever overloaded.

However, this system should not prevent users from assigning specific proxies to certain accounts, or excluding certain accounts from being connected through a proxy.

It should also allow the user to include the option of not using a proxy when the runtime is distributing accounts across proxies. For those users who use a VM to run nrelay (and not their personal computer which is associated with their own IP), the IP of the VM is essentially acting as another proxy.

API details

The proxies.json file

A new JSON file would be the best way to store the proxies that should be initially added to the pool by the runtime. Since there are some configuration options as aforementioned, the contents of the file will need to be slightly more complex than a simple list of proxies.

{
  "settings": {
    "useOwnIP": false, // set this to `true` to consider no proxy as an option when distributing accounts.
    "stickyProxies": false, // set this to `true` to make proxies "stick" to accounts.
  },
  "proxies": [
    {
      "host": "127.0.0.1",
      "port": 8080,
      "type": 5,
      "userId": "username",
      "password": "secret"
    },
    {
      "id": "USA Proxy", // a unique ID for this proxy.
      "host": "127.0.0.1",
      "port": 8080,
      "type": 5,
      "userId": "username",
      "password": "secret"
    },
  ]
}

The "settings" object in the file would allow the configuration options for the proxy pool to be changed, and the "proxies" array would contain the actual list of proxies.

Changes to accounts.json

The user should be able to select a particular proxy, based on it's id, for a client to use. To do this, the user can add a "proxyId" property to their account. The runtime should then choose the proxy with the matching ID for that account when it is distributing proxies.
This new property should not take precedence over the "proxy" property, and if that property is present, the runtime should immediately choose that proxy for the account instead of one of the pooled proxies.

"Sticky" proxies

In an account's lifetime, it may connect and disconnect several times. It may be more desirable such that each time the account connects, it uses the same proxy that was initially assigned to it by the runtime. This could be described as the proxy "sticking" to the account. This should be configurable, as sticky proxies may lead to the distribution of proxies being unbalanced if more proxies and accounts are added at runtime.

Using the pool

The proxy pool would be best suited as a new property of the Runtime class. The pool itself should essentially appear to the consumer as a read only list of proxies.

Pool configuration

The configuration options of the pool should be both visible to, and modifiable by the consumer.

// plugin example
this.runtime.proxyPool.useOwnIP = false; // corresponds to the property in `proxies.json` with the same name.

Adding proxies

Rather than allowing consumers to directly add proxies to the pool, a method should act as the interface for doing so. The method can simply accept a proxy object as the parameter, and should throw if it encounters an error.

// plugin example
fetchProxiesSomehow().then((proxyList) => {
  for (const proxy of proxyList) {
    try {
      this.runtime.proxyPool.add(proxy);
    } catch (err) {
      Logger.log('My Plugin', `Couldn't add proxy: ${proxy.host} because ${err.message}`, LogLevel.Error);
    }
  }
});

Removing proxies

Similarly to adding proxies, the interface for removing them should also be a method. This method should never throw, but should return a boolean based on whether or not the proxy was actually removed.

The method should accept a proxy object as a parameter, and should remove the proxy that matches the argument from the pool. The matching logic should be based on property equality rather than referential equality.

The method should also have an overload which accepts a string as an argument, and should remove the proxy whose id matches the provided string.

// plugin example

// this should work fine
this.runtime.proxyPool.delete({
  id: 'USA Proxy',
  host: '127.0.0.1',
  port: 8080,
  type: 5,
  userId: 'username',
  password: 'secret',
});

// this should also work
this.runtime.proxyPool.delete('USA Proxy');

Cannot read property 'lifetimeMS' of null

Version info

  • nrelay version: 8.8.4
  • RotMG version: X33.0.1

Plugins

  • Realm Joiner (unreleased)
    • Uses features
      • GameId
    • Uses packets
      • RandomRealm

Steps to reproduce

  1. Start nrelay
  2. Run client.changeGameId(GameId.RandomRealm)
  3. Crash, probably when someone shoots

Result

C:\Users\C\Desktop\nrelay\nrelay_v8\realm\node_modules\nrelay\lib\core\client.js:809
            const distance = projectile.lifetimeMS * (projectile.speed / 10000);
                                        ^

TypeError: Cannot read property 'lifetimeMS' of null
    at Client.onNewTick (C:\Users\C\Desktop\nrelay\nrelay_v8\realm\node_modules\nrelay\lib\core\client.js:809:41)
    at LibraryManager.callHooks (C:\Users\C\Desktop\nrelay\nrelay_v8\realm\node_modules\nrelay\lib\core\library-manager.js:215:33)
    at PacketIO.Client.io.on (C:\Users\C\Desktop\nrelay\nrelay_v8\realm\node_modules\nrelay\lib\core\client.js:94:45)
    at PacketIO.emit (events.js:198:13)
    at PacketIO.emitPacket (C:\Users\C\Desktop\nrelay\nrelay_v8\realm\node_modules\@realmlib\net\lib\packetio.js:144:18)
    at PacketIO.onData (C:\Users\C\Desktop\nrelay\nrelay_v8\realm\node_modules\@realmlib\net\lib\packetio.js:177:30)
    at Socket.emit (events.js:198:13)
    at addChunk (_stream_readable.js:287:12)
    at readableAddChunk (_stream_readable.js:268:11)
    at Socket.Readable.push (_stream_readable.js:223:10)

Resources being used after connection closed

Version info

  • nrelay version: 8.4.1
  • RotMG version: X31.7.0

Plugins

  • Event Notifier
    • Uses packets
      • UpdatePacket
      • ReconnectPacket

Steps to reproduce

  1. Start nrelay

Result


Resources are being used after the connection has been closed causing things to be undefined

Example:

C:\Users\Administrator\tracker\node_modules\nrelay\lib\core\client.js:453
        const tile = this.mapTiles[y * this.mapInfo.width + x];
                                  ^

TypeError: Cannot read property '33693' of undefined


Frequent disconnects from realms and dungeons

Version info

  • nrelay version: 8.8.6
  • RotMG version: X31.0.1

Plugins

  • Follow (unreleased)
    • Uses features
      • ResourceManager.objects
      • PlayerTracker
    • Uses packets
      • MapInfoPacket
      • UpdatePacket
      • NewTickPacket
      • TextPacket
      • UsePortalPacket
      • TeleportPacket

Steps to reproduce

  1. Start nrelay
  2. Enter realm or dungeon
  3. Walk around for a couple of seconds, shoot enemies etc
  4. Suddenly get kicked out

Result

The bot is disconnected with no error except:

[XX:XX:XX | Main Client]        Received failure 0: "Lost connection to server"
[XX:XX:XX | Main Client]        Received socket error: read ECONNRESET`

Seems like an object getting hit multiple times in a small period of time triggers it? Almost certainly related to hits in some way. I can walk around as much as I like but when enemies are near they tend to disconnect after a while. Happens in all dungeons. I'll keep you posted as I look into this.

Debug logs look like:


[XX:XX:23 | Main Client]      Connecting to Snake Pit
[XX:XX:24 | Main Client]      Connected!
[XX:XX:33 | Main Client]      Sent OtherHit for player: USERNAME_1
[XX:XX:33 | Main Client]      Sent OtherHit for player: USERNAME_1
[XX:XX:34 | Main Client]      Sent OtherHit for player: USERNAME_1
[XX:XX:34 | Main Client]      Sent OtherHit for object.
[XX:XX:34 | Main Client]      Took 2 damage. At 747 health.
[XX:XX:34 | Main Client]      Sent PlayerHit.
[XX:XX:34 | Main Client]      Took 12 damage. At 735 health.
[XX:XX:34 | Main Client]      Sent PlayerHit.
[XX:XX:34 | Main Client]      Sent OtherHit for player: USERNAME_1
[XX:XX:34 | Main Client]      Sent OtherHit for player: USERNAME_1
[XX:XX:34 | Main Client]      Sent OtherHit for player: USERNAME_1
[XX:XX:34 | Main Client]      Took 2 damage. At 734 health.
[XX:XX:34 | Main Client]      Sent PlayerHit.
[XX:XX:34 | Main Client]      Sent OtherHit for player: USERNAME_1
[XX:XX:34 | Main Client]      Sent OtherHit for player: USERNAME_1
[XX:XX:34 | Main Client]      Took 12 damage. At 723 health.
[XX:XX:34 | Main Client]      Sent PlayerHit.
[XX:XX:35 | Main Client]      Sent OtherHit for player: USERNAME_1
[XX:XX:35 | Main Client]      Took 12 damage. At 712 health.
[XX:XX:35 | Main Client]      Sent PlayerHit.
[XX:XX:35 | Main Client]      Sent OtherHit for player: USERNAME_1
[XX:XX:35 | Main Client]      Sent OtherHit for player: USERNAME_1
[XX:XX:35 | Main Client]      Sent OtherHit for player: USERNAME_1
[XX:XX:35 | Main Client]      Took 12 damage. At 701 health.
[XX:XX:35 | Main Client]      Sent PlayerHit.
[XX:XX:35 | Main Client]      Took 12 damage. At 689 health.
[XX:XX:35 | Main Client]      Sent PlayerHit.
[XX:XX:35 | Main Client]      Took 12 damage. At 678 health.
[XX:XX:35 | Main Client]      Sent PlayerHit.
[XX:XX:35 | Main Client]      Sent OtherHit for player: USERNAME_1
[XX:XX:35 | Main Client]      Took 12 damage. At 666 health.
[XX:XX:35 | Main Client]      Sent PlayerHit.
[XX:XX:35 | Main Client]      Sent OtherHit for player: USERNAME_1
[XX:XX:35 | Main Client]      Sent OtherHit for player: USERNAME_1
[XX:XX:35 | Main Client]      Sent OtherHit for object.
[XX:XX:36 | Main Client]      Sent OtherHit for object.
[XX:XX:36 | Main Client]      Sent OtherHit for object.
[XX:XX:36 | Main Client]      Sent OtherHit for object.
[XX:XX:36 | Main Client]      Sent OtherHit for object.
[XX:XX:36 | Main Client]      Sent OtherHit for player: USERNAME_1
[XX:XX:36 | Main Client]      Sent OtherHit for player: USERNAME_1
[XX:XX:36 | Main Client]      Sent OtherHit for player: USERNAME_1
[XX:XX:36 | Main Client]      Took 12 damage. At 710 health.
[XX:XX:36 | Main Client]      Sent PlayerHit.
[XX:XX:36 | Main Client]      Sent OtherHit for player: USERNAME_1
[XX:XX:36 | Main Client]      Took 12 damage. At 698 health.
[XX:XX:36 | Main Client]      Sent PlayerHit.
[XX:XX:36 | Main Client]      Sent OtherHit for object.
[XX:XX:36 | Main Client]      Sent OtherHit for object.
[XX:XX:36 | Main Client]      Sent OtherHit for object.
[XX:XX:36 | Main Client]      Took 12 damage. At 688 health.
[XX:XX:36 | Main Client]      Sent PlayerHit.
[XX:XX:36 | Main Client]      Sent OtherHit for player: USERNAME_1
[XX:XX:36 | Main Client]      Sent OtherHit for player: USERNAME_1
[XX:XX:36 | Main Client]      Sent OtherHit for player: USERNAME_1
[XX:XX:36 | Main Client]      Sent OtherHit for player: USERNAME_1
[XX:XX:37 | Main Client]      Sent OtherHit for player: USERNAME_2
[XX:XX:37 | Main Client]      Took 12 damage. At 677 health.
[XX:XX:37 | Main Client]      Sent PlayerHit.
[XX:XX:37 | Main Client]      Took 12 damage. At 665 health.
[XX:XX:37 | Main Client]      Sent PlayerHit.
[XX:XX:37 | Main Client]      Sent OtherHit for player: USERNAME_1
[XX:XX:37 | Main Client]      Sent OtherHit for player: USERNAME_1
[XX:XX:37 | Main Client]      Sent OtherHit for player: USERNAME_1
[XX:XX:37 | Main Client]      Sent OtherHit for player: USERNAME_1
[XX:XX:37 | Main Client]      Sent OtherHit for player: USERNAME_1
[XX:XX:37 | Main Client]      Sent OtherHit for player: USERNAME_1
[XX:XX:37 | Main Client]      Sent OtherHit for object.
[XX:XX:37 | Main Client]      Sent OtherHit for player: USERNAME_1
[XX:XX:37 | Main Client]      Sent OtherHit for player: USERNAME_1
[XX:XX:37 | Main Client]      Sent OtherHit for object.
[XX:XX:37 | Main Client]      Sent OtherHit for object.
[XX:XX:37 | Main Client]      Sent OtherHit for object.
[XX:XX:37 | Main Client]      Sent OtherHit for object.
[XX:XX:37 | Main Client]      Received failure 0: "Lost connection to server"
[XX:XX:37 | Main Client]      Sent OtherHit for object.
[XX:XX:37 | Main Client]      Received socket error: read ECONNRESET
[XX:XX:37 | Main Client]      Error: read ECONNRESET
    at TCP.onStreamRead (internal/stream_base_commons.js:XX5:27)
[XX:XX:37 | Main Client]      The connection to SERVER_NAME was closed.

unable to npm install and gulp after git clone latest verison(verison 7.8.1) to another computer folder

I used verison 6 nrelay since last year, and it run good.
I noticed there are new verison,
so I git clone latest verison(verison 7.8.1) to another computer folder,
after I npm install instead to the new nrelay verison folder, and gulp,
the cmd shows these error messages:

https://i.imgur.com/72b4xVS.png

Then, I updated my nodejs from verison 8 to 10 , error messages still occur when npm install, gulp

Missing PlayerData Stats

It would be beneficial to add the following stats to PlayaData interface. This information can be used in the calculation of maxed character stats.

ATTACK_BOOST_STAT = 48,
DEFENSE_BOOST_STAT = 49,
SPEED_BOOST_STAT = 50,
VITALITY_BOOST_STAT = 51,
WISDOM_BOOST_STAT = 52,
DEXTERITY_BOOST_STAT = 53,

Wrong Client Version?

Version info

  • nrelay version: 8.7.2
  • RotMG version: X32.0.6 (version it should have)
  • nrelay client version "X31.4.1"

Plugins

  • hello-plugin (same result even if removed)

Steps to reproduce

  1. Start nrelay

Result

The updater updates the client to a wrong version. Editing the the versions.json isn't enoght as expacted, it removes the "Client Token Error" message tho.
The update from path command dosn't seem to work either...
"nrelay --update-from= /home/pi/Desktop/client.swf" won't update the version. (it seems to do something and no error message from that command)
ECONNRESET is a cut off from the server side right? so my guess it that it is a problem with the client version.

pi@raspberrypiDaniel:~/Desktop/nrelay/my-new-project $ nrelay run
[11:05:43 | Runtime]          Checking for updates...
[11:05:43 | Updater]          Checking for new versions...
[11:05:44 | ResourceManager]  Loaded 1620 tiles.
[11:05:47 | ResourceManager]  Loaded 12831 objects.
[11:05:47 | Runtime]          Mapped 99 packet ids.
[11:05:47 | Runtime]          Using build version "X31.4.6"
[11:05:47 | LibraryManager]   Loading plugins...
[11:05:47 | LibraryManager]   Loading HelloPlugin...
[11:05:47 | LibraryManager]   Loaded Hello Plugin by tcrane!
[11:05:47 | Runtime]          Loading Main Client...
[11:05:47 | AccountService]   Loading server list...
[11:05:47 | AccountService]   Cached server list loaded!
[11:05:47 | AccountService]   Loading character info...
[11:05:47 | AccountService]   Cached character info loaded!
[11:05:47 | Runtime]          Loaded Main Client!
[11:05:47 | Main Client]      Starting connection to EUNorth
[11:05:47 | Main Client]      Connected to EUNorth!
[11:05:47 | Main Client]      Received failure 0: "Client Token Error"
[11:05:47 | Main Client]      Received socket error: read ECONNRESET
[11:05:47 | Main Client]      The connection to EUNorth was closed.
[11:05:47 | Main Client]      Connecting in 1.9 seconds.
[11:05:49 | Main Client]      Connected to EUNorth!
[11:05:49 | Main Client]      Received failure 0: "Client Token Error"
[11:05:49 | Main Client]      The connection to EUNorth was closed.
[11:05:49 | Main Client]      Connecting in 1.9 seconds.
^C
pi@raspberrypiDaniel:~/Desktop/nrelay/my-new-project $ nrelay -v
CLI version:    v1.6.0
nrelay version: v8.7.2
pi@raspberrypiDaniel:~/Desktop/nrelay/my-new-project $ 

PacketIO tries to log packets it didn't read, crashes

nrelay version: 7.5.2
RotMG version: X28.0.3

The issue is caused by the packet.type call in the log at L192, can be solved by placing it right below the actual packet read (as the packet is checked for null there, meanwhile it is not in the current place)

JDK 11 Issue

Version info

  • nrelay version: Latest Dev branch
  • RotMG version: X31.7.0

JDK 11 (Only tested on ubuntu)

nrelay run will cause issues on jdk 11 sample just under

[18:00:17 | Runtime]          Error while updating: Command failed: sudo java -jar --illegal-access=permit "/media/me/D2/rotmg-projects/nrelay/multi/node_modules/@realmlib/resx/lib/jpexs/ffdec.jar" -selectclass kabam.rotmg.messaging.impl.GameServerConnection -export script "/media/me/D2/rotmg-projects/nrelay/multi/temp/decompiled" "/media/me/D2/rotmg-projects/nrelay/multi/temp/client.swf"
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by com.jpexs.decompiler.flash.configuration.Configuration (file:/media/me/D2/rotmg-projects/nrelay/multi/node_modules/@realmlib/resx/lib/jpexs/lib/ffdec_lib.jar) to field java.lang.reflect.Field.modifiers
WARNING: Please consider reporting this to the maintainers of com.jpexs.decompiler.flash.configuration.Configuration
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
May 11, 2019 6:00:17 PM com.jpexs.decompiler.flash.gui.Main main
SEVERE: Failed to load plugins
java.lang.Error: Can not set static final com.jpexs.decompiler.flash.configuration.ConfigurationItem field com.jpexs.decompiler.flash.configuration.Configuration.registerNameFormat to com.jpexs.decompiler.flash.configuration.ConfigurationItem
	at com.jpexs.decompiler.flash.configuration.Configuration.setConfigurationFields(Configuration.java:889)
	at com.jpexs.decompiler.flash.configuration.Configuration.<clinit>(Configuration.java:839)
	at com.jpexs.decompiler.flash.helpers.SWFDecompilerPlugin.getPluginsDir(SWFDecompilerPlugin.java:61)
	at com.jpexs.decompiler.flash.helpers.SWFDecompilerPlugin.loadPlugins(SWFDecompilerPlugin.java:78)
	at com.jpexs.decompiler.flash.gui.Main.main(Main.java:1915)

Exception in thread "main" java.lang.NoClassDefFoundError: Could not initialize class com.jpexs.decompiler.flash.configuration.Configuration
	at com.jpexs.decompiler.flash.gui.Main.main(Main.java:1921)

I tried adding sudo as well as --illegal-access=permit to solve the issue but it did not solve it.
The fix I found at the moment was to change to JDK 8 which will run everything smoothly.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.