From 56ebfaf2bfe216c8373e56b84c5214643497faa9 Mon Sep 17 00:00:00 2001 From: Daniel Xie Date: Thu, 4 May 2017 20:08:44 -0500 Subject: [PATCH] refactored saving/loading by making it into a class. Tested and debugged prestige mechanic --- css/menupages.css | 18 +++++ index.html | 2 + src/Constants.js | 1 + src/Netscript/Evaluator.js | 6 +- src/Player.js | 15 ++-- src/Prestige.js | 41 ++++++++++ src/SaveObject.js | 59 ++++++++++++++ src/Script.js | 14 ++-- src/Terminal.js | 9 ++- src/engine.js | 134 ++++++------------------------- utils/PurchaseAugmentationBox.js | 4 +- 11 files changed, 173 insertions(+), 130 deletions(-) create mode 100644 src/SaveObject.js diff --git a/css/menupages.css b/css/menupages.css index 4a2d29212..de547aef3 100644 --- a/css/menupages.css +++ b/css/menupages.css @@ -104,6 +104,11 @@ overflow-y: scroll; } +.active-scripts-list > li { + margin: 6px; + width: 80%; +} + .active-scripts-list>li h2{ color: #66ff33; padding-top: 10px; @@ -290,6 +295,19 @@ color: #66ff33; } +#augmentations-list > li { + margin: 6px; + width: 80%; +} + +#augmentations-list > li h2{ + color: #66ff33; + padding-top: 10px; + padding-left: 10px; + background-color: #333; + text-decoration: none; +} + .installed-augmentation { /* TODO */ } diff --git a/index.html b/index.html index 0864e9d5e..b6c1ad9f6 100644 --- a/index.html +++ b/index.html @@ -51,6 +51,8 @@ + + diff --git a/src/Constants.js b/src/Constants.js index 86f29a9f7..34161cee4 100644 --- a/src/Constants.js +++ b/src/Constants.js @@ -93,6 +93,7 @@ CONSTANTS = { "free Check the machine's memory (RAM) usage
" + "hack Hack the current machine
" + "help Display this help text
" + + "home Connect to home computer
" + "hostname Displays the hostname of the machine
" + "ifconfig Displays the IP address of the machine
" + "kill [script name] Stops a script that is running on the current machine
" + diff --git a/src/Netscript/Evaluator.js b/src/Netscript/Evaluator.js index f1e26d7ba..1761cb887 100644 --- a/src/Netscript/Evaluator.js +++ b/src/Netscript/Evaluator.js @@ -582,7 +582,7 @@ function isScriptErrorMessage(msg) { //The same as Player's calculateHackingChance() function but takes in the server as an argument function scriptCalculateHackingChance(server) { var difficultyMult = (100 - server.hackDifficulty) / 100; - var skillMult = (Player.hacking_chance_mult * Player.hacking_skill); + var skillMult = (2 * Player.hacking_chance_mult * Player.hacking_skill); var skillChance = (skillMult - server.requiredHackingSkill) / skillMult; var chance = skillChance * difficultyMult; if (chance < 0) {return 0;} @@ -593,7 +593,7 @@ function scriptCalculateHackingChance(server) { function scriptCalculateHackingTime(server) { var difficultyMult = server.requiredHackingSkill * server.hackDifficulty; var skillFactor = (2.5 * difficultyMult + 500) / (Player.hacking_skill + 50); - var hackingTime = skillFactor * Player.hacking_speed_mult; //This is in seconds + var hackingTime = skillFactor * Player.hacking_speed_mult * 5; //This is in seconds return hackingTime; } @@ -606,7 +606,7 @@ function scriptCalculateExpGain(server) { function scriptCalculatePercentMoneyHacked(server) { var difficultyMult = (100 - server.hackDifficulty) / 100; var skillMult = (Player.hacking_skill - (server.requiredHackingSkill - 1)) / Player.hacking_skill; - var percentMoneyHacked = difficultyMult * skillMult * Player.hacking_money_mult; + var percentMoneyHacked = difficultyMult * skillMult * Player.hacking_money_mult / 1000; if (percentMoneyHacked < 0) {return 0;} if (percentMoneyHacked > 1) {return 1;} return percentMoneyHacked; diff --git a/src/Player.js b/src/Player.js index b54bd00e4..36f8f9eb4 100644 --- a/src/Player.js +++ b/src/Player.js @@ -14,10 +14,9 @@ function PlayerObject() { //Intelligence, perhaps? //Hacking multipliers - this.hacking_chance_mult = 2; //Increase through ascensions/augmentations - this.hacking_speed_mult = 5; //Decrease through ascensions/augmentations - //this.hacking_speed_mult = 1; //Make it faster for debugging - this.hacking_money_mult = .001; //Increase through ascensions/augmentations. Can't go above 1 + this.hacking_chance_mult = 1; //Increase through ascensions/augmentations + this.hacking_speed_mult = 1; //Decrease through ascensions/augmentations + this.hacking_money_mult = 1; //Increase through ascensions/augmentations. Can't go above 1 //Note: "Lifetime" refers to current ascension, "total" refers to the entire game history //Accumulative stats and skills @@ -101,7 +100,7 @@ function PlayerObject() { this.numTimesDealtDrugsLifetime = 0; this.numTimesTraffickArms = 0; this.numTimesTraffickArmsTotal = 0; - this.numTimesTrafficksArmsLifetime = 0; + this.numTimesTraffickArmsLifetime = 0; this.numPeopleKilled = 0; this.numPeopleKilledTotal = 0; this.numPeopleKilledLifetime = 0; @@ -207,7 +206,7 @@ PlayerObject.prototype.updateSkillLevels = function() { // (hacking_chance_multiplier * hacking_skill) 100 PlayerObject.prototype.calculateHackingChance = function() { var difficultyMult = (100 - this.getCurrentServer().hackDifficulty) / 100; - var skillMult = (this.hacking_chance_mult * this.hacking_skill); + var skillMult = (2 * this.hacking_chance_mult * this.hacking_skill); var skillChance = (skillMult - this.getCurrentServer().requiredHackingSkill) / skillMult; var chance = skillChance * difficultyMult; if (chance < 0) {return 0;} @@ -222,7 +221,7 @@ PlayerObject.prototype.calculateHackingChance = function() { PlayerObject.prototype.calculateHackingTime = function() { var difficultyMult = this.getCurrentServer().requiredHackingSkill * this.getCurrentServer().hackDifficulty; var skillFactor = (2.5 * difficultyMult + 200) / (this.hacking_skill + 100); - return skillFactor * this.hacking_speed_mult; + return skillFactor * this.hacking_speed_mult * 5; } //Calculates the PERCENTAGE of a server's money that the player will hack from the server if successful @@ -233,7 +232,7 @@ PlayerObject.prototype.calculateHackingTime = function() { PlayerObject.prototype.calculatePercentMoneyHacked = function() { var difficultyMult = (100 - this.getCurrentServer().hackDifficulty) / 100; var skillMult = (this.hacking_skill - (this.getCurrentServer().requiredHackingSkill - 1)) / this.hacking_skill; - var percentMoneyHacked = difficultyMult * skillMult * this.hacking_money_mult; + var percentMoneyHacked = difficultyMult * skillMult * this.hacking_money_mult / 1000; console.log("Percent money hacked calculated to be: " + percentMoneyHacked); if (percentMoneyHacked < 0) {return 0;} if (percentMoneyHacked > 1) {return 1;} diff --git a/src/Prestige.js b/src/Prestige.js index 11fe3854f..7b56d2e12 100644 --- a/src/Prestige.js +++ b/src/Prestige.js @@ -2,6 +2,7 @@ //Prestige by purchasing augmentation function prestigeAugmentation() { + //Sum up lifetime/total statistics Player.total_hacking += Player.hacking_skill; Player.lifetime_hacking += Player.hacking_skill; Player.total_strength += Player.strength; @@ -15,6 +16,27 @@ function prestigeAugmentation() { Player.total_charisma += Player.charisma; Player.lifetime_charisma += Player.charisma; + //Crime statistics + Player.numTimesShopliftedTotal += Player.numTimesShoplifted; + Player.numTimesShopliftedLifetime += Player.numTimesShoplifted; + Player.numTimesShoplifted = 0; + Player.numPeopleMuggedTotal += Player.numPeopleMugged; + Player.numPeopleMuggedLifetime += Player.numPeopleMugged; + Player.numPeopleMugged = 0; + Player.numTimesDealtDrugsTotal += Player.numTimesDealtDrugs; + Player.numTimesDealtDrugsLifetime += Player.numTimesDealtDrugs; + Player.numTimesDealtDrugs = 0; + Player.numTimesTraffickArmsTotal += Player.numTimesTraffickArms; + Player.numTimesTraffickArmsLifetime += Player.numTimesTraffickArms; + Player.numTimesTraffickArms = 0; + Player.numPeopleKilledTotal += Player.numPeopleKilled; + Player.numPeopleKilledLifetime += Player.numPeopleKilled; + Player.numPeopleKilled = 0; + Player.numTimesKidnappedTotal += Player.numTimesKidnapped; + Player.numTimesKidnappedLifetime += Player.numTimesKidnapped; + Player.numTimesKidnapped = 0; + + //Reset stats Player.hacking_skill = 1; Player.strength = 1; @@ -53,6 +75,9 @@ function prestigeAugmentation() { Player.isWorking = false; Player.currentWorkFactionName = ""; Player.currentWorkFactionDescription = ""; + this.createProgramName = ""; + this.className = ""; + this.crimeType = ""; Player.workHackExpGainRate = 0; Player.workStrExpGainRate = 0; @@ -82,6 +107,20 @@ function prestigeAugmentation() { } AllServers = {}; + //Delete all running scripts objects + for (var i = 0; i < workerScripts.length; ++i) { + workerScripts[i].env.stopFlag = true; + } + //Delete active scripts display elements + var list = Engine.ActiveScriptsList.querySelectorAll('#active-scripts-list li'); + for (var i = list.length-1; i >= 0; --i) { + Engine.deleteActiveScriptsItem(i); + } + workerScripts.length = 0; + + //Delete Hacknet Nodes + Player.hacknetNodes.length = 0; + //Delete Special Server IPs for (var member in SpecialServerIps) { delete SpecialServerIps[member]; @@ -107,4 +146,6 @@ function prestigeAugmentation() { initCompanies(); initFactions(); CompanyPositions.init(); + + Engine.loadTerminalContent(); } \ No newline at end of file diff --git a/src/SaveObject.js b/src/SaveObject.js new file mode 100644 index 000000000..4ff3b9b8e --- /dev/null +++ b/src/SaveObject.js @@ -0,0 +1,59 @@ +/* SaveObject.js + * Defines the object used to save/load games + */ +var saveObject = new BitburnerSaveObject(); + +function BitburnerSaveObject() { + this.PlayerSave = ""; + this.AllServersSave = ""; + this.CompaniesSave = ""; + this.FactionsSave = ""; + this.SpecialServerIpsSave = ""; + this.AugmentationsSave = ""; +} + +BitburnerSaveObject.prototype.saveGame = function() { + this.PlayerSave = JSON.stringify(Player); + this.AllServersSave = JSON.stringify(AllServers); + this.CompaniesSave = JSON.stringify(Companies); + this.FactionsSave = JSON.stringify(Factions); + this.SpecialServerIpsSave = JSON.stringify(SpecialServerIps); + this.AugmentationsSave = JSON.stringify(Augmentations); + + var saveString = JSON.stringify(this); + window.localStorage.setItem("bitburnerSave", saveString); +} + +loadGame = function(saveObj) { + if (!window.localStorage.getItem("bitburnerSave")) { + console.log("No save file to load"); + return false; + } + var saveString = window.localStorage.getItem("bitburnerSave"); + saveObj = JSON.parse(saveString, Reviver); + + Player = JSON.parse(saveObj.PlayerSave, Reviver); + AllServers = JSON.parse(saveObj.AllServersSave, Reviver); + Companies = JSON.parse(saveObj.CompaniesSave, Reviver); + Factions = JSON.parse(saveObj.FactionsSave, Reviver); + SpecialServerIps = JSON.parse(saveObj.SpecialServerIpsSave, Reviver); + Augmentations = JSON.parse(saveObj.AugmentationsSave, Reviver); + return true; +} + +BitburnerSaveObject.prototype.deleteGame = function() { + if (window.localStorage.getItem("bitburnerSave")) { + window.localStorage.removeItem("bitburnerSave"); + } +} + + +BitburnerSaveObject.prototype.toJSON = function() { + return Generic_toJSON("BitburnerSaveObject", this); +} + +BitburnerSaveObject.fromJSON = function(value) { + return Generic_fromJSON(BitburnerSaveObject, value.data); +} + +Reviver.constructors.BitburnerSaveObject = BitburnerSaveObject; \ No newline at end of file diff --git a/src/Script.js b/src/Script.js index 97759bec7..ba7677835 100644 --- a/src/Script.js +++ b/src/Script.js @@ -201,8 +201,8 @@ scriptCalculateOfflineProduction = function(script) { //Calculate the "confidence" rating of the script's true production. This is based //entirely off of time. We will arbitrarily say that if a script has been running for - //120 minutes (7200 sec) then we are completely confident in its ability - var confidence = (script.onlineRunningTime) / 7200; + //4 hours (14400 sec) then we are completely confident in its ability + var confidence = (script.onlineRunningTime) / 14400; if (confidence >= 1) {confidence = 1;} console.log("onlineRunningTime: " + script.onlineRunningTime.toString()); console.log("Confidence: " + confidence.toString()); @@ -214,11 +214,15 @@ scriptCalculateOfflineProduction = function(script) { var expGain = (1/2) * (script.onlineExpGained / script.onlineRunningTime) * timePassed; expGain *= confidence; - //Account for production in Player and server + //Account for production in Player and server) + var server = AllServers[script.server]; + if (production > server.moneyAvailable) { + production = server.moneyAvailable; + } + Player.gainMoney(production); - Player.hacking_exp += expGain; + Player.gainHackingExp(expGain); - var server = AllServers[script.server]; server.moneyAvailable -= production; if (server.moneyAvailable < 0) {server.moneyAvailable = 0;} diff --git a/src/Terminal.js b/src/Terminal.js index 84d3a8bf7..a3351492e 100644 --- a/src/Terminal.js +++ b/src/Terminal.js @@ -113,7 +113,6 @@ $(document).keydown(function(event) { arg = commandArray[1]; } - console.log("arg: " + arg); tabCompletion(commandArray[0], arg, allPos); } } @@ -438,7 +437,13 @@ var Terminal = { post(CONSTANTS.HelpText); break; case "home": - //TODO return to home computer + if (commandArray.length != 1) { + post("Incorrect usage of home command. Usage: home"); return; + } + Player.getCurrentServer().isConnectedTo = false; + Player.currentServer = Player.getHomeComputer().ip; + Player.getCurrentServer().isConnectedTo = true; + post("Connected to home"); break; case "hostname": if (commandArray.length != 1) { diff --git a/src/engine.js b/src/engine.js index b3ec2e5df..5cec9d82b 100644 --- a/src/engine.js +++ b/src/engine.js @@ -1,6 +1,6 @@ var Engine = { Debug: true, - + //Clickable objects Clickables: { //Main menu buttons @@ -85,92 +85,6 @@ var Engine = { _lastUpdate: new Date().getTime(), _idleSpeed: 200, //Speed (in ms) at which the main loop is updated - //Save function - saveGame: function() { - var PlayerSave = JSON.stringify(Player); - var AllServersSave = JSON.stringify(AllServers); - var CompaniesSave = JSON.stringify(Companies); - var FactionsSave = JSON.stringify(Factions); - var SpecialServerIpsSave = JSON.stringify(SpecialServerIps); - var AugmentationsSave = JSON.stringify(Augmentations); - - window.localStorage.setItem("netburnerPlayerSave", PlayerSave); - window.localStorage.setItem("netburnerAllServersSave", AllServersSave); - window.localStorage.setItem("netburnerCompaniesSave", CompaniesSave); - window.localStorage.setItem("netburnerFactionsSave", FactionsSave); - window.localStorage.setItem("netburnerSpecialServerIpsSave", SpecialServerIpsSave); - window.localStorage.setItem("netburnerAugmentationsSave", AugmentationsSave); - - console.log("Game saved to local storage"); - }, - - //Load saved game function - loadSave: function() { - //Check to see if file exists - if (!window.localStorage.getItem("netburnerPlayerSave")) { - console.log("No Player save to load"); - return false; - } else if (!window.localStorage.getItem("netburnerAllServersSave")) { - console.log("No AllServers save to load"); - return false; - } else if (!window.localStorage.getItem("netburnerCompaniesSave")) { - console.log("No Companies save to load"); - return false; - } else if (!window.localStorage.getItem("netburnerFactionsSave")) { - console.log("No Factions save to load"); - return false; - } else if (!window.localStorage.getItem("netburnerSpecialServerIpsSave")) { - console.log("No Special Server Ips save to load"); - return false; - } else if (!window.localStorage.getItem("netburnerAugmentationsSave")) { - console.log("No Augmentations save to load"); - return false; - } else { - var PlayerSave = window.localStorage.getItem("netburnerPlayerSave"); - var AllServersSave = window.localStorage.getItem("netburnerAllServersSave"); - var CompaniesSave = window.localStorage.getItem("netburnerCompaniesSave"); - var FactionsSave = window.localStorage.getItem("netburnerFactionsSave"); - var SpecialServerIpsSave = window.localStorage.getItem("netburnerSpecialServerIpsSave"); - var AugmentationsSave = window.localStorage.getItem("netburnerAugmentationsSave"); - - Player = JSON.parse(PlayerSave, Reviver); - AllServers = JSON.parse(AllServersSave, Reviver); - Companies = JSON.parse(CompaniesSave, Reviver); - Factions = JSON.parse(FactionsSave, Reviver); - SpecialServerIps = JSON.parse(SpecialServerIpsSave, Reviver); - Augmentations = JSON.parse(AugmentationsSave, Reviver); - return true; - } - }, - - //Delete saved game function - deleteSave: function() { - //TODO if a save doesn't exist..maybe I shouldn't return? I just keep going - //or else nothing gets deleted. TODO Fix this - if (window.localStorage.getItem("netburnerPlayerSave")) { - window.localStorage.removeItem("netburnerPlayerSave"); - } - - if (window.localStorage.getItem("netburnerAllServersSave")) { - window.localStorage.removeItem("netburnerAllServersSave"); - } - - if (window.localStorage.getItem("netburnerCompaniesSave")) { - window.localStorage.removeItem("netburnerCompaniesSave"); - } - - if (window.localStorage.getItem("netburnerFactionsSave")) { - window.localStorage.removeItem("netburnerFactionsSave"); - } - - if (window.localStorage.getItem("netburnerSpecialServerIpsSave")) { - window.localStorage.removeItem("netburnerSpecialServerIpsSave"); - } - - if (window.localStorage.getItem("netburnerAugmentationsSave")) { - window.localStorage.removeItem("netburnerAugmentationsSave"); - } - }, /* Load content when a main menu button is clicked */ loadTerminalContent: function() { @@ -312,7 +226,7 @@ var Engine = { companyPosition = Player.companyPosition.positionName; } Engine.Display.characterInfo.innerHTML = - 'General

' + + ('General

' + 'Current City: ' + Player.city + '

' + 'Employer: ' + Player.companyName + '
' + 'Job Title: ' + companyPosition + '

' + @@ -320,43 +234,43 @@ var Engine = { 'Stats

' + 'Hacking Level: ' + (Player.hacking_skill).toLocaleString() + " (" + formatNumber(Player.hacking_exp, 4) + ' experience)
' + - 'Strength: ' + (Player.strength).toLocaleString() + + 'Strength: ' + (Player.strength).toLocaleString() + " (" + formatNumber(Player.strength_exp, 4) + ' experience)
' + - 'Defense: ' + (Player.defense).toLocaleString() + + 'Defense: ' + (Player.defense).toLocaleString() + " (" + formatNumber(Player.defense_exp, 4) + ' experience)
' + - 'Dexterity: ' + (Player.dexterity).toLocaleString() + + 'Dexterity: ' + (Player.dexterity).toLocaleString() + " (" + formatNumber(Player.dexterity_exp, 4) + ' experience)
' + - 'Agility: ' + (Player.agility).toLocaleString() + + 'Agility: ' + (Player.agility).toLocaleString() + " (" + formatNumber(Player.agility_exp, 4) + ' experience)
' + - 'Charisma: ' + (Player.charisma).toLocaleString() + + 'Charisma: ' + (Player.charisma).toLocaleString() + " (" + formatNumber(Player.charisma_exp, 4) + ' experience)


