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"
This commit is contained in:
catloversg 2024-12-18 17:46:37 +07:00 committed by GitHub
parent 28da81f3f1
commit 9c4b0c004c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 22 additions and 17 deletions

@ -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;
}
}

@ -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.
<br />
<br />
You can replay this tutorial by going to the Options tab and pressing "Reset tutorial".
<br />
<br />
You can also collapse this panel to temporarily hide this tutorial.
</Typography>
</>
@ -593,7 +596,7 @@ export async function main(ns) {
<br />
<br />
<Button onClick={iTutorialEnd}>
{step !== iTutorialSteps.DocumentationPageInfo ? "SKIP TUTORIAL" : "FINISH TUTORIAL"}
{step !== iTutorialSteps.DocumentationPageInfo ? "Exit Tutorial" : "Finish Tutorial"}
</Button>
</Paper>
</>