npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

alclient

v0.21.7

Published

A node client for interacting with Adventure Land - The Code MMORPG. This package extends the functionality of 'alclient' by managing a mongo database.

Downloads

1,799

Readme

ALClient

This is a node client for the game Adventure Land - The Code MMORPG.

This code is NOT compatible with scripts written directly in the game. If you are just looking for a way to run your code headless, or with fewer resources, I recommend trying caracAL.

Basic Usage

  1. Install the latest version of node.
  2. Create a new folder for your project
  3. Run npm init and enter prompts. Check out this link for more information.
  4. If you are using Typescript, which is strongly recommended, install it by running npm install typescript. Save your files as .ts files instead of .js files.
  5. If you are using Typescript, build your code by running npx tsc.

Notes

In your tsconfig.json, make sure "esModuleInterop": true is set.

In your package.json, make sure "type": "module" is set.

General Steps

  1. Install the package using npm install alclient.
  2. Add a credentials.json file that looks like this:
{
    "email": "[email protected]",
    "password": "thisisnotmyrealpasswordlol"
}

You can also optionally add a Mongo URI to track various data with a mongo database.

{
    "email": "[email protected]",
    "password": "thisisnotmyrealpasswordlol",
    "mongo": "mongodb://localhost:27017/alclient"
}
  1. Copy and run this example script that prepares the pathfinder, logs in, moves your character around to different maps, then disconnects.
import AL from "alclient"

async function run() {
    await Promise.all([AL.Game.loginJSONFile("../credentials.json"), AL.Game.getGData()])
    await AL.Pathfinder.prepare(AL.Game.G)

    // Set `<<MERCHANT_NAME>>` to your merchant
    const merchant = await AL.Game.startMerchant("<<MERCHANT_NAME>>", "ASIA", "I")
    console.log("Moving to main")
    await merchant.smartMove("main")
    console.log("Moving to cyberland")
    await merchant.smartMove("cyberland")
    console.log("Moving to halloween")
    await merchant.smartMove("halloween")

    merchant.disconnect()
}
run()
  1. While the code is running, you should be able to see your character using /comm

Notable differences from 'native' Adventure Land code.

  1. Most actions like move() are on the Character in alclient.
import AL from "alclient"

async function run() {
    await AL.Game.loginJSONFile("../credentials.json")
    const ranger = await AL.Game.startRanger("earthiverse", "US", "I")

    while (true) {
        await ranger.move(50, 50)
        await ranger.move(50, -50)
        await ranger.move(-50, -50)
        await ranger.move(-50, 50)
    }
}
run()
  1. Some functions are renamed, most notably attack() is basicAttack().
import AL from "alclient"

async function run() {
    await Promise.all([AL.Game.loginJSONFile("../credentials.json"), AL.Game.getGData()])
    await AL.Pathfinder.prepare(AL.Game.G)
    const ranger = await AL.Game.startRanger("earthiverse", "US", "I")

    await ranger.smartMove("hen")

    while (true) {
        if (ranger.canUse("attack") && ranger.isPVP()) {
            // We can attack players
            for (const [, player] of ranger.players) {
                if (AL.Tools.distance(ranger, player) > ranger.range) continue // Too far to attack

                // We found a player to attack!
                await ranger.basicAttack(player.id)
                break
            }
        }
        if (ranger.canUse("attack")) {
            for (const [, entity] of ranger.entities) {
                if (AL.Tools.distance(ranger, entity) > ranger.range) continue // Too far to attack

                // We found an entity to attack!
                await ranger.basicAttack(entity.id)
                break
            }
        }
    }
}
run()