mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-11-18 21:53:50 +01:00
Fixed bugs with new multiple Augmentations feature. Added getServerMaxMoney() netscript command
This commit is contained in:
parent
aba6936295
commit
6712d340fb
@ -511,13 +511,16 @@ div.faction-clear {
|
||||
overflow-y: scroll;
|
||||
}
|
||||
|
||||
#augmentations-list li {
|
||||
#augmentations-list li,
|
||||
#queued-augmentations-list li {
|
||||
width: 70%;
|
||||
background-color: #333;
|
||||
}
|
||||
|
||||
#augmentations-list h2,
|
||||
#augmentations-list p {
|
||||
#augmentations-list p,
|
||||
#queued-augmentations-list h2,
|
||||
#queued-augmentations-list p {
|
||||
margin: 4px;
|
||||
color: var(--my-font-color);
|
||||
padding: 8px;
|
||||
|
@ -240,6 +240,7 @@ tr:focus {
|
||||
margin-right: 14px;
|
||||
background-color: transparent;
|
||||
z-index: 2;
|
||||
width: auto;
|
||||
}
|
||||
|
||||
/* Character Overview */
|
||||
|
@ -18,6 +18,11 @@
|
||||
background-color: var(--my-background-color);
|
||||
}
|
||||
|
||||
/*
|
||||
.posted {
|
||||
width: 70%;
|
||||
}*/
|
||||
|
||||
#terminal-input {
|
||||
background-color: var(--my-background-color);
|
||||
color: var(--my-font-color);
|
||||
|
36
index.html
36
index.html
@ -548,10 +548,29 @@
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<!-- Installed augmentations -->
|
||||
<!-- Augmentations -->
|
||||
<div id="augmentations-container">
|
||||
<h1> Augmentations </h1>
|
||||
<p> Lists all augmentations you have installed </p>
|
||||
<h1> Purchased Augmentations </h1>
|
||||
<p style="width:70%;">
|
||||
Below is a list of all Augmentations you have purchased but not yet installed. Click the button below to install them.
|
||||
<br>WARNING: Purchasing an Augmentation resets most of your progress, including: <br><br>
|
||||
Stats/Skill levels and Experience <br>
|
||||
Money <br>
|
||||
Scripts on every computer but your home computer<br>
|
||||
Purchased servers <br>
|
||||
Hacknet Nodes <br>
|
||||
Faction/Company reputation <br><br>
|
||||
Purchasing an Augmentation lets you start over with the perks and benefits granted by all
|
||||
of the Augmentations you have ever purchased. Also, you will keep any scripts and RAM upgrades
|
||||
on your home computer (but you will lose all programs besides NUKE.exe).
|
||||
</p>
|
||||
<br><br>
|
||||
<ul id="queued-augmentations-list"></ul>
|
||||
<br>
|
||||
<a id="install-augmentations-button" class="a-link-button"> Install Augmentations </a>
|
||||
<br><br>
|
||||
<h1> Installed Augmentations </h1>
|
||||
<p style="width:70%;"> List of all augmentations that have been installed. You have gained the effects of these augmentations </p>
|
||||
<ul id="augmentations-list">
|
||||
</ul>
|
||||
</div>
|
||||
@ -703,17 +722,6 @@
|
||||
<h2 id="purchase-augmentation-box-aug-name"> </h2>
|
||||
<p id="purchase-augmentation-box-aug-info"> </p>
|
||||
<p id="purchase-augmentation-box-text"> </p>
|
||||
<p> <br> WARNING: Purchasing an Augmentation resets most of your progress, including: <br><br>
|
||||
Stats/Skill levels and Experience <br>
|
||||
Money <br>
|
||||
Scripts on every computer but your home computer<br>
|
||||
Purchased servers <br>
|
||||
Hacknet Nodes <br>
|
||||
Faction/Company reputation <br><br>
|
||||
Purchasing an Augmentation lets you start over with the perks and benefits granted by all
|
||||
of the Augmentations you have ever purchased. Also, you will keep any scripts and RAM upgrades
|
||||
on your home computer (but you will lose all programs besides NUKE.exe).
|
||||
</p>
|
||||
<span id="purchase-augmentation-box-confirm"> Purchase </span>
|
||||
<span id="purchase-augmentation-box-cancel"> Cancel </span>
|
||||
</div>
|
||||
|
@ -2,6 +2,7 @@
|
||||
function Augmentation(name) {
|
||||
this.name = name;
|
||||
this.info = "";
|
||||
this.owned = false;
|
||||
|
||||
//Price and reputation base requirements (can change based on faction multipliers)
|
||||
this.baseRepRequirement = 0;
|
||||
@ -152,6 +153,11 @@ AugmentationNames = {
|
||||
}
|
||||
|
||||
initAugmentations = function() {
|
||||
for (var name in Factions) {
|
||||
if (Factions.hasOwnProperty(name)) {
|
||||
Factions[name].augmentations = [];
|
||||
}
|
||||
}
|
||||
//Combat stat augmentations
|
||||
var HemoRecirculator = new Augmentation(AugmentationNames.HemoRecirculator);
|
||||
HemoRecirculator.setInfo("A heart implant that greatly increases the body's ability to effectively use and pump " +
|
||||
@ -819,7 +825,7 @@ initAugmentations = function() {
|
||||
"for the Hacknet Node that provides better performance.<br><br>" +
|
||||
"This augmentation:<br>" +
|
||||
"Increases the amount of money produced by Hacknet Nodes by 15%<br>" +
|
||||
"Decreases the cost of purchasing a Hacknet Node Core by 15%");
|
||||
"Decreases the cost of purchasing a Hacknet Node by 15%");
|
||||
HacknetNodeCPUUpload.addToFactions(["Netburners"]);
|
||||
if (augmentationExists(AugmentationNames.HacknetNodeCPUUpload)) {
|
||||
delete Augmentations[AugmentationNames.HacknetNodeCPUUpload];
|
||||
@ -881,13 +887,16 @@ initAugmentations = function() {
|
||||
//Misc/Hybrid augmentations
|
||||
var NeuroFluxGovernor = new Augmentation(AugmentationNames.NeuroFluxGovernor);
|
||||
if (augmentationExists(AugmentationNames.NeuroFluxGovernor)) {
|
||||
var oldAug = Augmentations[AugmentationNames.NeuroFluxGovernor];
|
||||
NeuroFluxGovernor.level = oldAug.level;
|
||||
var nextLevel = getNextNeurofluxLevel();
|
||||
NeuroFluxGovernor.level = nextLevel - 1;
|
||||
mult = Math.pow(CONSTANTS.NeuroFluxGovernorLevelMult, NeuroFluxGovernor.level);
|
||||
NeuroFluxGovernor.setRequirements(500 * mult, 750000 * mult);
|
||||
delete Augmentations[AugmentationNames.NeuroFluxGovernor];
|
||||
} else {
|
||||
NeuroFluxGovernor.setRequirements(250, 500000);
|
||||
var nextLevel = getNextNeurofluxLevel();
|
||||
NeuroFluxGovernor.level = nextLevel - 1;
|
||||
mult = Math.pow(CONSTANTS.NeuroFluxGovernorLevelMult, NeuroFluxGovernor.level);
|
||||
NeuroFluxGovernor.setRequirements(500 * mult, 750000 * mult);
|
||||
}
|
||||
NeuroFluxGovernor.setInfo("A device that is embedded in the back of the neck. The NeuroFlux Governor " +
|
||||
"monitors and regulates nervous impulses coming to and from the spinal column, " +
|
||||
@ -1362,9 +1371,18 @@ initAugmentations = function() {
|
||||
delete Augmentations[AugmentationNames.SNA];
|
||||
}
|
||||
AddToAugmentations(SNA);
|
||||
|
||||
//Update costs based on how many have been purchased
|
||||
var mult = Math.pow(1.5, Player.queuedAugmentations.length);
|
||||
for (var name in Augmentations) {
|
||||
if (Augmentations.hasOwnProperty(name)) {
|
||||
Augmentations[name].baseCost *= mult;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
applyAugmentation = function(aug, reapply=false) {
|
||||
Augmentations[aug.name].owned = true;
|
||||
switch(aug.name) {
|
||||
//Combat stat augmentations
|
||||
case AugmentationNames.Targeting1:
|
||||
@ -1634,7 +1652,13 @@ applyAugmentation = function(aug, reapply=false) {
|
||||
Player.work_money_mult *= 1.01;
|
||||
|
||||
if (!reapply) {
|
||||
++aug.level;
|
||||
Augmentations[aug.name].level = aug.level;
|
||||
for (var i = 0; i < Player.augmentations.length; ++i) {
|
||||
if (Player.augmentations[i].name == AugmentationNames.NeuroFluxGovernor) {
|
||||
Player.augmentations[i].level = aug.level;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case AugmentationNames.Neurotrainer1: //Low Level
|
||||
@ -1834,7 +1858,7 @@ applyAugmentation = function(aug, reapply=false) {
|
||||
}
|
||||
|
||||
if (aug.name == AugmentationNames.NeuroFluxGovernor) {
|
||||
for (var i = 0; i > Player.augmentations.length; ++i) {
|
||||
for (var i = 0; i < Player.augmentations.length; ++i) {
|
||||
if (Player.augmentations[i].name == AugmentationNames.NeuroFluxGovernor) {
|
||||
//Already have this aug, just upgrade the level
|
||||
return;
|
||||
@ -1853,6 +1877,28 @@ function PlayerOwnedAugmentation(name) {
|
||||
this.level = 1;
|
||||
}
|
||||
|
||||
function installAugmentations() {
|
||||
if (Player.queuedAugmentations.length == 0) {
|
||||
dialogBoxCreate("You have not purchased any Augmentations to install!");
|
||||
return;
|
||||
}
|
||||
var augmentationList = "";
|
||||
for (var i = 0; i < Player.queuedAugmentations.length; ++i) {
|
||||
var aug = Augmentations[Player.queuedAugmentations[i].name];
|
||||
if (aug == null) {
|
||||
console.log("ERROR. Invalid augmentation");
|
||||
continue;
|
||||
}
|
||||
applyAugmentation(Player.queuedAugmentations[i]);
|
||||
augmentationList += (aug.name + "<br>");
|
||||
}
|
||||
Player.queuedAugmentations = [];
|
||||
dialogBoxCreate("You slowly drift to sleep as scientists put you under in order " +
|
||||
"to install the following Augmentations:<br>" + augmentationList +
|
||||
"<br>You wake up in your home...you feel different...");
|
||||
prestigeAugmentation();
|
||||
}
|
||||
|
||||
PlayerObject.prototype.reapplyAllAugmentations = function() {
|
||||
console.log("Re-applying augmentations");
|
||||
//Reset multipliers
|
||||
@ -1901,17 +1947,18 @@ PlayerObject.prototype.reapplyAllAugmentations = function() {
|
||||
|
||||
var augName = this.augmentations[i].name;
|
||||
var aug = Augmentations[augName];
|
||||
aug.owned = true;
|
||||
if (aug == null) {
|
||||
console.log("WARNING: Invalid augmentation name");
|
||||
continue;
|
||||
}
|
||||
if (aug.name == AugmentationNames.NeuroFluxGovernor) {
|
||||
for (j = 0; j < aug.level; ++j) {
|
||||
applyAugmentation(aug, true);
|
||||
applyAugmentation(this.augmentations[i], true);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
applyAugmentation(aug, true);
|
||||
applyAugmentation(this.augmentations[i], true);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
CONSTANTS = {
|
||||
Version: "0.22.1",
|
||||
Version: "0.23.0.BETA",
|
||||
|
||||
//Max level for any skill, assuming no multipliers. Determined by max numerical value in javascript for experience
|
||||
//and the skill level formula in Player.js. Note that all this means it that when experience hits MAX_INT, then
|
||||
@ -29,8 +29,8 @@ CONSTANTS = {
|
||||
HacknetNodeMaxCores: 16,
|
||||
|
||||
/* Faction and Company favor */
|
||||
FactionReputationToFavor: 7500,
|
||||
CompanyReputationToFavor: 5000,
|
||||
FactionReputationToFavor: 6000,
|
||||
CompanyReputationToFavor: 4500,
|
||||
|
||||
/* Augmentation */
|
||||
//NeuroFlux Governor cost multiplier as you level up
|
||||
@ -655,6 +655,13 @@ CONSTANTS = {
|
||||
"RAM Upgrades on your home computer",
|
||||
|
||||
Changelog:
|
||||
"v0.23.0<br>" +
|
||||
"-You can now purchase multiple Augmentations in a run. When you purchase an Augmentation you will lose money equal to the price " +
|
||||
"and then the cost of purchasing another Augmentation during this run will be increased by 50%. You do not gain the benefits " +
|
||||
"of your purchased Augmentations until you install them. This installation can be done through the 'Augmentation' tab. When " +
|
||||
"you install your Augmentations, your game will reset like before. <br>" +
|
||||
"-Reputation needed to gain a favor from faction decreased from 7500 to 6000<br>" +
|
||||
"-Reputation needed to gain a favor from company decreased from 5000 to 4500<br>" +
|
||||
"v0.22.1<br>" +
|
||||
"-You no longer lose progress on creating programs when cancelling your work. Your progress will be saved and you will pick up " +
|
||||
"where you left off when you start working on it again<br>" +
|
||||
|
@ -97,9 +97,9 @@ function determineCrimeChanceShoplift() {
|
||||
}
|
||||
|
||||
function determineCrimeChanceMug() {
|
||||
var chance = ((2 *Player.strength / CONSTANTS.MaxSkillLevel +
|
||||
var chance = ((1.5 *Player.strength / CONSTANTS.MaxSkillLevel +
|
||||
0.5 * Player.defense / CONSTANTS.MaxSkillLevel +
|
||||
2 * Player.dexterity / CONSTANTS.MaxSkillLevel +
|
||||
1.5 * Player.dexterity / CONSTANTS.MaxSkillLevel +
|
||||
0.5 * Player.agility / CONSTANTS.MaxSkillLevel)) * 5;
|
||||
chance *= Player.crime_success_mult;
|
||||
return Math.min(chance, 1);
|
||||
|
@ -972,6 +972,16 @@ displayFactionAugmentations = function(factionName) {
|
||||
for (var i = 0; i < faction.augmentations.length; ++i) {
|
||||
(function () {
|
||||
var aug = Augmentations[faction.augmentations[i]];
|
||||
if (aug == null) {
|
||||
console.log("ERROR: Invalid Augmentation");
|
||||
return;
|
||||
}
|
||||
var owned = false;
|
||||
for (var j = 0; j < Player.queuedAugmentations.length; ++j) {
|
||||
if (Player.queuedAugmentations[j].name == aug.name) {
|
||||
owned = true;
|
||||
}
|
||||
}
|
||||
var item = document.createElement("li");
|
||||
var span = document.createElement("span");
|
||||
var aDiv = document.createElement("div");
|
||||
@ -979,7 +989,7 @@ displayFactionAugmentations = function(factionName) {
|
||||
var pElem = document.createElement("p");
|
||||
aElem.setAttribute("href", "#");
|
||||
var req = aug.baseRepRequirement * faction.augmentationRepRequirementMult;
|
||||
if (aug.name != AugmentationNames.NeuroFluxGovernor && aug.owned) {
|
||||
if (aug.name != AugmentationNames.NeuroFluxGovernor && (aug.owned || owned)) {
|
||||
aElem.setAttribute("class", "a-link-button-inactive");
|
||||
pElem.innerHTML = "ALREADY OWNED";
|
||||
} else if (faction.playerReputation >= req) {
|
||||
@ -994,7 +1004,7 @@ displayFactionAugmentations = function(factionName) {
|
||||
pElem.style.display = "inline";
|
||||
aElem.innerHTML = aug.name;
|
||||
if (aug.name == AugmentationNames.NeuroFluxGovernor) {
|
||||
aElem.innerHTML += " - Level " + (aug.level + 1);
|
||||
aElem.innerHTML += " - Level " + (getNextNeurofluxLevel());
|
||||
}
|
||||
span.style.display = "inline-block"
|
||||
|
||||
|
@ -530,6 +530,22 @@ function evaluate(exp, workerScript) {
|
||||
}, function(e) {
|
||||
reject(e);
|
||||
});
|
||||
} else if (exp.func.value == "getServerMaxMoney") {
|
||||
if (exp.args.length != 1) {
|
||||
return reject(makeRuntimeRejectMsg(workerScript, "getServerMaxMoney() call has incorrect number of arguments. Takes 1 argument"));
|
||||
}
|
||||
var ipPromise = evaluate(exp.args[0], workerScript);
|
||||
ipPromise.then(function(ip) {
|
||||
var server = getServer(ip);
|
||||
if (server == null) {
|
||||
workerScript.scriptRef.log("getServerMaxMoney() failed. Invalid IP or hostname passed in: " + ip);
|
||||
return reject(makeRuntimeRejectMsg(workerScript, "Invalid IP or hostname passed into getServerMaxMoney() command"));
|
||||
}
|
||||
workerScript.scriptRef.log("getServerMaxMoney() returned " + formatNumber(server.moneyMax, 0) + " for " + server.hostname);
|
||||
resolve(server.moneyMax);
|
||||
}, function(e) {
|
||||
reject(e);
|
||||
});
|
||||
} else if (exp.func.value == "fileExists") {
|
||||
if (exp.args.length != 1 && exp.args.length != 2) {
|
||||
return reject(makeRuntimeRejectMsg(workerScript, "fileExists() call has incorrect number of arguments. Takes 1 or 2 arguments"));
|
||||
@ -620,6 +636,10 @@ function evaluate(exp, workerScript) {
|
||||
displayHacknetNodesContent();
|
||||
workerScript.scriptRef.log("Purchased new Hacknet Node with name: " + name);
|
||||
resolve(numOwned);
|
||||
} else if (exp.func.value == "val") {
|
||||
if (exp.args.length != 1) {
|
||||
return reject(makeRuntimeRejectMsg(workerScript, "val() call has incorrect number of arguments. Takes 1 arguments"));
|
||||
}
|
||||
} else {
|
||||
reject(makeRuntimeRejectMsg(workerScript, "Invalid function: " + exp.func.value));
|
||||
}
|
||||
|
@ -176,7 +176,7 @@ function netscriptHack(exp, workerScript) {
|
||||
workerScript.scriptRef.log("Attempting to hack " + ip + " in " + hackingTime.toFixed(3) + " seconds (t=" + threads + ")");
|
||||
return Promise.resolve([server, hackingTime]);
|
||||
}).then(function([server, hackingTime]) {
|
||||
console.log("Hacking " + server.hostname + " after " + hackingTime.toString() + " seconds (t=" + threads + ")");
|
||||
//console.log("Hacking " + server.hostname + " after " + hackingTime.toString() + " seconds (t=" + threads + ")");
|
||||
return netscriptDelay(hackingTime* 1000).then(function() {
|
||||
if (env.stopFlag) {return Promise.reject(workerScript);}
|
||||
var hackChance = scriptCalculateHackingChance(server);
|
||||
@ -201,7 +201,7 @@ function netscriptHack(exp, workerScript) {
|
||||
workerScript.scriptRef.recordHack(server.ip, moneyGained, threads);
|
||||
Player.gainHackingExp(expGainedOnSuccess);
|
||||
workerScript.scriptRef.onlineExpGained += expGainedOnSuccess;
|
||||
console.log("Script successfully hacked " + server.hostname + " for $" + formatNumber(moneyGained, 2) + " and " + formatNumber(expGainedOnSuccess, 4) + " exp");
|
||||
//console.log("Script successfully hacked " + server.hostname + " for $" + formatNumber(moneyGained, 2) + " and " + formatNumber(expGainedOnSuccess, 4) + " exp");
|
||||
workerScript.scriptRef.log("Script SUCCESSFULLY hacked " + server.hostname + " for $" + formatNumber(moneyGained, 2) + " and " + formatNumber(expGainedOnSuccess, 4) + " exp (t=" + threads + ")");
|
||||
server.fortify(CONSTANTS.ServerFortifyAmount * threads);
|
||||
return Promise.resolve(true);
|
||||
@ -209,7 +209,7 @@ function netscriptHack(exp, workerScript) {
|
||||
//Player only gains 25% exp for failure? TODO Can change this later to balance
|
||||
Player.gainHackingExp(expGainedOnFailure);
|
||||
workerScript.scriptRef.onlineExpGained += expGainedOnFailure;
|
||||
console.log("Script unsuccessful to hack " + server.hostname + ". Gained " + formatNumber(expGainedOnFailure, 4) + " exp");
|
||||
//console.log("Script unsuccessful to hack " + server.hostname + ". Gained " + formatNumber(expGainedOnFailure, 4) + " exp");
|
||||
workerScript.scriptRef.log("Script FAILED to hack " + server.hostname + ". Gained " + formatNumber(expGainedOnFailure, 4) + " exp (t=" + threads + ")");
|
||||
return Promise.resolve(false);
|
||||
}
|
||||
@ -245,7 +245,7 @@ function netscriptGrow(exp, workerScript) {
|
||||
}
|
||||
|
||||
var growTime = scriptCalculateGrowTime(server);
|
||||
console.log("Executing grow() on server " + server.hostname + " in " + formatNumber(growTime/1000, 3) + " seconds")
|
||||
//console.log("Executing grow() on server " + server.hostname + " in " + formatNumber(growTime/1000, 3) + " seconds")
|
||||
workerScript.scriptRef.log("Executing grow() on server " + server.hostname + " in " + formatNumber(growTime/1000, 3) + " seconds (t=" + threads + ")");
|
||||
|
||||
return Promise.resolve([server, growTime]);
|
||||
@ -298,7 +298,7 @@ function netscriptWeaken(exp, workerScript) {
|
||||
}
|
||||
|
||||
var weakenTime = scriptCalculateWeakenTime(server);
|
||||
console.log("Executing weaken() on server " + server.hostname + " in " + formatNumber(weakenTime/1000, 3) + " seconds")
|
||||
//console.log("Executing weaken() on server " + server.hostname + " in " + formatNumber(weakenTime/1000, 3) + " seconds")
|
||||
workerScript.scriptRef.log("Executing weaken() on server " + server.hostname + " in " +
|
||||
formatNumber(weakenTime/1000, 3) + " seconds (t=" + threads + ")");
|
||||
|
||||
|
@ -4,6 +4,8 @@ function PlayerObject() {
|
||||
this.hacking_skill = 1;
|
||||
|
||||
//Fighting
|
||||
this.hp = 10;
|
||||
this.max_hp = 10;
|
||||
this.strength = 1; //Damage dealt
|
||||
this.defense = 1; //Damage received
|
||||
this.dexterity = 1; //Accuracy
|
||||
@ -86,6 +88,7 @@ function PlayerObject() {
|
||||
this.factions = []; //Names of all factions player has joined
|
||||
|
||||
//Augmentations
|
||||
this.queuedAugmentations = []; //Purchased but not installed, names only
|
||||
this.augmentations = []; //Names of all installed augmentations
|
||||
|
||||
//Crime statistics (Total refers to this 'simulation'. Lifetime is forever)
|
||||
|
@ -75,6 +75,8 @@ function prestigeAugmentation() {
|
||||
|
||||
Player.factions = [];
|
||||
|
||||
Player.queuedAugmentations = [];
|
||||
|
||||
Player.startAction = false;
|
||||
Player.actionTime = 0;
|
||||
|
||||
@ -187,7 +189,7 @@ function prestigeAugmentation() {
|
||||
}
|
||||
|
||||
//Re-initialize things - This will update any changes
|
||||
initFactions();
|
||||
initFactions(); //Factions must be initialized before augmentations
|
||||
initAugmentations();
|
||||
initCompanies();
|
||||
|
||||
|
@ -9,7 +9,6 @@ function BitburnerSaveObject() {
|
||||
this.CompaniesSave = "";
|
||||
this.FactionsSave = "";
|
||||
this.SpecialServerIpsSave = "";
|
||||
this.AugmentationsSave = "";
|
||||
this.AliasesSave = "";
|
||||
this.MessagesSave = "";
|
||||
this.VersionSave = "";
|
||||
@ -35,11 +34,10 @@ BitburnerSaveObject.prototype.saveGame = function() {
|
||||
this.CompaniesSave = JSON.stringify(Companies);
|
||||
this.FactionsSave = JSON.stringify(Factions);
|
||||
this.SpecialServerIpsSave = JSON.stringify(SpecialServerIps);
|
||||
this.AugmentationsSave = JSON.stringify(Augmentations);
|
||||
//this.AugmentationsSave = JSON.stringify(Augmentations);
|
||||
this.AliasesSave = JSON.stringify(Aliases);
|
||||
this.MessagesSave = JSON.stringify(Messages);
|
||||
this.VersionSave = JSON.stringify(CONSTANTS.Version);
|
||||
|
||||
var saveString = btoa(unescape(encodeURIComponent(JSON.stringify(this))));
|
||||
window.localStorage.setItem("bitburnerSave", saveString);
|
||||
|
||||
@ -60,7 +58,7 @@ loadGame = function(saveObj) {
|
||||
Companies = JSON.parse(saveObj.CompaniesSave, Reviver);
|
||||
Factions = JSON.parse(saveObj.FactionsSave, Reviver);
|
||||
SpecialServerIps = JSON.parse(saveObj.SpecialServerIpsSave, Reviver);
|
||||
Augmentations = JSON.parse(saveObj.AugmentationsSave, Reviver);
|
||||
|
||||
if (saveObj.hasOwnProperty("AliasesSave")) {
|
||||
try {
|
||||
Aliases = JSON.parse(saveObj.AliasesSave, Reviver);
|
||||
@ -97,6 +95,9 @@ loadGame = function(saveObj) {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (CONSTANTS.Version == "0.23.0.BETA") {
|
||||
Augmentations = JSON.parse(saveObj.AugmentationsSave, Reviver);
|
||||
}
|
||||
createNewUpdateText();
|
||||
}
|
||||
} catch(e) {
|
||||
@ -167,6 +168,9 @@ loadImportedGame = function(saveObj, saveString) {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (CONSTANTS.Version == "0.23.0.BETA") {
|
||||
Augmentations = JSON.parse(saveObj.AugmentationsSave, Reviver);
|
||||
}
|
||||
createNewUpdateText();
|
||||
}
|
||||
} catch(e) {
|
||||
|
@ -369,6 +369,42 @@ var Engine = {
|
||||
},
|
||||
|
||||
displayAugmentationsContent: function() {
|
||||
//Purchased/queued augmentations
|
||||
var queuedAugmentationsList = document.getElementById("queued-augmentations-list");
|
||||
|
||||
while (queuedAugmentationsList.firstChild) {
|
||||
queuedAugmentationsList.removeChild(queuedAugmentationsList.firstChild);
|
||||
}
|
||||
|
||||
for (var i = 0; i < Player.queuedAugmentations.length; ++i) {
|
||||
var augName = Player.queuedAugmentations[i].name;
|
||||
var aug = Augmentations[augName];
|
||||
|
||||
var item = document.createElement("li");
|
||||
var hElem = document.createElement("h2");
|
||||
var pElem = document.createElement("p");
|
||||
|
||||
item.setAttribute("class", "installed-augmentation");
|
||||
hElem.innerHTML = augName;
|
||||
if (augName == AugmentationNames.NeuroFluxGovernor) {
|
||||
hElem.innerHTML += " - Level " + (Player.queuedAugmentations[i].level);
|
||||
}
|
||||
pElem.innerHTML = aug.info;
|
||||
|
||||
item.appendChild(hElem);
|
||||
item.appendChild(pElem);
|
||||
|
||||
queuedAugmentationsList.appendChild(item);
|
||||
}
|
||||
|
||||
//Install Augmentations button
|
||||
var installButton = clearEventListeners("install-augmentations-button");
|
||||
installButton.addEventListener("click", function() {
|
||||
installAugmentations();
|
||||
return false;
|
||||
});
|
||||
|
||||
//Installed augmentations
|
||||
var augmentationsList = document.getElementById("augmentations-list");
|
||||
|
||||
while (augmentationsList.firstChild) {
|
||||
@ -386,7 +422,7 @@ var Engine = {
|
||||
item.setAttribute("class", "installed-augmentation");
|
||||
hElem.innerHTML = augName;
|
||||
if (augName == AugmentationNames.NeuroFluxGovernor) {
|
||||
hElem.innerHTML += " - Level " + (aug.level);
|
||||
hElem.innerHTML += " - Level " + (Player.augmentations[i].level);
|
||||
}
|
||||
pElem.innerHTML = aug.info;
|
||||
|
||||
|
@ -79,12 +79,36 @@ purchaseAugmentationBoxCreate = function(aug, fac) {
|
||||
Augmentations[AugmentationNames.BionicArms].owned == false) {
|
||||
dialogBoxCreate("You must first install the Bionic Arms augmentation before installing this upgrade");
|
||||
} else if (Player.money >= (aug.baseCost * fac.augmentationPriceMult)) {
|
||||
applyAugmentation(aug);
|
||||
dialogBoxCreate("You slowly drift to sleep as " + fac.name + "'s scientists put you under " +
|
||||
" in order to install the " + aug.name + " Augmentation. <br><br>" +
|
||||
"You wake up in your home...you feel different...");
|
||||
|
||||
prestigeAugmentation();
|
||||
var queuedAugmentation = new PlayerOwnedAugmentation(aug.name);
|
||||
if (aug.name == AugmentationNames.NeuroFluxGovernor) {
|
||||
queuedAugmentation.level = getNextNeurofluxLevel();
|
||||
}
|
||||
Player.queuedAugmentations.push(queuedAugmentation);
|
||||
|
||||
Player.loseMoney((aug.baseCost * fac.augmentationPriceMult));
|
||||
dialogBoxCreate("You purchased " + aug.name + ". It's enhancements will not take " +
|
||||
"effect until they are installed. To install your augmentations, go to the " +
|
||||
"'Augmentations' tab on the left-hand navigation menu. Purchasing additional " +
|
||||
"augmentations will now be more expensive.");
|
||||
|
||||
//If you just purchased Neuroflux Governor, recalculate the cost
|
||||
if (aug.name == AugmentationNames.NeuroFluxGovernor) {
|
||||
var nextLevel = getNextNeurofluxLevel();
|
||||
--nextLevel;
|
||||
var mult = Math.pow(CONSTANTS.NeuroFluxGovernorLevelMult, nextLevel);
|
||||
aug.setRequirements(500 * mult, 750000 * mult);
|
||||
|
||||
for (var i = 0; i < Player.queuedAugmentations.length; ++i) {
|
||||
aug.baseCost *= 1.5;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
for (var name in Augmentations) {
|
||||
if (Augmentations.hasOwnProperty(name) && name != AugmentationNames.NeuroFluxGovernor) {
|
||||
Augmentations[name].baseCost *= 1.5;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
dialogBoxCreate("You don't have enough money to purchase this Augmentation!");
|
||||
}
|
||||
@ -94,4 +118,26 @@ purchaseAugmentationBoxCreate = function(aug, fac) {
|
||||
});
|
||||
|
||||
purchaseAugmentationBoxOpen();
|
||||
}
|
||||
|
||||
function getNextNeurofluxLevel() {
|
||||
var aug = Augmentations[AugmentationNames.NeuroFluxGovernor];
|
||||
if (aug == null) {
|
||||
for (var i = 0; i < Player.augmentations.length; ++i) {
|
||||
if (Player.augmentations[i].name == AugmentationNames.NeuroFluxGovernor) {
|
||||
aug = Player.augmentations[i];
|
||||
}
|
||||
}
|
||||
if (aug == null) {
|
||||
console.log("ERROR, Could not find NeuroFlux Governor aug");
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
var nextLevel = aug.level + 1;
|
||||
for (var i = 0; i < Player.queuedAugmentations.length; ++i) {
|
||||
if (Player.queuedAugmentations[i].name == AugmentationNames.NeuroFluxGovernor) {
|
||||
++nextLevel;
|
||||
}
|
||||
}
|
||||
return nextLevel;
|
||||
}
|
Loading…
Reference in New Issue
Block a user