0.5.52 • Published 3 years ago

alclient-mongo v0.5.52

Weekly downloads
-
License
MIT
Repository
github
Last release
3 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

3 years ago

0.5.50

3 years ago

0.5.51

3 years ago

0.5.44

3 years ago

0.5.49

3 years ago

0.5.47

3 years ago

0.5.48

3 years ago

0.5.45

3 years ago

0.5.46

3 years ago

0.5.43

3 years ago

0.5.42

3 years ago

0.5.40

3 years ago

0.5.38

3 years ago

0.5.39

3 years ago

0.5.37

3 years ago

0.5.36

3 years ago

0.5.34

3 years ago

0.5.35

3 years ago

0.5.32

3 years ago

0.5.33

3 years ago

0.5.30

3 years ago

0.5.31

3 years ago

0.5.29

3 years ago

0.5.27

3 years ago

0.5.28

3 years ago

0.5.25

3 years ago

0.5.26

3 years ago

0.5.24

3 years ago

0.5.23

3 years ago

0.5.22

3 years ago

0.5.18

3 years ago

0.5.19

3 years ago

0.5.21

3 years ago

0.5.20

3 years ago

0.5.17

3 years ago

0.5.16

3 years ago

0.5.14

3 years ago

0.5.15

3 years ago

0.5.11

3 years ago

0.5.12

3 years ago

0.5.13

3 years ago

0.5.10

3 years ago

0.4.32

3 years ago

0.4.37

3 years ago

0.4.35

3 years ago

0.4.36

3 years ago

0.4.33

3 years ago

0.4.34

3 years ago

0.5.4

3 years ago

0.5.3

3 years ago

0.5.6

3 years ago

0.5.5

3 years ago

0.5.0

3 years ago

0.5.2

3 years ago

0.5.8

3 years ago

0.5.7

3 years ago

0.5.9

3 years ago

0.4.31

3 years ago

0.4.30

3 years ago

0.4.29

3 years ago

0.4.28

3 years ago

0.4.27

3 years ago

0.4.26

3 years ago

0.4.25

3 years ago

0.4.24

3 years ago

0.4.23

3 years ago

0.4.22

3 years ago

0.4.21

3 years ago

0.4.20

3 years ago

0.4.19

3 years ago

0.4.18

3 years ago

0.4.17

3 years ago

0.4.16

3 years ago

0.4.15

3 years ago

0.4.14

3 years ago

0.4.13

3 years ago

0.4.12

3 years ago

0.4.11

3 years ago

0.4.10

3 years ago

0.4.9

3 years ago

0.4.8

3 years ago

0.4.7

3 years ago

0.4.6

3 years ago

0.4.5

3 years ago

0.4.4

3 years ago

0.4.3

3 years ago

0.4.2

3 years ago

0.4.1

3 years ago

0.4.0

3 years ago

0.3.49

3 years ago

0.3.48

3 years ago

0.3.47

3 years ago

0.3.45

3 years ago

0.3.44

3 years ago

0.3.42

3 years ago

0.3.41

3 years ago

0.3.40

3 years ago

0.3.39

3 years ago

0.3.38

3 years ago

0.3.37

3 years ago

0.3.36

3 years ago

0.3.35

3 years ago

0.3.34

3 years ago

0.3.33

3 years ago

0.3.32

3 years ago

0.3.31

3 years ago