From ce0ca6c24d40db45a6e706837ea1c387bd2dffb3 Mon Sep 17 00:00:00 2001 From: Daniel Xie Date: Thu, 20 Oct 2016 13:26:38 -0500 Subject: [PATCH] Fixed syntactical bugs/typos --- index.html | 2 +- src/Player.js | 13 +++-- src/Server.js | 8 +-- src/Terminal.js | 141 +++++++++++++++++++++++++----------------------- src/engine.js | 2 +- 5 files changed, 87 insertions(+), 79 deletions(-) diff --git a/index.html b/index.html index bdb65b45d..f10a201a2 100644 --- a/index.html +++ b/index.html @@ -54,8 +54,8 @@ + - \ No newline at end of file diff --git a/src/Player.js b/src/Player.js index d50318269..9a9160b9b 100644 --- a/src/Player.js +++ b/src/Player.js @@ -40,15 +40,18 @@ var Player = { lifetime_money: 0, //Starting (home) computer - homeComputer = new Server(); - startingServer.init("19.42.93.219", "home", "Home PC", true, true, true, true, 2); + homeComputer: new Server(), //Servers - currentServer = homeComputer, //Server currently being accessed through terminal - discoveredServers = [], - purchasedServers = [], + currentServer: null, //Server currently being accessed through terminal + discoveredServers: [], + purchasedServers: [], //Achievements and achievement progress + init: function() { + homeComputer.init("19.42.93.219", "home", "Home PC", true, true, true, true, 1); + currentServer = Player.homeComputer; + } }; \ No newline at end of file diff --git a/src/Server.js b/src/Server.js index 5eaa1611b..386c8f4db 100644 --- a/src/Server.js +++ b/src/Server.js @@ -1,5 +1,5 @@ //Netburner Server class -function Server() = { +function Server() { /* Properties */ //Connection information 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 -createRandomIp = function() = { +createRandomIp = function() { var ip = randomByte() +'.' + randomByte() +'.' + randomByte() +'.' + @@ -74,7 +74,7 @@ createRandomIp = function() = { return ip; } -createRandomByte = function() = { +createRandomByte = function() { return Math.round(Math.random()*256); } @@ -297,7 +297,7 @@ ForeignServers = { SigmaCosmetics.init(createRandomIp(), "sigma-cosmetics", "Sigma Cosmetics", true, false, false, false, 16); 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); Zer0Nightclub.init(createRandomIp(), "zer0", "ZER0 Nightclub", true, false, false, false, 32); diff --git a/src/Terminal.js b/src/Terminal.js index f2ce4799e..c0a0b0539 100644 --- a/src/Terminal.js +++ b/src/Terminal.js @@ -18,73 +18,78 @@ $(document).keyup(function(event) { } }); -var Terminal.executeCommand = function(command) { - var commandArray = command.split(); - - if (commandArray.length == 0) { - return; - } - - switch (commandArray[0]) { - 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..maybe rename this to telnet? - 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 { +var Terminal = { + executeCommand: function(command) { + var commandArray = command.split(); + + if (commandArray.length == 0) { + return; + } + + switch (commandArray[0]) { + 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..maybe rename this to telnet? + 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 "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) { + + } +}; + + + diff --git a/src/engine.js b/src/engine.js index bbeb8e9ff..b4dc7d83d 100644 --- a/src/engine.js +++ b/src/engine.js @@ -110,7 +110,7 @@ var Engine = { 'Defense: ' + Player.defense + '

' + 'Dexterity: ' + Player.dexterity + '

' + 'Agility: ' + Player.agility + '

' + - 'Servers owned: ' + Player.purchasedServers.length +

'; + 'Servers owned: ' + Player.purchasedServers.length + '

'; }, /* Main Event Loop */