mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-12-20 05:05:47 +01:00
commit
125f244700
@ -16,24 +16,7 @@ PlayerObject.prototype.applyForJob = function(entryPosType) {
|
|||||||
var pos = entryPosType;
|
var pos = entryPosType;
|
||||||
|
|
||||||
if (!this.isQualified(company, pos)) {
|
if (!this.isQualified(company, pos)) {
|
||||||
var offset = company.jobStatReqOffset;
|
var reqText = getJobRequirementText(company, pos);
|
||||||
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 += ")";
|
|
||||||
dialogBoxCreate("Unforunately, you do not qualify for this position", reqText);
|
dialogBoxCreate("Unforunately, you do not qualify for this position", reqText);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -67,24 +50,7 @@ PlayerObject.prototype.applyForJob = function(entryPosType) {
|
|||||||
if (currCompany.companyName == company.companyName &&
|
if (currCompany.companyName == company.companyName &&
|
||||||
pos.positionName == currPositionName) {
|
pos.positionName == currPositionName) {
|
||||||
var nextPos = getNextCompanyPosition(pos);
|
var nextPos = getNextCompanyPosition(pos);
|
||||||
var offset = company.jobStatReqOffset;
|
var reqText = getJobRequirementText(company, nextPos);
|
||||||
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 += ")";
|
|
||||||
dialogBoxCreate("Unfortunately, you do not qualify for a promotion", reqText);
|
dialogBoxCreate("Unfortunately, you do not qualify for a promotion", reqText);
|
||||||
|
|
||||||
return; //Same job, do nothing
|
return; //Same job, do nothing
|
||||||
@ -120,6 +86,29 @@ PlayerObject.prototype.applyForJob = function(entryPosType) {
|
|||||||
Engine.loadLocationContent();
|
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() {
|
PlayerObject.prototype.applyForSoftwareJob = function() {
|
||||||
this.applyForJob(CompanyPositions.SoftwareIntern);
|
this.applyForJob(CompanyPositions.SoftwareIntern);
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
CONSTANTS = {
|
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
|
//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
|
//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");
|
dialogBoxCreate("ERR: Unrecognized crime type. This is probably a bug please contact the developer");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
chance *= Player.crime_success_mult;
|
|
||||||
if (Math.random() <= chance) {
|
if (Math.random() <= chance) {
|
||||||
//Success
|
//Success
|
||||||
Player.gainMoney(moneyGained);
|
Player.gainMoney(moneyGained);
|
||||||
@ -94,7 +94,7 @@ function determineCrimeChanceShoplift() {
|
|||||||
Player.defense / CONSTANTS.MaxSkillLevel +
|
Player.defense / CONSTANTS.MaxSkillLevel +
|
||||||
Player.dexterity / CONSTANTS.MaxSkillLevel +
|
Player.dexterity / CONSTANTS.MaxSkillLevel +
|
||||||
Player.agility / CONSTANTS.MaxSkillLevel)) * 10;
|
Player.agility / CONSTANTS.MaxSkillLevel)) * 10;
|
||||||
|
chance *= Player.crime_success_mult;
|
||||||
return Math.min(chance, 1);
|
return Math.min(chance, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -103,6 +103,7 @@ function determineCrimeChanceMug() {
|
|||||||
Player.defense / CONSTANTS.MaxSkillLevel +
|
Player.defense / CONSTANTS.MaxSkillLevel +
|
||||||
Player.dexterity / CONSTANTS.MaxSkillLevel +
|
Player.dexterity / CONSTANTS.MaxSkillLevel +
|
||||||
Player.agility / CONSTANTS.MaxSkillLevel)) * 5;
|
Player.agility / CONSTANTS.MaxSkillLevel)) * 5;
|
||||||
|
chance *= Player.crime_success_mult;
|
||||||
return Math.min(chance, 1);
|
return Math.min(chance, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -112,6 +113,7 @@ function determineCrimeChanceDealDrugs() {
|
|||||||
Player.defense / CONSTANTS.MaxSkillLevel +
|
Player.defense / CONSTANTS.MaxSkillLevel +
|
||||||
Player.dexterity / CONSTANTS.MaxSkillLevel +
|
Player.dexterity / CONSTANTS.MaxSkillLevel +
|
||||||
Player.agility / CONSTANTS.MaxSkillLevel));
|
Player.agility / CONSTANTS.MaxSkillLevel));
|
||||||
|
chance *= Player.crime_success_mult;
|
||||||
return Math.min(chance, 1);
|
return Math.min(chance, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -121,6 +123,7 @@ function determineCrimeChanceTraffickArms() {
|
|||||||
Player.defense / CONSTANTS.MaxSkillLevel +
|
Player.defense / CONSTANTS.MaxSkillLevel +
|
||||||
Player.dexterity / CONSTANTS.MaxSkillLevel +
|
Player.dexterity / CONSTANTS.MaxSkillLevel +
|
||||||
Player.agility / CONSTANTS.MaxSkillLevel)) / 2;
|
Player.agility / CONSTANTS.MaxSkillLevel)) / 2;
|
||||||
|
chance *= Player.crime_success_mult;
|
||||||
return Math.min(chance, 1);
|
return Math.min(chance, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -129,6 +132,7 @@ function determineCrimeChanceHomicide() {
|
|||||||
Player.defense / CONSTANTS.MaxSkillLevel +
|
Player.defense / CONSTANTS.MaxSkillLevel +
|
||||||
Player.dexterity / CONSTANTS.MaxSkillLevel +
|
Player.dexterity / CONSTANTS.MaxSkillLevel +
|
||||||
Player.agility / CONSTANTS.MaxSkillLevel));
|
Player.agility / CONSTANTS.MaxSkillLevel));
|
||||||
|
chance *= Player.crime_success_mult;
|
||||||
return Math.min(chance, 1);
|
return Math.min(chance, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -139,6 +143,7 @@ function determineCrimeChanceGrandTheftAuto() {
|
|||||||
4 * Player.dexterity / CONSTANTS.MaxSkillLevel +
|
4 * Player.dexterity / CONSTANTS.MaxSkillLevel +
|
||||||
Player.agility / 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);
|
return Math.min(chance, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -148,6 +153,7 @@ function determineCrimeChanceKidnap() {
|
|||||||
Player.defense / CONSTANTS.MaxSkillLevel +
|
Player.defense / CONSTANTS.MaxSkillLevel +
|
||||||
Player.dexterity / CONSTANTS.MaxSkillLevel +
|
Player.dexterity / CONSTANTS.MaxSkillLevel +
|
||||||
Player.agility / CONSTANTS.MaxSkillLevel)) / 6;
|
Player.agility / CONSTANTS.MaxSkillLevel)) / 6;
|
||||||
|
chance *= Player.crime_success_mult;
|
||||||
return Math.min(chance, 1);
|
return Math.min(chance, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -156,6 +162,7 @@ function determineCrimeChanceAssassination() {
|
|||||||
Player.defense / CONSTANTS.MaxSkillLevel +
|
Player.defense / CONSTANTS.MaxSkillLevel +
|
||||||
Player.dexterity / 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);
|
return Math.min(chance, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -166,5 +173,6 @@ function determineCrimeChanceHeist() {
|
|||||||
Player.dexterity / CONSTANTS.MaxSkillLevel +
|
Player.dexterity / CONSTANTS.MaxSkillLevel +
|
||||||
Player.agility / 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);
|
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.",
|
CovenantInfo: "Yesterday we obeyed kings and bent our necks to emperors. Today we kneel only to truth.",
|
||||||
|
|
||||||
//Megacorporations, each forms its own faction
|
//Megacorporations, each forms its own faction
|
||||||
ECorpInfo: "ECorp's mission is simple: to connect the world of today with the technology of tomorrow.\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\n" +
|
"With our wide range of Internet-related software and commercial hardware, ECorp makes the world's " +
|
||||||
"information universally accessible.",
|
"information universally accessible.",
|
||||||
|
|
||||||
MegaCorpInfo: "MegaCorp does things that others don't. We imagine. We create. We invent. We build things that\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\n" +
|
"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.\n\n" +
|
"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.",
|
"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>" +
|
BachmanAndAssociatesInfo: "Where Law and Business meet - thats where we are. <br><br>" +
|
||||||
"Legal Insight - Business Instinct - Experience Innovation",
|
"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.",
|
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",
|
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.",
|
KuaiGongInternationalInfo: "Dream big. Work hard. Make history.",
|
||||||
|
|
||||||
@ -46,18 +47,18 @@ FactionInfo = {
|
|||||||
FulcrumSecretTechnologiesInfo: "TODO",
|
FulcrumSecretTechnologiesInfo: "TODO",
|
||||||
|
|
||||||
//Hacker groups
|
//Hacker groups
|
||||||
BitRunnersInfo: "Our entire lives are controlled by bits. All of our actions, our thoughts, our personal information. \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. It’s impossible for any person\n" +
|
"It's all transformed into bits, stored in bits, communicated through bits. It’s impossible for any person " +
|
||||||
"to move, to live, to operate at any level without the use of bits.\n\n" +
|
"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\n" +
|
"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.\n\n" +
|
"meaningly fragments of information. But these bits can be reconstructed. Transformed. Used.<br><br>" +
|
||||||
"Those who run the bits, run the world",
|
"Those who run the bits, run the world",
|
||||||
|
|
||||||
|
|
||||||
BlackHandInfo: "This is real freedom, freedom to own property, make a profit, make your life. \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.\n" +
|
"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,\n" +
|
"And those at the top rule with an invisible hand. They built a society where the rich get richer, " +
|
||||||
"and everyone else suffers. \n\n" +
|
"and everyone else suffers.<br><br>" +
|
||||||
"So much pain. So many lives. Their darkness must end.",
|
"So much pain. So many lives. Their darkness must end.",
|
||||||
|
|
||||||
NiteSecInfo:
|
NiteSecInfo:
|
||||||
@ -98,27 +99,26 @@ FactionInfo = {
|
|||||||
" $$$$$$$$$$$$$$$$$ $$b : <br>",
|
" $$$$$$$$$$$$$$$$$ $$b : <br>",
|
||||||
|
|
||||||
//City factions, essentially governments
|
//City factions, essentially governments
|
||||||
ChongqingInfo: "TODO",
|
ChongqingInfo: "Serve the people",
|
||||||
Sector12Info: "TODO",
|
Sector12Info: "The City of the Future",
|
||||||
HongKongInfo: "TODO",
|
HongKongInfo: "Asia's World City",
|
||||||
AevumInfo: "TODO",
|
AevumInfo: "The Silicon City",
|
||||||
IshimaInfo: "TODO",
|
IshimaInfo: "The East Asian Order of the Future",
|
||||||
VolhavenInfo: "TODO",
|
VolhavenInfo: "Benefit, Honour, and Glory",
|
||||||
|
|
||||||
//Criminal Organizations/Gangs
|
//Criminal Organizations/Gangs
|
||||||
SpeakersForTheDeadInfo: "It is better to reign in hell than to serve in heaven.",
|
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.",
|
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.",
|
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!",
|
SlumSnakesInfo: "Slum Snakes rule!",
|
||||||
|
|
||||||
|
|
||||||
//Earlygame factions - factions the player will prestige with early on that don't
|
//Earlygame factions - factions the player will prestige with early on that don't
|
||||||
//belong in other categories
|
//belong in other categories
|
||||||
NetburnersInfo: "~~//*>H4CK|\|3T 8URN3R5**>?>\\~~",
|
NetburnersInfo: "~~//*>H4CK|\|3T 8URN3R5**>?>\\~~",
|
||||||
|
@ -16,13 +16,13 @@ function evaluate(exp, workerScript) {
|
|||||||
case "str":
|
case "str":
|
||||||
case "bool":
|
case "bool":
|
||||||
return new Promise(function(resolve, reject) {
|
return new Promise(function(resolve, reject) {
|
||||||
if (env.stopFlag) {reject(workerScript);}
|
if (env.stopFlag) {reject(workerScript); return;}
|
||||||
resolve(exp.value);
|
resolve(exp.value);
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
case "var":
|
case "var":
|
||||||
return new Promise(function(resolve, reject) {
|
return new Promise(function(resolve, reject) {
|
||||||
if (env.stopFlag) {reject(workerScript);}
|
if (env.stopFlag) {reject(workerScript); return;}
|
||||||
if (exp.value == "hacknetnodes") {
|
if (exp.value == "hacknetnodes") {
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
var pEvaluateHacknetNode = evaluateHacknetNode(exp, workerScript);
|
var pEvaluateHacknetNode = evaluateHacknetNode(exp, workerScript);
|
||||||
@ -44,7 +44,7 @@ function evaluate(exp, workerScript) {
|
|||||||
//Can currently only assign to "var"s
|
//Can currently only assign to "var"s
|
||||||
case "assign":
|
case "assign":
|
||||||
return new Promise(function(resolve, reject) {
|
return new Promise(function(resolve, reject) {
|
||||||
if (env.stopFlag) {reject(workerScript);}
|
if (env.stopFlag) {reject(workerScript); return;}
|
||||||
|
|
||||||
if (exp.left.type != "var")
|
if (exp.left.type != "var")
|
||||||
reject("|" + workerScript.serverIp + "|" + workerScript.name + "| Cannot assign to " + JSON.stringify(exp.left));
|
reject("|" + workerScript.serverIp + "|" + workerScript.name + "| Cannot assign to " + JSON.stringify(exp.left));
|
||||||
@ -74,7 +74,7 @@ function evaluate(exp, workerScript) {
|
|||||||
|
|
||||||
case "binary":
|
case "binary":
|
||||||
return new Promise(function(resolve, reject) {
|
return new Promise(function(resolve, reject) {
|
||||||
if (env.stopFlag) {reject(workerScript);}
|
if (env.stopFlag) {reject(workerScript); return;}
|
||||||
|
|
||||||
var pLeft = new Promise(function(resolve, reject) {
|
var pLeft = new Promise(function(resolve, reject) {
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
@ -152,7 +152,7 @@ function evaluate(exp, workerScript) {
|
|||||||
break;
|
break;
|
||||||
case "for":
|
case "for":
|
||||||
return new Promise(function(resolve, reject) {
|
return new Promise(function(resolve, reject) {
|
||||||
if (env.stopFlag) {reject(workerScript);}
|
if (env.stopFlag) {reject(workerScript); return;}
|
||||||
|
|
||||||
var pInit = new Promise(function(resolve, reject) {
|
var pInit = new Promise(function(resolve, reject) {
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
@ -179,7 +179,7 @@ function evaluate(exp, workerScript) {
|
|||||||
break;
|
break;
|
||||||
case "while":
|
case "while":
|
||||||
return new Promise(function(resolve, reject) {
|
return new Promise(function(resolve, reject) {
|
||||||
if (env.stopFlag) {reject(workerScript);}
|
if (env.stopFlag) {reject(workerScript); return;}
|
||||||
|
|
||||||
var pEvaluateWhile = evaluateWhile(exp, workerScript);
|
var pEvaluateWhile = evaluateWhile(exp, workerScript);
|
||||||
pEvaluateWhile.then(function(whileLoopRes) {
|
pEvaluateWhile.then(function(whileLoopRes) {
|
||||||
@ -191,7 +191,7 @@ function evaluate(exp, workerScript) {
|
|||||||
break;
|
break;
|
||||||
case "prog":
|
case "prog":
|
||||||
return new Promise(function(resolve, reject) {
|
return new Promise(function(resolve, reject) {
|
||||||
if (env.stopFlag) {reject(workerScript);}
|
if (env.stopFlag) {reject(workerScript); return;}
|
||||||
|
|
||||||
var evaluateProgPromise = evaluateProg(exp, workerScript, 0);
|
var evaluateProgPromise = evaluateProg(exp, workerScript, 0);
|
||||||
evaluateProgPromise.then(function(w) {
|
evaluateProgPromise.then(function(w) {
|
||||||
@ -224,10 +224,11 @@ function evaluate(exp, workerScript) {
|
|||||||
// return evaluate(arg, env);
|
// return evaluate(arg, env);
|
||||||
//}));
|
//}));
|
||||||
return new Promise(function(resolve, reject) {
|
return new Promise(function(resolve, reject) {
|
||||||
if (env.stopFlag) {reject(workerScript);}
|
if (env.stopFlag) {reject(workerScript); return;}
|
||||||
|
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
if (exp.func.value == "hack") {
|
if (exp.func.value == "hack") {
|
||||||
|
if (env.stopFlag) {reject(workerScript); return;}
|
||||||
if (exp.args.length != 1) {
|
if (exp.args.length != 1) {
|
||||||
reject("|" + workerScript.serverIp + "|" + workerScript.name + "|Hack() call has incorrect number of arguments. Takes 1 argument");
|
reject("|" + workerScript.serverIp + "|" + workerScript.name + "|Hack() call has incorrect number of arguments. Takes 1 argument");
|
||||||
return;
|
return;
|
||||||
@ -235,6 +236,7 @@ function evaluate(exp, workerScript) {
|
|||||||
var ipPromise = evaluate(exp.args[0], workerScript);
|
var ipPromise = evaluate(exp.args[0], workerScript);
|
||||||
|
|
||||||
ipPromise.then(function(ip) {
|
ipPromise.then(function(ip) {
|
||||||
|
if (env.stopFlag) {reject(workerScript); return;}
|
||||||
var server = getServer(ip);
|
var server = getServer(ip);
|
||||||
if (server == null) {
|
if (server == null) {
|
||||||
reject("|" + workerScript.serverIp + "|" + workerScript.name + "|Invalid IP or hostname passed into hack() command");
|
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");
|
workerScript.scriptRef.log("Attempting to hack " + ip + " in " + hackingTime.toFixed(3) + " seconds");
|
||||||
|
|
||||||
var p = new Promise(function(resolve, reject) {
|
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.");
|
console.log("Hacking " + server.hostname + " after " + hackingTime.toString() + " seconds.");
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
if (env.stopFlag) {reject(workerScript);}
|
if (env.stopFlag) {reject(workerScript); return;}
|
||||||
var hackChance = scriptCalculateHackingChance(server);
|
var hackChance = scriptCalculateHackingChance(server);
|
||||||
var rand = Math.random();
|
var rand = Math.random();
|
||||||
var expGainedOnSuccess = scriptCalculateExpGain(server);
|
var expGainedOnSuccess = scriptCalculateExpGain(server);
|
||||||
@ -355,13 +357,14 @@ function evaluate(exp, workerScript) {
|
|||||||
reject(e);
|
reject(e);
|
||||||
});
|
});
|
||||||
} else if (exp.func.value == "grow") {
|
} else if (exp.func.value == "grow") {
|
||||||
|
if (env.stopFlag) {reject(workerScript); return;}
|
||||||
if (exp.args.length != 1) {
|
if (exp.args.length != 1) {
|
||||||
reject("|" + workerScript.serverIp + "|" + workerScript.name + "|grow() call has incorrect number of arguments. Takes 1 argument");
|
reject("|" + workerScript.serverIp + "|" + workerScript.name + "|grow() call has incorrect number of arguments. Takes 1 argument");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var ipPromise = evaluate(exp.args[0], workerScript);
|
var ipPromise = evaluate(exp.args[0], workerScript);
|
||||||
ipPromise.then(function(ip) {
|
ipPromise.then(function(ip) {
|
||||||
if (env.stopFlag) {reject(workerScript);}
|
if (env.stopFlag) {reject(workerScript); return;}
|
||||||
var server = getServer(ip);
|
var server = getServer(ip);
|
||||||
if (server == null) {
|
if (server == null) {
|
||||||
reject("|" + workerScript.serverIp + "|" + workerScript.name + "|Invalid IP or hostname passed into grow() command");
|
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");
|
workerScript.scriptRef.log("Executing grow() on server " + server.hostname + " in " + formatNumber(growTime/1000, 3) + " seconds");
|
||||||
|
|
||||||
var p = new Promise(function(resolve, reject) {
|
var p = new Promise(function(resolve, reject) {
|
||||||
if (env.stopFlag) {reject(workerScript);}
|
if (env.stopFlag) {reject(workerScript); return;}
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
server.moneyAvailable += 1; //It can be grown even if it has no money
|
server.moneyAvailable += 1; //It can be grown even if it has no money
|
||||||
var growthPercentage = processSingleServerGrowth(server, 450);
|
var growthPercentage = processSingleServerGrowth(server, 450);
|
||||||
@ -407,7 +410,7 @@ function evaluate(exp, workerScript) {
|
|||||||
}
|
}
|
||||||
var ipPromise = evaluate(exp.args[0], workerScript);
|
var ipPromise = evaluate(exp.args[0], workerScript);
|
||||||
ipPromise.then(function(ip) {
|
ipPromise.then(function(ip) {
|
||||||
if (env.stopFlag) {reject(workerScript);}
|
if (env.stopFlag) {reject(workerScript); return;}
|
||||||
var server = getServer(ip);
|
var server = getServer(ip);
|
||||||
if (server == null) {
|
if (server == null) {
|
||||||
reject("|" + workerScript.serverIp + "|" + workerScript.name + "|Invalid IP or hostname passed into nuke() command");
|
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");
|
workerScript.scriptRef.log("Running NUKE.exe on server " + server.hostname + " in 5 seconds");
|
||||||
var p = new Promise(function(resolve, reject) {
|
var p = new Promise(function(resolve, reject) {
|
||||||
if (env.stopFlag) {reject(workerScript);}
|
if (env.stopFlag) {reject(workerScript); return;}
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
if (server.hasAdminRights) {
|
if (server.hasAdminRights) {
|
||||||
workerScript.scriptRef.log("Already have root access to " + server.hostname);
|
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);
|
var ipPromise = evaluate(exp.args[0], workerScript);
|
||||||
ipPromise.then(function(ip) {
|
ipPromise.then(function(ip) {
|
||||||
if (env.stopFlag) {reject(workerScript);}
|
if (env.stopFlag) {reject(workerScript); return;}
|
||||||
var server = getServer(ip);
|
var server = getServer(ip);
|
||||||
if (server == null) {
|
if (server == null) {
|
||||||
reject("|" + workerScript.serverIp + "|" + workerScript.name + "|Invalid IP or hostname passed into brutessh() command");
|
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");
|
workerScript.scriptRef.log("Running BruteSSH.exe on server " + server.hostname + " in 10 seconds");
|
||||||
var p = new Promise(function(resolve, reject) {
|
var p = new Promise(function(resolve, reject) {
|
||||||
if (env.stopFlag) {reject(workerScript);}
|
if (env.stopFlag) {reject(workerScript); return;}
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
if (!server.sshPortOpen) {
|
if (!server.sshPortOpen) {
|
||||||
workerScript.scriptRef.log("Executed BruteSSH.exe virus on " + server.hostname + " to open SSH port (22)");
|
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);
|
var ipPromise = evaluate(exp.args[0], workerScript);
|
||||||
ipPromise.then(function(ip) {
|
ipPromise.then(function(ip) {
|
||||||
if (env.stopFlag) {reject(workerScript);}
|
if (env.stopFlag) {reject(workerScript); return;}
|
||||||
var server = getServer(ip);
|
var server = getServer(ip);
|
||||||
if (server == null) {
|
if (server == null) {
|
||||||
reject("|" + workerScript.serverIp + "|" + workerScript.name + "|Invalid IP or hostname passed into ftpcrack() command");
|
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");
|
workerScript.scriptRef.log("Running FTPCrack.exe on server " + server.hostname + " in 15 seconds");
|
||||||
var p = new Promise(function(resolve, reject) {
|
var p = new Promise(function(resolve, reject) {
|
||||||
if (env.stopFlag) {reject(workerScript);}
|
if (env.stopFlag) {reject(workerScript); return;}
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
if (!server.ftpPortOpen) {
|
if (!server.ftpPortOpen) {
|
||||||
workerScript.scriptRef.log("Executed FTPCrack.exe virus on " + server.hostname + " to open FTP port (21)");
|
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);
|
var ipPromise = evaluate(exp.args[0], workerScript);
|
||||||
ipPromise.then(function(ip) {
|
ipPromise.then(function(ip) {
|
||||||
if (env.stopFlag) {reject(workerScript);}
|
if (env.stopFlag) {reject(workerScript); return;}
|
||||||
var server = getServer(ip);
|
var server = getServer(ip);
|
||||||
if (server == null) {
|
if (server == null) {
|
||||||
reject("|" + workerScript.serverIp + "|" + workerScript.name + "|Invalid IP or hostname passed into relaysmtp() command");
|
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");
|
workerScript.scriptRef.log("Running relaySMTP.exe on server " + server.hostname + " in 20 seconds");
|
||||||
var p = new Promise(function(resolve, reject) {
|
var p = new Promise(function(resolve, reject) {
|
||||||
if (env.stopFlag) {reject(workerScript);}
|
if (env.stopFlag) {reject(workerScript); return;}
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
if (!server.smtpPortOpen) {
|
if (!server.smtpPortOpen) {
|
||||||
workerScript.scriptRef.log("Executed relaySMTP.exe virus on " + server.hostname + " to open SMTP port (25)");
|
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);
|
var ipPromise = evaluate(exp.args[0], workerScript);
|
||||||
ipPromise.then(function(ip) {
|
ipPromise.then(function(ip) {
|
||||||
if (env.stopFlag) {reject(workerScript);}
|
if (env.stopFlag) {reject(workerScript); return;}
|
||||||
var server = getServer(ip);
|
var server = getServer(ip);
|
||||||
if (server == null) {
|
if (server == null) {
|
||||||
reject("|" + workerScript.serverIp + "|" + workerScript.name + "|Invalid IP or hostname passed into relaysmtp() command");
|
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");
|
workerScript.scriptRef.log("Running HTTPWorm.exe on server " + server.hostname + " in 25 seconds");
|
||||||
var p = new Promise(function(resolve, reject) {
|
var p = new Promise(function(resolve, reject) {
|
||||||
if (env.stopFlag) {reject(workerScript);}
|
if (env.stopFlag) {reject(workerScript); return;}
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
if (!server.httpPortOpen) {
|
if (!server.httpPortOpen) {
|
||||||
workerScript.scriptRef.log("Executed HTTPWorm.exe virus on " + server.hostname + " to open HTTP port (25)");
|
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);
|
var ipPromise = evaluate(exp.args[0], workerScript);
|
||||||
ipPromise.then(function(ip) {
|
ipPromise.then(function(ip) {
|
||||||
if (env.stopFlag) {reject(workerScript);}
|
if (env.stopFlag) {reject(workerScript); return;}
|
||||||
var server = getServer(ip);
|
var server = getServer(ip);
|
||||||
if (server == null) {
|
if (server == null) {
|
||||||
reject("|" + workerScript.serverIp + "|" + workerScript.name + "|Invalid IP or hostname passed into sqlinject() command");
|
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");
|
workerScript.scriptRef.log("Running SQLInject.exe on server " + server.hostname + " in 30 seconds");
|
||||||
var p = new Promise(function(resolve, reject) {
|
var p = new Promise(function(resolve, reject) {
|
||||||
if (env.stopFlag) {reject(workerScript);}
|
if (env.stopFlag) {reject(workerScript); return;}
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
if (!server.sqlPortOpen) {
|
if (!server.sqlPortOpen) {
|
||||||
workerScript.scriptRef.log("Executed SQLInject.exe virus on " + server.hostname + " to open SQL port (1433)");
|
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);
|
var ipPromise = evaluate(exp.args[0], workerScript);
|
||||||
ipPromise.then(function(ip) {
|
ipPromise.then(function(ip) {
|
||||||
if (env.stopFlag) {reject(workerScript);}
|
if (env.stopFlag) {reject(workerScript); return;}
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
var server = getServer(ip);
|
var server = getServer(ip);
|
||||||
if (server == null) {
|
if (server == null) {
|
||||||
@ -690,7 +693,7 @@ function evaluate(exp, workerScript) {
|
|||||||
}
|
}
|
||||||
var scriptNamePromise = evaluate(exp.args[0], workerScript);
|
var scriptNamePromise = evaluate(exp.args[0], workerScript);
|
||||||
scriptNamePromise.then(function(scriptname) {
|
scriptNamePromise.then(function(scriptname) {
|
||||||
if (env.stopFlag) {reject(workerScript);}
|
if (env.stopFlag) {reject(workerScript); return;}
|
||||||
var scriptServer = getServer(workerScript.serverIp);
|
var scriptServer = getServer(workerScript.serverIp);
|
||||||
if (scriptServer == null) {
|
if (scriptServer == null) {
|
||||||
reject("|"+workerScript.serverIp+"|"+workerScript.name+"|Could not find server. This is a bug in the game. Report to game dev");
|
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;
|
return;
|
||||||
}
|
}
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
if (env.stopFlag) {reject(workerScript);}
|
if (env.stopFlag) {reject(workerScript); return;}
|
||||||
Player.updateSkillLevels();
|
Player.updateSkillLevels();
|
||||||
workerScript.scriptRef.log("getHackingLevel() returned " + Player.hacking_skill);
|
workerScript.scriptRef.log("getHackingLevel() returned " + Player.hacking_skill);
|
||||||
resolve(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);
|
workerScript.scriptRef.log("Purchased new Hacknet Node with name: " + name);
|
||||||
resolve(numOwned);
|
resolve(numOwned);
|
||||||
}, CONSTANTS.CodeInstructionRunTime);
|
}, CONSTANTS.CodeInstructionRunTime);
|
||||||
|
} else {
|
||||||
|
reject(makeRuntimeRejectMsg(workerScript, "Invalid function: " + exp.func.value));
|
||||||
}
|
}
|
||||||
}, CONSTANTS.CodeInstructionRunTime);
|
}, CONSTANTS.CodeInstructionRunTime);
|
||||||
});
|
});
|
||||||
@ -887,7 +892,7 @@ function evaluateIf(exp, workerScript, i) {
|
|||||||
function evaluateFor(exp, workerScript) {
|
function evaluateFor(exp, workerScript) {
|
||||||
var env = workerScript.env;
|
var env = workerScript.env;
|
||||||
return new Promise(function(resolve, reject) {
|
return new Promise(function(resolve, reject) {
|
||||||
if (env.stopFlag) {reject(workerScript);}
|
if (env.stopFlag) {reject(workerScript); return;}
|
||||||
|
|
||||||
var pCond = new Promise(function(resolve, reject) {
|
var pCond = new Promise(function(resolve, reject) {
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
@ -954,7 +959,7 @@ function evaluateWhile(exp, workerScript) {
|
|||||||
var env = workerScript.env;
|
var env = workerScript.env;
|
||||||
|
|
||||||
return new Promise(function(resolve, reject) {
|
return new Promise(function(resolve, reject) {
|
||||||
if (env.stopFlag) {reject(workerScript);}
|
if (env.stopFlag) {reject(workerScript); return;}
|
||||||
|
|
||||||
var pCond = new Promise(function(resolve, reject) {
|
var pCond = new Promise(function(resolve, reject) {
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
@ -1108,7 +1113,7 @@ function evaluateProg(exp, workerScript, index) {
|
|||||||
var env = workerScript.env;
|
var env = workerScript.env;
|
||||||
|
|
||||||
return new Promise(function(resolve, reject) {
|
return new Promise(function(resolve, reject) {
|
||||||
if (env.stopFlag) {reject(workerScript);}
|
if (env.stopFlag) {reject(workerScript); return;}
|
||||||
|
|
||||||
if (index >= exp.prog.length) {
|
if (index >= exp.prog.length) {
|
||||||
resolve("progFinished");
|
resolve("progFinished");
|
||||||
@ -1177,7 +1182,7 @@ function apply_op(op, a, b) {
|
|||||||
function runScriptFromScript(server, scriptname, workerScript) {
|
function runScriptFromScript(server, scriptname, workerScript) {
|
||||||
return new Promise(function(resolve, reject) {
|
return new Promise(function(resolve, reject) {
|
||||||
var env = workerScript.env;
|
var env = workerScript.env;
|
||||||
if (env.stopFlag) {reject(workerScript);}
|
if (env.stopFlag) {reject(workerScript); return;}
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
//Check if the script is already running
|
//Check if the script is already running
|
||||||
for (var i = 0; i < server.runningScripts.length; ++i) {
|
for (var i = 0; i < server.runningScripts.length; ++i) {
|
||||||
@ -1259,7 +1264,7 @@ function scriptCalculateExpGain(server) {
|
|||||||
function scriptCalculatePercentMoneyHacked(server) {
|
function scriptCalculatePercentMoneyHacked(server) {
|
||||||
var difficultyMult = (100 - server.hackDifficulty) / 100;
|
var difficultyMult = (100 - server.hackDifficulty) / 100;
|
||||||
var skillMult = (Player.hacking_skill - (server.requiredHackingSkill - 1)) / Player.hacking_skill;
|
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 < 0) {return 0;}
|
||||||
if (percentMoneyHacked > 1) {return 1;}
|
if (percentMoneyHacked > 1) {return 1;}
|
||||||
return percentMoneyHacked;
|
return percentMoneyHacked;
|
||||||
|
@ -243,7 +243,7 @@ PlayerObject.prototype.calculateHackingTime = function() {
|
|||||||
PlayerObject.prototype.calculatePercentMoneyHacked = function() {
|
PlayerObject.prototype.calculatePercentMoneyHacked = function() {
|
||||||
var difficultyMult = (100 - this.getCurrentServer().hackDifficulty) / 100;
|
var difficultyMult = (100 - this.getCurrentServer().hackDifficulty) / 100;
|
||||||
var skillMult = (this.hacking_skill - (this.getCurrentServer().requiredHackingSkill - 1)) / this.hacking_skill;
|
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);
|
console.log("Percent money hacked calculated to be: " + percentMoneyHacked);
|
||||||
if (percentMoneyHacked < 0) {return 0;}
|
if (percentMoneyHacked < 0) {return 0;}
|
||||||
if (percentMoneyHacked > 1) {return 1;}
|
if (percentMoneyHacked > 1) {return 1;}
|
||||||
|
@ -107,6 +107,11 @@ function prestigeAugmentation() {
|
|||||||
|
|
||||||
Player.lastUpdate = new Date().getTime();
|
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();
|
var homeComp = Player.getHomeComputer();
|
||||||
//Delete all servers except home computer
|
//Delete all servers except home computer
|
||||||
for (var member in AllServers) {
|
for (var member in AllServers) {
|
||||||
@ -157,10 +162,6 @@ function prestigeAugmentation() {
|
|||||||
s.moneyStolenMap.printConsole();
|
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
|
//Delete active scripts display elements
|
||||||
var list = Engine.ActiveScriptsList.querySelectorAll('#active-scripts-list li');
|
var list = Engine.ActiveScriptsList.querySelectorAll('#active-scripts-list li');
|
||||||
for (var i = list.length-1; i >= 0; --i) {
|
for (var i = list.length-1; i >= 0; --i) {
|
||||||
|
@ -39,119 +39,45 @@ purchaseAugmentationBoxCreate = function(aug, fac) {
|
|||||||
newConfirmButton.addEventListener("click", function() {
|
newConfirmButton.addEventListener("click", function() {
|
||||||
|
|
||||||
//TODO Requirements for specific augmentations (e.g Embedded Netburner Module b4 its upgrades)
|
//TODO Requirements for specific augmentations (e.g Embedded Netburner Module b4 its upgrades)
|
||||||
if (aug.name == AugmentationNames.Targeting2) {
|
if (aug.name == AugmentationNames.Targeting2 &&
|
||||||
var targeting1 = Augmentations[AugmentationNames.Targeting1];
|
Augmentations[AugmentationNames.Targeting1].owned == false) {
|
||||||
if (targeting1 == null) {
|
dialogBoxCreate("You must first install Augmented Targeting I before you can upgrade it to Augmented Targeting II");
|
||||||
console.log("ERROR: Could not find Augmented Targeting I");
|
} else if (aug.name == AugmentationNames.Targeting3 &&
|
||||||
return;
|
Augmentations[AugmentationNames.Targeting2].owned == false) {
|
||||||
}
|
dialogBoxCreate("You must first install Augmented Targeting II before you can upgrade it to Augmented Targeting III");
|
||||||
if (targeting1.owned == false) {
|
} else if (aug.name == AugmentationNames.CombatRib2 &&
|
||||||
dialogBoxCreate("You must first install Augmented Targeting I before you can upgrade it to Augmented Targeting II");
|
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.Targeting3) {
|
} else if (aug.name == AugmentationNames.CombatRib3 &&
|
||||||
var targeting2 = Augmentations[AugmentationNames.Targeting2];
|
Augmentations[AugmentationNames.CombatRib2].owned == false) {
|
||||||
if (targeting2 == null) {
|
dialogBoxCreate("You must first install Combat Rib II before you can upgrade it to Combat Rib III");
|
||||||
console.log("ERROR: Could not find Augmented Targeting II");
|
} else if (aug.name == AugmentationNames.GrapheneBionicSpine &&
|
||||||
return;
|
Augmentations[AugmentationNames.BionicSpine].owned == false) {
|
||||||
}
|
dialogBoxCreate("You must first install a Bionic Spine before you can upgrade it to a Graphene Bionic Spine");
|
||||||
if (targeting2.owned == false) {
|
} else if (aug.name == AugmentationNames.GrapheneBionicLegs &&
|
||||||
dialogBoxCreate("You must first install Augmented Targeting II before you can upgrade it to Augmented Targeting III");
|
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.CombatRib2) {
|
} else if (aug.name == AugmentationNames.ENMCoreV2 &&
|
||||||
var combatRib1 = Augmentations[AugmentationNames.CombatRib1];
|
Augmentations[AugmentationNames.ENMCore].owned == false) {
|
||||||
if (combatRib1 == null) {
|
dialogBoxCreate("You must first install Embedded Netburner Module Core Implant before you can upgrade it to V2");
|
||||||
console.log("ERROR: Could not find Combat Rib I");
|
} else if (aug.name == AugmentationNames.ENMCoreV3 &&
|
||||||
return;
|
Augmentations[AugmentationNames.ENMCoreV2].owned == false) {
|
||||||
}
|
dialogBoxCreate("You must first install Embedded Netburner Module Core V2 Upgrade before you can upgrade it to V3");
|
||||||
if (combatRib1.owned == false) {
|
} else if ((aug.name == AugmentationNames.ENMCore ||
|
||||||
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 ||
|
|
||||||
aug.name == AugmentationNames.ENMAnalyzeEngine ||
|
aug.name == AugmentationNames.ENMAnalyzeEngine ||
|
||||||
aug.name == AugmentationNames.ENMDMA) {
|
aug.name == AugmentationNames.ENMDMA) &&
|
||||||
var enm = Augmentations[AugmentationNames.ENM];
|
Augmentations[AugmentationNames.ENM].owned == false) {
|
||||||
if (enm == null) {
|
dialogBoxCreate("You must first install the Embedded Netburner Module before installing any upgrades to it");
|
||||||
console.log("ERROR: Could not find ENM");
|
} else if ((aug.name == AugmentationNames.PCDNIOptimizer ||
|
||||||
return;
|
aug.name == AugmentationNames.PCDNINeuralNetwork) &&
|
||||||
}
|
Augmentations[AugmentationNames.PCDNI].owned == false) {
|
||||||
if (enm.owned == false) {
|
dialogBoxCreate("You must first install the Pc Direct-Neural Interface before installing this upgrade");
|
||||||
dialogBoxCreate("You must first install the Embedded Netburner Module before installing any upgrades to it");
|
} 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.PCDNIOptimizer ||
|
} else if (aug.name == AugmentationNames.GrapheneBionicArms &&
|
||||||
aug.name == AugmentationNames.PCDNINeuralNetwork) {
|
Augmentations[AugmentationNames.BionicArms].owned == false) {
|
||||||
var pcdni = Augmentations[AugmentationNames.PCDNI];
|
dialogBoxCreate("You must first install the Bionic Arms augmentation before installing this upgrade");
|
||||||
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");
|
|
||||||
}
|
|
||||||
} else if (Player.money >= (aug.baseCost * fac.augmentationPriceMult)) {
|
} else if (Player.money >= (aug.baseCost * fac.augmentationPriceMult)) {
|
||||||
applyAugmentation(aug);
|
applyAugmentation(aug);
|
||||||
dialogBoxCreate("You slowly drift to sleep as " + fac.name + "'s scientists put you under " +
|
dialogBoxCreate("You slowly drift to sleep as " + fac.name + "'s scientists put you under " +
|
||||||
|
Loading…
Reference in New Issue
Block a user