mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-11-10 09:43:54 +01:00
oops
This commit is contained in:
parent
1883bea906
commit
89ea9aaff5
@ -63,8 +63,6 @@ function iTutorialStart() {
|
||||
ITutorial.stepIsDone[i] = false;
|
||||
}
|
||||
|
||||
Engine.loadTerminalContent();
|
||||
|
||||
// Don't autosave during this interactive tutorial
|
||||
Engine.Counters.autoSaveCounter = Infinity;
|
||||
ITutorial.currStep = 0;
|
||||
@ -120,7 +118,6 @@ function iTutorialEvaluateStep() {
|
||||
|
||||
switch (ITutorial.currStep) {
|
||||
case iTutorialSteps.Start:
|
||||
Engine.loadTerminalContent();
|
||||
iTutorialSetText(
|
||||
"Welcome to Bitburner, a cyberpunk-themed incremental RPG! " +
|
||||
"The game takes place in a dark, dystopian future... The year is 2077...<br><br>" +
|
||||
@ -130,7 +127,6 @@ function iTutorialEvaluateStep() {
|
||||
nextBtn.style.display = "inline-block";
|
||||
break;
|
||||
case iTutorialSteps.GoToCharacterPage:
|
||||
Engine.loadTerminalContent();
|
||||
iTutorialSetText(
|
||||
"Let's start by heading to the Stats page. Click the <code class='interactive-tutorial-tab flashing-button'>Stats</code> tab on " +
|
||||
"the main navigation menu (left-hand side of the screen)",
|
||||
@ -138,7 +134,6 @@ function iTutorialEvaluateStep() {
|
||||
nextBtn.style.display = "none";
|
||||
break;
|
||||
case iTutorialSteps.CharacterPage:
|
||||
Engine.loadCharacterContent();
|
||||
iTutorialSetText(
|
||||
"The <code class='interactive-tutorial-tab'>Stats</code> page shows a lot of important information about your progress, " +
|
||||
"such as your skills, money, and bonuses. ",
|
||||
@ -146,7 +141,6 @@ function iTutorialEvaluateStep() {
|
||||
nextBtn.style.display = "inline-block";
|
||||
break;
|
||||
case iTutorialSteps.CharacterGoToTerminalPage:
|
||||
Engine.loadCharacterContent();
|
||||
iTutorialSetText(
|
||||
"Let's head to your computer's terminal by clicking the <code class='interactive-tutorial-tab flashing-button'>Terminal</code> tab on the " +
|
||||
"main navigation menu.",
|
||||
@ -154,7 +148,6 @@ function iTutorialEvaluateStep() {
|
||||
nextBtn.style.display = "none";
|
||||
break;
|
||||
case iTutorialSteps.TerminalIntro:
|
||||
Engine.loadTerminalContent();
|
||||
iTutorialSetText(
|
||||
"The <code class='interactive-tutorial-tab'>Terminal</code> is used to interface with your home computer as well as " +
|
||||
"all of the other machines around the world.",
|
||||
@ -162,7 +155,6 @@ function iTutorialEvaluateStep() {
|
||||
nextBtn.style.display = "inline-block";
|
||||
break;
|
||||
case iTutorialSteps.TerminalHelp:
|
||||
Engine.loadTerminalContent();
|
||||
iTutorialSetText(
|
||||
"Let's try it out. Start by entering the <code class='interactive-tutorial-command'>help</code> command into the <code class='interactive-tutorial-tab'>Terminal</code> " +
|
||||
"(Don't forget to press Enter after typing the command)",
|
||||
@ -170,7 +162,6 @@ function iTutorialEvaluateStep() {
|
||||
nextBtn.style.display = "none"; // next step triggered by terminal command
|
||||
break;
|
||||
case iTutorialSteps.TerminalLs:
|
||||
Engine.loadTerminalContent();
|
||||
iTutorialSetText(
|
||||
"The <code class='interactive-tutorial-command'>help</code> command displays a list of all available <code class='interactive-tutorial-tab'>Terminal</code> commands, how to use them, " +
|
||||
"and a description of what they do. <br><br>Let's try another command. Enter the <code class='interactive-tutorial-command'>ls</code> command.",
|
||||
@ -178,7 +169,6 @@ function iTutorialEvaluateStep() {
|
||||
nextBtn.style.display = "none"; // next step triggered by terminal command
|
||||
break;
|
||||
case iTutorialSteps.TerminalScan:
|
||||
Engine.loadTerminalContent();
|
||||
iTutorialSetText(
|
||||
" <code class='interactive-tutorial-command'>ls</code> is a basic command that shows files " +
|
||||
"on the computer. Right now, it shows that you have a program called <code class='interactive-tutorial-command'>NUKE.exe</code> on your computer. " +
|
||||
@ -189,7 +179,6 @@ function iTutorialEvaluateStep() {
|
||||
nextBtn.style.display = "none"; // next step triggered by terminal command
|
||||
break;
|
||||
case iTutorialSteps.TerminalScanAnalyze1:
|
||||
Engine.loadTerminalContent();
|
||||
iTutorialSetText(
|
||||
"The <code class='interactive-tutorial-command'>scan</code> command shows all available network connections. In other words, " +
|
||||
"it displays a list of all servers that can be connected to from your " +
|
||||
@ -201,7 +190,6 @@ function iTutorialEvaluateStep() {
|
||||
nextBtn.style.display = "none"; // next step triggered by terminal command
|
||||
break;
|
||||
case iTutorialSteps.TerminalScanAnalyze2:
|
||||
Engine.loadTerminalContent();
|
||||
iTutorialSetText(
|
||||
"You just ran <code class='interactive-tutorial-command'>scan-analyze</code> with a depth of one. This command shows more detailed " +
|
||||
"information about each server that you can connect to (servers that are a distance of " +
|
||||
@ -211,7 +199,6 @@ function iTutorialEvaluateStep() {
|
||||
nextBtn.style.display = "none"; // next step triggered by terminal command
|
||||
break;
|
||||
case iTutorialSteps.TerminalConnect:
|
||||
Engine.loadTerminalContent();
|
||||
iTutorialSetText(
|
||||
"Now you can see information about all servers that are up to two nodes away, as well " +
|
||||
"as figure out how to navigate to those servers through the network. You can only connect to " +
|
||||
@ -222,7 +209,6 @@ function iTutorialEvaluateStep() {
|
||||
nextBtn.style.display = "none"; // next step triggered by terminal command
|
||||
break;
|
||||
case iTutorialSteps.TerminalAnalyze:
|
||||
Engine.loadTerminalContent();
|
||||
iTutorialSetText(
|
||||
"You are now connected to another machine! What can you do now? You can hack it!<br><br> In the year 2077, currency has " +
|
||||
"become digital and decentralized. People and corporations store their money " +
|
||||
@ -233,7 +219,6 @@ function iTutorialEvaluateStep() {
|
||||
nextBtn.style.display = "none"; // next step triggered by terminal command
|
||||
break;
|
||||
case iTutorialSteps.TerminalNuke:
|
||||
Engine.loadTerminalContent();
|
||||
iTutorialSetText(
|
||||
"When the <code class='interactive-tutorial-command'>analyze</code> command finishes running it will show useful information " +
|
||||
"about hacking the server. <br><br> For this server, the required hacking skill is only <span class='character-hack-cell'>1</span>, " +
|
||||
@ -247,7 +232,6 @@ function iTutorialEvaluateStep() {
|
||||
nextBtn.style.display = "none"; // next step triggered by terminal command
|
||||
break;
|
||||
case iTutorialSteps.TerminalManualHack:
|
||||
Engine.loadTerminalContent();
|
||||
iTutorialSetText(
|
||||
"You now have root access! You can hack the server using the <code class='interactive-tutorial-command'>hack</code> command. " +
|
||||
"Try doing that now.",
|
||||
@ -255,7 +239,6 @@ function iTutorialEvaluateStep() {
|
||||
nextBtn.style.display = "none"; // next step triggered by terminal command
|
||||
break;
|
||||
case iTutorialSteps.TerminalHackingMechanics:
|
||||
Engine.loadTerminalContent();
|
||||
iTutorialSetText(
|
||||
"You are now attempting to hack the server. Performing a hack takes time and " +
|
||||
"only has a certain percentage chance " +
|
||||
@ -270,7 +253,6 @@ function iTutorialEvaluateStep() {
|
||||
nextBtn.style.display = "inline-block";
|
||||
break;
|
||||
case iTutorialSteps.TerminalCreateScript:
|
||||
Engine.loadTerminalContent();
|
||||
iTutorialSetText(
|
||||
"Hacking is the core mechanic of the game and is necessary for progressing. However, " +
|
||||
"you don't want to be hacking manually the entire time. You can automate your hacking " +
|
||||
@ -282,7 +264,6 @@ function iTutorialEvaluateStep() {
|
||||
nextBtn.style.display = "none"; // next step triggered by terminal command
|
||||
break;
|
||||
case iTutorialSteps.TerminalTypeScript:
|
||||
Engine.loadScriptEditorContent("n00dles.script", "");
|
||||
iTutorialSetText(
|
||||
"This is the script editor. You can use it to program your scripts. Scripts are " +
|
||||
"written in a simplified version of javascript. Copy and paste the following code into the script editor: <br><br>" +
|
||||
@ -297,7 +278,6 @@ function iTutorialEvaluateStep() {
|
||||
nextBtn.style.display = "none"; // next step triggered in saveAndCloseScriptEditor() (Script.js)
|
||||
break;
|
||||
case iTutorialSteps.TerminalFree:
|
||||
Engine.loadTerminalContent();
|
||||
iTutorialSetText(
|
||||
"Now we'll run the script. Scripts require a certain amount of RAM to run, and can be " +
|
||||
"run on any machine which you have root access to. Different servers have different " +
|
||||
@ -307,7 +287,6 @@ function iTutorialEvaluateStep() {
|
||||
nextBtn.style.display = "none"; // next step triggered by terminal commmand
|
||||
break;
|
||||
case iTutorialSteps.TerminalRunScript:
|
||||
Engine.loadTerminalContent();
|
||||
iTutorialSetText(
|
||||
"We have 4GB of free RAM on this machine, which is enough to run our " +
|
||||
"script. Let's run our script using <code class='interactive-tutorial-command'>run n00dles.script</code>.",
|
||||
@ -315,7 +294,6 @@ function iTutorialEvaluateStep() {
|
||||
nextBtn.style.display = "none"; // next step triggered by terminal commmand
|
||||
break;
|
||||
case iTutorialSteps.TerminalGoToActiveScriptsPage:
|
||||
Engine.loadTerminalContent();
|
||||
iTutorialSetText(
|
||||
"Your script is now running! " +
|
||||
"It will continuously run in the background and will automatically stop if " +
|
||||
@ -329,7 +307,6 @@ function iTutorialEvaluateStep() {
|
||||
nextBtn.style.display = "none";
|
||||
break;
|
||||
case iTutorialSteps.ActiveScriptsPage:
|
||||
Engine.loadActiveScriptsContent();
|
||||
iTutorialSetText(
|
||||
"This page displays information about all of your scripts that are " +
|
||||
"running across every server. You can use this to gauge how well " +
|
||||
@ -338,7 +315,6 @@ function iTutorialEvaluateStep() {
|
||||
nextBtn.style.display = "none";
|
||||
break;
|
||||
case iTutorialSteps.ActiveScriptsToTerminal:
|
||||
Engine.loadTerminalContent();
|
||||
iTutorialSetText(
|
||||
"One last thing about scripts, each active script contains logs that detail " +
|
||||
"what it's doing. We can check these logs using the <code class='interactive-tutorial-command'>tail</code> command. Do that " +
|
||||
@ -347,7 +323,6 @@ function iTutorialEvaluateStep() {
|
||||
nextBtn.style.display = "none"; // next step triggered by terminal command
|
||||
break;
|
||||
case iTutorialSteps.TerminalTailScript:
|
||||
Engine.loadTerminalContent();
|
||||
iTutorialSetText(
|
||||
"The log for this script won't show much right now (it might show nothing at all) because it " +
|
||||
"just started running...but check back again in a few minutes! <br><br>" +
|
||||
@ -361,7 +336,6 @@ function iTutorialEvaluateStep() {
|
||||
nextBtn.style.display = "inline-block";
|
||||
break;
|
||||
case iTutorialSteps.GoToHacknetNodesPage:
|
||||
Engine.loadTerminalContent();
|
||||
iTutorialSetText(
|
||||
"Hacking is not the only way to earn money. One other way to passively " +
|
||||
"earn money is by purchasing and upgrading Hacknet Nodes. Let's go to " +
|
||||
@ -370,14 +344,12 @@ function iTutorialEvaluateStep() {
|
||||
nextBtn.style.display = "none";
|
||||
break;
|
||||
case iTutorialSteps.HacknetNodesIntroduction:
|
||||
Engine.loadHacknetNodesContent();
|
||||
iTutorialSetText(
|
||||
"here you can purchase new Hacknet Nodes and upgrade your " + "existing ones. Let's purchase a new one now.",
|
||||
);
|
||||
nextBtn.style.display = "none"; // Next step triggered by purchaseHacknet() (HacknetNode.js)
|
||||
break;
|
||||
case iTutorialSteps.HacknetNodesGoToWorldPage:
|
||||
Engine.loadHacknetNodesContent();
|
||||
iTutorialSetText(
|
||||
"You just purchased a Hacknet Node! This Hacknet Node will passively " +
|
||||
"earn you money over time, both online and offline. When you get enough " +
|
||||
@ -388,7 +360,6 @@ function iTutorialEvaluateStep() {
|
||||
nextBtn.style.display = "none";
|
||||
break;
|
||||
case iTutorialSteps.WorldDescription:
|
||||
Engine.loadLocationContent();
|
||||
iTutorialSetText(
|
||||
"This page lists all of the different locations you can currently " +
|
||||
"travel to. Each location has something that you can do. " +
|
||||
@ -399,7 +370,6 @@ function iTutorialEvaluateStep() {
|
||||
nextBtn.style.display = "none";
|
||||
break;
|
||||
case iTutorialSteps.TutorialPageInfo:
|
||||
Engine.loadTutorialContent();
|
||||
iTutorialSetText(
|
||||
"This page contains a lot of different documentation about the game's " +
|
||||
"content and mechanics. <strong style='background-color:#444;'> I know it's a lot, but I highly suggest you read " +
|
||||
|
@ -93,22 +93,18 @@ export class Script {
|
||||
* @param {Script[]} otherScripts - Other scripts on the server. Used to process imports
|
||||
*/
|
||||
saveScript(code: string, serverIp: string, otherScripts: Script[]): void {
|
||||
if (routing.isOn(Page.ScriptEditor)) {
|
||||
// Update code and filename
|
||||
this.code = code.replace(/^\s+|\s+$/g, "");
|
||||
// Update code and filename
|
||||
this.code = code.replace(/^\s+|\s+$/g, "");
|
||||
|
||||
const filenameElem: HTMLInputElement | null = document.getElementById(
|
||||
"script-editor-filename",
|
||||
) as HTMLInputElement;
|
||||
if (filenameElem == null) {
|
||||
console.error(`Failed to get Script filename DOM element`);
|
||||
return;
|
||||
}
|
||||
this.filename = filenameElem.value;
|
||||
this.server = serverIp;
|
||||
this.updateRamUsage(otherScripts);
|
||||
this.markUpdated();
|
||||
const filenameElem: HTMLInputElement | null = document.getElementById("script-editor-filename") as HTMLInputElement;
|
||||
if (filenameElem == null) {
|
||||
console.error(`Failed to get Script filename DOM element`);
|
||||
return;
|
||||
}
|
||||
this.filename = filenameElem.value;
|
||||
this.server = serverIp;
|
||||
this.updateRamUsage(otherScripts);
|
||||
this.markUpdated();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -9,7 +9,7 @@ import { Options } from "./Options";
|
||||
import { js_beautify as beautifyCode } from "js-beautify";
|
||||
import { isValidFilePath } from "../../Terminal/DirectoryHelpers";
|
||||
import { IPlayer } from "../../PersonObjects/IPlayer";
|
||||
import { IEngine } from "../../IEngine";
|
||||
import { IRouter } from "../../ui/Router";
|
||||
import { dialogBoxCreate } from "../../../utils/DialogBox";
|
||||
import { parseFconfSettings } from "../../Fconf/Fconf";
|
||||
import { isScriptFilename } from "../../Script/ScriptHelpersTS";
|
||||
@ -53,7 +53,7 @@ interface IProps {
|
||||
filename: string;
|
||||
code: string;
|
||||
player: IPlayer;
|
||||
engine: IEngine;
|
||||
router: IRouter;
|
||||
}
|
||||
|
||||
/*
|
||||
@ -103,7 +103,6 @@ export function Root(props: IProps): React.ReactElement {
|
||||
}
|
||||
lastPosition = null;
|
||||
|
||||
// TODO(hydroflame): re-enable the tutorial.
|
||||
if (ITutorial.isRunning && ITutorial.currStep === iTutorialSteps.TerminalTypeScript) {
|
||||
//Make sure filename + code properly follow tutorial
|
||||
if (filename !== "n00dles.script") {
|
||||
@ -121,7 +120,7 @@ export function Root(props: IProps): React.ReactElement {
|
||||
for (let i = 0; i < server.scripts.length; i++) {
|
||||
if (filename == server.scripts[i].filename) {
|
||||
server.scripts[i].saveScript(code, props.player.currentServer, server.scripts);
|
||||
props.engine.loadTerminalContent();
|
||||
props.router.toTerminal();
|
||||
return iTutorialNextStep();
|
||||
}
|
||||
}
|
||||
@ -160,7 +159,7 @@ export function Root(props: IProps): React.ReactElement {
|
||||
for (let i = 0; i < server.scripts.length; i++) {
|
||||
if (filename == server.scripts[i].filename) {
|
||||
server.scripts[i].saveScript(code, props.player.currentServer, server.scripts);
|
||||
props.engine.loadTerminalContent();
|
||||
props.router.toTerminal();
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -173,7 +172,7 @@ export function Root(props: IProps): React.ReactElement {
|
||||
for (let i = 0; i < server.textFiles.length; ++i) {
|
||||
if (server.textFiles[i].fn === filename) {
|
||||
server.textFiles[i].write(code);
|
||||
props.engine.loadTerminalContent();
|
||||
props.router.toTerminal();
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -183,7 +182,7 @@ export function Root(props: IProps): React.ReactElement {
|
||||
dialogBoxCreate("Invalid filename. Must be either a script (.script, .js, or .ns) or " + " or text file (.txt)");
|
||||
return;
|
||||
}
|
||||
props.engine.loadTerminalContent();
|
||||
props.router.toTerminal();
|
||||
}
|
||||
|
||||
function beautify(): void {
|
||||
|
@ -1,7 +1,7 @@
|
||||
import { TextFile } from "../TextFile";
|
||||
import { Script } from "../Script/Script";
|
||||
import { IPlayer } from "../PersonObjects/IPlayer";
|
||||
import { IEngine } from "../IEngine";
|
||||
import { IRouter } from "../ui/Router";
|
||||
|
||||
export class Output {
|
||||
text: string;
|
||||
@ -70,8 +70,8 @@ export interface ITerminal {
|
||||
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;
|
||||
executeCommand(router: IRouter, player: IPlayer, command: string): void;
|
||||
executeCommands(router: IRouter, player: IPlayer, commands: string): void;
|
||||
// If there was any changes, will return true, once.
|
||||
pollChanges(): boolean;
|
||||
process(player: IPlayer, cycles: number): void;
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { ITerminal, Output, Link, TTimer } from "./ITerminal";
|
||||
import { IEngine } from "../IEngine";
|
||||
import { IRouter } from "../ui/Router";
|
||||
import { IPlayer } from "../PersonObjects/IPlayer";
|
||||
import { HacknetServer } from "../Hacknet/HacknetServer";
|
||||
import { BaseServer } from "../Server/BaseServer";
|
||||
@ -468,7 +468,7 @@ export class Terminal implements ITerminal {
|
||||
}
|
||||
}
|
||||
|
||||
executeCommands(engine: IEngine, player: IPlayer, commands: string): void {
|
||||
executeCommands(router: IRouter, player: IPlayer, commands: string): void {
|
||||
// Sanitize input
|
||||
commands = commands.trim();
|
||||
commands = commands.replace(/\s\s+/g, " "); // Replace all extra whitespace in command with a single space
|
||||
@ -484,7 +484,7 @@ export class Terminal implements ITerminal {
|
||||
const allCommands = ParseCommands(commands);
|
||||
|
||||
for (let i = 0; i < allCommands.length; i++) {
|
||||
this.executeCommand(engine, player, allCommands[i]);
|
||||
this.executeCommand(router, player, allCommands[i]);
|
||||
}
|
||||
}
|
||||
|
||||
@ -499,7 +499,7 @@ export class Terminal implements ITerminal {
|
||||
this.clear();
|
||||
}
|
||||
|
||||
executeCommand(engine: IEngine, player: IPlayer, command: string): void {
|
||||
executeCommand(router: IRouter, player: IPlayer, command: string): void {
|
||||
if (this.action !== null) {
|
||||
this.error(`Cannot execute command (${command}) while an action is in progress`);
|
||||
return;
|
||||
@ -532,7 +532,7 @@ export class Terminal implements ITerminal {
|
||||
break;
|
||||
case iTutorialSteps.TerminalLs:
|
||||
if (commandArray.length === 1 && commandArray[0] == "ls") {
|
||||
ls(this, engine, player, s, commandArray.slice(1));
|
||||
ls(this, router, player, s, commandArray.slice(1));
|
||||
iTutorialNextStep();
|
||||
} else {
|
||||
this.print("Bad command. Please follow the tutorial");
|
||||
@ -540,7 +540,7 @@ export class Terminal implements ITerminal {
|
||||
break;
|
||||
case iTutorialSteps.TerminalScan:
|
||||
if (commandArray.length === 1 && commandArray[0] == "scan") {
|
||||
scan(this, engine, player, s, commandArray.slice(1));
|
||||
scan(this, router, player, s, commandArray.slice(1));
|
||||
iTutorialNextStep();
|
||||
} else {
|
||||
this.print("Bad command. Please follow the tutorial");
|
||||
@ -609,7 +609,7 @@ export class Terminal implements ITerminal {
|
||||
break;
|
||||
case iTutorialSteps.TerminalCreateScript:
|
||||
if (commandArray.length == 2 && commandArray[0] == "nano" && commandArray[1] == "n00dles.script") {
|
||||
engine.loadScriptEditorContent("n00dles.script", "");
|
||||
router.toScriptEditor("n00dles.script", "");
|
||||
iTutorialNextStep();
|
||||
} else {
|
||||
this.print("Bad command. Please follow the tutorial");
|
||||
@ -617,7 +617,7 @@ export class Terminal implements ITerminal {
|
||||
break;
|
||||
case iTutorialSteps.TerminalFree:
|
||||
if (commandArray.length == 1 && commandArray[0] == "free") {
|
||||
free(this, engine, player, s, commandArray.slice(1));
|
||||
free(this, router, player, s, commandArray.slice(1));
|
||||
iTutorialNextStep();
|
||||
} else {
|
||||
this.print("Bad command. Please follow the tutorial");
|
||||
@ -625,7 +625,7 @@ export class Terminal implements ITerminal {
|
||||
break;
|
||||
case iTutorialSteps.TerminalRunScript:
|
||||
if (commandArray.length == 2 && commandArray[0] == "run" && commandArray[1] == "n00dles.script") {
|
||||
run(this, engine, player, s, commandArray.slice(1));
|
||||
run(this, router, player, s, commandArray.slice(1));
|
||||
iTutorialNextStep();
|
||||
} else {
|
||||
this.print("Bad command. Please follow the tutorial");
|
||||
@ -662,7 +662,7 @@ export class Terminal implements ITerminal {
|
||||
const commands: {
|
||||
[key: string]: (
|
||||
terminal: ITerminal,
|
||||
engine: IEngine,
|
||||
router: IRouter,
|
||||
player: IPlayer,
|
||||
server: BaseServer,
|
||||
args: (string | number)[],
|
||||
@ -713,7 +713,7 @@ export class Terminal implements ITerminal {
|
||||
return;
|
||||
}
|
||||
|
||||
f(this, engine, player, s, commandArray.slice(1));
|
||||
f(this, router, player, s, commandArray.slice(1));
|
||||
}
|
||||
|
||||
getProgressText(): string {
|
||||
|
@ -1,12 +1,12 @@
|
||||
import { ITerminal } from "../ITerminal";
|
||||
import { IEngine } from "../../IEngine";
|
||||
import { IRouter } from "../../ui/Router";
|
||||
import { IPlayer } from "../../PersonObjects/IPlayer";
|
||||
import { BaseServer } from "../../Server/BaseServer";
|
||||
import { parseAliasDeclaration, printAliases } from "../../Alias";
|
||||
|
||||
export function alias(
|
||||
terminal: ITerminal,
|
||||
engine: IEngine,
|
||||
router: IRouter,
|
||||
player: IPlayer,
|
||||
server: BaseServer,
|
||||
args: (string | number)[],
|
||||
|
@ -1,11 +1,11 @@
|
||||
import { ITerminal } from "../ITerminal";
|
||||
import { IEngine } from "../../IEngine";
|
||||
import { IRouter } from "../../ui/Router";
|
||||
import { IPlayer } from "../../PersonObjects/IPlayer";
|
||||
import { BaseServer } from "../../Server/BaseServer";
|
||||
|
||||
export function analyze(
|
||||
terminal: ITerminal,
|
||||
engine: IEngine,
|
||||
router: IRouter,
|
||||
player: IPlayer,
|
||||
server: BaseServer,
|
||||
args: (string | number)[],
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { ITerminal } from "../ITerminal";
|
||||
import { IEngine } from "../../IEngine";
|
||||
import { IRouter } from "../../ui/Router";
|
||||
import { IPlayer } from "../../PersonObjects/IPlayer";
|
||||
import { BaseServer } from "../../Server/BaseServer";
|
||||
import { Server } from "../../Server/Server";
|
||||
@ -7,7 +7,7 @@ import { HacknetServer } from "../../Hacknet/HacknetServer";
|
||||
|
||||
export function backdoor(
|
||||
terminal: ITerminal,
|
||||
engine: IEngine,
|
||||
router: IRouter,
|
||||
player: IPlayer,
|
||||
server: BaseServer,
|
||||
args: (string | number)[],
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { ITerminal } from "../ITerminal";
|
||||
import { IEngine } from "../../IEngine";
|
||||
import { IRouter } from "../../ui/Router";
|
||||
import { IPlayer } from "../../PersonObjects/IPlayer";
|
||||
import { BaseServer } from "../../Server/BaseServer";
|
||||
import { listAllDarkwebItems, buyDarkwebItem } from "../../DarkWeb/DarkWeb";
|
||||
@ -7,7 +7,7 @@ import { SpecialServerIps } from "../../Server/SpecialServerIps";
|
||||
|
||||
export function buy(
|
||||
terminal: ITerminal,
|
||||
engine: IEngine,
|
||||
router: IRouter,
|
||||
player: IPlayer,
|
||||
server: BaseServer,
|
||||
args: (string | number)[],
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { ITerminal } from "../ITerminal";
|
||||
import { IEngine } from "../../IEngine";
|
||||
import { IRouter } from "../../ui/Router";
|
||||
import { IPlayer } from "../../PersonObjects/IPlayer";
|
||||
import { BaseServer } from "../../Server/BaseServer";
|
||||
import { showMessage } from "../../Message/MessageHelpers";
|
||||
@ -8,7 +8,7 @@ import { showLiterature } from "../../Literature/LiteratureHelpers";
|
||||
|
||||
export function cat(
|
||||
terminal: ITerminal,
|
||||
engine: IEngine,
|
||||
router: IRouter,
|
||||
player: IPlayer,
|
||||
server: BaseServer,
|
||||
args: (string | number)[],
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { ITerminal } from "../ITerminal";
|
||||
import { IEngine } from "../../IEngine";
|
||||
import { IRouter } from "../../ui/Router";
|
||||
import { IPlayer } from "../../PersonObjects/IPlayer";
|
||||
import { BaseServer } from "../../Server/BaseServer";
|
||||
|
||||
@ -7,7 +7,7 @@ import { evaluateDirectoryPath, removeTrailingSlash } from "../DirectoryHelpers"
|
||||
|
||||
export function cd(
|
||||
terminal: ITerminal,
|
||||
engine: IEngine,
|
||||
router: IRouter,
|
||||
player: IPlayer,
|
||||
server: BaseServer,
|
||||
args: (string | number)[],
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { ITerminal } from "../ITerminal";
|
||||
import { IEngine } from "../../IEngine";
|
||||
import { IRouter } from "../../ui/Router";
|
||||
import { IPlayer } from "../../PersonObjects/IPlayer";
|
||||
import { BaseServer } from "../../Server/BaseServer";
|
||||
import { findRunningScript } from "../../Script/ScriptHelpers";
|
||||
@ -7,7 +7,7 @@ import { isScriptFilename } from "../../Script/ScriptHelpersTS";
|
||||
|
||||
export function check(
|
||||
terminal: ITerminal,
|
||||
engine: IEngine,
|
||||
router: IRouter,
|
||||
player: IPlayer,
|
||||
server: BaseServer,
|
||||
args: (string | number)[],
|
||||
|
@ -1,12 +1,12 @@
|
||||
import { ITerminal } from "../ITerminal";
|
||||
import { IEngine } from "../../IEngine";
|
||||
import { IRouter } from "../../ui/Router";
|
||||
import { IPlayer } from "../../PersonObjects/IPlayer";
|
||||
import { BaseServer } from "../../Server/BaseServer";
|
||||
import { getServerOnNetwork } from "../../Server/ServerHelpers";
|
||||
|
||||
export function connect(
|
||||
terminal: ITerminal,
|
||||
engine: IEngine,
|
||||
router: IRouter,
|
||||
player: IPlayer,
|
||||
server: BaseServer,
|
||||
args: (string | number)[],
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { ITerminal } from "../ITerminal";
|
||||
import { IEngine } from "../../IEngine";
|
||||
import { IRouter } from "../../ui/Router";
|
||||
import { IPlayer } from "../../PersonObjects/IPlayer";
|
||||
import { BaseServer } from "../../Server/BaseServer";
|
||||
import { isScriptFilename } from "../../Script/ScriptHelpersTS";
|
||||
@ -8,7 +8,7 @@ import JSZip from "jszip";
|
||||
|
||||
export function download(
|
||||
terminal: ITerminal,
|
||||
engine: IEngine,
|
||||
router: IRouter,
|
||||
player: IPlayer,
|
||||
server: BaseServer,
|
||||
args: (string | number)[],
|
||||
|
@ -1,11 +1,11 @@
|
||||
import { ITerminal } from "../ITerminal";
|
||||
import { IEngine } from "../../IEngine";
|
||||
import { IRouter } from "../../ui/Router";
|
||||
import { IPlayer } from "../../PersonObjects/IPlayer";
|
||||
import { BaseServer } from "../../Server/BaseServer";
|
||||
|
||||
export function expr(
|
||||
terminal: ITerminal,
|
||||
engine: IEngine,
|
||||
router: IRouter,
|
||||
player: IPlayer,
|
||||
server: BaseServer,
|
||||
args: (string | number)[],
|
||||
|
@ -1,12 +1,12 @@
|
||||
import { ITerminal } from "../ITerminal";
|
||||
import { IEngine } from "../../IEngine";
|
||||
import { IRouter } from "../../ui/Router";
|
||||
import { IPlayer } from "../../PersonObjects/IPlayer";
|
||||
import { BaseServer } from "../../Server/BaseServer";
|
||||
import { numeralWrapper } from "../../ui/numeralFormat";
|
||||
|
||||
export function free(
|
||||
terminal: ITerminal,
|
||||
engine: IEngine,
|
||||
router: IRouter,
|
||||
player: IPlayer,
|
||||
server: BaseServer,
|
||||
args: (string | number)[],
|
||||
|
@ -1,12 +1,12 @@
|
||||
import { ITerminal } from "../ITerminal";
|
||||
import { IEngine } from "../../IEngine";
|
||||
import { IRouter } from "../../ui/Router";
|
||||
import { IPlayer } from "../../PersonObjects/IPlayer";
|
||||
import { BaseServer } from "../../Server/BaseServer";
|
||||
import { Server } from "../../Server/Server";
|
||||
|
||||
export function hack(
|
||||
terminal: ITerminal,
|
||||
engine: IEngine,
|
||||
router: IRouter,
|
||||
player: IPlayer,
|
||||
server: BaseServer,
|
||||
args: (string | number)[],
|
||||
|
@ -1,12 +1,12 @@
|
||||
import { ITerminal } from "../ITerminal";
|
||||
import { IEngine } from "../../IEngine";
|
||||
import { IRouter } from "../../ui/Router";
|
||||
import { IPlayer } from "../../PersonObjects/IPlayer";
|
||||
import { BaseServer } from "../../Server/BaseServer";
|
||||
import { TerminalHelpText, HelpTexts } from "../HelpText";
|
||||
|
||||
export function help(
|
||||
terminal: ITerminal,
|
||||
engine: IEngine,
|
||||
router: IRouter,
|
||||
player: IPlayer,
|
||||
server: BaseServer,
|
||||
args: (string | number)[],
|
||||
|
@ -1,11 +1,11 @@
|
||||
import { ITerminal } from "../ITerminal";
|
||||
import { IEngine } from "../../IEngine";
|
||||
import { IRouter } from "../../ui/Router";
|
||||
import { IPlayer } from "../../PersonObjects/IPlayer";
|
||||
import { BaseServer } from "../../Server/BaseServer";
|
||||
|
||||
export function home(
|
||||
terminal: ITerminal,
|
||||
engine: IEngine,
|
||||
router: IRouter,
|
||||
player: IPlayer,
|
||||
server: BaseServer,
|
||||
args: (string | number)[],
|
||||
|
@ -1,11 +1,11 @@
|
||||
import { ITerminal } from "../ITerminal";
|
||||
import { IEngine } from "../../IEngine";
|
||||
import { IRouter } from "../../ui/Router";
|
||||
import { IPlayer } from "../../PersonObjects/IPlayer";
|
||||
import { BaseServer } from "../../Server/BaseServer";
|
||||
|
||||
export function hostname(
|
||||
terminal: ITerminal,
|
||||
engine: IEngine,
|
||||
router: IRouter,
|
||||
player: IPlayer,
|
||||
server: BaseServer,
|
||||
args: (string | number)[],
|
||||
|
@ -1,11 +1,11 @@
|
||||
import { ITerminal } from "../ITerminal";
|
||||
import { IEngine } from "../../IEngine";
|
||||
import { IRouter } from "../../ui/Router";
|
||||
import { IPlayer } from "../../PersonObjects/IPlayer";
|
||||
import { BaseServer } from "../../Server/BaseServer";
|
||||
|
||||
export function ifconfig(
|
||||
terminal: ITerminal,
|
||||
engine: IEngine,
|
||||
router: IRouter,
|
||||
player: IPlayer,
|
||||
server: BaseServer,
|
||||
args: (string | number)[],
|
||||
|
@ -1,12 +1,12 @@
|
||||
import { ITerminal } from "../ITerminal";
|
||||
import { IEngine } from "../../IEngine";
|
||||
import { IRouter } from "../../ui/Router";
|
||||
import { IPlayer } from "../../PersonObjects/IPlayer";
|
||||
import { BaseServer } from "../../Server/BaseServer";
|
||||
import { killWorkerScript } from "../../Netscript/killWorkerScript";
|
||||
|
||||
export function kill(
|
||||
terminal: ITerminal,
|
||||
engine: IEngine,
|
||||
router: IRouter,
|
||||
player: IPlayer,
|
||||
server: BaseServer,
|
||||
args: (string | number)[],
|
||||
|
@ -1,11 +1,11 @@
|
||||
import { ITerminal } from "../ITerminal";
|
||||
import { IEngine } from "../../IEngine";
|
||||
import { IRouter } from "../../ui/Router";
|
||||
import { IPlayer } from "../../PersonObjects/IPlayer";
|
||||
import { BaseServer } from "../../Server/BaseServer";
|
||||
import { killWorkerScript } from "../../Netscript/killWorkerScript";
|
||||
import { WorkerScriptStartStopEventEmitter } from "../../Netscript/WorkerScriptStartStopEventEmitter";
|
||||
|
||||
export function killall(terminal: ITerminal, engine: IEngine, player: IPlayer, server: BaseServer): void {
|
||||
export function killall(terminal: ITerminal, router: IRouter, player: IPlayer, server: BaseServer): void {
|
||||
for (let i = server.runningScripts.length - 1; i >= 0; --i) {
|
||||
killWorkerScript(server.runningScripts[i], server.ip, false);
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { ITerminal } from "../ITerminal";
|
||||
import { IEngine } from "../../IEngine";
|
||||
import { IRouter } from "../../ui/Router";
|
||||
import { IPlayer } from "../../PersonObjects/IPlayer";
|
||||
import { BaseServer } from "../../Server/BaseServer";
|
||||
import { Message } from "../../Message/Message";
|
||||
@ -7,7 +7,7 @@ import { getFirstParentDirectory, isValidDirectoryPath, evaluateDirectoryPath }
|
||||
|
||||
export function ls(
|
||||
terminal: ITerminal,
|
||||
engine: IEngine,
|
||||
router: IRouter,
|
||||
player: IPlayer,
|
||||
server: BaseServer,
|
||||
args: (string | number)[],
|
||||
|
@ -1,7 +1,7 @@
|
||||
import { ITerminal } from "../ITerminal";
|
||||
import { IEngine } from "../../IEngine";
|
||||
import { IRouter } from "../../ui/Router";
|
||||
import { IPlayer } from "../../PersonObjects/IPlayer";
|
||||
|
||||
export function lscpu(terminal: ITerminal, engine: IEngine, player: IPlayer): void {
|
||||
export function lscpu(terminal: ITerminal, router: IRouter, player: IPlayer): void {
|
||||
terminal.print(player.getCurrentServer().cpuCores + " Core(s)");
|
||||
}
|
||||
|
@ -1,12 +1,12 @@
|
||||
import { ITerminal } from "../ITerminal";
|
||||
import { IEngine } from "../../IEngine";
|
||||
import { IRouter } from "../../ui/Router";
|
||||
import { IPlayer } from "../../PersonObjects/IPlayer";
|
||||
import { BaseServer } from "../../Server/BaseServer";
|
||||
import { numeralWrapper } from "../../ui/numeralFormat";
|
||||
|
||||
export function mem(
|
||||
terminal: ITerminal,
|
||||
engine: IEngine,
|
||||
router: IRouter,
|
||||
player: IPlayer,
|
||||
server: BaseServer,
|
||||
args: (string | number)[],
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { ITerminal } from "../ITerminal";
|
||||
import { IEngine } from "../../IEngine";
|
||||
import { IRouter } from "../../ui/Router";
|
||||
import { IPlayer } from "../../PersonObjects/IPlayer";
|
||||
import { BaseServer } from "../../Server/BaseServer";
|
||||
import { isScriptFilename } from "../../Script/ScriptHelpersTS";
|
||||
@ -8,7 +8,7 @@ import { Script } from "../../Script/Script";
|
||||
|
||||
export function mv(
|
||||
terminal: ITerminal,
|
||||
engine: IEngine,
|
||||
router: IRouter,
|
||||
player: IPlayer,
|
||||
server: BaseServer,
|
||||
args: (string | number)[],
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { ITerminal } from "../ITerminal";
|
||||
import { IEngine } from "../../IEngine";
|
||||
import { IRouter } from "../../ui/Router";
|
||||
import { IPlayer } from "../../PersonObjects/IPlayer";
|
||||
import { BaseServer } from "../../Server/BaseServer";
|
||||
import { isScriptFilename } from "../../Script/ScriptHelpersTS";
|
||||
@ -7,7 +7,7 @@ import { createFconf } from "../../Fconf/Fconf";
|
||||
|
||||
export function nano(
|
||||
terminal: ITerminal,
|
||||
engine: IEngine,
|
||||
router: IRouter,
|
||||
player: IPlayer,
|
||||
server: BaseServer,
|
||||
args: (string | number)[],
|
||||
@ -21,7 +21,7 @@ export function nano(
|
||||
const filename = args[0] + "";
|
||||
if (filename === ".fconf") {
|
||||
const text = createFconf();
|
||||
engine.loadScriptEditorContent(filename, text);
|
||||
router.toScriptEditor(filename, text);
|
||||
return;
|
||||
} else if (isScriptFilename(filename)) {
|
||||
const filepath = terminal.getFilepath(filename);
|
||||
@ -33,17 +33,17 @@ export function nano(
|
||||
|
||||
}`;
|
||||
}
|
||||
engine.loadScriptEditorContent(filepath, code);
|
||||
router.toScriptEditor(filepath, code);
|
||||
} else {
|
||||
engine.loadScriptEditorContent(filepath, script.code);
|
||||
router.toScriptEditor(filepath, script.code);
|
||||
}
|
||||
} else if (filename.endsWith(".txt")) {
|
||||
const filepath = terminal.getFilepath(filename);
|
||||
const txt = terminal.getTextFile(player, filename);
|
||||
if (txt == null) {
|
||||
engine.loadScriptEditorContent(filepath);
|
||||
router.toScriptEditor(filepath);
|
||||
} else {
|
||||
engine.loadScriptEditorContent(filepath, txt.text);
|
||||
router.toScriptEditor(filepath, txt.text);
|
||||
}
|
||||
} else {
|
||||
terminal.error(
|
||||
|
@ -1,11 +1,11 @@
|
||||
import { ITerminal } from "../ITerminal";
|
||||
import { IEngine } from "../../IEngine";
|
||||
import { IRouter } from "../../ui/Router";
|
||||
import { IPlayer } from "../../PersonObjects/IPlayer";
|
||||
import { BaseServer } from "../../Server/BaseServer";
|
||||
|
||||
export function ps(
|
||||
terminal: ITerminal,
|
||||
engine: IEngine,
|
||||
router: IRouter,
|
||||
player: IPlayer,
|
||||
server: BaseServer,
|
||||
args: (string | number)[],
|
||||
|
@ -1,12 +1,12 @@
|
||||
import { ITerminal } from "../ITerminal";
|
||||
import { IEngine } from "../../IEngine";
|
||||
import { IRouter } from "../../ui/Router";
|
||||
import { IPlayer } from "../../PersonObjects/IPlayer";
|
||||
import { BaseServer } from "../../Server/BaseServer";
|
||||
import { IReturnStatus } from "../../types";
|
||||
|
||||
export function rm(
|
||||
terminal: ITerminal,
|
||||
engine: IEngine,
|
||||
router: IRouter,
|
||||
player: IPlayer,
|
||||
server: BaseServer,
|
||||
args: (string | number)[],
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { ITerminal } from "../ITerminal";
|
||||
import { IEngine } from "../../IEngine";
|
||||
import { IRouter } from "../../ui/Router";
|
||||
import { IPlayer } from "../../PersonObjects/IPlayer";
|
||||
import { BaseServer } from "../../Server/BaseServer";
|
||||
import { isScriptFilename } from "../../Script/ScriptHelpersTS";
|
||||
@ -8,7 +8,7 @@ import { runProgram } from "./runProgram";
|
||||
|
||||
export function run(
|
||||
terminal: ITerminal,
|
||||
engine: IEngine,
|
||||
router: IRouter,
|
||||
player: IPlayer,
|
||||
server: BaseServer,
|
||||
args: (string | number)[],
|
||||
@ -30,11 +30,11 @@ export function run(
|
||||
|
||||
// Check if its a script or just a program/executable
|
||||
if (isScriptFilename(executableName)) {
|
||||
runScript(terminal, engine, player, server, args);
|
||||
runScript(terminal, router, player, server, args);
|
||||
} else if (executableName.endsWith(".cct")) {
|
||||
terminal.runContract(player, executableName);
|
||||
} else {
|
||||
runProgram(terminal, engine, player, server, args);
|
||||
runProgram(terminal, router, player, server, args);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,12 +1,12 @@
|
||||
import { ITerminal } from "../ITerminal";
|
||||
import { IEngine } from "../../IEngine";
|
||||
import { IRouter } from "../../ui/Router";
|
||||
import { IPlayer } from "../../PersonObjects/IPlayer";
|
||||
import { BaseServer } from "../../Server/BaseServer";
|
||||
import { Programs } from "../../Programs/Programs";
|
||||
|
||||
export function runProgram(
|
||||
terminal: ITerminal,
|
||||
engine: IEngine,
|
||||
router: IRouter,
|
||||
player: IPlayer,
|
||||
server: BaseServer,
|
||||
args: (string | number)[],
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { ITerminal } from "../ITerminal";
|
||||
import { IEngine } from "../../IEngine";
|
||||
import { IRouter } from "../../ui/Router";
|
||||
import { IPlayer } from "../../PersonObjects/IPlayer";
|
||||
import { BaseServer } from "../../Server/BaseServer";
|
||||
import { logBoxCreate } from "../../../utils/LogBox";
|
||||
@ -10,7 +10,7 @@ import * as libarg from "arg";
|
||||
|
||||
export function runScript(
|
||||
terminal: ITerminal,
|
||||
engine: IEngine,
|
||||
router: IRouter,
|
||||
player: IPlayer,
|
||||
server: BaseServer,
|
||||
commandArgs: (string | number)[],
|
||||
|
@ -1,12 +1,12 @@
|
||||
import { ITerminal } from "../ITerminal";
|
||||
import { IEngine } from "../../IEngine";
|
||||
import { IRouter } from "../../ui/Router";
|
||||
import { IPlayer } from "../../PersonObjects/IPlayer";
|
||||
import { BaseServer } from "../../Server/BaseServer";
|
||||
import { getServerOnNetwork } from "../../Server/ServerHelpers";
|
||||
|
||||
export function scan(
|
||||
terminal: ITerminal,
|
||||
engine: IEngine,
|
||||
router: IRouter,
|
||||
player: IPlayer,
|
||||
server: BaseServer,
|
||||
args: (string | number)[],
|
||||
|
@ -1,12 +1,12 @@
|
||||
import { ITerminal } from "../ITerminal";
|
||||
import { IEngine } from "../../IEngine";
|
||||
import { IRouter } from "../../ui/Router";
|
||||
import { IPlayer } from "../../PersonObjects/IPlayer";
|
||||
import { BaseServer } from "../../Server/BaseServer";
|
||||
import { Programs } from "../../Programs/Programs";
|
||||
|
||||
export function scananalyze(
|
||||
terminal: ITerminal,
|
||||
engine: IEngine,
|
||||
router: IRouter,
|
||||
player: IPlayer,
|
||||
server: BaseServer,
|
||||
args: (string | number)[],
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { ITerminal } from "../ITerminal";
|
||||
import { IEngine } from "../../IEngine";
|
||||
import { IRouter } from "../../ui/Router";
|
||||
import { IPlayer } from "../../PersonObjects/IPlayer";
|
||||
import { BaseServer } from "../../Server/BaseServer";
|
||||
import { Message } from "../../Message/Message";
|
||||
@ -8,7 +8,7 @@ import { isScriptFilename } from "../../Script/ScriptHelpersTS";
|
||||
|
||||
export function scp(
|
||||
terminal: ITerminal,
|
||||
engine: IEngine,
|
||||
router: IRouter,
|
||||
player: IPlayer,
|
||||
server: BaseServer,
|
||||
args: (string | number)[],
|
||||
|
@ -1,11 +1,11 @@
|
||||
import { ITerminal } from "../ITerminal";
|
||||
import { IEngine } from "../../IEngine";
|
||||
import { IRouter } from "../../ui/Router";
|
||||
import { IPlayer } from "../../PersonObjects/IPlayer";
|
||||
import { BaseServer } from "../../Server/BaseServer";
|
||||
|
||||
export function sudov(
|
||||
terminal: ITerminal,
|
||||
engine: IEngine,
|
||||
router: IRouter,
|
||||
player: IPlayer,
|
||||
server: BaseServer,
|
||||
args: (string | number)[],
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { ITerminal } from "../ITerminal";
|
||||
import { IEngine } from "../../IEngine";
|
||||
import { IRouter } from "../../ui/Router";
|
||||
import { IPlayer } from "../../PersonObjects/IPlayer";
|
||||
import { BaseServer } from "../../Server/BaseServer";
|
||||
import { logBoxCreate } from "../../../utils/LogBox";
|
||||
@ -9,7 +9,7 @@ import { isScriptFilename } from "../../Script/ScriptHelpersTS";
|
||||
|
||||
export function tail(
|
||||
terminal: ITerminal,
|
||||
engine: IEngine,
|
||||
router: IRouter,
|
||||
player: IPlayer,
|
||||
server: BaseServer,
|
||||
commandArray: (string | number)[],
|
||||
|
@ -1,12 +1,12 @@
|
||||
import { ITerminal } from "../ITerminal";
|
||||
import { IEngine } from "../../IEngine";
|
||||
import { IRouter } from "../../ui/Router";
|
||||
import { IPlayer } from "../../PersonObjects/IPlayer";
|
||||
import { BaseServer } from "../../Server/BaseServer";
|
||||
import { FconfSettings } from "../../Fconf/FconfSettings";
|
||||
|
||||
export function theme(
|
||||
terminal: ITerminal,
|
||||
engine: IEngine,
|
||||
router: IRouter,
|
||||
player: IPlayer,
|
||||
server: BaseServer,
|
||||
args: (string | number)[],
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { ITerminal } from "../ITerminal";
|
||||
import { IEngine } from "../../IEngine";
|
||||
import { IRouter } from "../../ui/Router";
|
||||
import { IPlayer } from "../../PersonObjects/IPlayer";
|
||||
import { BaseServer } from "../../Server/BaseServer";
|
||||
import { getRamUsageFromRunningScript } from "../../Script/RunningScriptHelpers";
|
||||
@ -7,7 +7,7 @@ import { numeralWrapper } from "../../ui/numeralFormat";
|
||||
|
||||
export function top(
|
||||
terminal: ITerminal,
|
||||
engine: IEngine,
|
||||
router: IRouter,
|
||||
player: IPlayer,
|
||||
server: BaseServer,
|
||||
args: (string | number)[],
|
||||
|
@ -1,12 +1,12 @@
|
||||
import { ITerminal } from "../ITerminal";
|
||||
import { IEngine } from "../../IEngine";
|
||||
import { IRouter } from "../../ui/Router";
|
||||
import { IPlayer } from "../../PersonObjects/IPlayer";
|
||||
import { BaseServer } from "../../Server/BaseServer";
|
||||
import { removeAlias } from "../../Alias";
|
||||
|
||||
export function unalias(
|
||||
terminal: ITerminal,
|
||||
engine: IEngine,
|
||||
router: IRouter,
|
||||
player: IPlayer,
|
||||
server: BaseServer,
|
||||
args: (string | number)[],
|
||||
|
@ -1,12 +1,12 @@
|
||||
import { ITerminal } from "../ITerminal";
|
||||
import { IEngine } from "../../IEngine";
|
||||
import { IRouter } from "../../ui/Router";
|
||||
import { IPlayer } from "../../PersonObjects/IPlayer";
|
||||
import { BaseServer } from "../../Server/BaseServer";
|
||||
import { isScriptFilename } from "../../Script/ScriptHelpersTS";
|
||||
|
||||
export function wget(
|
||||
terminal: ITerminal,
|
||||
engine: IEngine,
|
||||
router: IRouter,
|
||||
player: IPlayer,
|
||||
server: BaseServer,
|
||||
args: (string | number)[],
|
||||
|
@ -6,7 +6,7 @@ import createStyles from "@mui/styles/createStyles";
|
||||
import TextField from "@mui/material/TextField";
|
||||
import { KEY } from "../../../utils/helpers/keyCodes";
|
||||
import { ITerminal } from "../ITerminal";
|
||||
import { IEngine } from "../../IEngine";
|
||||
import { IRouter } from "../../ui/Router";
|
||||
import { IPlayer } from "../../PersonObjects/IPlayer";
|
||||
import { determineAllPossibilitiesForTabCompletion } from "../determineAllPossibilitiesForTabCompletion";
|
||||
import { tabCompletion } from "../tabCompletion";
|
||||
@ -37,11 +37,11 @@ const useStyles = makeStyles((theme: Theme) =>
|
||||
|
||||
interface IProps {
|
||||
terminal: ITerminal;
|
||||
engine: IEngine;
|
||||
router: IRouter;
|
||||
player: IPlayer;
|
||||
}
|
||||
|
||||
export function TerminalInput({ terminal, engine, player }: IProps): React.ReactElement {
|
||||
export function TerminalInput({ terminal, router, player }: IProps): React.ReactElement {
|
||||
const terminalInput = useRef<HTMLInputElement>(null);
|
||||
|
||||
const [value, setValue] = useState("");
|
||||
@ -157,7 +157,7 @@ export function TerminalInput({ terminal, engine, player }: IProps): React.React
|
||||
if (event.keyCode === KEY.ENTER && value !== "") {
|
||||
event.preventDefault();
|
||||
terminal.print(`[${player.getCurrentServer().hostname} ~${terminal.cwd()}]> ${value}`);
|
||||
terminal.executeCommands(engine, player, value);
|
||||
terminal.executeCommands(router, player, value);
|
||||
setValue("");
|
||||
return;
|
||||
}
|
||||
|
@ -8,7 +8,7 @@ import makeStyles from "@mui/styles/makeStyles";
|
||||
import createStyles from "@mui/styles/createStyles";
|
||||
import Box from "@mui/material/Box";
|
||||
import { ITerminal, Output, Link } from "../ITerminal";
|
||||
import { IEngine } from "../../IEngine";
|
||||
import { IRouter } from "../../ui/Router";
|
||||
import { IPlayer } from "../../PersonObjects/IPlayer";
|
||||
import { TerminalInput } from "./TerminalInput";
|
||||
|
||||
@ -42,11 +42,11 @@ const useStyles = makeStyles((theme: Theme) =>
|
||||
|
||||
interface IProps {
|
||||
terminal: ITerminal;
|
||||
engine: IEngine;
|
||||
router: IRouter;
|
||||
player: IPlayer;
|
||||
}
|
||||
|
||||
export function TerminalRoot({ terminal, engine, player }: IProps): React.ReactElement {
|
||||
export function TerminalRoot({ terminal, router, player }: IProps): React.ReactElement {
|
||||
const scrollHook = useRef<HTMLDivElement>(null);
|
||||
const setRerender = useState(false)[1];
|
||||
function rerender(): void {
|
||||
@ -106,7 +106,7 @@ export function TerminalRoot({ terminal, engine, player }: IProps): React.ReactE
|
||||
<div ref={scrollHook}></div>
|
||||
</Box>
|
||||
<Box position="sticky" bottom={0} width="100%" px={0}>
|
||||
<TerminalInput player={player} engine={engine} terminal={terminal} />
|
||||
<TerminalInput player={player} router={router} terminal={terminal} />
|
||||
</Box>
|
||||
</>
|
||||
);
|
||||
|
@ -207,25 +207,6 @@ const Engine = {
|
||||
ReactDOM.render(<MilestonesRoot player={Player} />, Engine.Display.content);
|
||||
},
|
||||
|
||||
loadTutorialContent: function () {
|
||||
Engine.hideAllContent();
|
||||
Engine.Display.content.style.display = "block";
|
||||
routing.navigateTo(Page.Tutorial);
|
||||
MainMenuLinks.Tutorial.classList.add("active");
|
||||
ReactDOM.render(<TutorialRoot />, Engine.Display.content);
|
||||
},
|
||||
|
||||
loadDevMenuContent: function () {
|
||||
Engine.hideAllContent();
|
||||
if (process.env.NODE_ENV !== "development") {
|
||||
throw new Error("Cannot create Dev Menu because you are not in a dev build");
|
||||
}
|
||||
Engine.Display.content.style.display = "block";
|
||||
ReactDOM.render(<DevMenuRoot player={Player} engine={this} />, Engine.Display.content);
|
||||
routing.navigateTo(Page.DevMenu);
|
||||
MainMenuLinks.DevMenu.classList.add("active");
|
||||
},
|
||||
|
||||
loadLocationContent: function (initiallyInCity = true) {
|
||||
Engine.hideAllContent();
|
||||
Engine.Display.content.style.display = "block";
|
||||
|
@ -69,6 +69,9 @@ const useStyles = makeStyles((theme: Theme) =>
|
||||
}),
|
||||
);
|
||||
|
||||
let filename = "";
|
||||
let code = "";
|
||||
|
||||
export function GameRoot({ player, engine, terminal }: IProps): React.ReactElement {
|
||||
const contentRef = useRef<HTMLDivElement>(null);
|
||||
const [faction, setFaction] = useState<Faction | null>(null);
|
||||
@ -93,7 +96,11 @@ export function GameRoot({ player, engine, terminal }: IProps): React.ReactEleme
|
||||
toHacknetNodes: () => setPage(Page.Hacknet),
|
||||
toMilestones: () => setPage(Page.Milestones),
|
||||
toResleeves: () => setPage(Page.Resleeves),
|
||||
toScriptEditor: () => setPage(Page.CreateScript),
|
||||
toScriptEditor: (fn: string, c: string) => {
|
||||
filename = fn;
|
||||
code = c;
|
||||
setPage(Page.CreateScript);
|
||||
},
|
||||
toSleeves: () => setPage(Page.Sleeves),
|
||||
toStockMarket: () => setPage(Page.StockMarket),
|
||||
toTerminal: () => setPage(Page.Terminal),
|
||||
@ -113,19 +120,24 @@ export function GameRoot({ player, engine, terminal }: IProps): React.ReactEleme
|
||||
},
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
filename = "";
|
||||
code = "";
|
||||
});
|
||||
|
||||
return (
|
||||
<>
|
||||
<Box display="flex" flexDirection="row" width="100%">
|
||||
<SidebarRoot player={player} router={router} page={page} />
|
||||
<Box ref={contentRef} className={classes.root} flexGrow={1} display="block" width="100%" px={1} height="100vh">
|
||||
{page === Page.Terminal ? (
|
||||
<TerminalRoot terminal={terminal} engine={engine} player={player} />
|
||||
<TerminalRoot terminal={terminal} router={router} player={player} />
|
||||
) : page === Page.Sleeves ? (
|
||||
<SleeveRoot player={player} />
|
||||
) : page === Page.Stats ? (
|
||||
<CharacterInfo player={player} />
|
||||
) : page === Page.CreateScript ? (
|
||||
<ScriptEditorRoot filename={""} code={""} player={player} engine={engine} />
|
||||
<ScriptEditorRoot filename={filename} code={code} player={player} router={router} />
|
||||
) : page === Page.ActiveScripts ? (
|
||||
<ActiveScriptsRoot p={player} workerScripts={workerScripts} />
|
||||
) : page === Page.Hacknet ? (
|
||||
|
Loading…
Reference in New Issue
Block a user