GithubHelp home page GithubHelp logo

melg8 / alclient Goto Github PK

View Code? Open in Web Editor NEW

This project forked from earthiverse/alclient

0.0 0.0 0.0 11.34 MB

A node client for interacting with Adventure Land - The Code MMORPG

JavaScript 0.01% TypeScript 100.00%

alclient's Introduction

ALClient README

NOTE: This code is very much a work in progress. Things will quickly change, and your code will likely break between changes.


This is a node client for the game Adventure Land - The Code MMORPG. It's 99% custom code that seems much more efficient than running the code in-game, or using the game's official CLI.

This code is NOT a 1-to-1 drop in, like ALBot aims to be. The code that you run in the console in game WILL NOT run as-is if you try to run your in-game code using this project.

Requirements

  • Node
    • Tested with 16.5, but some earlier versions will most likely work, too.

Basic Usage

For Beginners:

  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)

    const merchant = await AL.Game.startMerchant("earthMer2", "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()

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()

alclient's People

Contributors

earthiverse avatar joeynenni-paypal avatar kevinsandow avatar oliver-cool-beans avatar stormsurge95 avatar

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.