Skip to content

creaffy/zombslib

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

79 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

zombslib

Create and manage artificial connections to ZombsRoyale.io servers.

⚙️ Installation

Zombslib is not available through the npm registry, however you can still easily install it like so:

npm install https://github.com/creaffy/zombslib

A more detailed documentation for this library is available on ZR Wiki. In case something is not clearly explained there, consider joining our Discord server.

✨ Features

  • Game Session
    Establish and manage live connections to servers over TCP/UDP.

  • High-Level Events
    Subscribe to world updates, RPCs, and social events through a unified event system.

  • Protocol Reimplementation
    Encode or decode all kinds of packets.

  • Mason Service
    Manage parties, friends and enter matchmaking via the MasonService wrapper.

  • REST API
    Simple wrapper for all endpoints.

  • Entity Utilities
    Query players and other world entities by type, UID, or name with convenient lookups.

🚀 Usage

Basic in-game bot example:

import {
    ApiServer,
    EnterWorldResponse,
    Game,
    KillFeedRpc,
    MasonService,
    SocketIOSessionData,
    UdpConnectResponse,
    UdpTick,
} from "zombslib";

const mason = new MasonService();
mason.once("socketIoSessionData", (d: SocketIOSessionData) => {
    mason.createParty();
    mason.setPartyGameMode("Solo");
    mason.setPartyRegion("vultr-la");
    mason.setReady(true);
});

mason.once("partyJoinServer", (server: ApiServer) => {
    const game = new Game(server, { displayName: "Example", udp: true });

    game.once("EnterWorldResponse", (r: EnterWorldResponse) => game.setPlatformRpc("android"));
    game.once("UdpConnectResponse", (r: UdpConnectResponse) => game.startUdpStreamRpc());

    game.on("EntityUpdate", (u: UdpTick) => {
        const me = game.getEntityByUid(game.getMyUid());
        if (me?.tick?.currentAmmo === 0) {
            game.reloadRpc();
        }
    });

    game.on("KillFeedRpc", (rpc: KillFeedRpc) => {
        game.sendChatMessageRpc("Party", `${rpc.killer} KO'd ${rpc.victim}`);
    });
});

Here are some more simple usage examples:

🚨 Future

We cannot say for sure how long this project is going to be kept up-to-date with the game. However, considering the lack of content updates, probably quite a while. In the meantime, there's still some things that need to be implemented into the codebase, like a comprehensive error handling system, as currently all decoders fail silently.

⚠️ Disclaimer

This project is unofficial and not affiliated with Zombs Royale or Endgame. Use responsibly and at your own risk.

About

Complete library for connecting to ZombsRoyale.io servers

Resources

Stars

Watchers

Forks

Contributors 2

  •  
  •