Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Client

Hierarchy

  • Client

Index

Constructors

constructor

  • Creates a new instance of the client and begins the connection process to the specified server.

    Parameters

    • runtime: Runtime
    • server: Server

      The server to connect to.

    • accInfo: Account

      The account info to connect with.

    Returns Client

Properties

alias

alias: string

The alias of the client.

autoAim

autoAim: boolean

Whether or not the client should automatically shoot at enemies.

Private buildVersion

buildVersion: string

charInfo

charInfo: CharacterInfo

Info about the account's characters.

see

CharacterInfo for more information.

Private clientHP

clientHP: number

Private clientSocket

clientSocket: Socket

Private connectTime

connectTime: number

Private currentBulletId

currentBulletId: number

Private currentTickTime

currentTickTime: number

Private enemies

enemies: Map<number, Enemy>

Private frameUpdateTimer

frameUpdateTimer: Timer

guid

guid: string

The email address of the client.

Private hasPet

hasPet: boolean

Private hpLog

hpLog: number

Private internalAutoNexusThreshold

internalAutoNexusThreshold: number

Private internalGameId

internalGameId: GameId

Private internalMoveMultiplier

internalMoveMultiplier: number

Private internalServer

internalServer: Server

io

io: PacketIO

The PacketIO instance associated with the client.

see

PacketIO for more info.

Private key

key: number[]

Private keyTime

keyTime: number

Private lastAttackTime

lastAttackTime: number

Private lastFrameTime

lastFrameTime: number

Private lastTickId

lastTickId: number

Private lastTickTime

lastTickTime: number

mapInfo

mapInfo: MapInfo

Info about the current map.

see

MapInfo for more information.

mapTiles

mapTiles: MapTile[]

The tiles of the current map. These are stored in a 1d array, so to access the tile at x, y the index y * height + x should be used where height is the height of the map.

example
getTile(client: Client, x: number, y: number): MapTile {
  const tileX = Math.floor(x);
  const tileY = Math.floor(y);
  return client.mapTiles.mapTiles[tileY * client.mapInfo.height + tileX];
}

Private moveRecords

moveRecords: MoveRecords

Private needsNewCharacter

needsNewCharacter: boolean

nextPos

nextPos: WorldPosData[]

A queue of positions for the client to move towards. If the queue is not empty, the client will move towards the first item in it. The first item will be removed when the client has reached it.

example
const pos: WorldPosData = client.worldPos.clone();
pos.x += 1;
pos.y += 1;
client.nextPos.push(pos);

Private nexusServer

nexusServer: Server

objectId

objectId: number

The objectId of the client.

password

password: string

The password of the client.

Private pathfinder

pathfinder: Pathfinder

Private pathfinderEnabled

pathfinderEnabled: boolean

Private pathfinderTarget

pathfinderTarget: Point

playerData

playerData: PlayerData

The player data of the client.

see

PlayerData for more info.

Private players

players: Map<number, Entity>

Private projectiles

projectiles: Projectile[]

Private proxy

proxy: Proxy

Private random

random: Random

Private reconnectCooldown

reconnectCooldown: number

runtime

runtime: Runtime

The runtime in which this client is running.

Private safeMap

safeMap: boolean

Private socketConnected

socketConnected: boolean

Private tileMultiplier

tileMultiplier: number

worldPos

worldPos: WorldPosData

The current position of the client.

Accessors

autoNexusThreshold

  • get autoNexusThreshold(): number
  • set autoNexusThreshold(value: number): void
  • A number between 0 and 1 which represents the percentage of health at which the client will escape to the Nexus. A value of 0.5 will be 50% of the max health.

    Returns number

  • A number between 0 and 1 which represents the percentage of health at which the client will escape to the Nexus. A value of 0.5 will be 50% of the max health.

    Parameters

    • value: number

    Returns void

connected

  • get connected(): boolean
  • Indicates whether or not the client's TCP socket is connected.

    Returns boolean

gameId

moveMultiplier

  • get moveMultiplier(): number
  • set moveMultiplier(value: number): void
  • A number between 0 and 1 which can be used to modify the speed of the client. A value of 1 will be 100% move speed for the client, a value of 0.5 will be 50% of the max speed. etc.

    Returns number

  • A number between 0 and 1 which can be used to modify the speed of the client. A value of 1 will be 100% move speed for the client, a value of 0.5 will be 50% of the max speed. etc.

    example

    client.moveMultiplier = 0.8;

    Parameters

    • value: number

    Returns void

server

Methods

