UNPKG

@peacockproject/core

Version:

Type definitions for Peacock's core.

155 lines (154 loc) 3.71 kB
import { EventEmitter } from "events"; export type LiveSplitResult = Promise<string | boolean | undefined>; /** * Node.js client for the LiveSplit Server running instance. * * @see https://github.com/LiveSplit/LiveSplit.Server LiveSplit server component * @see https://github.com/satanch/livesplit-node-client Original source code * @author satanch (https://github.com/satanch) * @license MIT */ export declare class LiveSplitClient extends EventEmitter { timeout: number; private readonly _connectionDetails; private _connected; private _initGameTimeOnce; private _socket; /** * Creates a new instance. * * @param address - Connection address, in the format of 127.0.0.1:1234. */ constructor(address: string); /** * Checks that no disallowed symbols are present in the command. * * @param str The command. * @throws {Error} If the command includes `\r\n`. */ private static _checkDisallowedSymbols; /** * Performs connection attempt to the LiveSplit Server instance. */ connect(): Promise<boolean>; /** * Disconnect client from the server. */ disconnect(): boolean; /** * Send command to the LiveSplit Server instance. */ send(command: string, expectResponse?: boolean): LiveSplitResult; /** * Start the timer. */ startTimer(): LiveSplitResult; /** * Start or split. */ startOrSplit(): LiveSplitResult; /** * Split. */ split(): LiveSplitResult; /** * Un-split. */ unsplit(): LiveSplitResult; /** * Skip split. */ skipSplit(): LiveSplitResult; /** * Pause. */ pause(): LiveSplitResult; /** * Resume. */ resume(): LiveSplitResult; /** * Reset. */ reset(): LiveSplitResult; /** * Init game time. Can only be called once according to LiveSplit Server documentation. */ initGameTime(): LiveSplitResult; /** * Set game time. * * @param time Game time. */ setGameTime(time: string): LiveSplitResult; /** * Set loading times. * * @param time Loading times. */ setLoadingTimes(time: string): LiveSplitResult; /** * Pause game time. */ pauseGameTime(): LiveSplitResult; /** * Unpause game time. */ unpauseGameTime(): LiveSplitResult; /** * Set comparison. * * @param comparison The comparison. */ setComparison(comparison: string): LiveSplitResult; /** * Get delta. * * @param comparison The comparison. */ getDelta(comparison?: string): LiveSplitResult; /** * Get last split time. */ getLastSplitTime(): LiveSplitResult; /** * Get comparison split time. */ getComparisonSplitTime(): LiveSplitResult; /** * Get the current time. */ getCurrentTime(): LiveSplitResult; /** * Get the final time. * * @param comparison The comparison. */ getFinalTime(comparison?: string): LiveSplitResult; /** * Get predicted time. * * @param comparison The comparison. */ getPredictedTime(comparison: string): LiveSplitResult; /** * Get the best possible time. */ getBestPossibleTime(): LiveSplitResult; /** * Get split index. */ getSplitIndex(): LiveSplitResult; /** * Get current split name. */ getCurrentSplitName(): LiveSplitResult; /** * Get previous split name. */ getPreviousSplitName(): LiveSplitResult; /** * Get current timer phase. */ getCurrentTimerPhase(): LiveSplitResult; }