mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-12-21 05:35:45 +01:00
Remove more unused interfaces
This commit is contained in:
parent
e578bd7681
commit
dcd9023b93
@ -1,28 +0,0 @@
|
|||||||
/**
|
|
||||||
* TypeScript interface for the game engine (engine.js), which can't be converted
|
|
||||||
* to TypeScript at the moment
|
|
||||||
*/
|
|
||||||
export interface IEngine {
|
|
||||||
_lastUpdate: number;
|
|
||||||
updateGame: (numCycles?: number) => void;
|
|
||||||
Counters: {
|
|
||||||
[key: string]: number | undefined;
|
|
||||||
autoSaveCounter: number;
|
|
||||||
updateSkillLevelsCounter: number;
|
|
||||||
updateDisplays: number;
|
|
||||||
updateDisplaysLong: number;
|
|
||||||
updateActiveScriptsDisplay: number;
|
|
||||||
createProgramNotifications: number;
|
|
||||||
augmentationsNotifications: number;
|
|
||||||
checkFactionInvitations: number;
|
|
||||||
passiveFactionGrowth: number;
|
|
||||||
messages: number;
|
|
||||||
mechanicProcess: number;
|
|
||||||
contractGeneration: number;
|
|
||||||
achievementsCounter: number;
|
|
||||||
};
|
|
||||||
decrementAllCounters: (numCycles?: number) => void;
|
|
||||||
checkCounters: () => void;
|
|
||||||
load: (saveString: string) => void;
|
|
||||||
start: () => void;
|
|
||||||
}
|
|
@ -1,105 +0,0 @@
|
|||||||
import React from "react";
|
|
||||||
import { TextFile } from "../TextFile";
|
|
||||||
import { Script } from "../Script/Script";
|
|
||||||
import { Settings } from "../Settings/Settings";
|
|
||||||
import { formatTime } from "../utils/helpers/formatTime";
|
|
||||||
import { BaseServer } from "../Server/BaseServer";
|
|
||||||
|
|
||||||
export class Output {
|
|
||||||
text: string;
|
|
||||||
color: "primary" | "error" | "success" | "info" | "warn";
|
|
||||||
constructor(text: string, color: "primary" | "error" | "success" | "info" | "warn") {
|
|
||||||
if (Settings.TimestampsFormat) text = "[" + formatTime(Settings.TimestampsFormat) + "] " + text;
|
|
||||||
this.text = text;
|
|
||||||
this.color = color;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export class RawOutput {
|
|
||||||
raw: React.ReactNode;
|
|
||||||
constructor(node: React.ReactNode) {
|
|
||||||
if (Settings.TimestampsFormat)
|
|
||||||
node = (
|
|
||||||
<>
|
|
||||||
[{formatTime(Settings.TimestampsFormat)}] {node}
|
|
||||||
</>
|
|
||||||
);
|
|
||||||
this.raw = node;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export class Link {
|
|
||||||
hostname: string;
|
|
||||||
dashes: string;
|
|
||||||
constructor(dashes: string, hostname: string) {
|
|
||||||
if (Settings.TimestampsFormat) dashes = "[" + formatTime(Settings.TimestampsFormat) + "] " + dashes;
|
|
||||||
this.hostname = hostname;
|
|
||||||
this.dashes = dashes;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export class TTimer {
|
|
||||||
time: number;
|
|
||||||
timeLeft: number;
|
|
||||||
action: "h" | "b" | "a" | "g" | "w";
|
|
||||||
server?: BaseServer;
|
|
||||||
|
|
||||||
constructor(time: number, action: "h" | "b" | "a" | "g" | "w", server?: BaseServer) {
|
|
||||||
this.time = time;
|
|
||||||
this.timeLeft = time;
|
|
||||||
this.action = action;
|
|
||||||
this.server = server;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface ITerminal {
|
|
||||||
action: TTimer | null;
|
|
||||||
|
|
||||||
commandHistory: string[];
|
|
||||||
commandHistoryIndex: number;
|
|
||||||
|
|
||||||
outputHistory: (Output | Link | RawOutput)[];
|
|
||||||
|
|
||||||
// True if a Coding Contract prompt is opened
|
|
||||||
contractOpen: boolean;
|
|
||||||
|
|
||||||
// Full Path of current directory
|
|
||||||
// Excludes the trailing forward slash
|
|
||||||
currDir: string;
|
|
||||||
|
|
||||||
print(s: string): void;
|
|
||||||
printRaw(node: React.ReactNode): void;
|
|
||||||
error(s: string): void;
|
|
||||||
success(s: string): void;
|
|
||||||
info(s: string): void;
|
|
||||||
warn(s: string): void;
|
|
||||||
|
|
||||||
clear(): void;
|
|
||||||
startAnalyze(): void;
|
|
||||||
startBackdoor(): void;
|
|
||||||
startHack(): void;
|
|
||||||
startGrow(): void;
|
|
||||||
startWeaken(): void;
|
|
||||||
finishHack(server: BaseServer, cancelled?: boolean): void;
|
|
||||||
finishGrow(server: BaseServer, cancelled?: boolean): void;
|
|
||||||
finishWeaken(server: BaseServer, cancelled?: boolean): void;
|
|
||||||
finishBackdoor(server: BaseServer, cancelled?: boolean): void;
|
|
||||||
finishAnalyze(server: BaseServer, cancelled?: boolean): void;
|
|
||||||
finishAction(cancelled?: boolean): void;
|
|
||||||
getFilepath(filename: string): string;
|
|
||||||
getFile(filename: string): Script | TextFile | string | null;
|
|
||||||
getScript(filename: string): Script | null;
|
|
||||||
getTextFile(filename: string): TextFile | null;
|
|
||||||
getLitFile(filename: string): string | null;
|
|
||||||
cwd(): string;
|
|
||||||
setcwd(dir: string): void;
|
|
||||||
runContract(name: string): void;
|
|
||||||
executeScanAnalyzeCommand(depth?: number, all?: boolean): void;
|
|
||||||
connectToServer(server: string): void;
|
|
||||||
executeCommand(command: string): void;
|
|
||||||
executeCommands(commands: string): void;
|
|
||||||
// If there was any changes, will return true, once.
|
|
||||||
process(cycles: number): void;
|
|
||||||
prestige(): void;
|
|
||||||
getProgressText(): string;
|
|
||||||
}
|
|
51
src/Terminal/OutputTypes.tsx
Normal file
51
src/Terminal/OutputTypes.tsx
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
import React from "react";
|
||||||
|
import { Settings } from "../Settings/Settings";
|
||||||
|
import { formatTime } from "../utils/helpers/formatTime";
|
||||||
|
import { BaseServer } from "../Server/BaseServer";
|
||||||
|
|
||||||
|
export class Output {
|
||||||
|
text: string;
|
||||||
|
color: "primary" | "error" | "success" | "info" | "warn";
|
||||||
|
constructor(text: string, color: "primary" | "error" | "success" | "info" | "warn") {
|
||||||
|
if (Settings.TimestampsFormat) text = "[" + formatTime(Settings.TimestampsFormat) + "] " + text;
|
||||||
|
this.text = text;
|
||||||
|
this.color = color;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export class RawOutput {
|
||||||
|
raw: React.ReactNode;
|
||||||
|
constructor(node: React.ReactNode) {
|
||||||
|
if (Settings.TimestampsFormat)
|
||||||
|
node = (
|
||||||
|
<>
|
||||||
|
[{formatTime(Settings.TimestampsFormat)}] {node}
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
this.raw = node;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export class Link {
|
||||||
|
hostname: string;
|
||||||
|
dashes: string;
|
||||||
|
constructor(dashes: string, hostname: string) {
|
||||||
|
if (Settings.TimestampsFormat) dashes = "[" + formatTime(Settings.TimestampsFormat) + "] " + dashes;
|
||||||
|
this.hostname = hostname;
|
||||||
|
this.dashes = dashes;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export class TTimer {
|
||||||
|
time: number;
|
||||||
|
timeLeft: number;
|
||||||
|
action: "h" | "b" | "a" | "g" | "w";
|
||||||
|
server?: BaseServer;
|
||||||
|
|
||||||
|
constructor(time: number, action: "h" | "b" | "a" | "g" | "w", server?: BaseServer) {
|
||||||
|
this.time = time;
|
||||||
|
this.timeLeft = time;
|
||||||
|
this.action = action;
|
||||||
|
this.server = server;
|
||||||
|
}
|
||||||
|
}
|
@ -1,4 +1,4 @@
|
|||||||
import { ITerminal, Output, Link, RawOutput, TTimer } from "./ITerminal";
|
import { Output, Link, RawOutput, TTimer } from "./OutputTypes";
|
||||||
import { Router } from "../ui/GameRoot";
|
import { Router } from "../ui/GameRoot";
|
||||||
import { Player } from "../Player";
|
import { Player } from "../Player";
|
||||||
import { HacknetServer } from "../Hacknet/HacknetServer";
|
import { HacknetServer } from "../Hacknet/HacknetServer";
|
||||||
@ -75,7 +75,7 @@ import { hash } from "../hash/hash";
|
|||||||
import { apr1 } from "./commands/apr1";
|
import { apr1 } from "./commands/apr1";
|
||||||
import { BitNodeMultipliers } from "../BitNode/BitNodeMultipliers";
|
import { BitNodeMultipliers } from "../BitNode/BitNodeMultipliers";
|
||||||
|
|
||||||
export class Terminal implements ITerminal {
|
export class Terminal {
|
||||||
// Flags to determine whether the player is currently running a hack or an analyze
|
// Flags to determine whether the player is currently running a hack or an analyze
|
||||||
action: TTimer | null = null;
|
action: TTimer | null = null;
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@ import { Theme } from "@mui/material/styles";
|
|||||||
import makeStyles from "@mui/styles/makeStyles";
|
import makeStyles from "@mui/styles/makeStyles";
|
||||||
import createStyles from "@mui/styles/createStyles";
|
import createStyles from "@mui/styles/createStyles";
|
||||||
import Box from "@mui/material/Box";
|
import Box from "@mui/material/Box";
|
||||||
import { Output, Link, RawOutput } from "../ITerminal";
|
import { Output, Link, RawOutput } from "../OutputTypes";
|
||||||
import { Terminal } from "../../Terminal";
|
import { Terminal } from "../../Terminal";
|
||||||
import { TerminalInput } from "./TerminalInput";
|
import { TerminalInput } from "./TerminalInput";
|
||||||
import { TerminalEvents, TerminalClearEvents } from "../TerminalEvents";
|
import { TerminalEvents, TerminalClearEvents } from "../TerminalEvents";
|
||||||
|
Loading…
Reference in New Issue
Block a user