From 0d6890a5653bf4859a3119e7c2b3ecb2b31afe39 Mon Sep 17 00:00:00 2001 From: Daniel Xie Date: Thu, 13 Apr 2017 15:21:03 -0500 Subject: [PATCH] Added ability to purchase Tor router to access the dark web. Still need to implement functionality for this dark web --- README.md | 6 +++++- index.html | 1 + src/Constants.js | 3 +++ src/Location.js | 35 +++++++++++++++++++++++++++++++++++ src/Player.js | 6 ++++++ src/engine.js | 8 +++++++- 6 files changed, 57 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index f7997dca1..c8761c049 100644 --- a/README.md +++ b/README.md @@ -55,6 +55,8 @@ TESTING TODO: Augmentations + rm command seems to work + Make it so that a script cannot be edited if it is running + Traveling @@ -65,12 +67,14 @@ TESTING TODO: Seems to work fine Tasks TODO: + Augmentations that decrease time to make programs + New server hostname in Purchase Server Pop-up Box needs limits..don't think the ones set in HTML work Tutorial and help - INTERACTIVE TUTORIAL Secret Servers - Hack time formula needs rebalancing I think, so does hack exp + Hack time formula needs rebalancing I think, so does hack exp formula Create new menu page for purchased servers diff --git a/index.html b/index.html index 533f944ce..f16ae2bae 100644 --- a/index.html +++ b/index.html @@ -466,6 +466,7 @@ Purchase 256GB Server - $100,000,000 Purchase 512GB Server - $250,000,000 Purchase 1TB Server - $600,000,000 + Purchase TOR Router - $2,000,000

