diff --git a/css/menupages.css b/css/menupages.css index e0dd53848..dc8217e8f 100644 --- a/css/menupages.css +++ b/css/menupages.css @@ -191,6 +191,14 @@ color: #66ff33; } +#faction-augmentations-container p, +#faction-augmentations-container a, +#faction-augmentations-container ul, +#faction-augmentations-container h1{ + margin: 8px; + padding: 4px; +} + /* World */ #world-container li { margin: 0 0 15px 0; diff --git a/css/styles.css b/css/styles.css index 6e23405e4..2ef8cfaee 100644 --- a/css/styles.css +++ b/css/styles.css @@ -73,8 +73,8 @@ li { text-decoration: none; background-color: #555; color: #FFFFFF; - padding: 4px; - margin: 4px; + padding: 6px; + margin: 6px; border-top: 1px solid #333333; border-right: 1px solid #333333; border-bottom: 1px solid #333333; @@ -86,8 +86,8 @@ li { text-decoration: none; background-color: #555; color: #FFFFFF; - padding: 4px; - margin: 4px; + padding: 6px; + margin: 6px; border-top: 1px solid #333333; border-right: 1px solid #333333; border-bottom: 1px solid #333333; diff --git a/index.html b/index.html index 779c636ad..21248b30b 100644 --- a/index.html +++ b/index.html @@ -397,9 +397,10 @@
+ Back

Faction Augmentations

Lists all augmentations that are available to purchase from

