From 9c4b0c004cb940f5ce33bb76b82e168096321092 Mon Sep 17 00:00:00 2001
From: catloversg <152669316+catloversg@users.noreply.github.com>
Date: Wed, 18 Dec 2024 17:46:37 +0700
Subject: [PATCH] UI: Make minor changes in buttons and error messages of
tutorial (#1837)
* UI: Make minor changes in buttons and error messages of tutorial
* Update
* Change "Skip Tutorial" to "Exit Tutorial"
---
src/Terminal/Terminal.ts | 34 ++++++++++---------
.../InteractiveTutorialRoot.tsx | 5 ++-
2 files changed, 22 insertions(+), 17 deletions(-)
diff --git a/src/Terminal/Terminal.ts b/src/Terminal/Terminal.ts
index 235be962d..6d9929a31 100644
--- a/src/Terminal/Terminal.ts
+++ b/src/Terminal/Terminal.ts
@@ -636,12 +636,14 @@ export class Terminal {
if (n00dlesServ == null) {
throw new Error("Could not get n00dles server");
}
+ const errorMessageForBadCommand =
+ "Bad command. Please follow the tutorial or click 'Exit Tutorial' if you'd like to skip it.";
switch (ITutorial.currStep) {
case iTutorialSteps.TerminalHelp:
if (commandArray.length === 1 && commandArray[0] == "help") {
iTutorialNextStep();
} else {
- this.error("Bad command. Please follow the tutorial");
+ this.error(errorMessageForBadCommand);
return;
}
break;
@@ -649,7 +651,7 @@ export class Terminal {
if (commandArray.length === 1 && commandArray[0] == "ls") {
iTutorialNextStep();
} else {
- this.error("Bad command. Please follow the tutorial");
+ this.error(errorMessageForBadCommand);
return;
}
break;
@@ -657,7 +659,7 @@ export class Terminal {
if (commandArray.length === 1 && commandArray[0] == "scan") {
iTutorialNextStep();
} else {
- this.error("Bad command. Please follow the tutorial");
+ this.error(errorMessageForBadCommand);
return;
}
break;
@@ -665,7 +667,7 @@ export class Terminal {
if (commandArray.length == 1 && commandArray[0] == "scan-analyze") {
iTutorialNextStep();
} else {
- this.error("Bad command. Please follow the tutorial");
+ this.error(errorMessageForBadCommand);
return;
}
break;
@@ -673,7 +675,7 @@ export class Terminal {
if (commandArray.length == 2 && commandArray[0] == "scan-analyze" && commandArray[1] === 2) {
iTutorialNextStep();
} else {
- this.error("Bad command. Please follow the tutorial");
+ this.error(errorMessageForBadCommand);
return;
}
break;
@@ -689,7 +691,7 @@ export class Terminal {
return;
}
} else {
- this.error("Bad command. Please follow the tutorial");
+ this.error(errorMessageForBadCommand);
return;
}
break;
@@ -697,7 +699,7 @@ export class Terminal {
if (commandArray.length === 1 && commandArray[0] === "analyze") {
iTutorialNextStep();
} else {
- this.error("Bad command. Please follow the tutorial");
+ this.error(errorMessageForBadCommand);
return;
}
break;
@@ -705,7 +707,7 @@ export class Terminal {
if (commandArray.length == 2 && commandArray[0] == "run" && commandArray[1] == "NUKE.exe") {
iTutorialNextStep();
} else {
- this.error("Bad command. Please follow the tutorial");
+ this.error(errorMessageForBadCommand);
return;
}
break;
@@ -713,13 +715,13 @@ export class Terminal {
if (commandArray.length == 1 && commandArray[0] == "hack") {
iTutorialNextStep();
} else {
- this.error("Bad command. Please follow the tutorial");
+ this.error(errorMessageForBadCommand);
return;
}
break;
case iTutorialSteps.TerminalHackingMechanics:
if (commandArray.length !== 1 || !["grow", "weaken", "hack"].includes(commandArray[0] + "")) {
- this.error("Bad command. Please follow the tutorial");
+ this.error(errorMessageForBadCommand);
return;
}
break;
@@ -727,7 +729,7 @@ export class Terminal {
if (commandArray.length == 1 && commandArray[0] == "home") {
iTutorialNextStep();
} else {
- this.error("Bad command. Please follow the tutorial");
+ this.error(errorMessageForBadCommand);
return;
}
break;
@@ -739,7 +741,7 @@ export class Terminal {
) {
iTutorialNextStep();
} else {
- this.error("Bad command. Please follow the tutorial");
+ this.error(errorMessageForBadCommand);
return;
}
break;
@@ -747,7 +749,7 @@ export class Terminal {
if (commandArray.length == 1 && commandArray[0] == "free") {
iTutorialNextStep();
} else {
- this.error("Bad command. Please follow the tutorial");
+ this.error(errorMessageForBadCommand);
return;
}
break;
@@ -759,7 +761,7 @@ export class Terminal {
) {
iTutorialNextStep();
} else {
- this.error("Bad command. Please follow the tutorial");
+ this.error(errorMessageForBadCommand);
return;
}
break;
@@ -771,12 +773,12 @@ export class Terminal {
) {
iTutorialNextStep();
} else {
- this.error("Bad command. Please follow the tutorial");
+ this.error(errorMessageForBadCommand);
return;
}
break;
default:
- this.error("Please follow the tutorial, or click 'EXIT' if you'd like to skip it");
+ this.error("Please follow the tutorial or click 'Exit Tutorial' if you'd like to skip it");
return;
}
}
diff --git a/src/ui/InteractiveTutorial/InteractiveTutorialRoot.tsx b/src/ui/InteractiveTutorial/InteractiveTutorialRoot.tsx
index 62d670af8..ef08c8ac7 100644
--- a/src/ui/InteractiveTutorial/InteractiveTutorialRoot.tsx
+++ b/src/ui/InteractiveTutorial/InteractiveTutorialRoot.tsx
@@ -60,6 +60,9 @@ export function InteractiveTutorialRoot(): React.ReactElement {
This tutorial will show you the basics of the game. You may skip the tutorial at any time.
+ You can replay this tutorial by going to the Options tab and pressing "Reset tutorial".
+
+
You can also collapse this panel to temporarily hide this tutorial.
>
@@ -593,7 +596,7 @@ export async function main(ns) {