' + 'Multipliers

' + 'Hacking Chance multiplier: ' + formatNumber(Player.hacking_chance_mult * 100, 2) + '%
' + - 'Hacking Speed multiplier: ' + formatNumber(Player.hacking_speed_mult * 100, 2) + '%
' + - 'Hacking money multiplier: ' + formatNumber(Player.hacking_money_mult * 100, 2) + '%

' + - 'Hacking Level multiplier: ' + formatNumber(Player.hacking_mult * 100, 2) + '%
' + + 'Hacking Speed multiplier: ' + formatNumber(Player.hacking_speed_mult * 100, 2) + '%
' + + 'Hacking money multiplier: ' + formatNumber(Player.hacking_money_mult * 100, 2) + '%

' + + 'Hacking Level multiplier: ' + formatNumber(Player.hacking_mult * 100, 2) + '%
' + 'Hacking Experience multiplier: ' + formatNumber(Player.hacking_exp_mult * 100, 2) + '%

' + - 'Strength Level multiplier: ' + formatNumber(Player.strength_mult * 100, 2) + '%
' + + 'Strength Level multiplier: ' + formatNumber(Player.strength_mult * 100, 2) + '%
' + 'Strength Experience multiplier: ' + formatNumber(Player.strength_exp_mult * 100, 2) + '%