diff --git a/src/Constants.js b/src/Constants.js index 6723298b7..a6546af87 100644 --- a/src/Constants.js +++ b/src/Constants.js @@ -16,6 +16,9 @@ CONSTANTS = { //Maximum number of log entries for a script MaxLogCapacity: 20, + //How much a TOR router costs + TorRouterCost: 2000000, + //Text that is displayed when the 'help' command is ran in Terminal HelpText: "analyze Get statistics and information about current machine
" + "clear Clear all text on the terminal
" + diff --git a/src/Location.js b/src/Location.js index 9e66886eb..435dc831d 100644 --- a/src/Location.js +++ b/src/Location.js @@ -115,6 +115,7 @@ displayLocationContent = function() { var purchase256gb = document.getElementById("location-purchase-256gb"); var purchase512gb = document.getElementById("location-purchase-512gb"); var purchase1tb = document.getElementById("location-purchase-1tb"); + var purchaseTor = document.getElementById("location-purchase-tor"); var travelAgencyText = document.getElementById("location-travel-agency-text"); var travelToAevum = document.getElementById("location-travel-to-aevum"); @@ -173,6 +174,7 @@ displayLocationContent = function() { purchase256gb.style.display = "none"; purchase512gb.style.display = "none"; purchase1tb.style.display = "none"; + purchaseTor.style.display = "none"; travelAgencyText.style.display = "none"; travelToAevum.style.display = "none"; @@ -245,6 +247,7 @@ displayLocationContent = function() { purchase256gb.style.display = "block"; purchase512gb.style.display = "block"; purchase1tb.style.display = "block"; + purchaseTor.style.display = "block"; break; case Locations.AevumBachmanAndAssociates: @@ -282,6 +285,7 @@ displayLocationContent = function() { purchase256gb.style.display = "block"; purchase512gb.style.display = "block"; purchase1tb.style.display = "block"; + purchaseTor.style.display = "block"; break; case Locations.AevumAeroCorp: @@ -342,6 +346,7 @@ displayLocationContent = function() { purchase2gb.style.display = "block"; purchase4gb.style.display = "block"; purchase8gb.style.display = "block"; + purchaseTor.style.display = "block"; break; case Locations.AevumCrushFitnessGym: @@ -493,6 +498,7 @@ displayLocationContent = function() { purchase1gb.style.display = "block"; purchase2gb.style.display = "block"; purchase4gb.style.display = "block"; + purchaseTor.style.display = "block"; break; case Locations.Sector12CarmichaelSecurity: @@ -628,6 +634,7 @@ displayLocationContent = function() { purchase8gb.style.display = "block"; purchase16gb.style.display = "block"; purchase32gb.style.display = "block"; + purchaseTor.style.display = "block"; break; case Locations.VolhavenTravelAgency: @@ -721,6 +728,7 @@ displayLocationContent = function() { purchase64gb.style.display = "block"; purchase128gb.style.display = "block"; purchase256gb.style.display = "block"; + purchaseTor.style.display = "block"; break; @@ -1123,6 +1131,7 @@ initLocationButtons = function() { var purchase256gb = document.getElementById("location-purchase-256gb"); var purchase512gb = document.getElementById("location-purchase-512gb"); var purchase1tb = document.getElementById("location-purchase-1tb"); + var purchaseTor = document.getElementById("location-purchase-tor"); var travelToAevum = document.getElementById("location-travel-to-aevum"); var travelToChongqing = document.getElementById("location-travel-to-chongqing"); @@ -1231,28 +1240,39 @@ initLocationButtons = function() { return false; }); + purchaseTor.addEventListener("click", function() { + purchaseTor(); + return false; + } + travelToAevum.addEventListener("click", function() { travelBoxCreate(Locations.Aevum, 1000000); + return false; }); travelToChongqing.addEventListener("click", function() { travelBoxCreate(Locations.Chongqing, 1000000); + return false; }); travelToSector12.addEventListener("click", function() { travelBoxCreate(Locations.Sector12, 1000000); + return false; }); travelToNewTokyo.addEventListener("click", function() { travelBoxCreate(Locations.NewTokyo, 1000000); + return false; }); travelToIshima.addEventListener("click", function() { travelBoxCreate(Locations.Ishima, 1000000); + return false; }); travelToVolhaven.addEventListener("click", function() { travelBoxCreate(Locations.Volhaven, 1000000); + return false; }); } @@ -1267,4 +1287,19 @@ travelToCity = function(destCityName, cost) { Player.city = destCityName; dialogBoxCreate("You are now in " + destCityName + "!"); Engine.loadWorldContent(); +} + +purchaseTor = function() { + if (CONSTANTS.TorRouterCost > Player.money) { + dialogBoxCreate("You cannot afford to purchase the Tor router"); + return; + } + Player.money -= CONSTANTS.TorRouterCost; + + var darkweb = new Server(); + darkweb.init(createRandomIp(), "darkweb", "", true, false, false, false, 1); + AddToAllServers(darkweb); + + Player.getHomeComputer().serversOnNetwork.push(darkweb.ip); + dialogBoxCreate("You have purchased a Tor router!", "You now have access to the dark web from your home computer", "Use the scan/netstat commands to search for the dark web connect.", ""); } \ No newline at end of file diff --git a/src/Player.js b/src/Player.js index bb069f45d..7fa128580 100644 --- a/src/Player.js +++ b/src/Player.js @@ -297,6 +297,9 @@ PlayerObject.prototype.finishWork = function(cancelled) { PlayerObject.prototype.startWork = function() { this.isWorking = true; + this.currentWorkFactionName = ""; + this.currentWorkFactionDescription = ""; + this.createProgramName = ""; this.workHackExpGainRate = this.getWorkHackExpGain(); this.workStrExpGainRate = this.getWorkStrExpGain(); @@ -420,6 +423,7 @@ PlayerObject.prototype.finishFactionWork = function(cancelled, faction) { PlayerObject.prototype.startFactionWork = function(faction) { this.isWorking = true; this.currentWorkFactionName = faction.name; + this.createProgramName = ""; this.workHackExpGained = 0; this.workStrExpGained = 0; @@ -616,6 +620,8 @@ PlayerObject.prototype.startCreateProgramWork = function(programName) { this.timeWorked = 0; + this.currentWorkFactionName = ""; + this.currentWorkFactionDescription = ""; this.createProgramName = programName; var cancelButton = document.getElementById("work-in-progress-cancel-button"); diff --git a/src/engine.js b/src/engine.js index c73c5d0ed..b3234ea8f 100644 --- a/src/engine.js +++ b/src/engine.js @@ -556,7 +556,13 @@ var Engine = { } if (Player.isWorking) { - Player.work(numCycles); + if (Player.currentWorkFactionName != "") { + Player.workForFaction(numCycles); + } else if (Player.createProgramName != "") { + Player.createProgramWork(numCycles); + } else { + Player.work(numCycles); + } } //Counters