Added cases for all the commands that will be implemented for now. Updated Server class to contain information about servers, home computer, etc. Added a few fields to Server that will be used when hacking, as well as constructor.

This commit is contained in:
Daniel Xie
2016-10-17 16:23:23 -05:00
parent 7c03b274d7
commit a1fd46232e
4 changed files with 117 additions and 38 deletions
+59 -4
View File
@@ -10,9 +10,10 @@ $(document).keyup(function(event) {
var command = $('input[class=terminal-input]').val();
if (command.length > 0) {
post("> " + command);
$('input[class=terminal-input]').val("");
//Execute command function here
//TODO Do i have to switch the order of these two?
executeCommand(command);
$('input[class=terminal-input]').val("");
}
}
});
@@ -25,6 +26,60 @@ var executeCommand = function(command) {
}
switch (commandArray[0]) {
case
case "analyze":
//TODO Analyze the system for ports
break;
case "clear":
case "cls":
//TODO
break;
case "connect":
//TODO Disconnect from current server in terminal and connect to new one
break;
case "df":
//TODO
break;
case "hack":
//TODO Hack the current PC (usually for money)
//You can't hack your home pc or servers you purchased
if (Player.currentServer.purchasedByPlayer) {
post("Cannot hack your own machines! You are currently connected to your home PC or one of your purchased servers");
} else {
}
break;
case "help":
//TODO
break;
case "hostname":
//Print the hostname of current system
post(Player.currentServer.hostname);
break;
case "ifconfig":
//Print the IP address of the current system
post(Player.currentServer.ip);
break;
case "kill":
//TODO
break;
case "ls":
//TODO
break;
case "ps":
//TODO
break;
case "rm":
//TODO
break;
case "run":
//TODO
break;
case "scan":
//TODO
break;
}
}
}
var runProgram = function(programName) {
}