In my spare time I've been developing a headless modular client in
TypeScript. I've decided to release it here as it's pretty functional now and can be fun to play around with if you know a little bit of JavaScript/TypeScript.
This was mostly inspired by the
C++ clientless made by @
toddddd so thanks to him for making his code open source.
I don't really know C++ so I wanted to recreate it with Node, since it has great built in support for Net Sockets and Buffers, and since it is a fairly large project, TypeScript seemed like a better choice than just plain ES6 JavaScript.
This project isn't completed yet, quite a few of the packets are still missing implementations. All of the essential packets (like Ack packets) are implemented as well as other frequently used ones such as text and trade packets.
The GoundTile data is loaded from xml resources currently, but Objects.xml loading still needs to be added.
The project is modular, so it supports running plugins (similar to KRelay). The project only has one default plugin so far which is more of an example of how to structure plugins.
The account information is loaded through a JSON file, and it supports running multiple accounts at once. This is the structure of the accounts file:
acc-config.json
{
"buildVersion": "X19.0.1",
"accounts": [
{
"guid": "john@email.com",
"password": "SecretPassWord11",
"serverPref": "AsiaSouthEast"
}
]
}
The client can be run anywhere from the console with a simple command and will connect to the nexus.
When it starts it will look something like this:
Side Note
I called this project nrelay (Nodejs Relay) before JRelay was released, I don't want there to be 3 different 'letter'-relay programs as that is a bit confusing. It's a lot of work to refactor the name everywhere but will probably happen at some point.
The name is also a tiny bit misleading as it's not actually a relay, but a client. All implemented packets do have a read/write implementation however, so it could be turned in to a relay with minimal extra code (the code could even be in a plugin).
If you get the client up and running, it won't do much other than sit in the nexus. The default plugin will respond to you if you whisper the client 'hello', so you can test if the client is working or not.
And here is an example of running more than one client. These bots will just walk in a circle along the edge of the nexus spawn platform.
The functionality of these bots walking in a circle around the nexus fountains was actually added by making a plugin. This is the source code for the plugin:
walkpath-plugin.ts
import { NrPlugin, HookPacket, Packet, PacketType, Client, Log } from './../core/plugin-module';
import { WorldPosData } from './../networking/data/world-pos-data';
import { NewTickPacket } from './../networking/packets/incoming/newtick-packet';
const path = [
{ x: 129.5824, y: 143.6437 }, // bottom-left
{ x: 138.5885, y: 143.6437 }, // bottom-right
{ x: 138.5885, y: 136.4980 }, // top-right
{ x: 129.5824, y: 136.4980 } // top-left
];
@NRPlugin({
name: 'Path Walker',
author: 'tcrane'
})
export default class WalkpathPlugin {
private players: {
[id: number]: any[]
};
constructor() {
this.players = {};
}
@hookPacket(PacketType.NewTick)
onNewTick(client: Client, newTickPacket: NewTickPacket): void {
if (!this.players[client.playerData.objectId]) {
this.players[client.playerData.objectId] = path.slice();
}
if (!client.nextPos) {
const wp = new WorldPosData();
const point = this.players[client.playerData.objectId].pop();
this.players[client.playerData.objectId].unshift(point);
wp.x = point.x;
wp.y = point.y;
client.nextPos = wp;
}
}
}
This project is hosted on my GitHub page where you will also find a readme on how to setup and run the client, as well as a large amount of documentation covering how to write plugins, packet types and data structures available to use when making plugins.
I thought GitHub links were not allowed, but have recently seen other posts using GitHub links. Just to be safe I won't link the GitHub but please let me know if the rules have changed @
Raple @
Ahlwong
The GitHub endpoint is '/thomas-crane/nrelay'.
The TypeScript source is attached to this post, but you will need to build the source yourself to run the client. You can look at the included readme file or the GitHub to see how to do this. The only thing you need to have installed before running this client is
Nodejs
There is still a fair bit of functionality that can be added to the client, so feel free to open a pull request or an issue if you find a bug.
Virus Scans
Jotti. (0/17)
Virus Total. (0/51)
The packet ids have been updated to work with build X19.0.2
@
Raple @
Ahlwong please move this to the main post
Virus Scans
Jotti. (0/18)
VirusTotal. (0/59)