- Back +
diff --git a/src/Constants.js b/src/Constants.js index 7a906c932..a6213e4f9 100644 --- a/src/Constants.js +++ b/src/Constants.js @@ -28,6 +28,9 @@ CONSTANTS = { MillisecondsPer8Hours: 28800000, GameCyclesPer8Hours: 28800000 / 200, + MillisecondsPer4Hours: 14400000, + GameCyclesPer4Hours: 14400000 / 200, + MillisecondsPerHour: 3600000, GameCyclesPerHour: 3600000 / 200, diff --git a/src/CreateProgram.js b/src/CreateProgram.js index 6d28ab69c..f8fa6295f 100644 --- a/src/CreateProgram.js +++ b/src/CreateProgram.js @@ -8,6 +8,8 @@ Programs = { SQLInjectProgram: "SQLInject.exe", } +//TODO Right now the times needed to complete work are hard-coded... +//maybe later make this dependent on hacking level or something function displayCreateProgramContent() { var portHackALink = document.getElementById("create-program-porthack"); var bruteSshALink = document.getElementById("create-program-brutessh"); @@ -38,7 +40,7 @@ function displayCreateProgramContent() { Player.hacking_skill >= 50) { bruteSshALink.style.display = "block"; bruteSshALink.addEventListener("click", function() { - createProgram(Programs.BruteSSHProgram); + Player.startCreateProgramWork(Programs.BruteSSHProgram, CONSTANTS.MillisecondsPerHour); }); } @@ -47,7 +49,7 @@ function displayCreateProgramContent() { Player.hacking_skill >= 125) { ftpCrackALink.style.display = "block"; ftpCrackALink.addEventListener("click", function() { - createProgram(Programs.FTPCrackProgram); + Player.startCreateProgramWork(Programs.FTPCrackProgram, CONSTANTS.MillisecondsPer4Hours); }); } @@ -56,7 +58,7 @@ function displayCreateProgramContent() { Player.hacking_skill >= 300) { relaySmtpALink.style.display = "block"; relaySmtpAlink.addEventListener("click", function() { - createProgram(Programs.RelaySMTPProgram); + Player.startCreateProgramWork(Programs.RelaySMTPProgram. CONSTANTS.MillisecondsPer8Hours); }); } @@ -65,7 +67,7 @@ function displayCreateProgramContent() { Player.hacking_skill >= 500) { httpWormALink.style.display = "block"; httpWormALink.addEventListener("click", function() { - createProgram(Programs.HTTPWormProgram); + Player.startCreateProgramWork(Programs.HTTPWormProgram, CONSTANTS.MillisecondsPer10Hours); }); } @@ -74,11 +76,7 @@ function displayCreateProgramContent() { Player.hacking_skill >= 750) { sqlInjectALink.style.display = "block"; sqlInjectALink.addEventListener("click", function() { - createProgram(Programs.SQLInjectProgram); + Player.startCreateProgramWork(Programs.SQLInjectProgram, CONSTANTS.MillisecondsPer10Hours); }); } -} - -function createProgram(programName) { - Player.startCreateProgramWork(programName); } \ No newline at end of file diff --git a/src/Faction.js b/src/Faction.js index 37dd59a6c..4f29bd851 100644 --- a/src/Faction.js +++ b/src/Faction.js @@ -445,7 +445,7 @@ displayFactionContent = function(factionName) { var faction = Factions[factionName]; document.getElementById("faction-name").innerHTML = factionName; document.getElementById("faction-info").innerHTML = faction.info; - document.getElementById("faction-reputation").innerHTML = "Reputation: " + faction.playerReputation; + document.getElementById("faction-reputation").innerHTML = "Reputation: " + faction.playerReputation.toFixed(3); var hackDiv = document.getElementById("faction-hack-div"); var fieldWorkDiv = document.getElementById("faction-fieldwork-div"); @@ -649,6 +649,9 @@ displayFactionAugmentations = function(factionName) { var faction = Factions[factionName]; var augmentationsList = document.getElementById("faction-augmentations-list"); + while (augmentationsList.firstChild) { + augmentationsList.removeChild(augmentationsList.firstChild); + } for (var i = 0; i < faction.augmentations.length; ++i) { var aug = Augmentations[faction.augmentations[i]]; @@ -660,13 +663,14 @@ displayFactionAugmentations = function(factionName) { if (faction.playerReputation >= (aug.baseRepRequirement * faction.augmentationRepRequirementMult)) { aElem.setAttribute("class", "a-link-button"); pElem.innerHTML = "UNLOCKED"; - //Might need to set color? Should be the green by default though... //TODO Event listener for button to purchase augmentation } else { aElem.setAttribute("class", "a-link-button-inactive"); pElem.innerHTML = "LOCKED"; - pElem.style.color = red; + pElem.style.color = "red"; } + aElem.style.display = "inline-block"; + pElem.style.display = "inline-block"; aElem.innerHTML = aug.name; span.appendChild(aElem); diff --git a/src/Player.js b/src/Player.js index 0e7a17206..d46339b18 100644 --- a/src/Player.js +++ b/src/Player.js @@ -125,6 +125,7 @@ function PlayerObject() { this.createProgramName = ""; this.timeWorked = 0; //in ms + this.timeNeededToCompleteWork = 0; this.work_money_mult = 1; @@ -368,6 +369,7 @@ PlayerObject.prototype.startWork = function() { this.workMoneyGained = 0; this.timeWorked = 0; + this.timeNeededToCompleteWork = CONSTANTS.MillisecondsPer8Hours; var cancelButton = document.getElementById("work-in-progress-cancel-button"); @@ -400,7 +402,7 @@ PlayerObject.prototype.work = function(numCycles) { //If timeWorked == 8 hours, then finish. You can only gain 8 hours worth of exp and money if (this.timeWorked >= CONSTANTS.MillisecondsPer8Hours) { - var maxCycles = CONSTANTS.GameCyclesPer8Hours; //Number of cycles in 8 hours + var maxCycles = CONSTANTS.GameCyclesPer8Hours; this.workHackExpGained = this.workHackExpGainRate * maxCycles; this.workStrExpGained = this.workStrExpGainRate * maxCycles; this.workDefExpGained = this.workDefExpGainRate * maxCycles; @@ -483,6 +485,7 @@ PlayerObject.prototype.startFactionWork = function(faction) { this.workMoneyGained = 0; this.timeWorked = 0; + this.timeNeededToCompleteWork = CONSTANTS.MillisecondsPer20Hours; var cancelButton = document.getElementById("work-in-progress-cancel-button"); @@ -562,7 +565,7 @@ PlayerObject.prototype.workForFaction = function(numCycles) { //If timeWorked == 20 hours, then finish. You can only work for the faction for 20 hours if (this.timeWorked >= CONSTANTS.MillisecondsPer20Hours) { - var maxCycles = CONSTANTS.GameCyclesPer20Hours; //Number of cycles in 20 hours + var maxCycles = CONSTANTS.GameCyclesPer20Hours; this.workHackExpGained = this.workHackExpGainRate * maxCycles; this.workStrExpGained = this.workStrExpGainRate * maxCycles; this.workDefExpGained = this.workDefExpGainRate * maxCycles; @@ -579,7 +582,7 @@ PlayerObject.prototype.workForFaction = function(numCycles) { "You have been doing this for " + convertTimeMsToTimeElapsedString(this.timeWorked) + "

" + "You have earned:

" + "$" + this.workMoneyGained + " (" + (this.workMoneyGainRate * cyclesPerSec).toFixed(2) + " / sec)

" + - this.workRepGained.toFixed(3) + " (" + (this.workRepGainRate * cyclesPerSec).toFixed(3) + " / sec) reputation for this company

" + + this.workRepGained.toFixed(3) + " (" + (this.workRepGainRate * cyclesPerSec).toFixed(3) + " / sec) reputation for this faction

" + this.workHackExpGained.toFixed(3) + " (" + (this.workHackExpGainRate * cyclesPerSec).toFixed(3) + " / sec) hacking exp

" + this.workStrExpGained.toFixed(3) + " (" + (this.workStrExpGainRate * cyclesPerSec).toFixed(3) + " / sec) strength exp
" + this.workDefExpGained.toFixed(3) + " (" + (this.workDefExpGainRate * cyclesPerSec).toFixed(3) + " / sec) defense exp
" + @@ -587,8 +590,8 @@ PlayerObject.prototype.workForFaction = function(numCycles) { this.workAgiExpGained.toFixed(3) + " (" + (this.workAgiExpGainRate * cyclesPerSec).toFixed(3) + " / sec) agility exp

" + this.workChaExpGained.toFixed(3) + " (" + (this.workChaExpGainRate * cyclesPerSec).toFixed(3) + " / sec) charisma exp

" + - "You will automatically finish after working for 8 hours. You can cancel earlier if you wish.
" + - "There is no penalty for cancelling earlier"; + "You will automatically finish after working for 20 hours. You can cancel earlier if you wish.
" + + "There is no penalty for cancelling earlier."; } @@ -663,10 +666,11 @@ PlayerObject.prototype.getFactionFieldWorkRepGain = function() { } /* Creating a Program */ -PlayerObject.prototype.startCreateProgramWork = function(programName) { +PlayerObject.prototype.startCreateProgramWork = function(programName, time) { this.isWorking = true; this.timeWorked = 0; + this.timeNeededToCompleteWork = time; this.currentWorkFactionName = ""; this.currentWorkFactionDescription = ""; @@ -691,18 +695,14 @@ PlayerObject.prototype.createProgramWork = function(numCycles) { this.timeWorked += Engine._idleSpeed * numCycles; var programName = this.createProgramName; - //If timeWorked == 10 hours, then finish - //Creating a program will take a flat 10 hours for now. We can make this variable based - //on skill level later - var timeToComplete = 36000000; - if (this.timeWorked >= timeToComplete) { + if (this.timeWorked >= this.timeNeededToCompleteWork) { this.finishCreateProgramWork(false, programName); } var txt = document.getElementById("work-in-progress-text"); txt.innerHTML = "You are currently working on coding " + programName + ".

" + "You have been working for " + convertTimeMsToTimeElapsedString(this.timeWorked) + "

" + - "The program is " + (this.timeWorked / timeToComplete).toFixed(2) + "% complete.
" + + "The program is " + (this.timeWorked / this.timeNeededToCompleteWork * 100).toFixed(2) + "% complete.
" + "If you cancel, you will lose all of your progress."; } diff --git a/src/PurchaseServers.js b/src/PurchaseServers.js index 67caa66ec..7487be172 100644 --- a/src/PurchaseServers.js +++ b/src/PurchaseServers.js @@ -13,17 +13,16 @@ purchaseServer = function(ram, cost) { return; } - //Create server newServ.init(createRandomIp(), hostname, "", true, false, true, true, ram); AddToAllServers(newServ); //Add to Player's purchasedServers array - Player.purchasedServers.push(newServ); + Player.purchasedServers.push(newServ.ip); //Connect new server to home computer var homeComputer = Player.getHomeComputer(); - homeComputer.serversOnNetwork.push(newServ); + homeComputer.serversOnNetwork.push(newServ.ip); Player.money -= cost; diff --git a/src/Terminal.js b/src/Terminal.js index 6a59a4777..7898d84c6 100644 --- a/src/Terminal.js +++ b/src/Terminal.js @@ -493,12 +493,13 @@ var Terminal = { //Contains the implementations of all possible programs executeProgram: function(programName) { switch (programName) { + var s = Player.getCurrentServer(); case Programs.NukeProgram: - if (Player.getCurrentServer().hasAdminRights) { + if (s.hasAdminRights) { post("You already have root access to this computer. There is no reason to run NUKE.exe"); } else { - if (Player.getCurrentServer().openPortCount >= Player.getCurrentServer().numOpenPortsRequired) { - Player.getCurrentServer().hasAdminRights = true; + if (s.openPortCount >= Player.getCurrentServer().numOpenPortsRequired) { + s.hasAdminRights = true; post("NUKE successful! Gained root access to " + Player.getCurrentServer().hostname); //TODO Make this take time rather than be instant } else { @@ -506,6 +507,61 @@ var Terminal = { } } break; + case Programs.BruteSSHProgram: + if (s.hasAdminRights == false) { + post("Permission denied. You do not have root access to this computer."); + } else if (s.sshPortOpen) { + post("SSH Port (22) is already open!"); + } else { + s.sshPortOpen = true; + post("Opened SSH Port(22)!") + ++s.openPortCount; + } + break; + case Programs.FTPCrackProgram: + if (s.hasAdminRights == false) { + post("Permission denied. You do not have root access to this computer."); + } else if (s.ftpPortOpen) { + post("FTP Port (21) is already open!"); + } else { + s.ftpPortOpen = true; + post("Opened FTP Port (21)!"); + ++s.openPortCount; + } + break; + case Programs.RelaySMTPProgram: + if (s.hasAdminRights == false) { + post("Permission denied. You do not have root access to this computer."); + } else if (s.smtpPortOpen) { + post("SMTP Port (25) is already open!"); + } else { + s.smtpPortOpen = true; + post("Opened SMTP Port (25)!"); + ++s.openPortCount; + } + break; + case Programs.HTTPWormProgram: + if (s.hasAdminRights == false) { + post("permission denied. You do not have root access to this computer."); + } else if (s.httpPortOpen) { + post("HTTP Port (80) is already open!"); + } else { + s.httpPortOpen = true; + post("Opened HTTP Port (80)!"); + ++s.openPortCount; + } + break; + case Programs.SQLInjectProgram: + if (s.hasAdminRights == false) { + post("permission denied. You do not have root access to this computer."); + } else if (s.sqlPortOpen) { + post("SQL Port (1433) is already open!"); + } else { + s.sqlPortOpen = true; + post("Opened SQL Port (1433)!"); + ++s.openPortCount; + } + break; default: post("Executable not found"); return;