2022-10-10 00:42:14 +02:00
|
|
|
import { Player } from "@player";
|
2023-06-12 06:34:20 +02:00
|
|
|
import { LiteratureName } from "@enums";
|
2021-09-20 05:29:02 +02:00
|
|
|
import { ITutorialEvents } from "./ui/InteractiveTutorial/ITutorialEvents";
|
|
|
|
|
|
|
|
// Ordered array of keys to Interactive Tutorial Steps
|
|
|
|
enum iTutorialSteps {
|
|
|
|
Start,
|
|
|
|
GoToCharacterPage, // Click on 'Stats' page
|
|
|
|
CharacterPage, // Introduction to 'Stats' page
|
|
|
|
CharacterGoToTerminalPage, // Go back to Terminal
|
|
|
|
TerminalIntro, // Introduction to Terminal
|
|
|
|
TerminalHelp, // Using 'help' Terminal command
|
|
|
|
TerminalLs, // Using 'ls' Terminal command
|
|
|
|
TerminalScan, // Using 'scan' Terminal command
|
|
|
|
TerminalScanAnalyze1, // Using 'scan-analyze' Terminal command
|
|
|
|
TerminalScanAnalyze2, // Using 'scan-analyze 3' Terminal command
|
|
|
|
TerminalConnect, // Connecting to n00dles
|
|
|
|
TerminalAnalyze, // Analyzing n00dles
|
|
|
|
TerminalNuke, // NUKE n00dles
|
|
|
|
TerminalManualHack, // Hack n00dles
|
|
|
|
TerminalHackingMechanics, // Explanation of hacking mechanics
|
|
|
|
TerminalGoHome, // Go home before creating a script.
|
|
|
|
TerminalCreateScript, // Create a script using 'nano'
|
|
|
|
TerminalTypeScript, // Script Editor page - Type script and then save & close
|
|
|
|
TerminalFree, // Using 'Free' Terminal command
|
|
|
|
TerminalRunScript, // Running script using 'run' Terminal command
|
|
|
|
TerminalGoToActiveScriptsPage,
|
|
|
|
ActiveScriptsPage,
|
|
|
|
ActiveScriptsToTerminal,
|
|
|
|
TerminalTailScript,
|
|
|
|
GoToHacknetNodesPage,
|
|
|
|
HacknetNodesIntroduction,
|
|
|
|
HacknetNodesGoToWorldPage,
|
|
|
|
WorldDescription,
|
2023-07-12 23:10:52 +02:00
|
|
|
DocumentationPageInfo,
|
2021-09-20 05:29:02 +02:00
|
|
|
End,
|
|
|
|
}
|
|
|
|
|
2022-09-20 13:23:35 +02:00
|
|
|
const ITutorial = {
|
2021-09-20 05:29:02 +02:00
|
|
|
currStep: iTutorialSteps.Start,
|
|
|
|
isRunning: false,
|
|
|
|
|
|
|
|
// Keeps track of whether each step has been done
|
|
|
|
stepIsDone: {
|
|
|
|
[iTutorialSteps.Start]: false,
|
|
|
|
[iTutorialSteps.GoToCharacterPage]: false,
|
|
|
|
[iTutorialSteps.CharacterPage]: false,
|
|
|
|
[iTutorialSteps.CharacterGoToTerminalPage]: false,
|
|
|
|
[iTutorialSteps.TerminalIntro]: false,
|
|
|
|
[iTutorialSteps.TerminalHelp]: false,
|
|
|
|
[iTutorialSteps.TerminalLs]: false,
|
|
|
|
[iTutorialSteps.TerminalScan]: false,
|
|
|
|
[iTutorialSteps.TerminalScanAnalyze1]: false,
|
|
|
|
[iTutorialSteps.TerminalScanAnalyze2]: false,
|
|
|
|
[iTutorialSteps.TerminalConnect]: false,
|
|
|
|
[iTutorialSteps.TerminalAnalyze]: false,
|
|
|
|
[iTutorialSteps.TerminalNuke]: false,
|
|
|
|
[iTutorialSteps.TerminalManualHack]: false,
|
|
|
|
[iTutorialSteps.TerminalHackingMechanics]: false,
|
|
|
|
[iTutorialSteps.TerminalGoHome]: false,
|
|
|
|
[iTutorialSteps.TerminalCreateScript]: false,
|
|
|
|
[iTutorialSteps.TerminalTypeScript]: false,
|
|
|
|
[iTutorialSteps.TerminalFree]: false,
|
|
|
|
[iTutorialSteps.TerminalRunScript]: false,
|
|
|
|
[iTutorialSteps.TerminalGoToActiveScriptsPage]: false,
|
|
|
|
[iTutorialSteps.ActiveScriptsPage]: false,
|
|
|
|
[iTutorialSteps.ActiveScriptsToTerminal]: false,
|
|
|
|
[iTutorialSteps.TerminalTailScript]: false,
|
|
|
|
[iTutorialSteps.GoToHacknetNodesPage]: false,
|
|
|
|
[iTutorialSteps.HacknetNodesIntroduction]: false,
|
|
|
|
[iTutorialSteps.HacknetNodesGoToWorldPage]: false,
|
|
|
|
[iTutorialSteps.WorldDescription]: false,
|
2023-07-12 23:10:52 +02:00
|
|
|
[iTutorialSteps.DocumentationPageInfo]: false,
|
2021-09-20 05:29:02 +02:00
|
|
|
[iTutorialSteps.End]: false,
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
|
|
|
function iTutorialStart(): void {
|
|
|
|
ITutorial.isRunning = true;
|
2021-12-14 00:44:52 +01:00
|
|
|
ITutorial.currStep = iTutorialSteps.Start;
|
2021-09-20 05:29:02 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
// Go to the next step and evaluate it
|
|
|
|
function iTutorialNextStep(): void {
|
|
|
|
ITutorial.stepIsDone[ITutorial.currStep] = true;
|
|
|
|
if (ITutorial.currStep < iTutorialSteps.End) {
|
|
|
|
ITutorial.currStep += 1;
|
|
|
|
}
|
|
|
|
if (ITutorial.currStep === iTutorialSteps.End) iTutorialEnd();
|
|
|
|
ITutorialEvents.emit();
|
|
|
|
}
|
|
|
|
|
|
|
|
// Go to previous step and evaluate
|
|
|
|
function iTutorialPrevStep(): void {
|
|
|
|
if (ITutorial.currStep > iTutorialSteps.Start) {
|
|
|
|
ITutorial.currStep -= 1;
|
|
|
|
}
|
|
|
|
ITutorialEvents.emit();
|
|
|
|
}
|
|
|
|
|
|
|
|
function iTutorialEnd(): void {
|
|
|
|
ITutorial.isRunning = false;
|
2021-11-12 05:28:08 +01:00
|
|
|
ITutorial.currStep = iTutorialSteps.Start;
|
2022-09-20 13:23:35 +02:00
|
|
|
const messages = Player.getHomeComputer().messages;
|
FILES: Path rework & typesafety (#479)
* Added new types for various file paths, all in the Paths folder.
* TypeSafety and other helper functions related to these types
* Added basic globbing support with * and ?. Currently only implemented for Script/Text, on nano and download terminal commands
* Enforcing the new types throughout the codebase, plus whatever rewrites happened along the way
* Server.textFiles is now a map
* TextFile no longer uses a fn property, now it is filename
* Added a shared ContentFile interface for shared functionality between TextFile and Script.
* related to ContentFile change above, the player is now allowed to move a text file to a script file and vice versa.
* File paths no longer conditionally start with slashes, and all directory names other than root have ending slashes. The player is still able to provide paths starting with / but this now indicates that the player is specifying an absolute path instead of one relative to root.
* Singularized the MessageFilename and LiteratureName enums
* Because they now only accept correct types, server.writeToXFile functions now always succeed (the only reasons they could fail before were invalid filepath).
* Fix several issues with tab completion, which included pretty much a complete rewrite
* Changed the autocomplete display options so there's less chance it clips outside the display area.
* Turned CompletedProgramName into an enum.
* Got rid of programsMetadata, and programs and DarkWebItems are now initialized immediately instead of relying on initializers called from the engine.
* For any executable (program, cct, or script file) pathing can be used directly to execute without using the run command (previously the command had to start with ./ and it wasn't actually using pathing).
2023-04-24 16:26:57 +02:00
|
|
|
const handbook = LiteratureName.HackersStartingHandbook;
|
2022-09-20 13:23:35 +02:00
|
|
|
if (!messages.includes(handbook)) messages.push(handbook);
|
2021-09-20 05:29:02 +02:00
|
|
|
ITutorialEvents.emit();
|
|
|
|
}
|
|
|
|
|
|
|
|
export { iTutorialSteps, iTutorialEnd, iTutorialStart, iTutorialNextStep, ITutorial, iTutorialPrevStep };
|