Fixed syntactical bugs/typos

This commit is contained in:
Daniel Xie 2016-10-20 13:26:38 -05:00
parent f6212a4c6d
commit ce0ca6c24d
5 changed files with 87 additions and 79 deletions

@ -54,8 +54,8 @@
</script> </script>
<script src="src/Terminal.js"></script> <script src="src/Terminal.js"></script>
<script src="src/Server.js"></script>
<script src="src/Player.js"></script> <script src="src/Player.js"></script>
<script src="src/Server.js"></script>
<script src="src/engine.js"></script> <script src="src/engine.js"></script>
</body> </body>
</html> </html>

@ -40,15 +40,18 @@ var Player = {
lifetime_money: 0, lifetime_money: 0,
//Starting (home) computer //Starting (home) computer
homeComputer = new Server(); homeComputer: new Server(),
startingServer.init("19.42.93.219", "home", "Home PC", true, true, true, true, 2);
//Servers //Servers
currentServer = homeComputer, //Server currently being accessed through terminal currentServer: null, //Server currently being accessed through terminal
discoveredServers = [], discoveredServers: [],
purchasedServers = [], purchasedServers: [],
//Achievements and achievement progress //Achievements and achievement progress
init: function() {
homeComputer.init("19.42.93.219", "home", "Home PC", true, true, true, true, 1);
currentServer = Player.homeComputer;
}
}; };

@ -1,5 +1,5 @@
//Netburner Server class //Netburner Server class
function Server() = { function Server() {
/* Properties */ /* Properties */
//Connection information //Connection information
this.ip = "0.0.0.0"; this.ip = "0.0.0.0";
@ -66,7 +66,7 @@ Server.prototype.setHackingParameters = function(requiredHackingSkill, moneyAvai
} }
//Generate a random IP address. Used for the foreign servers //Generate a random IP address. Used for the foreign servers
createRandomIp = function() = { createRandomIp = function() {
var ip = randomByte() +'.' + var ip = randomByte() +'.' +
randomByte() +'.' + randomByte() +'.' +
randomByte() +'.' + randomByte() +'.' +
@ -74,7 +74,7 @@ createRandomIp = function() = {
return ip; return ip;
} }
createRandomByte = function() = { createRandomByte = function() {
return Math.round(Math.random()*256); return Math.round(Math.random()*256);
} }
@ -297,7 +297,7 @@ ForeignServers = {
SigmaCosmetics.init(createRandomIp(), "sigma-cosmetics", "Sigma Cosmetics", true, false, false, false, 16); SigmaCosmetics.init(createRandomIp(), "sigma-cosmetics", "Sigma Cosmetics", true, false, false, false, 16);
SigmaCosmetics.setHackingParameters(5, 500000, 5, 10); SigmaCosmetics.setHackingParameters(5, 500000, 5, 10);
JoesGuns.init(createRandomIp(), "joesguns", "Joe's Guns", true, false, false, false), 16); JoesGuns.init(createRandomIp(), "joesguns", "Joe's Guns", true, false, false, false, 16);
JoesGuns.setHackingParameters(10, 200000, 20, 20); JoesGuns.setHackingParameters(10, 200000, 20, 20);
Zer0Nightclub.init(createRandomIp(), "zer0", "ZER0 Nightclub", true, false, false, false, 32); Zer0Nightclub.init(createRandomIp(), "zer0", "ZER0 Nightclub", true, false, false, false, 32);

@ -18,73 +18,78 @@ $(document).keyup(function(event) {
} }
}); });
var Terminal.executeCommand = function(command) { var Terminal = {
var commandArray = command.split(); executeCommand: function(command) {
var commandArray = command.split();
if (commandArray.length == 0) {
return; if (commandArray.length == 0) {
} return;
}
switch (commandArray[0]) {
case "analyze": switch (commandArray[0]) {
//TODO Analyze the system for ports case "analyze":
break; //TODO Analyze the system for ports
case "clear": break;
case "cls": case "clear":
//TODO case "cls":
break; //TODO
case "connect": break;
//TODO Disconnect from current server in terminal and connect to new one..maybe rename this to telnet? case "connect":
break; //TODO Disconnect from current server in terminal and connect to new one..maybe rename this to telnet?
case "df": break;
//TODO case "df":
break; //TODO
case "hack": break;
//TODO Hack the current PC (usually for money) case "hack":
//You can't hack your home pc or servers you purchased //TODO Hack the current PC (usually for money)
if (Player.currentServer.purchasedByPlayer) { //You can't hack your home pc or servers you purchased
post("Cannot hack your own machines! You are currently connected to your home PC or one of your purchased servers"); if (Player.currentServer.purchasedByPlayer) {
} else { 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 "netstat":
case "scan":
//TODO Displays available network connections using TCP
case "ps":
//TODO
break;
case "rm":
//TODO
break;
case "run":
//TODO
break;
case "scp":
//TODO
break;
default:
} }
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 "netstat":
case "scan":
//TODO Displays available network connections using TCP
case "ps":
//TODO
break;
case "rm":
//TODO
break;
case "run":
//TODO
break;
case "scp":
//TODO
break;
default:
}
}
var Terminal.runProgram = function(programName) {
} runProgram: function(programName) {
}
};

@ -110,7 +110,7 @@ var Engine = {
'Defense: ' + Player.defense + '<br><br>' + 'Defense: ' + Player.defense + '<br><br>' +
'Dexterity: ' + Player.dexterity + '<br><br>' + 'Dexterity: ' + Player.dexterity + '<br><br>' +
'Agility: ' + Player.agility + '<br><br>' + 'Agility: ' + Player.agility + '<br><br>' +
'Servers owned: ' + Player.purchasedServers.length + <br><br>'; 'Servers owned: ' + Player.purchasedServers.length + '<br><br>';
}, },
/* Main Event Loop */ /* Main Event Loop */