Merge pull request #28 from danielyxie/dev

Dev v0.17.1
This commit is contained in:
danielyxie 2017-05-30 08:58:27 -05:00 committed by GitHub
commit 125f244700
8 changed files with 147 additions and 218 deletions

@ -16,24 +16,7 @@ PlayerObject.prototype.applyForJob = function(entryPosType) {
var pos = entryPosType;
if (!this.isQualified(company, pos)) {
var offset = company.jobStatReqOffset;
var reqHacking = pos.requiredHacking > 0 ? pos.requiredHacking+offset : 0;
var reqStrength = pos.requiredStrength > 0 ? pos.requiredStrength+offset : 0;
var reqDefense = pos.requiredDefense > 0 ? pos.requiredDefense+offset : 0;
var reqDexterity = pos.requiredDexterity > 0 ? pos.requiredDexterity+offset : 0;
var reqAgility = pos.requiredDexterity > 0 ? pos.requiredDexterity+offset : 0;
var reqCharisma = pos.requiredCharisma > 0 ? pos.requiredCharisma+offset : 0;
var reqRep = pos.requiredReputation;
var reqText = "(Requires ";
if (reqHacking > 0) {reqText += (reqHacking + " hacking, ");}
if (reqStrength > 0) {reqText += (reqStrength + " strength, ");}
if (reqDefense > 0) {reqText += (reqDefense + " defense, ");}
if (reqDexterity > 0) {reqText += (reqDexterity + " dexterity, ");}
if (reqAgility > 0) {reqText += (reqAgility + " agility, ");}
if (reqCharisma > 0) {reqText += (reqCharisma + " charisma, ");}
if (reqRep > 1) {reqText += (reqRep + " reputation, ");}
reqText = reqText.substring(0, reqText.length - 2);
reqText += ")";
var reqText = getJobRequirementText(company, pos);
dialogBoxCreate("Unforunately, you do not qualify for this position", reqText);
return;
}
@ -67,24 +50,7 @@ PlayerObject.prototype.applyForJob = function(entryPosType) {
if (currCompany.companyName == company.companyName &&
pos.positionName == currPositionName) {
var nextPos = getNextCompanyPosition(pos);
var offset = company.jobStatReqOffset;
var reqHacking = nextPos.requiredHacking > 0 ? nextPos.requiredHacking+offset : 0;
var reqStrength = nextPos.requiredStrength > 0 ? nextPos.requiredStrength+offset : 0;
var reqDefense = nextPos.requiredDefense > 0 ? nextPos.requiredDefense+offset : 0;
var reqDexterity = nextPos.requiredDexterity > 0 ? nextPos.requiredDexterity+offset : 0;
var reqAgility = nextPos.requiredDexterity > 0 ? nextPos.requiredDexterity+offset : 0;
var reqCharisma = nextPos.requiredCharisma > 0 ? nextPos.requiredCharisma+offset : 0;
var reqRep = nextPos.requiredReputation;
var reqText = "(Requires ";
if (reqHacking > 0) {reqText += (reqHacking + " hacking, ");}
if (reqStrength > 0) {reqText += (reqStrength + " strength, ");}
if (reqDefense > 0) {reqText += (reqDefense + " defense, ");}
if (reqDexterity > 0) {reqText += (reqDexterity + " dexterity, ");}
if (reqAgility > 0) {reqText += (reqAgility + " agility, ");}
if (reqCharisma > 0) {reqText += (reqCharisma + " charisma, ");}
if (reqRep > 1) {reqText += (reqRep + " reputation, ");}
reqText = reqText.substring(0, reqText.length - 2);
reqText += ")";
var reqText = getJobRequirementText(company, nextPos);
dialogBoxCreate("Unfortunately, you do not qualify for a promotion", reqText);
return; //Same job, do nothing
@ -120,6 +86,29 @@ PlayerObject.prototype.applyForJob = function(entryPosType) {
Engine.loadLocationContent();
}
function getJobRequirementText(company, pos) {
var reqText = "";
var offset = company.jobStatReqOffset;
var reqHacking = pos.requiredHacking > 0 ? pos.requiredHacking+offset : 0;
var reqStrength = pos.requiredStrength > 0 ? pos.requiredStrength+offset : 0;
var reqDefense = pos.requiredDefense > 0 ? pos.requiredDefense+offset : 0;
var reqDexterity = pos.requiredDexterity > 0 ? pos.requiredDexterity+offset : 0;
var reqAgility = pos.requiredDexterity > 0 ? pos.requiredDexterity+offset : 0;
var reqCharisma = pos.requiredCharisma > 0 ? pos.requiredCharisma+offset : 0;
var reqRep = pos.requiredReputation;
var reqText = "(Requires ";
if (reqHacking > 0) {reqText += (reqHacking + " hacking, ");}
if (reqStrength > 0) {reqText += (reqStrength + " strength, ");}
if (reqDefense > 0) {reqText += (reqDefense + " defense, ");}
if (reqDexterity > 0) {reqText += (reqDexterity + " dexterity, ");}
if (reqAgility > 0) {reqText += (reqAgility + " agility, ");}
if (reqCharisma > 0) {reqText += (reqCharisma + " charisma, ");}
if (reqRep > 1) {reqText += (reqRep + " reputation, ");}
reqText = reqText.substring(0, reqText.length - 2);
reqText += ")";
return reqText;
}
PlayerObject.prototype.applyForSoftwareJob = function() {
this.applyForJob(CompanyPositions.SoftwareIntern);
}

@ -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);
}
@ -129,6 +132,7 @@ function determineCrimeChanceHomicide() {
Player.defense / CONSTANTS.MaxSkillLevel +
Player.dexterity / CONSTANTS.MaxSkillLevel +
Player.agility / CONSTANTS.MaxSkillLevel));
chance *= Player.crime_success_mult;
return Math.min(chance, 1);
}
@ -139,6 +143,7 @@ function determineCrimeChanceGrandTheftAuto() {
4 * Player.dexterity / CONSTANTS.MaxSkillLevel +
Player.agility / CONSTANTS.MaxSkillLevel +
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);
}
@ -156,6 +162,7 @@ function determineCrimeChanceAssassination() {
Player.defense / CONSTANTS.MaxSkillLevel +
Player.dexterity / CONSTANTS.MaxSkillLevel +
Player.agility / CONSTANTS.MaxSkillLevel)) / 8;
chance *= Player.crime_success_mult;
return Math.min(chance, 1);
}
@ -166,5 +173,6 @@ function determineCrimeChanceHeist() {
Player.dexterity / CONSTANTS.MaxSkillLevel +
Player.agility / CONSTANTS.MaxSkillLevel +
Player.charisma / CONSTANTS.MaxSkillLevel)) / 18;
chance *= Player.crime_success_mult;
return Math.min(chance, 1);
}

