0.5.52 • Published 4 years ago

alclient-mongo v0.5.52

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

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 code is essentially the 'alclient' package, but with a mongo database that tracks things like monster and player positions, and deaths.

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 14.9

Basic Usage

Notes: In tsconfig.json, make sure "esModuleInterop": true is set. In package.json, make sure "type": "module" is set.

  1. Install the package using npm install alclient.
  2. Add a credentials.json file that looks like this:
{
    "email": "hyprkookeez@gmail.com",
    "password": "thisisnotmyrealpasswordlol"
}
  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()
0.5.52

4 years ago

0.5.50

4 years ago

0.5.51

4 years ago

0.5.44

4 years ago

0.5.49

4 years ago

0.5.47

4 years ago

0.5.48

4 years ago

0.5.45

4 years ago

0.5.46

4 years ago

0.5.43

4 years ago

0.5.42

4 years ago

0.5.40

4 years ago

0.5.38

4 years ago

0.5.39

4 years ago

0.5.37

4 years ago

0.5.36

4 years ago

0.5.34

4 years ago

0.5.35

4 years ago

0.5.32

4 years ago

0.5.33

4 years ago

0.5.30

4 years ago

0.5.31

4 years ago

0.5.29

4 years ago

0.5.27

4 years ago

0.5.28

4 years ago

0.5.25

4 years ago

0.5.26

4 years ago

0.5.24

4 years ago

0.5.23

4 years ago

0.5.22

4 years ago

0.5.18

4 years ago

0.5.19

4 years ago

0.5.21

4 years ago

0.5.20

4 years ago

0.5.17

4 years ago

0.5.16

4 years ago

0.5.14

4 years ago

0.5.15

4 years ago

0.5.11

4 years ago

0.5.12

4 years ago

0.5.13

4 years ago

0.5.10

4 years ago

0.4.32

4 years ago

0.4.37

4 years ago

0.4.35

4 years ago

0.4.36

4 years ago

0.4.33

4 years ago

0.4.34

4 years ago

0.5.4

4 years ago

0.5.3

4 years ago

0.5.6

4 years ago

0.5.5

4 years ago

0.5.0

4 years ago

0.5.2

4 years ago

0.5.8

4 years ago

0.5.7

4 years ago

0.5.9

4 years ago

0.4.31

4 years ago

0.4.30

4 years ago

0.4.29

4 years ago

0.4.28

4 years ago

0.4.27

4 years ago

0.4.26

4 years ago

0.4.25

4 years ago

0.4.24

4 years ago

0.4.23

4 years ago

0.4.22

4 years ago

0.4.21

4 years ago

0.4.20

4 years ago

0.4.19

4 years ago

0.4.18

4 years ago

0.4.17

4 years ago

0.4.16

4 years ago

0.4.15

4 years ago

0.4.14

4 years ago

0.4.13

4 years ago

0.4.12

4 years ago

0.4.11

4 years ago

0.4.10

4 years ago

0.4.9

4 years ago

0.4.8

4 years ago

0.4.7

4 years ago

0.4.6

4 years ago

0.4.5

4 years ago

0.4.4

4 years ago

0.4.3

4 years ago

0.4.2

4 years ago

0.4.1

4 years ago

0.4.0

4 years ago

0.3.49

4 years ago

0.3.48

4 years ago

0.3.47

4 years ago

0.3.45

4 years ago

0.3.44

4 years ago

0.3.42

4 years ago

0.3.41

4 years ago

0.3.40

4 years ago

0.3.39

4 years ago

0.3.38

4 years ago

0.3.37

4 years ago

0.3.36

4 years ago

0.3.35

4 years ago

0.3.34

4 years ago

0.3.33

4 years ago

0.3.32

4 years ago

0.3.31

4 years ago