More work on Tutorial

This commit is contained in:
Daniel Xie 2017-04-05 16:09:37 -05:00
parent 14684dd6d5
commit e2ad62c62a
4 changed files with 58 additions and 15 deletions

@ -61,7 +61,7 @@ TESTING TODO:
Can see log with tail. Can see log with tail.
Should add something where if you click it in the "Active Scripts" GUI you can see the logs too Should add something where if you click it in the "Active Scripts" GUI you can see the logs too
Tasks TODO: Tasks TODO:
Tutorial and help Tutorial and help - INTERACTIVE TUTORIAL
Secret Servers Secret Servers
Hack time formula needs rebalancing I think Hack time formula needs rebalancing I think

@ -18,7 +18,7 @@ CONSTANTS = {
MaxLogCapacity: 20, MaxLogCapacity: 20,
//Programs //Programs
PortHackProgram: "PortHack.exe", NukeProgram: "NUKE.exe",
BruteSSHProgram: "BruteSSH.exe", BruteSSHProgram: "BruteSSH.exe",
FTPCrackProgram: "FTPCrack.exe", FTPCrackProgram: "FTPCrack.exe",
RelaySMTPProgram: "relaySMTP.exe", RelaySMTPProgram: "relaySMTP.exe",
@ -30,7 +30,7 @@ CONSTANTS = {
"clear Clear all text on the terminal <br>" + "clear Clear all text on the terminal <br>" +
"cls See 'clear' command <br>" + "cls See 'clear' command <br>" +
"connect [ip/hostname] Connects to the machine given by its IP or hostname <br>" + "connect [ip/hostname] Connects to the machine given by its IP or hostname <br>" +
"free Check the machine's memory usage<br>" + "free Check the machine's memory (RAM) usage<br>" +
"hack Hack the current machine<br>" + "hack Hack the current machine<br>" +
"help Display this list<br>" + "help Display this list<br>" +
"hostname Displays the hostname of the machine<br>" + "hostname Displays the hostname of the machine<br>" +
@ -43,16 +43,59 @@ CONSTANTS = {
"rm Delete a script/program from the machine. (WARNING: Permanent)<br>" + "rm Delete a script/program from the machine. (WARNING: Permanent)<br>" +
"run [script/program] Execute a program or a script<br>" + "run [script/program] Execute a program or a script<br>" +
"scan See 'netstat' command<br>" + "scan See 'netstat' command<br>" +
"tail Display script logs (logs contain details about active scripts)" "tail [script] Display script logs (logs contain details about active scripts)"
"telnet [ip/hostname] See 'connect' command<br>" + "telnet [ip/hostname] See 'connect' command<br>" +
"top Display all running scripts and their RAM usage<br>", "top Display all running scripts and their RAM usage<br>",
/* Tutorial related things */ /* Tutorial related things */
TutorialGettingStartedText: TutorialGettingStartedText: "Todo...",
TutorialNetworkingText: TutorialNetworkingText: "Servers are a central part of the game. You start with a single personal server (your home computer) " +
TutorialHackingText: "and you can purchase additional servers as you progress through the game. Connecting to other servers " +
TutorialScriptsText: "and hacking them can be a major source of income and experience. Servers can also be used to run " +
"scripts which can automatically hack servers for you. <br><br>" +
"In order to navigate between machines, use the 'scan' or 'netstat' commands to see all servers " +
"that are reachable from your current server. Then, you can use the 'connect [hostname/ip]' or " +
"'telnet [hostname/ip]' commands to connect to one of the available machines. <br><br>" +
"The 'hostname' and 'ifconfig' commands can be used to display the hostname/IP of the " +
"server you are currently connected to.",
TutorialHackingText: "In the year 2077, currency has become digital and decentralized. People and corporations " +
"store their money on servers. By hacking these servers, you can steal their money and gain " +
"experience. <br><br>" +
"Gaining root access <br>" +
"The key to hacking a server is to gain root access to that server. This can be done using " +
"the NUKE virus (NUKE.exe). You start the game with a copy of the NUKE virus on your home " +
"computer. The NUKE virus attacks the target server's open ports using buffer overflow " +
"exploits. When successful, you are granted root administrative access to the machine. <br><br>" +
"Typically, in order for the NUKE virus to succeed, the target server needs to have at least " +
"one of its ports opened. Some servers have no security and will not need any ports opened. Some " +
"will have very high security and will need many ports opened. In order to open ports on another " +
"server, you will need to run programs that attack the server to open specific ports. These programs " +
"can be coded once your hacking skill gets high enough, or they can be purchased if you can find " +
"a seller. <br><br>"
"In order to determine how many ports need to be opened to successfully NUKE a server, connect to " +
"that server and run the 'analyze' command. This will also show you which ports have already been " +
"opened. <br><br>" +
"Once you have enough ports opened and have ran the NUKE virus to gain root access, the server " +
"can then be hacked by simply calling the 'hack' command, or by using a script.<br><br>" +
"Hacking mechanics <br>" +
,
//TODO Add stuff about only hacking a percentage and so if you keep hacking a server it'll go down, and
//Hacking percentage
TutorialScriptsText: "Scripts can be used to automate the hacking process. Scripts must be written in the Netscript language " +
"and are saved as a file. Running a script requires RAM. The more complex a script is, the more RAM " +
"it requires to run. Scripts can be run on any server you have root access to. <br><br>" +
"Here are some commands that are useful when working with scripts: <br>" +
"free - Shows the current server's RAM usage <br>" +
"kill [script] - Stops a script that is running <br>" +
"nano [script] - Edit the script <br>" +
"ps - Displays all scripts that are actively running on the current server<br>" +
"run [script] - Run a script <br>" +
"tail [script] - Displays a script's logs<br>" +
"top - Displays all active scripts and their RAM usage <br><br>"
TutorialTravelingText: TutorialTravelingText:
TutorialJobsText: TutorialJobsText:
TutorialFactionsText: TutorialFactionsText:

@ -17,7 +17,7 @@ function displayCreateProgramContent() {
//TODO These addEventListeners should only happen once so I guess just put them in Engine.init() //TODO These addEventListeners should only happen once so I guess just put them in Engine.init()
//PortHack.exe (in case you delete it lol) //PortHack.exe (in case you delete it lol)
if (Player.getHomeComputer().programs.indexOf(CONSTANTS.PortHackProgram) == -1) { if (Player.getHomeComputer().programs.indexOf(CONSTANTS.NukeProgram) == -1) {
portHackALink.style.display = "block"; portHackALink.style.display = "block";
portHackALink.addEventListener("click", function() { portHackALink.addEventListener("click", function() {
createProgram(CONSTANTS.PortHackProgram); createProgram(CONSTANTS.PortHackProgram);

@ -140,7 +140,7 @@ var Terminal = {
post("Estimated chance to hack: " + Math.round(Player.calculateHackingChance() * 100) + "%"); post("Estimated chance to hack: " + Math.round(Player.calculateHackingChance() * 100) + "%");
post("Estimated time to hack: " + Math.round(Player.calculateHackingTime()) + " seconds"); post("Estimated time to hack: " + Math.round(Player.calculateHackingTime()) + " seconds");
post("Estimed total money available on server: $" + Player.getCurrentServer().moneyAvailable); post("Estimed total money available on server: $" + Player.getCurrentServer().moneyAvailable);
post("Required number of open ports for PortHack: " +Player.getCurrentServer().numOpenPortsRequired); post("Required number of open ports for NUKE: " +Player.getCurrentServer().numOpenPortsRequired);
if (Player.getCurrentServer().sshPortOpen) { if (Player.getCurrentServer().sshPortOpen) {
post("SSH port: Open") post("SSH port: Open")
} else { } else {
@ -471,17 +471,17 @@ var Terminal = {
//Contains the implementations of all possible programs //Contains the implementations of all possible programs
executeProgram: function(programName) { executeProgram: function(programName) {
switch (programName) { switch (programName) {
case CONSTANTS.PortHackProgram: case CONSTANTS.NukeProgram:
if (Player.getCurrentServer().hasAdminRights) { if (Player.getCurrentServer().hasAdminRights) {
post("You already have root access to this computer. There is no reason to run PortHack.exe"); post("You already have root access to this computer. There is no reason to run NUKE.exe");
} else { } else {
console.log("Running PortHack executable"); console.log("Running NUKE executable");
if (Player.getCurrentServer().openPortCount >= Player.getCurrentServer().numOpenPortsRequired) { if (Player.getCurrentServer().openPortCount >= Player.getCurrentServer().numOpenPortsRequired) {
Player.getCurrentServer().hasAdminRights = true; Player.getCurrentServer().hasAdminRights = true;
post("PortHack successful! Gained root access to " + Player.getCurrentServer().hostname); post("NUKE successful! Gained root access to " + Player.getCurrentServer().hostname);
//TODO Make this take time rather than be instant //TODO Make this take time rather than be instant
} else { } else {
post("PortHack unsuccessful. Not enough ports have been opened"); post("NUKE unsuccessful. Not enough ports have been opened");
} }
} }
break; break;