1.3.4 • Published 4 months ago

growtopia.js v1.3.4

Weekly downloads
-
License
MIT
Repository
github
Last release
4 months ago

Growtopia.js

Github Version NPM Version NPM Minified

A fork of GrowSockets to create a growtopia private servers.

Features

  • Stable
  • Plugins system
  • Built-in ItemsDat tools & Web server

Requirements

Installation

npm i growtopia.js

Example

const { Client, TextPacket, Peer } = require("growtopia.js");

const client = new Client();

client.on("ready", () => {
  console.log(
    `ENet server: port ${client.config.enet.port} on ${client.config.enet.ip}\nHttps server: port ${client.config.https.port} on ${client.config.https.ip}`
  );
});

client.on("error", (err) => {
  console.log("Something wrong", err);
});

client.on("connect", (netID) => {
  console.log(`Connected netID ${netID}`);
  const peer = new Peer(client, netID);
  peer.send(TextPacket.from(0x1));
});

client.on("disconnect", (netID) => {
  console.log(`Disconnected netID ${netID}`);
});

client.on("raw", (netID, data) => {
  console.log("raw", data);
});

client.on("action", (peer, data) => {
  console.log(`Peer (${peer.data.netID}) action`, { data });
  if (data.action === "quit") {
    peer.disconnect();
  }
});

client.on("tank", (peer, tank) => {
  console.log(`Peer (${peer.data.netID}) tank`, { tank });
});

client.on("text", (peer, data) => {
  console.log(peer.ping);

  console.log(`Peer (${peer.data.netID}) text`, { data });
});

client.listen();

Plugins

To create your own plugin, take a look here

A example adding plugin to your server:

const client = new Client({
  // Add a plugin here
  plugins: [new IModule(), new WorldGen()]
});

Plugins list

Open a PR to add your plugin here

NameLinkDescription
HelloWorldGithubTest sending hello world :D

Building

Requirements

npm i growtopia.js --build-from-source

Links

Credits

Give a thumbs to these cool people

1.3.4

4 months ago

1.3.3

5 months ago

1.3.2

5 months ago

1.3.1

6 months ago

1.3.0

6 months ago

1.2.7

9 months ago

1.2.6

9 months ago

1.2.5

10 months ago

1.2.4

11 months ago

1.2.3

11 months ago

1.2.2

11 months ago

1.2.1

11 months ago

1.2.0

11 months ago

1.1.7

11 months ago

1.1.6

11 months ago

1.1.5

11 months ago

1.1.4

11 months ago

1.1.3

11 months ago

1.1.2

11 months ago

1.1.1

12 months ago

1.1.0

12 months ago

1.0.6

12 months ago

1.0.5

12 months ago

1.0.4

12 months ago

1.0.3

12 months ago

1.0.2

12 months ago

1.0.1

12 months ago

1.0.0

12 months ago