mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-11-10 01:33:54 +01:00
FIxed issue with purchasing Augmentations that require previous Augmentations. Buffed hacking slightly. FIxed UI issues:
This commit is contained in:
parent
dad7a58291
commit
ea7b93e953
@ -1,5 +1,5 @@
|
||||
CONSTANTS = {
|
||||
Version: "0.17",
|
||||
Version: "0.17.1",
|
||||
|
||||
//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
|
||||
|
@ -78,7 +78,7 @@ function determineCrimeSuccess(crime, moneyGained) {
|
||||
dialogBoxCreate("ERR: Unrecognized crime type. This is probably a bug please contact the developer");
|
||||
return;
|
||||
}
|
||||
chance *= Player.crime_success_mult;
|
||||
|
||||
if (Math.random() <= chance) {
|
||||
//Success
|
||||
Player.gainMoney(moneyGained);
|
||||
@ -94,7 +94,7 @@ function determineCrimeChanceShoplift() {
|
||||
Player.defense / CONSTANTS.MaxSkillLevel +
|
||||
Player.dexterity / CONSTANTS.MaxSkillLevel +
|
||||
Player.agility / CONSTANTS.MaxSkillLevel)) * 10;
|
||||
|
||||
chance *= Player.crime_success_mult;
|
||||
return Math.min(chance, 1);
|
||||
}
|
||||
|
||||
@ -103,6 +103,7 @@ function determineCrimeChanceMug() {
|
||||
Player.defense / CONSTANTS.MaxSkillLevel +
|
||||
Player.dexterity / CONSTANTS.MaxSkillLevel +
|
||||
Player.agility / CONSTANTS.MaxSkillLevel)) * 5;
|
||||
chance *= Player.crime_success_mult;
|
||||
return Math.min(chance, 1);
|
||||
}
|
||||
|
||||
@ -112,6 +113,7 @@ function determineCrimeChanceDealDrugs() {
|
||||
Player.defense / CONSTANTS.MaxSkillLevel +
|
||||
Player.dexterity / CONSTANTS.MaxSkillLevel +
|
||||
Player.agility / CONSTANTS.MaxSkillLevel));
|
||||
chance *= Player.crime_success_mult;
|
||||
return Math.min(chance, 1);
|
||||
}
|
||||
|
||||
@ -121,6 +123,7 @@ function determineCrimeChanceTraffickArms() {
|
||||
Player.defense / CONSTANTS.MaxSkillLevel +
|
||||
Player.dexterity / CONSTANTS.MaxSkillLevel +
|
||||
Player.agility / CONSTANTS.MaxSkillLevel)) / 2;
|
||||
chance *= Player.crime_success_mult;
|
||||
return Math.min(chance, 1);
|
||||
}
|
||||
|
||||
@ -128,7 +131,8 @@ function determineCrimeChanceHomicide() {
|
||||
var chance = ((Player.strength / CONSTANTS.MaxSkillLevel +
|
||||
Player.defense / CONSTANTS.MaxSkillLevel +
|
||||
Player.dexterity / CONSTANTS.MaxSkillLevel +
|
||||
Player.agility / CONSTANTS.MaxSkillLevel));
|
||||
Player.agility / CONSTANTS.MaxSkillLevel));
|
||||
chance *= Player.crime_success_mult;
|
||||
return Math.min(chance, 1);
|
||||
}
|
||||
|
||||
@ -138,7 +142,8 @@ function determineCrimeChanceGrandTheftAuto() {
|
||||
Player.defense / CONSTANTS.MaxSkillLevel +
|
||||
4 * Player.dexterity / CONSTANTS.MaxSkillLevel +
|
||||
Player.agility / CONSTANTS.MaxSkillLevel +
|
||||
2 * Player.charisma / CONSTANTS.MaxSkillLevel)) / 8;
|
||||
2 * Player.charisma / CONSTANTS.MaxSkillLevel)) / 8;
|
||||
chance *= Player.crime_success_mult;
|
||||
return Math.min(chance, 1);
|
||||
}
|
||||
|
||||
@ -148,6 +153,7 @@ function determineCrimeChanceKidnap() {
|
||||
Player.defense / CONSTANTS.MaxSkillLevel +
|
||||
Player.dexterity / CONSTANTS.MaxSkillLevel +
|
||||
Player.agility / CONSTANTS.MaxSkillLevel)) / 6;
|
||||
chance *= Player.crime_success_mult;
|
||||
return Math.min(chance, 1);
|
||||
}
|
||||
|
||||
@ -155,7 +161,8 @@ function determineCrimeChanceAssassination() {
|
||||
var chance = ((Player.strength / CONSTANTS.MaxSkillLevel +
|
||||
Player.defense / CONSTANTS.MaxSkillLevel +
|
||||
Player.dexterity / CONSTANTS.MaxSkillLevel +
|
||||
Player.agility / CONSTANTS.MaxSkillLevel)) / 8;
|
||||
Player.agility / CONSTANTS.MaxSkillLevel)) / 8;
|
||||
chance *= Player.crime_success_mult;
|
||||
return Math.min(chance, 1);
|
||||
}
|
||||
|
||||
@ -165,6 +172,7 @@ function determineCrimeChanceHeist() {
|
||||
Player.defense / CONSTANTS.MaxSkillLevel +
|
||||
Player.dexterity / CONSTANTS.MaxSkillLevel +
|
||||
Player.agility / CONSTANTS.MaxSkillLevel +
|
||||
Player.charisma / CONSTANTS.MaxSkillLevel)) / 18;
|
||||
Player.charisma / CONSTANTS.MaxSkillLevel)) / 18;
|
||||
chance *= Player.crime_success_mult;
|
||||
return Math.min(chance, 1);
|
||||
}
|
||||
|
@ -16,13 +16,13 @@ function evaluate(exp, workerScript) {
|
||||
case "str":
|
||||
case "bool":
|
||||
return new Promise(function(resolve, reject) {
|
||||
if (env.stopFlag) {reject(workerScript);}
|
||||
if (env.stopFlag) {reject(workerScript); return;}
|
||||
resolve(exp.value);
|
||||
});
|
||||
break;
|
||||
case "var":
|
||||
return new Promise(function(resolve, reject) {
|
||||
if (env.stopFlag) {reject(workerScript);}
|
||||
if (env.stopFlag) {reject(workerScript); return;}
|
||||
if (exp.value == "hacknetnodes") {
|
||||
setTimeout(function() {
|
||||
var pEvaluateHacknetNode = evaluateHacknetNode(exp, workerScript);
|
||||
@ -44,7 +44,7 @@ function evaluate(exp, workerScript) {
|
||||
//Can currently only assign to "var"s
|
||||
case "assign":
|
||||
return new Promise(function(resolve, reject) {
|
||||
if (env.stopFlag) {reject(workerScript);}
|
||||
if (env.stopFlag) {reject(workerScript); return;}
|
||||
|
||||
if (exp.left.type != "var")
|
||||
reject("|" + workerScript.serverIp + "|" + workerScript.name + "| Cannot assign to " + JSON.stringify(exp.left));
|
||||
@ -74,7 +74,7 @@ function evaluate(exp, workerScript) {
|
||||
|
||||
case "binary":
|
||||
return new Promise(function(resolve, reject) {
|
||||
if (env.stopFlag) {reject(workerScript);}
|
||||
if (env.stopFlag) {reject(workerScript); return;}
|
||||
|
||||
var pLeft = new Promise(function(resolve, reject) {
|
||||
setTimeout(function() {
|
||||
@ -152,7 +152,7 @@ function evaluate(exp, workerScript) {
|
||||
break;
|
||||
case "for":
|
||||
return new Promise(function(resolve, reject) {
|
||||
if (env.stopFlag) {reject(workerScript);}
|
||||
if (env.stopFlag) {reject(workerScript); return;}
|
||||
|
||||
var pInit = new Promise(function(resolve, reject) {
|
||||
setTimeout(function() {
|
||||
@ -179,7 +179,7 @@ function evaluate(exp, workerScript) {
|
||||
break;
|
||||
case "while":
|
||||
return new Promise(function(resolve, reject) {
|
||||
if (env.stopFlag) {reject(workerScript);}
|
||||
if (env.stopFlag) {reject(workerScript); return;}
|
||||
|
||||
var pEvaluateWhile = evaluateWhile(exp, workerScript);
|
||||
pEvaluateWhile.then(function(whileLoopRes) {
|
||||
@ -191,7 +191,7 @@ function evaluate(exp, workerScript) {
|
||||
break;
|
||||
case "prog":
|
||||
return new Promise(function(resolve, reject) {
|
||||
if (env.stopFlag) {reject(workerScript);}
|
||||
if (env.stopFlag) {reject(workerScript); return;}
|
||||
|
||||
var evaluateProgPromise = evaluateProg(exp, workerScript, 0);
|
||||
evaluateProgPromise.then(function(w) {
|
||||
@ -224,10 +224,11 @@ function evaluate(exp, workerScript) {
|
||||
// return evaluate(arg, env);
|
||||
//}));
|
||||
return new Promise(function(resolve, reject) {
|
||||
if (env.stopFlag) {reject(workerScript);}
|
||||
if (env.stopFlag) {reject(workerScript); return;}
|
||||
|
||||
setTimeout(function() {
|
||||
if (exp.func.value == "hack") {
|
||||
if (env.stopFlag) {reject(workerScript); return;}
|
||||
if (exp.args.length != 1) {
|
||||
reject("|" + workerScript.serverIp + "|" + workerScript.name + "|Hack() call has incorrect number of arguments. Takes 1 argument");
|
||||
return;
|
||||
@ -235,6 +236,7 @@ function evaluate(exp, workerScript) {
|
||||
var ipPromise = evaluate(exp.args[0], workerScript);
|
||||
|
||||
ipPromise.then(function(ip) {
|
||||
if (env.stopFlag) {reject(workerScript); return;}
|
||||
var server = getServer(ip);
|
||||
if (server == null) {
|
||||
reject("|" + workerScript.serverIp + "|" + workerScript.name + "|Invalid IP or hostname passed into hack() command");
|
||||
@ -261,10 +263,10 @@ function evaluate(exp, workerScript) {
|
||||
workerScript.scriptRef.log("Attempting to hack " + ip + " in " + hackingTime.toFixed(3) + " seconds");
|
||||
|
||||
var p = new Promise(function(resolve, reject) {
|
||||
if (env.stopFlag) {reject(workerScript);}
|
||||
if (env.stopFlag) {reject(workerScript); return;}
|
||||
console.log("Hacking " + server.hostname + " after " + hackingTime.toString() + " seconds.");
|
||||
setTimeout(function() {
|
||||
if (env.stopFlag) {reject(workerScript);}
|
||||
if (env.stopFlag) {reject(workerScript); return;}
|
||||
var hackChance = scriptCalculateHackingChance(server);
|
||||
var rand = Math.random();
|
||||
var expGainedOnSuccess = scriptCalculateExpGain(server);
|
||||
@ -355,13 +357,14 @@ function evaluate(exp, workerScript) {
|
||||
reject(e);
|
||||
});
|
||||
} else if (exp.func.value == "grow") {
|
||||
if (env.stopFlag) {reject(workerScript); return;}
|
||||
if (exp.args.length != 1) {
|
||||
reject("|" + workerScript.serverIp + "|" + workerScript.name + "|grow() call has incorrect number of arguments. Takes 1 argument");
|
||||
return;
|
||||
}
|
||||
var ipPromise = evaluate(exp.args[0], workerScript);
|
||||
ipPromise.then(function(ip) {
|
||||
if (env.stopFlag) {reject(workerScript);}
|
||||
if (env.stopFlag) {reject(workerScript); return;}
|
||||
var server = getServer(ip);
|
||||
if (server == null) {
|
||||
reject("|" + workerScript.serverIp + "|" + workerScript.name + "|Invalid IP or hostname passed into grow() command");
|
||||
@ -381,7 +384,7 @@ function evaluate(exp, workerScript) {
|
||||
workerScript.scriptRef.log("Executing grow() on server " + server.hostname + " in " + formatNumber(growTime/1000, 3) + " seconds");
|
||||
|
||||
var p = new Promise(function(resolve, reject) {
|
||||
if (env.stopFlag) {reject(workerScript);}
|
||||
if (env.stopFlag) {reject(workerScript); return;}
|
||||
setTimeout(function() {
|
||||
server.moneyAvailable += 1; //It can be grown even if it has no money
|
||||
var growthPercentage = processSingleServerGrowth(server, 450);
|
||||
@ -407,7 +410,7 @@ function evaluate(exp, workerScript) {
|
||||
}
|
||||
var ipPromise = evaluate(exp.args[0], workerScript);
|
||||
ipPromise.then(function(ip) {
|
||||
if (env.stopFlag) {reject(workerScript);}
|
||||
if (env.stopFlag) {reject(workerScript); return;}
|
||||
var server = getServer(ip);
|
||||
if (server == null) {
|
||||
reject("|" + workerScript.serverIp + "|" + workerScript.name + "|Invalid IP or hostname passed into nuke() command");
|
||||
@ -427,7 +430,7 @@ function evaluate(exp, workerScript) {
|
||||
|
||||
workerScript.scriptRef.log("Running NUKE.exe on server " + server.hostname + " in 5 seconds");
|
||||
var p = new Promise(function(resolve, reject) {
|
||||
if (env.stopFlag) {reject(workerScript);}
|
||||
if (env.stopFlag) {reject(workerScript); return;}
|
||||
setTimeout(function() {
|
||||
if (server.hasAdminRights) {
|
||||
workerScript.scriptRef.log("Already have root access to " + server.hostname);
|
||||
@ -454,7 +457,7 @@ function evaluate(exp, workerScript) {
|
||||
}
|
||||
var ipPromise = evaluate(exp.args[0], workerScript);
|
||||
ipPromise.then(function(ip) {
|
||||
if (env.stopFlag) {reject(workerScript);}
|
||||
if (env.stopFlag) {reject(workerScript); return;}
|
||||
var server = getServer(ip);
|
||||
if (server == null) {
|
||||
reject("|" + workerScript.serverIp + "|" + workerScript.name + "|Invalid IP or hostname passed into brutessh() command");
|
||||
@ -469,7 +472,7 @@ function evaluate(exp, workerScript) {
|
||||
|
||||
workerScript.scriptRef.log("Running BruteSSH.exe on server " + server.hostname + " in 10 seconds");
|
||||
var p = new Promise(function(resolve, reject) {
|
||||
if (env.stopFlag) {reject(workerScript);}
|
||||
if (env.stopFlag) {reject(workerScript); return;}
|
||||
setTimeout(function() {
|
||||
if (!server.sshPortOpen) {
|
||||
workerScript.scriptRef.log("Executed BruteSSH.exe virus on " + server.hostname + " to open SSH port (22)");
|
||||
@ -497,7 +500,7 @@ function evaluate(exp, workerScript) {
|
||||
}
|
||||
var ipPromise = evaluate(exp.args[0], workerScript);
|
||||
ipPromise.then(function(ip) {
|
||||
if (env.stopFlag) {reject(workerScript);}
|
||||
if (env.stopFlag) {reject(workerScript); return;}
|
||||
var server = getServer(ip);
|
||||
if (server == null) {
|
||||
reject("|" + workerScript.serverIp + "|" + workerScript.name + "|Invalid IP or hostname passed into ftpcrack() command");
|
||||
@ -512,7 +515,7 @@ function evaluate(exp, workerScript) {
|
||||
|
||||
workerScript.scriptRef.log("Running FTPCrack.exe on server " + server.hostname + " in 15 seconds");
|
||||
var p = new Promise(function(resolve, reject) {
|
||||
if (env.stopFlag) {reject(workerScript);}
|
||||
if (env.stopFlag) {reject(workerScript); return;}
|
||||
setTimeout(function() {
|
||||
if (!server.ftpPortOpen) {
|
||||
workerScript.scriptRef.log("Executed FTPCrack.exe virus on " + server.hostname + " to open FTP port (21)");
|
||||
@ -540,7 +543,7 @@ function evaluate(exp, workerScript) {
|
||||
}
|
||||
var ipPromise = evaluate(exp.args[0], workerScript);
|
||||
ipPromise.then(function(ip) {
|
||||
if (env.stopFlag) {reject(workerScript);}
|
||||
if (env.stopFlag) {reject(workerScript); return;}
|
||||
var server = getServer(ip);
|
||||
if (server == null) {
|
||||
reject("|" + workerScript.serverIp + "|" + workerScript.name + "|Invalid IP or hostname passed into relaysmtp() command");
|
||||
@ -555,7 +558,7 @@ function evaluate(exp, workerScript) {
|
||||
|
||||
workerScript.scriptRef.log("Running relaySMTP.exe on server " + server.hostname + " in 20 seconds");
|
||||
var p = new Promise(function(resolve, reject) {
|
||||
if (env.stopFlag) {reject(workerScript);}
|
||||
if (env.stopFlag) {reject(workerScript); return;}
|
||||
setTimeout(function() {
|
||||
if (!server.smtpPortOpen) {
|
||||
workerScript.scriptRef.log("Executed relaySMTP.exe virus on " + server.hostname + " to open SMTP port (25)");
|
||||
@ -583,7 +586,7 @@ function evaluate(exp, workerScript) {
|
||||
}
|
||||
var ipPromise = evaluate(exp.args[0], workerScript);
|
||||
ipPromise.then(function(ip) {
|
||||
if (env.stopFlag) {reject(workerScript);}
|
||||
if (env.stopFlag) {reject(workerScript); return;}
|
||||
var server = getServer(ip);
|
||||
if (server == null) {
|
||||
reject("|" + workerScript.serverIp + "|" + workerScript.name + "|Invalid IP or hostname passed into relaysmtp() command");
|
||||
@ -598,7 +601,7 @@ function evaluate(exp, workerScript) {
|
||||
|
||||
workerScript.scriptRef.log("Running HTTPWorm.exe on server " + server.hostname + " in 25 seconds");
|
||||
var p = new Promise(function(resolve, reject) {
|
||||
if (env.stopFlag) {reject(workerScript);}
|
||||
if (env.stopFlag) {reject(workerScript); return;}
|
||||
setTimeout(function() {
|
||||
if (!server.httpPortOpen) {
|
||||
workerScript.scriptRef.log("Executed HTTPWorm.exe virus on " + server.hostname + " to open HTTP port (25)");
|
||||
@ -626,7 +629,7 @@ function evaluate(exp, workerScript) {
|
||||
}
|
||||
var ipPromise = evaluate(exp.args[0], workerScript);
|
||||
ipPromise.then(function(ip) {
|
||||
if (env.stopFlag) {reject(workerScript);}
|
||||
if (env.stopFlag) {reject(workerScript); return;}
|
||||
var server = getServer(ip);
|
||||
if (server == null) {
|
||||
reject("|" + workerScript.serverIp + "|" + workerScript.name + "|Invalid IP or hostname passed into sqlinject() command");
|
||||
@ -641,7 +644,7 @@ function evaluate(exp, workerScript) {
|
||||
|
||||
workerScript.scriptRef.log("Running SQLInject.exe on server " + server.hostname + " in 30 seconds");
|
||||
var p = new Promise(function(resolve, reject) {
|
||||
if (env.stopFlag) {reject(workerScript);}
|
||||
if (env.stopFlag) {reject(workerScript); return;}
|
||||
setTimeout(function() {
|
||||
if (!server.sqlPortOpen) {
|
||||
workerScript.scriptRef.log("Executed SQLInject.exe virus on " + server.hostname + " to open SQL port (1433)");
|
||||
@ -669,7 +672,7 @@ function evaluate(exp, workerScript) {
|
||||
}
|
||||
var ipPromise = evaluate(exp.args[0], workerScript);
|
||||
ipPromise.then(function(ip) {
|
||||
if (env.stopFlag) {reject(workerScript);}
|
||||
if (env.stopFlag) {reject(workerScript); return;}
|
||||
setTimeout(function() {
|
||||
var server = getServer(ip);
|
||||
if (server == null) {
|
||||
@ -690,7 +693,7 @@ function evaluate(exp, workerScript) {
|
||||
}
|
||||
var scriptNamePromise = evaluate(exp.args[0], workerScript);
|
||||
scriptNamePromise.then(function(scriptname) {
|
||||
if (env.stopFlag) {reject(workerScript);}
|
||||
if (env.stopFlag) {reject(workerScript); return;}
|
||||
var scriptServer = getServer(workerScript.serverIp);
|
||||
if (scriptServer == null) {
|
||||
reject("|"+workerScript.serverIp+"|"+workerScript.name+"|Could not find server. This is a bug in the game. Report to game dev");
|
||||
@ -778,7 +781,7 @@ function evaluate(exp, workerScript) {
|
||||
return;
|
||||
}
|
||||
setTimeout(function() {
|
||||
if (env.stopFlag) {reject(workerScript);}
|
||||
if (env.stopFlag) {reject(workerScript); return;}
|
||||
Player.updateSkillLevels();
|
||||
workerScript.scriptRef.log("getHackingLevel() returned " + Player.hacking_skill);
|
||||
resolve(Player.hacking_skill);
|
||||
@ -832,6 +835,8 @@ function evaluate(exp, workerScript) {
|
||||
workerScript.scriptRef.log("Purchased new Hacknet Node with name: " + name);
|
||||
resolve(numOwned);
|
||||
}, CONSTANTS.CodeInstructionRunTime);
|
||||
} else {
|
||||
reject(makeRuntimeRejectMsg(workerScript, "Invalid function: " + exp.func.value));
|
||||
}
|
||||
}, CONSTANTS.CodeInstructionRunTime);
|
||||
});
|
||||
@ -887,7 +892,7 @@ function evaluateIf(exp, workerScript, i) {
|
||||
function evaluateFor(exp, workerScript) {
|
||||
var env = workerScript.env;
|
||||
return new Promise(function(resolve, reject) {
|
||||
if (env.stopFlag) {reject(workerScript);}
|
||||
if (env.stopFlag) {reject(workerScript); return;}
|
||||
|
||||
var pCond = new Promise(function(resolve, reject) {
|
||||
setTimeout(function() {
|
||||
@ -954,7 +959,7 @@ function evaluateWhile(exp, workerScript) {
|
||||
var env = workerScript.env;
|
||||
|
||||
return new Promise(function(resolve, reject) {
|
||||
if (env.stopFlag) {reject(workerScript);}
|
||||
if (env.stopFlag) {reject(workerScript); return;}
|
||||
|
||||
var pCond = new Promise(function(resolve, reject) {
|
||||
setTimeout(function() {
|
||||
@ -1108,7 +1113,7 @@ function evaluateProg(exp, workerScript, index) {
|
||||
var env = workerScript.env;
|
||||
|
||||
return new Promise(function(resolve, reject) {
|
||||
if (env.stopFlag) {reject(workerScript);}
|
||||
if (env.stopFlag) {reject(workerScript); return;}
|
||||
|
||||
if (index >= exp.prog.length) {
|
||||
resolve("progFinished");
|
||||
@ -1177,7 +1182,7 @@ function apply_op(op, a, b) {
|
||||
function runScriptFromScript(server, scriptname, workerScript) {
|
||||
return new Promise(function(resolve, reject) {
|
||||
var env = workerScript.env;
|
||||
if (env.stopFlag) {reject(workerScript);}
|
||||
if (env.stopFlag) {reject(workerScript); return;}
|
||||
setTimeout(function() {
|
||||
//Check if the script is already running
|
||||
for (var i = 0; i < server.runningScripts.length; ++i) {
|
||||
@ -1259,7 +1264,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 / 725;
|
||||
var percentMoneyHacked = difficultyMult * skillMult * Player.hacking_money_mult / 700;
|
||||
if (percentMoneyHacked < 0) {return 0;}
|
||||
if (percentMoneyHacked > 1) {return 1;}
|
||||
return percentMoneyHacked;
|
||||
|
@ -243,7 +243,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 / 725;
|
||||
var percentMoneyHacked = difficultyMult * skillMult * this.hacking_money_mult / 700;
|
||||
console.log("Percent money hacked calculated to be: " + percentMoneyHacked);
|
||||
if (percentMoneyHacked < 0) {return 0;}
|
||||
if (percentMoneyHacked > 1) {return 1;}
|
||||
|
@ -39,119 +39,45 @@ purchaseAugmentationBoxCreate = function(aug, fac) {
|
||||
newConfirmButton.addEventListener("click", function() {
|
||||
|
||||
//TODO Requirements for specific augmentations (e.g Embedded Netburner Module b4 its upgrades)
|
||||
if (aug.name == AugmentationNames.Targeting2) {
|
||||
var targeting1 = Augmentations[AugmentationNames.Targeting1];
|
||||
if (targeting1 == null) {
|
||||
console.log("ERROR: Could not find Augmented Targeting I");
|
||||
return;
|
||||
}
|
||||
if (targeting1.owned == false) {
|
||||
dialogBoxCreate("You must first install Augmented Targeting I before you can upgrade it to Augmented Targeting II");
|
||||
}
|
||||
} else if (aug.name == AugmentationNames.Targeting3) {
|
||||
var targeting2 = Augmentations[AugmentationNames.Targeting2];
|
||||
if (targeting2 == null) {
|
||||
console.log("ERROR: Could not find Augmented Targeting II");
|
||||
return;
|
||||
}
|
||||
if (targeting2.owned == false) {
|
||||
dialogBoxCreate("You must first install Augmented Targeting II before you can upgrade it to Augmented Targeting III");
|
||||
}
|
||||
} else if (aug.name == AugmentationNames.CombatRib2) {
|
||||
var combatRib1 = Augmentations[AugmentationNames.CombatRib1];
|
||||
if (combatRib1 == null) {
|
||||
console.log("ERROR: Could not find Combat Rib I");
|
||||
return;
|
||||
}
|
||||
if (combatRib1.owned == false) {
|
||||
dialogBoxCreate("You must first install Combat Rib I before you can upgrade it to Combat Rib II");
|
||||
}
|
||||
} else if (aug.name == AugmentationNames.CombatRib3) {
|
||||
var combatRib2 = Augmentations[AugmentationNames.CombatRib2];
|
||||
if (combatRib2 == null) {
|
||||
console.log("ERROR: Could not find Combat Rib II");
|
||||
return;
|
||||
}
|
||||
if (combatRib2.owned == false) {
|
||||
dialogBoxCreate("You must first install Combat Rib II before you can upgrade it to Combat Rib III");
|
||||
}
|
||||
} else if (aug.name == AugmentationNames.GrapheneBionicSpine) {
|
||||
var bionicSpine = Augmentations[AugmentationNames.BionicSpine];
|
||||
if (bionicSpine == null) {
|
||||
console.log("ERROR: Could not find Bionic Spine");
|
||||
return;
|
||||
}
|
||||
if (bionicSpine.owned == false) {
|
||||
dialogBoxCreate("You must first install a Bionic Spine before you can upgrade it to a Graphene Bionic Spine");
|
||||
}
|
||||
} else if (aug.name == AugmentationNames.GrapheneBionicLegs) {
|
||||
var bionicLegs = Augmentations[AugmentationNames.BionicLegs];
|
||||
if (bionicLegs == null) {
|
||||
console.log("ERROR: Could not find Bionic Legs");
|
||||
return;
|
||||
}
|
||||
if (bionicLegs.owned == false ) {
|
||||
dialogBoxCreate("You must first install Bionic Legs before you can upgrade it to Graphene Bionic Legs");
|
||||
}
|
||||
} else if (aug.name == AugmentationNames.ENMCoreV2) {
|
||||
var coreImplant = Augmentations[AugmentationNames.ENMCore];
|
||||
if (coreImplant == null) {
|
||||
console.log("ERROR: Could not find ENM Core Implant");
|
||||
return;
|
||||
}
|
||||
if (coreImplant.owned == false) {
|
||||
dialogBoxCreate("You must first install Embedded Netburner Module Core Implant before you can upgrade it to V2");
|
||||
}
|
||||
} else if (aug.name == AugmentationNames.ENMCoreV3) {
|
||||
var v2Upgrade = Augmentations[AugmentationNames.ENMCoreV2];
|
||||
if (v2Upgrade == null) {
|
||||
console.log("ERROR: Could not find ENM Core V2 upgrade");
|
||||
return;
|
||||
}
|
||||
if (v2Upgrade.owned == false) {
|
||||
dialogBoxCreate("You must first install Embedded Netburner Module Core V2 Upgrade before you can upgrade it to V3");
|
||||
}
|
||||
} else if (aug.name == AugmentationNames.ENMCore ||
|
||||
if (aug.name == AugmentationNames.Targeting2 &&
|
||||
Augmentations[AugmentationNames.Targeting1].owned == false) {
|
||||
dialogBoxCreate("You must first install Augmented Targeting I before you can upgrade it to Augmented Targeting II");
|
||||
} else if (aug.name == AugmentationNames.Targeting3 &&
|
||||
Augmentations[AugmentationNames.Targeting2].owned == false) {
|
||||
dialogBoxCreate("You must first install Augmented Targeting II before you can upgrade it to Augmented Targeting III");
|
||||
} else if (aug.name == AugmentationNames.CombatRib2 &&
|
||||
Augmentations[AugmentationNames.CombatRib1].owned == false) {
|
||||
dialogBoxCreate("You must first install Combat Rib I before you can upgrade it to Combat Rib II");
|
||||
} else if (aug.name == AugmentationNames.CombatRib3 &&
|
||||
Augmentations[AugmentationNames.CombatRib2].owned == false) {
|
||||
dialogBoxCreate("You must first install Combat Rib II before you can upgrade it to Combat Rib III");
|
||||
} else if (aug.name == AugmentationNames.GrapheneBionicSpine &&
|
||||
Augmentations[AugmentationNames.BionicSpine].owned == false) {
|
||||
dialogBoxCreate("You must first install a Bionic Spine before you can upgrade it to a Graphene Bionic Spine");
|
||||
} else if (aug.name == AugmentationNames.GrapheneBionicLegs &&
|
||||
Augmentations[AugmentationNames.BionicLegs].owned == false) {
|
||||
dialogBoxCreate("You must first install Bionic Legs before you can upgrade it to Graphene Bionic Legs");
|
||||
} else if (aug.name == AugmentationNames.ENMCoreV2 &&
|
||||
Augmentations[AugmentationNames.ENMCore].owned == false) {
|
||||
dialogBoxCreate("You must first install Embedded Netburner Module Core Implant before you can upgrade it to V2");
|
||||
} else if (aug.name == AugmentationNames.ENMCoreV3 &&
|
||||
Augmentations[AugmentationNames.ENMCoreV2].owned == false) {
|
||||
dialogBoxCreate("You must first install Embedded Netburner Module Core V2 Upgrade before you can upgrade it to V3");
|
||||
} else if ((aug.name == AugmentationNames.ENMCore ||
|
||||
aug.name == AugmentationNames.ENMAnalyzeEngine ||
|
||||
aug.name == AugmentationNames.ENMDMA) {
|
||||
var enm = Augmentations[AugmentationNames.ENM];
|
||||
if (enm == null) {
|
||||
console.log("ERROR: Could not find ENM");
|
||||
return;
|
||||
}
|
||||
if (enm.owned == false) {
|
||||
dialogBoxCreate("You must first install the Embedded Netburner Module before installing any upgrades to it");
|
||||
}
|
||||
|
||||
} else if (aug.name == AugmentationNames.PCDNIOptimizer ||
|
||||
aug.name == AugmentationNames.PCDNINeuralNetwork) {
|
||||
var pcdni = Augmentations[AugmentationNames.PCDNI];
|
||||
if (pcdni == null) {
|
||||
console.log("ERROR: Could not find PC Direct Neural Interface");
|
||||
return;
|
||||
}
|
||||
if (pcdni.owned == false) {
|
||||
dialogBoxCreate("You must first install the Pc Direct-Neural Interface before installing this upgrade");
|
||||
}
|
||||
|
||||
} else if (aug.name == AugmentationNames.GrapheneBrachiBlades) {
|
||||
var brachiblades = Augmentations[AugmentationNames.BrachiBlades];
|
||||
if (brachiblades == null) {
|
||||
console.log("ERROR: Could not find Brachi Blades aug");
|
||||
return;
|
||||
}
|
||||
if (brachiblades.owned == false) {
|
||||
dialogBoxCreate("You must first install the Brachi Blades augmentation before installing this upgrade");
|
||||
}
|
||||
} else if (aug.name == AugmentationNames.GrapheneBionicArms) {
|
||||
var bionicarms = Augmentations[AugmentationNames.BionicArms];
|
||||
if (bionicarms == null) {
|
||||
console.log("ERORR: Could not find Bionic Arms aug");
|
||||
return;
|
||||
}
|
||||
if (bionicarms.owned == false) {
|
||||
dialogBoxCreate("You must first install the Bionic Arms augmentation before installing this upgrade");
|
||||
}
|
||||
aug.name == AugmentationNames.ENMDMA) &&
|
||||
Augmentations[AugmentationNames.ENM].owned == false) {
|
||||
dialogBoxCreate("You must first install the Embedded Netburner Module before installing any upgrades to it");
|
||||
} else if ((aug.name == AugmentationNames.PCDNIOptimizer ||
|
||||
aug.name == AugmentationNames.PCDNINeuralNetwork) &&
|
||||
Augmentations[AugmentationNames.PCDNI].owned == false) {
|
||||
dialogBoxCreate("You must first install the Pc Direct-Neural Interface before installing this upgrade");
|
||||
} else if (aug.name == AugmentationNames.GrapheneBrachiBlades &&
|
||||
Augmentations[AugmentationNames.BrachiBlades].owned == false) {
|
||||
dialogBoxCreate("You must first install the Brachi Blades augmentation before installing this upgrade");
|
||||
} else if (aug.name == AugmentationNames.GrapheneBionicArms &&
|
||||
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 " +
|
||||
|
Loading…
Reference in New Issue
Block a user