import { TypedEmitter } from 'tiny-typed-emitter'; import type { InSimEvents } from './InSimEvents'; import type { IS_ISI_Data, SendablePacket } from './packets'; import { MessageSound, packetTypeToClass } from './packets'; import type { InSimPacketInstance } from './packets/types'; type InSimConnectionOptions = { Host: string; Port: number; Protocol?: 'TCP' | 'UDP'; }; export type InSimOptions = Omit & InSimConnectionOptions; export declare class InSim extends TypedEmitter { /** Currently supported InSim version */ static INSIM_VERSION: number; private static COMMAND_PREFIX; /** A unique identifier of the InSim connection to a specific host */ id: string; private _options; /** The main connection to InSim (TCP or UDP) */ private connection; private sizeMultiplier; constructor(id?: string); /** * Connect to a server via InSim. */ connect: (options: Omit, "InSimVer"> & InSimConnectionOptions) => void; disconnect: () => void; send: (packet: SendablePacket) => void; get options(): InSimOptions; /** * Send a message or command to LFS * * If the message starts with a slash (`/`), it will be treated as a command. * Otherwise, it will be treated as a message. * * The maximum length of the message is {@link MSX_MSG_MAX_LENGTH} characters. */ sendMessage: (message: string) => void; /** * Send a message which will appear on the local computer only. * * The maximum length of the message is {@link MSL_MSG_MAX_LENGTH} characters. */ sendLocalMessage: (message: string, sound?: MessageSound) => void; /** Send a message to a specific connection */ sendMessageToConnection: (ucid: number, message: string, sound?: MessageSound) => void; /** Send a message to a specific player */ sendMessageToPlayer: (plid: number, message: string, sound?: MessageSound) => void; sendAwait: (packet: SendablePacket, packetTypeToAwait: TPacketTypeToAwait, filterPacketData?: (packet: InSimPacketInstance) => boolean) => Promise>; private handlePacket; private handleKeepAlive; } export {};