UNPKG

alclient

Version:

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

77 lines (76 loc) 3.23 kB
import type { Graph, Link, Node } from "ngraph.graph"; import type { IPosition } from "./definitions/adventureland.js"; import type { GData, ItemName, MapName, MonsterName, NPCName } from "./definitions/adventureland-data.js"; import type { Grids, Grid, LinkData, NodeData, PathfinderOptions } from "./definitions/pathfinder.js"; export declare class Pathfinder { protected static G: GData; protected static FIRST_MAP: MapName; protected static TRANSPORT_COST: number; protected static TOWN_COST: number; protected static ENTER_COST: number; protected static grids: Grids; protected static graph: Graph<NodeData, LinkData>; protected static addLinkToGraph(from: Node<NodeData>, to: Node<NodeData>, data?: LinkData): Link<LinkData>; protected static addNodeToGraph(map: MapName, x: number, y: number): Node<NodeData>; /** * Checks if we can stand at the given location. Useful for `blink()`. * * @static * @param {IPosition} location Position to check if we can stand there * @return {*} {boolean} * @memberof Pathfinder */ static canStand(location: IPosition): boolean; /** * Checks if we can walk from `from` to `to`. Useful for `move()`. * Adapted from http://eugen.dedu.free.fr/projects/bresenham/ * @param from The starting position (where we start walking from) * @param to The ending position (where we walk to) */ static canWalkPath(from: IPosition, to: IPosition): boolean; static computeLinkCost(from: NodeData, to: NodeData, link?: LinkData, options?: PathfinderOptions): number; static computePathCost(path: LinkData[], options?: PathfinderOptions): number; /** * Generates a grid of walkable pixels that we use for pathfinding. * @param map The map to generate the grid for */ static getGrid(map: MapName, base?: { h: number; v: number; vn: number; }): Grid; static findClosestNode(map: MapName, x: number, y: number): Node<NodeData>; static findClosestSpawn(map: MapName, x: number, y: number): { map: MapName; x: number; y: number; distance: number; }; static getPath(from: NodeData, to: NodeData, options?: PathfinderOptions): LinkData[]; /** * If we were to walk from `from` to `to`, and `to` was unreachable, get the furthest `to` we can walk to. * Adapted from http://eugen.dedu.free.fr/projects/bresenham/ * @param from * @param to */ static getSafeWalkTo(from: IPosition, to: IPosition): IPosition; static prepare(g: GData, options?: { base?: { h: number; v: number; vn: number; }; cheat?: boolean; remove_abtesting?: boolean; remove_bank_b?: boolean; remove_bank_u?: boolean; remove_goobrawl?: boolean; remove_test?: boolean; maps?: MapName[]; showConsole?: boolean; }): Promise<void>; static locateMonster(mTypes: MonsterName | MonsterName[]): IPosition[]; static locateNPC(npcID: NPCName): IPosition[]; static locateCraftNPC(itemName: ItemName): IPosition; static locateExchangeNPC(itemName: ItemName): IPosition; }