Private addHealth

  • addHealth(amount: number): void

Private applyDamage

  • applyDamage(amount: number, armorPiercing: boolean, time: number): boolean
  • Applies some damage and returns whether or not the client should return to the nexus.

    Parameters

    • amount: number

      The amount of damage to apply.

    • armorPiercing: boolean

      Whether or not the damage should be armor piercing.

    • time: number

    Returns boolean

Private calcHealth

  • calcHealth(delta: number): void

changeGameId

  • changeGameId(gameId: GameId): void
  • Connects to gameId on the current server @param gameId The gameId to use upon connecting.

    Parameters

    Returns void

Private checkGroundDamage

  • checkGroundDamage(time: number): void
  • Checks whether or not the client should take damage from the tile they are currently standing on.

    Parameters

    • time: number

    Returns void

Private checkHealth

  • checkHealth(time?: number): boolean

Private checkProjectiles

  • checkProjectiles(time: number): void

Private connect

  • connect(): Promise<void>

connectToNexus

  • connectToNexus(): void

connectToServer

  • Connects the bot to the server.

    Parameters

    • server: Server

      The server to connect to.

    • Default value gameId: GameId = this.internalGameId

      An optional game id to use when connecting. Defaults to the current game id.

    Returns void

destroy

  • destroy(): void
  • Removes all event listeners and releases any resources held by the client. This should only be used when the client is no longer needed.

    Returns void

findPath

  • findPath(to: Point): void
  • Finds a path from the client's current position to the to point and moves the client along the path.

    Parameters

    • to: Point

      The point to navigate towards.

    Returns void

Private fixCharInfoCache

  • fixCharInfoCache(): void
  • Fixes the character cache after a dead character has been loaded.

    Returns void

Private getAttackFrequency

  • getAttackFrequency(): number

Private getAttackMultiplier

  • getAttackMultiplier(): number

Private getBulletId

  • getBulletId(): number

Private getSpeed

  • getSpeed(timeElapsed: number): number

getTime

  • getTime(): number
  • Returns how long the client has been connected for, in milliseconds.

    Returns number

Private moveTo

  • moveTo(target: WorldPosData, timeElapsed: number): void
  • Parameters

    • target: WorldPosData
    • timeElapsed: number

    Returns void

Private onAoe

  • onAoe(aoePacket: AoePacket): void

Private onClose

  • onClose(): void

Private onConnect

  • onConnect(): void

Private onCreateSuccess

  • onCreateSuccess(createSuccessPacket: CreateSuccessPacket): void
  • Parameters

    • createSuccessPacket: CreateSuccessPacket

    Returns void

Private onDamage

  • onDamage(damage: DamagePacket): void

Private onDeath

  • onDeath(deathPacket: DeathPacket): void

Private onEnemyShoot

  • onEnemyShoot(enemyShootPacket: EnemyShootPacket): void

Private onError

  • onError(error: Error): void

Private onFailurePacket

  • onFailurePacket(failurePacket: FailurePacket): void

Private onFrame

  • onFrame(): void

Private onGotoPacket

  • onGotoPacket(gotoPacket: GotoPacket): void

Private onMapInfo

  • onMapInfo(mapInfoPacket: MapInfoPacket): void

Private onNewTick

  • onNewTick(newTickPacket: NewTickPacket): void

Private onNotification

  • onNotification(notification: NotificationPacket): void

Private onPing

  • onPing(pingPacket: PingPacket): void

Private onReconnectPacket

  • onReconnectPacket(reconnectPacket: ReconnectPacket): void

Private onServerPlayerShoot

  • onServerPlayerShoot(serverPlayerShoot: ServerPlayerShootPacket): void
  • Parameters

    • serverPlayerShoot: ServerPlayerShootPacket

    Returns void

Private onUpdate

  • onUpdate(updatePacket: UpdatePacket): void

Private send

  • send(packet: Packet): void
  • Sends a packet only if the client is currently connected.

    Parameters

    • packet: Packet

      The packet to send.

    Returns void

Private sendHello

  • sendHello(): void

setProxy

  • setProxy(proxy: Proxy): void
  • Switches the client connect to a proxied connection. Setting this to undefined will remove the current proxy if there is one.

    Parameters

    • proxy: Proxy

      The proxy to use.

    Returns void

shoot

  • shoot(angle: number): boolean
  • Shoots a projectile at the specified angle.

    Parameters

    • angle: number

      The angle in radians to shoot towards.

    Returns boolean

Private walkTo

  • walkTo(x: number, y: number): void

Generated using TypeDoc