' + - 'Defense Level multiplier: ' + formatNumber(Player.defense_mult * 100, 2) + '%
' + + 'Defense Level multiplier: ' + formatNumber(Player.defense_mult * 100, 2) + '%
' + 'Defense Experience multiplier: ' + formatNumber(Player.defense_exp_mult * 100, 2) + '%

' + - 'Dexterity Level multiplier: ' + formatNumber(Player.dexterity_mult * 100, 2) + '%
' + + 'Dexterity Level multiplier: ' + formatNumber(Player.dexterity_mult * 100, 2) + '%
' + 'Dexterity Experience multiplier: ' + formatNumber(Player.dexterity_exp_mult * 100, 2) + '%

' + - 'Agility Level multiplier: ' + formatNumber(Player.agility_mult * 100, 2) + '%
' + + 'Agility Level multiplier: ' + formatNumber(Player.agility_mult * 100, 2) + '%
' + 'Agility Experience multiplier: ' + formatNumber(Player.agility_exp_mult * 100, 2) + '%

' + - 'Charisma Level multiplier: ' + formatNumber(Player.charisma_mult * 100, 2) + '%
' + + 'Charisma Level multiplier: ' + formatNumber(Player.charisma_mult * 100, 2) + '%
' + 'Charisma Experience multiplier: ' + formatNumber(Player.charisma_exp_mult * 100, 2) + '%

