2021-09-16 01:50:44 +02:00
|
|
|
import { TextFile } from "../TextFile";
|
|
|
|
import { Script } from "../Script/Script";
|
|
|
|
import { IPlayer } from "../PersonObjects/IPlayer";
|
|
|
|
import { IEngine } from "../IEngine";
|
|
|
|
|
2021-09-16 08:52:45 +02:00
|
|
|
export interface IOutput {
|
|
|
|
text: string;
|
|
|
|
color: "inherit" | "initial" | "primary" | "secondary" | "error" | "textPrimary" | "textSecondary" | undefined;
|
|
|
|
}
|
|
|
|
|
2021-09-16 01:50:44 +02:00
|
|
|
export interface ITerminal {
|
2021-09-16 02:06:48 +02:00
|
|
|
// Flags to determine whether the player is currently running a hack or an analyze
|
|
|
|
hackFlag: boolean;
|
|
|
|
backdoorFlag: boolean;
|
|
|
|
analyzeFlag: boolean;
|
|
|
|
actionStarted: boolean;
|
|
|
|
actionTime: number;
|
|
|
|
|
|
|
|
commandHistory: string[];
|
|
|
|
commandHistoryIndex: number;
|
|
|
|
|
2021-09-16 08:52:45 +02:00
|
|
|
outputHistory: IOutput[];
|
|
|
|
|
2021-09-16 02:06:48 +02:00
|
|
|
// True if a Coding Contract prompt is opened
|
|
|
|
contractOpen: boolean;
|
|
|
|
|
|
|
|
// Full Path of current directory
|
|
|
|
// Excludes the trailing forward slash
|
|
|
|
currDir: string;
|
|
|
|
|
2021-09-16 01:50:44 +02:00
|
|
|
print(s: string, config?: any): void;
|
|
|
|
error(s: string): void;
|
|
|
|
|
2021-09-16 08:52:45 +02:00
|
|
|
clear(): void;
|
2021-09-16 01:50:44 +02:00
|
|
|
startAnalyze(): void;
|
|
|
|
startBackdoor(player: IPlayer): void;
|
|
|
|
startHack(player: IPlayer): void;
|
|
|
|
finishHack(player: IPlayer, cancelled?: boolean): void;
|
|
|
|
finishBackdoor(player: IPlayer, cancelled?: boolean): void;
|
|
|
|
finishAnalyze(player: IPlayer, cancelled?: boolean): void;
|
|
|
|
finishAction(player: IPlayer, cancelled?: boolean): void;
|
|
|
|
getFilepath(filename: string): string;
|
|
|
|
getFile(player: IPlayer, filename: string): Script | TextFile | string | null;
|
|
|
|
getScript(player: IPlayer, filename: string): Script | null;
|
|
|
|
getTextFile(player: IPlayer, filename: string): TextFile | null;
|
|
|
|
getLitFile(player: IPlayer, filename: string): string | null;
|
|
|
|
cwd(): string;
|
|
|
|
setcwd(dir: string): void;
|
|
|
|
runContract(player: IPlayer, name: string): void;
|
|
|
|
executeScanAnalyzeCommand(player: IPlayer, depth?: number, all?: boolean): void;
|
|
|
|
connectToServer(player: IPlayer, server: string): void;
|
|
|
|
executeCommand(engine: IEngine, player: IPlayer, command: string): void;
|
|
|
|
executeCommands(engine: IEngine, player: IPlayer, commands: string): void;
|
2021-09-16 08:52:45 +02:00
|
|
|
// If there was any changes, will return true, once.
|
|
|
|
pollChanges(): boolean;
|
2021-09-16 01:50:44 +02:00
|
|
|
}
|