Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UI: Make minor changes in buttons and error messages of tutorial #1837

Open
wants to merge 2 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 18 additions & 16 deletions src/Terminal/Terminal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -636,44 +636,46 @@ export class Terminal {
if (n00dlesServ == null) {
throw new Error("Could not get n00dles server");
}
const errorMessageForBadCommand =
"Bad command. Please follow the tutorial or click 'Skip 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;
case iTutorialSteps.TerminalLs:
if (commandArray.length === 1 && commandArray[0] == "ls") {
iTutorialNextStep();
} else {
this.error("Bad command. Please follow the tutorial");
this.error(errorMessageForBadCommand);
return;
}
break;
case iTutorialSteps.TerminalScan:
if (commandArray.length === 1 && commandArray[0] == "scan") {
iTutorialNextStep();
} else {
this.error("Bad command. Please follow the tutorial");
this.error(errorMessageForBadCommand);
return;
}
break;
case iTutorialSteps.TerminalScanAnalyze1:
if (commandArray.length == 1 && commandArray[0] == "scan-analyze") {
iTutorialNextStep();
} else {
this.error("Bad command. Please follow the tutorial");
this.error(errorMessageForBadCommand);
return;
}
break;
case iTutorialSteps.TerminalScanAnalyze2:
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;
Expand All @@ -689,45 +691,45 @@ export class Terminal {
return;
}
} else {
this.error("Bad command. Please follow the tutorial");
this.error(errorMessageForBadCommand);
return;
}
break;
case iTutorialSteps.TerminalAnalyze:
if (commandArray.length === 1 && commandArray[0] === "analyze") {
iTutorialNextStep();
} else {
this.error("Bad command. Please follow the tutorial");
this.error(errorMessageForBadCommand);
return;
}
break;
case iTutorialSteps.TerminalNuke:
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;
case iTutorialSteps.TerminalManualHack:
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;
case iTutorialSteps.TerminalGoHome:
if (commandArray.length == 1 && commandArray[0] == "home") {
iTutorialNextStep();
} else {
this.error("Bad command. Please follow the tutorial");
this.error(errorMessageForBadCommand);
return;
}
break;
Expand All @@ -739,15 +741,15 @@ export class Terminal {
) {
iTutorialNextStep();
} else {
this.error("Bad command. Please follow the tutorial");
this.error(errorMessageForBadCommand);
return;
}
break;
case iTutorialSteps.TerminalFree:
if (commandArray.length == 1 && commandArray[0] == "free") {
iTutorialNextStep();
} else {
this.error("Bad command. Please follow the tutorial");
this.error(errorMessageForBadCommand);
return;
}
break;
Expand All @@ -759,7 +761,7 @@ export class Terminal {
) {
iTutorialNextStep();
} else {
this.error("Bad command. Please follow the tutorial");
this.error(errorMessageForBadCommand);
return;
}
break;
Expand All @@ -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 'Skip Tutorial' if you'd like to skip it");
return;
}
}
Expand Down
5 changes: 4 additions & 1 deletion src/ui/InteractiveTutorial/InteractiveTutorialRoot.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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>
</>
Expand Down Expand Up @@ -593,7 +596,7 @@ export async function main(ns) {
<br />
<br />
<Button onClick={iTutorialEnd}>
{step !== iTutorialSteps.DocumentationPageInfo ? "SKIP TUTORIAL" : "FINISH TUTORIAL"}
{step !== iTutorialSteps.DocumentationPageInfo ? "Skip Tutorial" : "Finish Tutorial"}
</Button>
</Paper>
</>
Expand Down
Loading