@ -18,27 +18,28 @@ FactionInfo = {
CovenantInfo: "Yesterday we obeyed kings and bent our necks to emperors. Today we kneel only to truth.",
//Megacorporations, each forms its own faction
ECorpInfo: "ECorp's mission is simple: to connect the world of today with the technology of tomorrow.\n" +
"With our wide range of Internet-related software and commercial hardware, ECorp makes the world's\n" +
ECorpInfo: "ECorp's mission is simple: to connect the world of today with the technology of tomorrow. " +
"With our wide range of Internet-related software and commercial hardware, ECorp makes the world's " +
"information universally accessible.",
MegaCorpInfo: "MegaCorp does things that others don't. We imagine. We create. We invent. We build things that\n" +
"others have never even dreamed of. Our work fills the world's needs for food, water, power, and\n" +
"transporation on an unprecendented scale, in ways that no other company can.\n\n" +
MegaCorpInfo: "MegaCorp does things that others don't. We imagine. We create. We invent. We build things that " +
"others have never even dreamed of. Our work fills the world's needs for food, water, power, and " +
"transporation on an unprecendented scale, in ways that no other company can.<br><br>" +
"In our labs and factories and on the ground with customers, MegaCorp is ushering in a new era for the world.",
BachmanAndAssociatesInfo: "Where Law and Business meet - thats where we are. <br><br>" +
"Legal Insight - Business Instinct - Experience Innovation",
BladeIndustriesInfo: "TODO",
BladeIndustriesInfo: "Augmentation is salvation",
NWOInfo: "The human being created civilization not because of willingness but of a need to be assimilated into higher orders of structure and meaning.",
ClarkeIncorporatedInfo: "TODO",
ClarkeIncorporatedInfo: "Unlocking the power of the genome",
OmniTekIncorporatedInfo: "Simply put, our mission is to design and build robots that make a difference",
FourSigmaInfo: "TODO",
FourSigmaInfo: "The scientific method is the best way to approach investing. Big strategies backed up with big data. Driven by " +
"deep learning and innovative ideas. And improved by iteration. That's Four Sigma.",
KuaiGongInternationalInfo: "Dream big. Work hard. Make history.",
@ -46,18 +47,18 @@ FactionInfo = {
FulcrumSecretTechnologiesInfo: "TODO",
//Hacker groups
BitRunnersInfo: "Our entire lives are controlled by bits. All of our actions, our thoughts, our personal information. \n"+
"It's all transformed into bits, stored in bits, communicated through bits. Its impossible for any person\n" +
"to move, to live, to operate at any level without the use of bits.\n\n" +
"And when a person moves, lives, and operates, they leave behind their bits, mere traces of seemingly\n" +
"meaningly fragments of information. But these bits can be reconstructed. Transformed. Used.\n\n" +
BitRunnersInfo: "Our entire lives are controlled by bits. All of our actions, our thoughts, our personal information. "+
"It's all transformed into bits, stored in bits, communicated through bits. Its impossible for any person " +
"to move, to live, to operate at any level without the use of bits. " +
"And when a person moves, lives, and operates, they leave behind their bits, mere traces of seemingly " +
"meaningly fragments of information. But these bits can be reconstructed. Transformed. Used.<br><br>" +
"Those who run the bits, run the world",
BlackHandInfo: "This is real freedom, freedom to own property, make a profit, make your life. \n" +
"The West, so afraid of strong government, now has no government. Only financial power.\n" +
"And those at the top rule with an invisible hand. They built a society where the rich get richer,\n" +
"and everyone else suffers. \n\n" +
BlackHandInfo: "This is real freedom, freedom to own property, make a profit, make your life. " +
"The West, so afraid of strong government, now has no government. Only financial power. " +
"And those at the top rule with an invisible hand. They built a society where the rich get richer, " +
"and everyone else suffers.<br><br>" +
"So much pain. So many lives. Their darkness must end.",
NiteSecInfo:
@ -98,27 +99,26 @@ FactionInfo = {
" $$$$$$$$$$$$$$$$$ $$b : <br>",
//City factions, essentially governments
ChongqingInfo: "TODO",
Sector12Info: "TODO",
HongKongInfo: "TODO",
AevumInfo: "TODO",
IshimaInfo: "TODO",
VolhavenInfo: "TODO",
ChongqingInfo: "Serve the people",
Sector12Info: "The City of the Future",
HongKongInfo: "Asia's World City",
AevumInfo: "The Silicon City",
IshimaInfo: "The East Asian Order of the Future",
VolhavenInfo: "Benefit, Honour, and Glory",
//Criminal Organizations/Gangs
SpeakersForTheDeadInfo: "It is better to reign in hell than to serve in heaven.",
DarkArmyInfo: "The World doesn't care about right or wrong. It's all about power.",
TheSyndicateInfo: "TODO",
TheSyndicateInfo: "Honor holds you back",
SilhouetteInfo: "Corporations are so big, you don't even know who you're working for. That's terror. Terror built into the system.",
TetradsInfo: "Following the Mandate of HEaven and Carrying out the way",
TetradsInfo: "Following the Mandate of Heaven and Carrying out the Way",
SlumSnakesInfo: "Slum Snakes rule!",
//Earlygame factions - factions the player will prestige with early on that don't
//belong in other categories
NetburnersInfo: "~~//*>H4CK|\|3T 8URN3R5**>?>\\~~",

@ -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;}

@ -107,6 +107,11 @@ function prestigeAugmentation() {
Player.lastUpdate = new Date().getTime();
//Delete all running scripts objects
for (var i = 0; i < workerScripts.length; ++i) {
workerScripts[i].env.stopFlag = true;
}
var homeComp = Player.getHomeComputer();
//Delete all servers except home computer
for (var member in AllServers) {
@ -157,10 +162,6 @@ function prestigeAugmentation() {
s.moneyStolenMap.printConsole();
}
//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) {

@ -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) {
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) {
var targeting2 = Augmentations[AugmentationNames.Targeting2];
if (targeting2 == null) {
console.log("ERROR: Could not find Augmented Targeting II");
return;
}
if (targeting2.owned == false) {
} 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) {
var combatRib1 = Augmentations[AugmentationNames.CombatRib1];
if (combatRib1 == null) {
console.log("ERROR: Could not find Combat Rib I");
return;
}
if (combatRib1.owned == false) {
} 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) {
var combatRib2 = Augmentations[AugmentationNames.CombatRib2];
if (combatRib2 == null) {
console.log("ERROR: Could not find Combat Rib II");
return;
}
if (combatRib2.owned == false) {
} 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) {
var bionicSpine = Augmentations[AugmentationNames.BionicSpine];
if (bionicSpine == null) {
console.log("ERROR: Could not find Bionic Spine");
return;
}
if (bionicSpine.owned == false) {
} 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) {
var bionicLegs = Augmentations[AugmentationNames.BionicLegs];
if (bionicLegs == null) {
console.log("ERROR: Could not find Bionic Legs");
return;
}
if (bionicLegs.owned == false ) {
} 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) {
var coreImplant = Augmentations[AugmentationNames.ENMCore];
if (coreImplant == null) {
console.log("ERROR: Could not find ENM Core Implant");
return;
}
if (coreImplant.owned == false) {
} 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) {
var v2Upgrade = Augmentations[AugmentationNames.ENMCoreV2];
if (v2Upgrade == null) {
console.log("ERROR: Could not find ENM Core V2 upgrade");
return;
}
if (v2Upgrade.owned == false) {
} 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 ||
} 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) {
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) {
var pcdni = Augmentations[AugmentationNames.PCDNI];
if (pcdni == null) {
console.log("ERROR: Could not find PC Direct Neural Interface");
return;
}
if (pcdni.owned == false) {
} 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) {
var brachiblades = Augmentations[AugmentationNames.BrachiBlades];
if (brachiblades == null) {
console.log("ERROR: Could not find Brachi Blades aug");
return;
}
if (brachiblades.owned == false) {
} 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) {
var bionicarms = Augmentations[AugmentationNames.BionicArms];
if (bionicarms == null) {
console.log("ERORR: Could not find Bionic Arms aug");
return;
}
if (bionicarms.owned == false) {
} 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 " +