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