' + - 'Hacknet Node production multiplier: ' + formatNumber(Player.hacknet_node_money_mult * 100, 2) + '%
' + - 'Hacknet Node purchase cost multiplier: '+ formatNumber(Player.hacknet_node_purchase_cost_mult * 100, 2) + '%
' + - 'Hacknet Node RAM upgrade cost multiplier: ' + formatNumber(Player.hacknet_node_ram_cost_mult * 100, 2) + '%
' + + 'Hacknet Node production multiplier: ' + formatNumber(Player.hacknet_node_money_mult * 100, 2) + '%
' + + 'Hacknet Node purchase cost multiplier: ' + formatNumber(Player.hacknet_node_purchase_cost_mult * 100, 2) + '%
' + + 'Hacknet Node RAM upgrade cost multiplier: ' + formatNumber(Player.hacknet_node_ram_cost_mult * 100, 2) + '%
' + 'Hacknet Node Core purchase cost multiplier: ' + formatNumber(Player.hacknet_node_core_cost_mult * 100, 2) + '%
' + 'Hacknet Node level upgrade cost multiplier: ' + formatNumber(Player.hacknet_node_level_cost_mult * 100, 2) + '%

' + 'Company reputation gain multiplier: ' + formatNumber(Player.company_rep_mult * 100, 2) + '%
' + 'Faction reputation gain multiplier: ' + formatNumber(Player.faction_rep_mult * 100, 2) + '%
' + 'Salary multiplier: ' + formatNumber(Player.work_money_mult * 100, 2) + '%


' + 'Misc

' + - 'Servers owned: ' + Player.purchasedServers.length + '
' + - 'Hacknet Nodes owned: ' + Player.hacknetNodes.length + '
'; + 'Servers owned: ' + Player.purchasedServers.length + '
' + + 'Hacknet Nodes owned: ' + Player.hacknetNodes.length + '
').replace( / /g, " " ); }, @@ -660,7 +574,7 @@ var Engine = { //is necessary and then resets the counter checkCounters: function() { if (Engine.Counters.autoSaveCounter <= 0) { - Engine.saveGame(); + saveObject.saveGame(); Engine.Counters.autoSaveCounter = 300; } @@ -806,13 +720,13 @@ var Engine = { Engine.Clickables.saveMainMenuButton = document.getElementById("save-game-link"); Engine.Clickables.saveMainMenuButton.addEventListener("click", function() { - Engine.saveGame(); + saveObject.saveGame(); return false; }); Engine.Clickables.deleteMainMenuButton = document.getElementById("delete-game-link"); Engine.Clickables.deleteMainMenuButton.addEventListener("click", function() { - Engine.deleteSave(); + saveObject.deleteGame(); return false; }); @@ -927,7 +841,7 @@ var Engine = { Engine.Display.scriptEditorText = document.getElementById("script-editor-text"); //Load game from save or create new game - if (Engine.loadSave()) { + if (loadGame(saveObject)) { console.log("Loaded game from save"); CompanyPositions.init(); diff --git a/utils/PurchaseAugmentationBox.js b/utils/PurchaseAugmentationBox.js index 5b4dd3534..95769c896 100644 --- a/utils/PurchaseAugmentationBox.js +++ b/utils/PurchaseAugmentationBox.js @@ -138,8 +138,8 @@ purchaseAugmentationBoxCreate = function(aug, fac) { } else if (Player.money >= (aug.baseCost * fac.augmentationPriceMult)) { applyAugmentation(aug, fac); //TODO Make this text better - dialogBoxCreate("You slowly drift to sleep as " + fac.name + "'s scientists put you under
" + - " in order to install the " + aug.name + " Augmentation.
br>" + + dialogBoxCreate("You slowly drift to sleep as " + fac.name + "'s scientists put you under " + + " in order to install the " + aug.name + " Augmentation.

" + "You wake up in your home...you feel different..."); prestigeAugmentation();