Added Bladeburner API (untested). Rebalanced Bladeburner. Bladeburner progress no longer resets when installing Augmentations. Fixed up BN-12

This commit is contained in:
danielyxie 2018-06-08 10:51:48 -05:00
parent 2332532d91
commit 5e38355152
16 changed files with 2480 additions and 738 deletions

1130
dist/engine.bundle.js vendored

File diff suppressed because it is too large Load Diff

@ -25,6 +25,14 @@
ga('send', 'pageview');
</script>
<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<script>
(adsbygoogle = window.adsbygoogle || []).push({
google_ad_client: "ca-pub-8908225340346450",
enable_page_level_ads: true
});
</script>
</head>
<body>
<div id="entire-game-container" style="visibility:hidden;">

@ -1552,7 +1552,7 @@ function initAugmentations() {
var BladeburnersFactionName = "Bladeburners";
if (factionExists(BladeburnersFactionName)) {
var EsperEyewear = new Augmentation({
name:AugmentationNames.EsperEyewear, repCost:400, moneyCost:30e6,
name:AugmentationNames.EsperEyewear, repCost:500, moneyCost:33e6,
info:"Ballistic-grade protective and retractable eyewear that was designed specially " +
"for Bladeburner units. This " +
"is implanted by installing a mechanical frame in the skull's orbit. " +
@ -1569,7 +1569,7 @@ function initAugmentations() {
resetAugmentation(EsperEyewear);
var EMS4Recombination = new Augmentation({
name:AugmentationNames.EMS4Recombination, repCost: 800, moneyCost:50e6,
name:AugmentationNames.EMS4Recombination, repCost: 1e3, moneyCost:55e6,
info:"A DNA recombination of the EMS-4 Gene. This genetic engineering " +
"technique was originally used on Bladeburners during the Synthoid uprising " +
"to induce wakefulness and concentration, suppress fear, reduce empathy, and " +
@ -1583,7 +1583,7 @@ function initAugmentations() {
resetAugmentation(EMS4Recombination);
var OrionShoulder = new Augmentation({
name:AugmentationNames.OrionShoulder, repCost:2e3, moneyCost:100e6,
name:AugmentationNames.OrionShoulder, repCost:2.5e3, moneyCost:110e6,
info:"A bionic shoulder augmentation for the right shoulder. Using cybernetics, " +
"the ORION-MKIV shoulder enhances the strength and dexterity " +
"of the user's right arm. It also provides protection due to its " +
@ -1597,7 +1597,7 @@ function initAugmentations() {
resetAugmentation(OrionShoulder);
var HyperionV1 = new Augmentation({
name:AugmentationNames.HyperionV1, repCost: 4e3, moneyCost:500e6,
name:AugmentationNames.HyperionV1, repCost: 5e3, moneyCost:550e6,
info:"A pair of mini plasma cannons embedded into the hands. The Hyperion is capable " +
"of rapidly firing bolts of high-density plasma. The weapon is meant to " +
"be used against augmented enemies as the ionized " +
@ -1611,7 +1611,7 @@ function initAugmentations() {
resetAugmentation(HyperionV1);
var HyperionV2 = new Augmentation({
name:AugmentationNames.HyperionV2, repCost:8e3, moneyCost:1e9,
name:AugmentationNames.HyperionV2, repCost:10e3, moneyCost:1.1e9,
info:"A pair of mini plasma cannons embedded into the hands. This augmentation " +
"is more advanced and powerful than the original V1 model. This V2 model is " +
"more power-efficiency, more accurate, and can fire plasma bolts at a much " +
@ -1624,7 +1624,7 @@ function initAugmentations() {
resetAugmentation(HyperionV2);
var GolemSerum = new Augmentation({
name:AugmentationNames.GolemSerum, repCost:10e3, moneyCost:2e9,
name:AugmentationNames.GolemSerum, repCost:12.5e3, moneyCost:2.2e9,
info:"A serum that permanently enhances many aspects of a human's capabilities, " +
"including strength, speed, immune system performance, and mitochondrial efficiency. The " +
"serum was originally developed by the Chinese military in an attempt to " +
@ -1637,7 +1637,7 @@ function initAugmentations() {
resetAugmentation(GolemSerum);
var VangelisVirus = new Augmentation({
name:AugmentationNames.VangelisVirus, repCost:6e3, moneyCost:500e6,
name:AugmentationNames.VangelisVirus, repCost:7.5e3, moneyCost:550e6,
info:"A synthetic symbiotic virus that is injected into the human brain tissue. The Vangelis virus " +
"heightens the senses and focus of its host, and also enhances its intuition.<br><br>" +
"This augmentation:<br>" +
@ -1649,7 +1649,7 @@ function initAugmentations() {
resetAugmentation(VangelisVirus);
var VangelisVirus3 = new Augmentation({
name:AugmentationNames.VangelisVirus3, repCost:12e3, moneyCost:2e9,
name:AugmentationNames.VangelisVirus3, repCost:15e3, moneyCost:2.2e9,
info:"An improved version of Vangelis, a synthetic symbiotic virus that is " +
"injected into the human brain tissue. On top of the benefits of the original " +
"virus, this also grants an accelerated healing factor and enhanced " +
@ -1664,7 +1664,7 @@ function initAugmentations() {
resetAugmentation(VangelisVirus3);
var INTERLINKED = new Augmentation({
name:AugmentationNames.INTERLINKED, repCost:8e3, moneyCost:1e9,
name:AugmentationNames.INTERLINKED, repCost:10e3, moneyCost:1.1e9,
info:"The DNA is genetically modified to enhance the human's body " +
"extracellular matrix (ECM). This improves the ECM's ability to " +
"structurally support the body and grants heightened strength and " +
@ -1677,7 +1677,7 @@ function initAugmentations() {
resetAugmentation(INTERLINKED);
var BladeRunner = new Augmentation({
name:AugmentationNames.BladeRunner, repCost:8e3, moneyCost:1.5e9,
name:AugmentationNames.BladeRunner, repCost:8e3, moneyCost:1.65e9,
info:"A cybernetic foot augmentation that was specially created for Bladeburners " +
"during the Synthoid Uprising. The organic musculature of the human foot " +
"is enhanced with flexible carbon nanotube matrices that are controlled by " +
@ -1691,7 +1691,7 @@ function initAugmentations() {
resetAugmentation(BladeRunner);
var BladeArmor = new Augmentation({
name:AugmentationNames.BladeArmor, repCost:4e3, moneyCost:250e6,
name:AugmentationNames.BladeArmor, repCost:5e3, moneyCost:275e6,
info:"A powered exoskeleton suit (exosuit) designed as armor for Bladeburner units. This " +
"exoskeleton is incredibly adaptable and can protect the wearer from blunt, piercing, " +
"concussive, thermal, chemical, and electric trauma. It also enhances the user's " +
@ -1705,7 +1705,7 @@ function initAugmentations() {
resetAugmentation(BladeArmor);
var BladeArmorPowerCells = new Augmentation({
name:AugmentationNames.BladeArmorPowerCells, repCost:6e3, moneyCost:500e6,
name:AugmentationNames.BladeArmorPowerCells, repCost:7.5e3, moneyCost:550e6,
info:"Upgrades the BLADE-51b Tesla Armor with Ion Power Cells, which are capable of " +
"more efficiently storing and using power.<br><br>" +
"This augmentation:<br>" +
@ -1718,7 +1718,7 @@ function initAugmentations() {
resetAugmentation(BladeArmorPowerCells);
var BladeArmorEnergyShielding = new Augmentation({
name:AugmentationNames.BladeArmorEnergyShielding, repCost:7e3, moneyCost:1e9,
name:AugmentationNames.BladeArmorEnergyShielding, repCost:8.5e3, moneyCost:1.1e9,
info:"Upgrades the BLADE-51b Tesla Armor with a plasma energy propulsion system " +
"that is capable of projecting an energy shielding force field.<br><br>" +
"This augmentation:<br>" +
@ -1730,7 +1730,7 @@ function initAugmentations() {
resetAugmentation(BladeArmorEnergyShielding);
var BladeArmorUnibeam = new Augmentation({
name:AugmentationNames.BladeArmorUnibeam, repCost:10e3, moneyCost:3e9,
name:AugmentationNames.BladeArmorUnibeam, repCost:12.5e3, moneyCost:3.3e9,
info:"Upgrades the BLADE-51b Tesla Armor with a concentrated deuterium-fluoride laser " +
"weapon. It's precision an accuracy makes it useful for quickly neutralizing " +
"threats while keeping casualties to a minimum.<br><br>" +
@ -1742,7 +1742,7 @@ function initAugmentations() {
resetAugmentation(BladeArmorUnibeam);
var BladeArmorOmnibeam = new Augmentation({
name:AugmentationNames.BladeArmorOmnibeam, repCost:20e3, moneyCost:5e9,
name:AugmentationNames.BladeArmorOmnibeam, repCost:25e3, moneyCost:5.5e9,
info:"Upgrades the BLADE-51b Tesla Armor Unibeam augmentation to use " +
"multiple-fiber system. The upgraded weapon uses multiple fiber laser " +
"modules that combine together to form a single, more powerful beam of up to " +
@ -1755,7 +1755,7 @@ function initAugmentations() {
resetAugmentation(BladeArmorOmnibeam);
var BladeArmorIPU = new Augmentation({
name:AugmentationNames.BladeArmorIPU, repCost: 5e3, moneyCost:200e6,
name:AugmentationNames.BladeArmorIPU, repCost: 6e3, moneyCost:220e6,
info:"Upgrades the BLADE-51b Tesla Armor with an AI Information Processing " +
"Unit that was specially designed to analyze Synthoid related data and " +
"information.<br><br>" +

@ -156,7 +156,11 @@ function initBitNodes() {
"Level 1: 24%<br>" +
"Level 2: 36%<br>" +
"Level 3: 42%");
BitNodes["BitNode12"] = new BitNode(12, "The testing ground", "Ender improvement center", "Something about this bitnode being the testing ground for the enders security. This bitnode is infinitely repeatable but gets harder each time. This awards Source-File 12 which awards 1% to all stats each time this bitnode is destroyed.");
BitNodes["BitNode12"] = new BitNode(12, "The Recursion", "Repeat.",
"To iterate is human, to recurse divine.<br><br>" +
"Every time this BitNode is destroyed, it becomes slightly harder. Destroying this BitNode will give your Souce-File 12, or " +
"if you already have this Source-File it will upgrade its level. There is no maximum level for Source-File 12. Each level " +
"of Source-File 12 will increase all of your multipliers by 1%.");
//Books: Frontera, Shiner
BitNodes["BitNode13"] = new BitNode(13, "fOS", "COMING SOON"); //Unlocks the new game mode and the rest of the BitNodes
BitNodes["BitNode14"] = new BitNode(14, "", "COMING SOON");
@ -231,10 +235,10 @@ function initBitNodeMultipliers() {
BitNodeMultipliers.RepToDonateToFaction = 0.5;
BitNodeMultipliers.AugmentationRepCost = 3;
BitNodeMultipliers.AugmentationMoneyCost = 3;
BitNodeMultipliers.ServerMaxMoney = 0.25;
BitNodeMultipliers.ServerStartingMoney = 0.25;
BitNodeMultipliers.ServerGrowthRate = 0.20;
BitNodeMultipliers.ScriptHackMoney = 0.25;
BitNodeMultipliers.ServerMaxMoney = 0.2;
BitNodeMultipliers.ServerStartingMoney = 0.2;
BitNodeMultipliers.ServerGrowthRate = 0.2;
BitNodeMultipliers.ScriptHackMoney = 0.2;
BitNodeMultipliers.CompanyWorkMoney = 0.25;
BitNodeMultipliers.CrimeMoney = 0.25;
BitNodeMultipliers.HacknetNodeMoney = 0.25;
@ -303,12 +307,12 @@ function initBitNodeMultipliers() {
BitNodeMultipliers.InfiltrationRep = 2.5;
BitNodeMultipliers.CorporationValuation = 0.01;
break;
case 12: //The Testing Ground
case 12: //The Recursion
let sf12Lvl = 0;
for(let i = 0; i < Player.sourceFiles.length; i++) {
if(Player.sourceFiles[i].n == 12) {
sf12Lvl = Player.sourceFiles[i].lvl;
}
for (let i = 0; i < Player.sourceFiles.length; i++) {
if (Player.sourceFiles[i].n === 12) {
sf12Lvl = Player.sourceFiles[i].lvl;
}
}
const inc = Math.pow(1.01, sf12Lvl);
const dec = Math.pow(0.99, sf12Lvl);
@ -319,11 +323,8 @@ function initBitNodeMultipliers() {
BitNodeMultipliers.ServerGrowthRate = dec;
BitNodeMultipliers.ServerWeakenRate = dec;
//this one is special because it can cause the min
//security to go over 100 and make it impossible to
//get money through hacking. This stat should not be
//BitNodeMultipliers.ServerStartingSecurity = inc;
//Does not scale, otherwise security might start at 300+
BitNodeMultipliers.ServerStartingSecurity = 1.5;
BitNodeMultipliers.ManualHackMoney = dec;
BitNodeMultipliers.ScriptHackMoney = dec;
@ -354,4 +355,8 @@ function initBitNodeMultipliers() {
}
}
export {initBitNodes, BitNode, BitNodes, BitNodeMultipliers, initBitNodeMultipliers};
export {initBitNodes,
BitNode,
BitNodes,
BitNodeMultipliers,
initBitNodeMultipliers};

@ -45,13 +45,14 @@ var BaseIntGain = 0.001; //Base intelligence stat gain
var ActionCountGrowthPeriod = 300; //Time (s) it takes for action count to grow by its specified value
var RankToFactionRepFactor = 2; //Delta Faction Rep = this * Delta Rank
var RankNeededForFaction = 25;
var ContractSuccessesPerLevel = 15; //How many successes you need to level up a contract
var OperationSuccessesPerLevel = 10; //How many successes you need to level up an op
var ContractSuccessesPerLevel = 3; //How many successes you need to level up a contract
var OperationSuccessesPerLevel = 2.5; //How many successes you need to level up an op
var RanksPerSkillPoint = 4; //How many ranks needed to get 1 Skill Point
var ContractBaseMoneyGain = 5e3; //Base Money Gained per contract
var ContractBaseMoneyGain = 10e3; //Base Money Gained per contract
//DOM related variables
var ActiveActionCssClass = "bladeburner-active-action";
@ -533,6 +534,16 @@ Action.prototype.getActionTime = function(inst) {
}
}
Action.prototype.getSuccessesNeededForNextLevel = function(baseSuccessesPerLevel) {
return (0.5) * (this.maxLevel) * (2 * baseSuccessesPerLevel + (this.maxLevel-1));
}
Action.prototype.setMaxLevel = function(baseSuccessesPerLevel) {
if (this.successes > this.getSuccessesNeededForNextLevel(baseSuccessesPerLevel)) {
++this.maxLevel;
}
}
Action.prototype.toJSON = function() {
return Generic_toJSON("Action", this);
}
@ -1021,6 +1032,7 @@ Bladeburner.prototype.resetAction = function() {
}
Bladeburner.prototype.startAction = function(actionId) {
if (actionId == null) {return;}
this.action = actionId;
this.actionTimeCurrent = 0;
switch (actionId.type) {
@ -1067,10 +1079,7 @@ Bladeburner.prototype.startAction = function(actionId) {
this.actionTimeToComplete = 30;
break;
case ActionTypes["Recruitment"]:
var effCharisma = Player.charisma * this.skillMultipliers.effCha;
var charismaFactor = Math.pow(effCharisma, 0.81) + effCharisma / 90;
var time = Math.max(10, Math.round(BaseRecruitmentTimeNeeded - charismaFactor));
this.actionTimeToComplete = time;
this.actionTimeToComplete = this.getRecruitmentTime();
break;
case ActionTypes["FieldAnalysis"]:
case ActionTypes["Field Analysis"]:
@ -1130,9 +1139,9 @@ Bladeburner.prototype.completeAction = function() {
}
if (isOperation) {
action.maxLevel = Math.floor(action.successes / OperationSuccessesPerLevel) + 1;
this.setMaxLevel(OperationSuccessesPerLevel);
} else {
action.maxLevel = Math.floor(action.successes / ContractSuccessesPerLevel) + 1;
this.setMaxLevel(ContractSuccessesPerLevel);
}
if (action.rankGain) {
var gain = addOffset(action.rankGain * rewardMultiplier, 10);
@ -1301,7 +1310,7 @@ Bladeburner.prototype.completeAction = function() {
this.startAction(this.action); //Repeat action
break;
case ActionTypes["Recruitment"]:
var successChance = Math.pow(Player.charisma, 0.45) / (this.teamSize + 1);
var successChance = this.getRecruitmentSuccessChance();
console.log("Bladeburner recruitment success chance: " + successChance);
if (Math.random() < successChance) {
var expGain = 2 * BaseStatGain * this.actionTimeToComplete;
@ -1437,6 +1446,16 @@ Bladeburner.prototype.completeOperation = function(success) {
}
}
Bladeburner.prototype.getRecruitmentTime = function() {
var effCharisma = Player.charisma * this.skillMultipliers.effCha;
var charismaFactor = Math.pow(effCharisma, 0.81) + effCharisma / 90;
return Math.max(10, Math.round(BaseRecruitmentTimeNeeded - charismaFactor));
}
Bladeburner.prototype.getRecruitmentSuccessChance = function() {
return Math.pow(Player.charisma, 0.45) / (this.teamSize + 1);
}
//Process stat gains from Contracts, Operations, and Black Operations
//@action(Action obj) - Derived action class
//@success(bool) - Whether action was successful
@ -1851,7 +1870,7 @@ Bladeburner.prototype.createOverviewContent = function() {
Engine.loadFactionContent();
displayFactionContent(bladeburnersFactionName);
} else {
if (this.rank >= 25) {
if (this.rank >= RankNeededForFaction) {
joinFaction(bladeburnerFac);
dialogBoxCreate("Congratulations! You were accepted into the Bladeburners faction");
removeChildrenFromElement(DomElems.overviewDiv);
@ -2322,7 +2341,9 @@ Bladeburner.prototype.updateContractsUIElement = function(el, action) {
appendLineBreaks(el, 2);
el.appendChild(createElement("pre", {
display:"inline-block",
innerText:"Level: " + action.level + " / " + action.maxLevel
innerText:"Level: " + action.level + " / " + action.maxLevel,
tooltip:action.getSuccessesNeededForNextLevel(ContractSuccessesPerLevel) + " successes " +
"needed for next level"
}));
el.appendChild(createElement("a", {
class: maxLevel ? "a-link-button-inactive" : "a-link-button", innerHTML:"&uarr;",
@ -2454,7 +2475,9 @@ Bladeburner.prototype.updateOperationsUIElement = function(el, action) {
appendLineBreaks(el, 2);
el.appendChild(createElement("pre", {
display:"inline-block",
innerText:"Level: " + action.level + " / " + action.maxLevel
innerText:"Level: " + action.level + " / " + action.maxLevel,
tooltip:action.getSuccessesNeededForNextLevel(OperationSuccessesPerLevel) + " successes " +
"needed for next level"
}));
el.appendChild(createElement("a", {
class: maxLevel ? "a-link-button-inactive" : "a-link-button", innerHTML:"&uarr;",
@ -2633,6 +2656,7 @@ Bladeburner.prototype.updateSkillsUIElement = function(el, skill) {
class: canLevel && !maxLvl ? "a-link-button" : "a-link-button-inactive",
margin:"3px", padding:"3px",
clickListener:()=>{
if (this.skillPoints < pointCost) {return;}
this.skillPoints -= pointCost;
this.upgradeSkill(skill);
this.createActionAndSkillsContent();
@ -3143,6 +3167,397 @@ Bladeburner.prototype.executeStartConsoleCommand = function(args) {
}
}
Bladeburner.prototype.getActionIdFromTypeAndName = function(type="", name="") {
if (type === "" || name === "") {return null;}
var action = new ActionIdentifier();
var convertedType = type.toLowerCase().trim();
var convertedName = name.toLowerCase().trim();
switch (convertedType) {
case "contract":
case "contracts":
action.type = ActionTypes["Contract"];
if (this.contracts.hasOwnProperty(name)) {
action.name = name;
return action;
} else {
return null;
}
case "operation":
case "operations":
case "op":
case "ops":
action.type = ActionTypes["Operation"];
if (this.operations.hasOwnProperty(name)) {
action.name = name;
return action;
} else {
return null;
}
case "blackoperation":
case "black operation":
case "black operations":
case "black op":
case "black ops":
case "blackop":
case "blackops":
action.type = ActionTypes["BlackOp"];
if (BlackOperations.hasOwnProperty(name)) {
action.name = name;
return action;
} else {
return null;
}
case "general":
case "general action":
case "gen":
break;
default:
return null;
}
if (convertedType.startsWith("gen")) {
switch (convertedName) {
case "training":
action.type = ActionTypes["Training"];
break;
case "recruitment":
case "recruit":
action.type = ActionTypes["Recruitment"];
break;
case "field analysis":
case "fieldanalysis":
action.type = ActionTypes["Field Analysis"];
break;
default:
return null;
}
return action;
}
}
Bladeburner.prototype.isContractNameNetscriptFn = function(name) {
return this.contracts.hasOwnProperty(name);
}
Bladeburner.prototype.isOperationNameNetscriptFn = function(name) {
return this.operations.hasOwnProperty(name);
}
Bladeburner.prototype.isBlackOpNameNetscriptFn = function(name) {
return BlackOperations.hasOwnProperty(name);
}
Bladeburner.prototype.isGeneralActionNameNetscriptFn = function(name) {
return GeneralActions.hasOwnProperty(name);
}
Bladeburner.prototype.isSkillNameNetscriptFn = function(name) {
return Skills.hasOwnProperty(name);
}
Bladeburner.prototype.startActionNetscriptFn = function(type, name, workerScript) {
var errorLogText = "ERROR: Bladeburner.startAction() failed due to an invalid action specified. " +
"Type: " + type + ", Name: " + name + ". Note that for contracts and operations, the " +
"name of the operation is case-sensitive.";
var actionId = this.getActionIdFromTypeAndName(type, name);
if (actionId == null) {
workerScript.log(errorLogText);
return false;
}
try {
this.startAction(actionId);
if (workerScript.shouldLog("startAction")) {
workerScript.scriptRef.log("Starting Bladeburner action with type " + type + " and name " + name);
}
return true;
} catch(e) {
this.resetAction();
workerScript.scriptRef.log("ERROR: Bladeburner.startAction() failed to start action of type " + type + " due to invalid name: " + name +
"Note that this name is case-sensitive and whitespace-sensitive");
return false;
}
}
Bladeburner.prototype.getActionTimeNetscriptFn = function(type, name, workerScript) {
var errorLogText = "ERROR: Bladeburner.getActionTime() failed due to an invalid action specified. " +
"Type: " + type + ", Name: " + name + ". Note that for contracts and operations, the " +
"name of the operation is case-sensitive.";
var actionId = this.getActionIdFromTypeAndName(type, name);
if (actionId == null) {
workerScript.log(errorLogText);
return -1;
}
var actionObj = this.getActionObject(actionId);
if (actionObj == null) {
workerScript.log(errorLogText);
return -1;
}
switch (actionId.type) {
case ActionTypes["Contract"]:
case ActionTypes["Operation"]:
case ActionTypes["BlackOp"]:
case ActionTypes["BlackOperation"]:
return actionObj.getActionTime(this);
case ActionTypes["Training"]:
case ActionTypes["Field Analysis"]:
case ActionTypes["FieldAnalysis"]:
return 30;
case ActionTypes["Recruitment"]:
return this.getRecruitmentTime();
default:
workerScript.log(errorLogText);
return -1;
}
}
Bladeburner.prototype.getActionEstimatedSuccessChanceNetscriptFn = function(type, name, workerScript) {
var errorLogText = "ERROR: Bladeburner.getActionEstimatedSuccessChance() failed due to an invalid action specified. " +
"Type: " + type + ", Name: " + name + ". Note that for contracts and operations, the " +
"name of the operation is case-sensitive.";
var actionId = this.getActionIdFromTypeAndName(type, name);
if (actionId == null) {
workerScript.log(errorLogText);
return -1;
}
var actionObj = this.getActionObject(actionId);
if (actionObj == null) {
workerScript.log(errorLogText);
return -1;
}
switch (actionId.type) {
case ActionTypes["Contract"]:
case ActionTypes["Operation"]:
case ActionTypes["BlackOp"]:
case ActionTypes["BlackOperation"]:
return actionObj.getSuccessChance(this);
case ActionTypes["Training"]:
case ActionTypes["Field Analysis"]:
case ActionTypes["FieldAnalysis"]:
return 1;
case ActionTypes["Recruitment"]:
return this.getRecruitmentSuccessChance();
default:
workerScript.log(errorLogText);
return -1;
}
}
Bladeburner.prototype.getActionCountRemainingNetscriptFn = function(type, name, workerScript) {
var errorLogText = "ERROR: Bladeburner.getActionCountRemaining() failed due to an invalid action specified. " +
"Type: " + type + ", Name: " + name + ". Note that for contracts and operations, the " +
"name of the operation is case-sensitive.";
var actionId = this.getActionIdFromTypeAndName(type, name);
if (actionId == null) {
workerScript.log(errorLogText);
return -1;
}
var actionObj = this.getActionObject(actionId);
if (actionObj == null) {
workerScript.log(errorLogText);
return -1;
}
switch (actionId.type) {
case ActionTypes["Contract"]:
case ActionTypes["Operation"]:
case ActionTypes["BlackOp"]:
case ActionTypes["BlackOperation"]:
return actionObj.count;
case ActionTypes["Training"]:
case ActionTypes["Field Analysis"]:
case ActionTypes["FieldAnalysis"]:
return Infinity;
default:
workerScript.log(errorLogText);
return -1;
}
}
Bladeburner.prototype.getSkillLevelNetscriptFn = function(skillName, workerScript) {
var errorLogText = "ERROR: Bladeburner.getSkillLevel() failed due to an invalid skill specified: " +
skillName + ". Note that the name of the skill is case-sensitive";
if (skillName === "") {
//If skill name isn't specified, return an object with all of the player's skill levels
let copy = Object.assign({}, this.Skills);
return copy;
}
if (!Skills.hasOwnProperty(skillName)) {
workerScript.log(errorLogText);
return -1;
}
return Skills[skillName];
}
Bladeburner.prototype.upgradeSkillNetscriptFn = function(skillName, workerScript) {
var errorLogText = "ERROR: Bladeburner.upgradeSkill() failed due to an invalid skill specified: " +
skillName + ". Note that the name of the skill is case-sensitive";
if (!Skills.hasOwnProperty(skillName)) {
workerScript.log(errorLogText);
return false;
}
var skill = Skills[skillName];
var currentLevel = 0;
if (this.skills[skillName] && !isNaN(this.skills[skillName])) {
currentLevel = this.skills[skillName];
}
var cost = skill.baseCost + (currentLevel * skill.costInc);
if (this.skillPoints < cost) {
if (workerScript.shouldLog("upgradeSkill")) {
workerScript.log("Bladeburner.upgradeSkill() failed because you do not have enough " +
"skill points to upgrade " + skillName + " (You have " +
this.skillPoints + ", you need " + cost + ")");
}
return false;
}
this.skillPoints -= cost;
this.upgradeSkill(skill);
if (Engine.currentPage === Engine.Page.Bladeburner && DomElems.currentTab.toLowerCase() === "skills") {
this.createActionAndSkillsContent();
}
if (workerScript.shouldLog("upgradeSkill")) {
workerScript.log(skillName + " successfully upgraded to level " + this.skills[skillName]);
}
return true;
}
Bladeburner.prototype.getTeamSizeNetscriptFn = function(type, name, workerScript) {
if (type === "" && name === "") {
return this.teamSize;
}
var errorLogText = "ERROR: Bladeburner.getTeamSize() failed due to an invalid action specified. " +
"Type: " + type + ", Name: " + name + ". Note that for contracts and operations, the " +
"name of the operation is case-sensitive.";
var actionId = this.getActionIdFromTypeAndName(type, name);
if (actionId == null) {
workerScript.log(errorLogText);
return -1;
}
var actionObj = this.getActionObject(actionId);
if (actionObj == null) {
workerScript.log(errorLogText);
return -1;
}
if (actionId.type === ActionTypes["Operation"] ||
actionId.type === ActionTypes["BlackOp"] ||
actionId.type === ActionTypes["BlackOperation"]) {
return actionObj.teamCount;
} else {
return 0;
}
}
Bladeburner.prototype.setTeamSizeNetscriptFn = function(type, name, size, workerScript) {
var errorLogText = "ERROR: Bladeburner.setTeamSize() failed due to an invalid action specified. " +
"Type: " + type + ", Name: " + name + ". Note that for contracts and operations, the " +
"name of the operation is case-sensitive.";
var actionId = this.getActionIdFromTypeAndName(type, name);
if (actionId == null) {
workerScript.log(errorLogText);
return -1;
}
if (actionId.type !== ActionTypes["Operation"] ||
actionId.type !== ActionTypes["BlackOp"] ||
actionId.type !== ActionTypes["BlackOperation"]) {
workerScript.log("ERROR: Bladeburner.setTeamSize() failed. This function " +
"only works for Operations and BlackOps");
return -1;
}
var actionObj = this.getActionObject(actionId);
if (actionObj == null) {
workerScript.log(errorLogText);
return -1;
}
var sanitizedSize = Math.round(size);
if (isNaN(sanitizedSize)) {
workerScript.log("ERROR: Bladeburner.setTeamSize() failed due to an invalid 'size' argument: " + size);
return -1;
}
if (this.teamSize < sanitizedSize) {sanitizedSize = this.teamSize;}
actionObj.teamCount = sanitizedSize;
if (workerScript.shouldLog("setTeamSize")) {
workerScript.log("Team size for " + name + " set to " + sanitizedSize);
}
return sanitizedSize;
}
Bladeburner.prototype.getCityEstimatedPopulationNetscriptFn = function(cityName, workerScript) {
if (!this.cities.hasOwnProperty(cityName)) {
workerScript.log("ERROR: Bladeburner.getCityEstimatedPopulation() failed because the specified " +
"city was invalid: " + cityName + ". Note that this city argument is case-sensitive");
return -1;
}
return this.cities[cityName].popEst;
}
Bladeburner.prototype.getCityEstimatedCommunitiesNetscriptFn = function(cityName, workerScript) {
if (!this.cities.hasOwnProperty(cityName)) {
workerScript.log("ERROR: Bladeburner.getCityEstimatedCommunities() failed because the specified " +
"city was invalid: " + cityName + ". Note that this city argument is case-sensitive");
return -1;
}
return this.cities[cityName].commsEst;
}
Bladeburner.prototype.getCityChaosNetscriptFn = function(cityName, workerScript) {
if (!this.cities.hasOwnProperty(cityName)) {
workerScript.log("ERROR: Bladeburner.getCityChaos() failed because the specified " +
"city was invalid: " + cityName + ". Note that this city argument is case-sensitive");
return -1;
}
return this.cities[cityName].chaos;
}
Bladeburner.prototype.switchCityNetscriptFn = function(cityName, workerScript) {
if (!this.cities.hasOwnProperty(cityName)) {
workerScript.log("ERROR: Bladeburner.switchCity() failed because the specified " +
"city was invalid: " + cityName + ". Note that this city argument is case-sensitive");
return false;
}
this.city = cityName;
return true;
}
Bladeburner.prototype.joinBladeburnerFactionNetscriptFn = function(workerScript) {
var bladeburnerFac = Factions[bladeburnersFactionName];
if (bladeburnerFac.isMember) {
return true;
} else if (this.rank >= RankNeededForFaction) {
joinFaction(bladeburnerFac);
if (workerScript.shouldLog("joinBladeburnerFaction")) {
workerScript.log("Joined Bladeburners Faction");
}
if (Engine.currentPage === Engine.Page.Bladeburner) {
removeChildrenFromElement(DomElems.overviewDiv);
this.createOverviewContent();
}
return true;
} else {
if (workerScript.shouldLog("joinBladeburnerFaction")) {
workerScript.log("Failed to join Bladeburners Faction because " +
"you do not have the required " + RankNeededForFaction + " rank");
}
return false;
}
}
Bladeburner.prototype.toJSON = function() {
return Generic_toJSON("Bladeburner", this);
@ -3272,7 +3687,7 @@ function initBladeburner() {
"Zenyatta and RedWater by any means necessary. After the task " +
"is completed, the actions must be covered up from the general public.",
baseDifficulty:2000, reqdRank:2.5e3,
rankGain:25, rankLoss:10, hpLoss:100,
rankGain:50, rankLoss:10, hpLoss:100,
weights:{hack:0.1,str:0.2,def:0.2,dex:0.2,agi:0.2,cha:0, int:0.1},
decays:{hack:0.6,str:0.8,def:0.8,dex:0.8,agi:0.8,cha:0, int:0.75},
isKill:true
@ -3289,7 +3704,7 @@ function initBladeburner() {
"fabricated as a last resort. Be warned that AeroCorp has some of " +
"the most advanced security measures in the world.",
baseDifficulty:2500, reqdRank:5e3,
rankGain:30, rankLoss:15, hpLoss:50,
rankGain:60, rankLoss:15, hpLoss:50,
weights:{hack:0.2,str:0.15,def:0.15,dex:0.2,agi:0.2,cha:0, int:0.1},
decays:{hack:0.6,str:0.8,def:0.8,dex:0.8,agi:0.8,cha:0, int:0.75},
isStealth:true
@ -3308,7 +3723,7 @@ function initBladeburner() {
"investigate the sewer systems, and eliminate Samizdat. They must " +
"never publish anything again.",
baseDifficulty:3000, reqdRank:7.5e3,
rankGain:30, rankLoss:15, hpLoss:100,
rankGain:75, rankLoss:15, hpLoss:100,
weights:{hack:0.1,str:0.2,def:0.2,dex:0.2,agi:0.2,cha:0, int:0.1},
decays:{hack:0.6,str:0.8,def:0.8,dex:0.8,agi:0.8,cha:0, int:0.75},
isKill:true
@ -3326,7 +3741,7 @@ function initBladeburner() {
"also to destroy any information or research at the facility that " +
"is relevant to the Synthoids and their goals.",
baseDifficulty:4000, reqdRank:10e3,
rankGain:40, rankLoss:20, hpLoss:100,
rankGain:100, rankLoss:20, hpLoss:100,
weights:{hack:0.1,str:0.2,def:0.2,dex:0.2,agi:0.2,cha:0, int:0.1},
decays:{hack:0.6,str:0.8,def:0.8,dex:0.8,agi:0.8,cha:0, int:0.75},
isKill:true
@ -3340,7 +3755,7 @@ function initBladeburner() {
"that this deal does not happen.<br><br>" +
"Your task is to intercept the deal. Leave no survivors.",
baseDifficulty:5000, reqdRank:12.5e3,
rankGain:40, rankLoss:20, hpLoss:200,
rankGain:125, rankLoss:20, hpLoss:200,
weights:{hack:0,str:0.25,def:0.25,dex:0.25,agi:0.25,cha:0, int:0},
decays:{hack:0,str:0.8,def:0.8,dex:0.8,agi:0.8,cha:0, int:0.75},
isKill:true
@ -3355,7 +3770,7 @@ function initBladeburner() {
"the Red Rabbit brothel. Try to limit the number of other casualties, " +
"but do what you must to complete the mission.",
baseDifficulty:7500, reqdRank:15e3,
rankGain:50, rankLoss:20, hpLoss:25,
rankGain:200, rankLoss:20, hpLoss:25,
weights:{hack:0,str:0.2,def:0.2,dex:0.3,agi:0.3,cha:0, int:0},
decays:{hack:0,str:0.8,def:0.8,dex:0.8,agi:0.8,cha:0, int:0.75},
isKill:true,
@ -3372,7 +3787,7 @@ function initBladeburner() {
"have thus enlisted our help.<br><br>" +
"Your mission is to eradicate Juggernaut and his followers.",
baseDifficulty:10e3, reqdRank:20e3,
rankGain:75, rankLoss:40, hpLoss:300,
rankGain:300, rankLoss:40, hpLoss:300,
weights:{hack:0,str:0.25,def:0.25,dex:0.25,agi:0.25,cha:0, int:0},
decays:{hack:0,str:0.8,def:0.8,dex:0.8,agi:0.8,cha:0, int:0.75},
isKill:true,
@ -3388,7 +3803,7 @@ function initBladeburner() {
"in Los Angeles. Intelligence tells us that their base houses " +
"one of their Synthoid manufacturing units.",
baseDifficulty:12.5e3, reqdRank:25e3,
rankGain:100, rankLoss:50, hpLoss:500,
rankGain:500, rankLoss:50, hpLoss:500,
weights:{hack:0.05,str:0.2,def:0.2,dex:0.25,agi:0.25,cha:0, int:0.05},
decays:{hack:0.6,str:0.8,def:0.8,dex:0.8,agi:0.8,cha:0, int:0.75},
isKill:true,
@ -3408,7 +3823,7 @@ function initBladeburner() {
"operation. Your goal is to destroy this technology and eliminate" +
"anyone who was involved in its creation.",
baseDifficulty:15e3, reqdRank:30e3,
rankGain:120, rankLoss:60, hpLoss:1000,
rankGain:750, rankLoss:60, hpLoss:1000,
weights:{hack:0.05,str:0.2,def:0.2,dex:0.25,agi:0.25,cha:0, int:0.05},
decays:{hack:0.6,str:0.8,def:0.8,dex:0.8,agi:0.8,cha:0, int:0.75},
isKill:true
@ -3423,7 +3838,7 @@ function initBladeburner() {
"The goal of Operation Deckard is to hunt down these Synthoids and retire " +
"them. I don't need to tell you how critical this mission is.",
baseDifficulty:20e3, reqdRank:40e3,
rankGain:150, rankLoss:75, hpLoss:200,
rankGain:1e3, rankLoss:75, hpLoss:200,
weights:{hack:0,str:0.24,def:0.24,dex:0.24,agi:0.24,cha:0, int:0.04},
decays:{hack:0,str:0.8,def:0.8,dex:0.8,agi:0.8,cha:0, int:0.75},
isKill:true,
@ -3439,7 +3854,7 @@ function initBladeburner() {
"with Augmentations. Your task is to hunt down the associated Dark Army " +
"members and eliminate them.",
baseDifficulty:25e3, reqdRank:50e3,
rankGain:200, rankLoss:100, hpLoss:500,
rankGain:1.5e3, rankLoss:100, hpLoss:500,
weights:{hack:0.1,str:0.2,def:0.2,dex:0.2,agi:0.2,cha:0, int:0.1},
decays:{hack:0.6,str:0.8,def:0.8,dex:0.8,agi:0.8,cha:0, int:0.75},
isKill:true,
@ -3458,7 +3873,7 @@ function initBladeburner() {
"The goal of Operation Wallace is to destroy the Dark Army and " +
"Syndicate factions in Aevum immediately. Leave no survivors.",
baseDifficulty:30e3, reqdRank:75e3,
rankGain:500, rankLoss:150, hpLoss:1500,
rankGain:2e3, rankLoss:150, hpLoss:1500,
weights:{hack:0,str:0.24,def:0.24,dex:0.24,agi:0.24,cha:0, int:0.04},
decays:{hack:0.6,str:0.8,def:0.8,dex:0.8,agi:0.8,cha:0, int:0.75},
isKill:true
@ -3474,7 +3889,7 @@ function initBladeburner() {
"successfully return. In the event of failure, all of the operation's " +
"team members must not let themselves be captured alive.",
baseDifficulty:35e3, reqdRank:100e3,
rankGain:1e3, rankLoss:500, hpLoss:1500,
rankGain:2.5e3, rankLoss:500, hpLoss:1500,
weights:{hack:0.1,str:0.2,def:0.2,dex:0.2,agi:0.2,cha:0, int:0.1},
decays:{hack:0.6,str:0.8,def:0.8,dex:0.8,agi:0.8,cha:0, int:0.75},
isStealth:true
@ -3496,7 +3911,7 @@ function initBladeburner() {
"Infiltrate the compound, delete and destroy the work, and then find and kill the " +
"project lead.",
baseDifficulty:40e3, reqdRank:125e3,
rankGain:2e3, rankLoss:1e3, hpLoss:500,
rankGain:3e3, rankLoss:1e3, hpLoss:500,
weights:{hack:0.1,str:0.2,def:0.2,dex:0.2,agi:0.2,cha:0, int:0.1},
decays:{hack:0.6,str:0.8,def:0.8,dex:0.8,agi:0.8,cha:0, int:0.75},
isKill:true
@ -3513,7 +3928,7 @@ function initBladeburner() {
"The mission is to destroy this broadcast tower. Speed and " +
"stealth are of the upmost important for this.",
baseDifficulty:45e3, reqdRank:150e3,
rankGain:5e3, rankLoss:1e3, hpLoss:100,
rankGain:4e3, rankLoss:1e3, hpLoss:100,
weights:{hack:0.05,str:0.15,def:0.15,dex:0.3,agi:0.3,cha:0, int:0.05},
decays:{hack:0.6,str:0.8,def:0.8,dex:0.8,agi:0.8,cha:0, int:0.75},
isStealth:true
@ -3542,7 +3957,7 @@ function initBladeburner() {
"'The Covenant'. We have no prior intelligence about this " +
"organization, so you are going in blind.",
baseDifficulty:55e3, reqdRank:200e3,
rankGain:5e3, rankLoss:1e3, hpLoss:10e3,
rankGain:7.5e3, rankLoss:1e3, hpLoss:10e3,
weights:{hack:0,str:0.24,def:0.24,dex:0.24,agi:0.24,cha:0, int:0.04},
decays:{hack:0.6,str:0.8,def:0.8,dex:0.8,agi:0.8,cha:0, int:0.75},
isKill:true

@ -81,6 +81,8 @@ let CONSTANTS = {
ScriptSingularityFn2RamCost: 2,
ScriptSingularityFn3RamCost: 3,
ScriptBladeburnerApiBaseRamCost: 4,
MultithreadingRAMCost: 1,
NumNetscriptPorts: 20,
@ -487,6 +489,14 @@ let CONSTANTS = {
LatestUpdate:
"v0.37.3<br>" +
"* Bladeburner Changes:<br>" +
"*** Bladeburner progress is no longer reset when installing Augmentations<br>" +
"*** The number of successess needed to increase a Contract/Operation's max level now scales with the current max level (gradually gets harder)<br>" +
"*** All Bladeburner Augmentations are now slightly more expensive and require more reputation<br>" +
"*** Black Operations now give higher rank rewards<br>" +
"*** Doubled the base amount of money gained from Contracts<br>" +
"* Hacking is not slightly less profitable in BitNode-3<br>" +
"* Updated Hacknet Nodes UI - Implemented by Github user kopelli<br>" +
"* Bug Fix: Fixed an exploit that allowed calling any Netscript function without incurring any RAM Cost in NetscriptJS<br>"
}

@ -113,6 +113,10 @@ var possibleLogs = {
commitCrime: true,
shortStock: true,
sellShort: true,
startAction: true,
upgradeSkill: true,
setTeamSize: true,
joinBladeburnerFaction: true,
}
//Used to check and set flags for every Source File, despite the name of the function
@ -722,7 +726,7 @@ function NetscriptFunctions(workerScript) {
}
updateDynamicRam("scp", CONSTANTS.ScriptScpRamCost);
if (arguments.length !== 2 && arguments.length !== 3) {
throw makeRuntimeRejectMsg(workerScript, "Error: scp() call has incorrect number of arguments. Takes 2 or 3 arguments");
throw makeRuntimeRejectMsg(workerScript, "ERROR: scp() call has incorrect number of arguments. Takes 2 or 3 arguments");
}
if (scriptname && scriptname.constructor === Array) {
//Recursively call scp on all elements of array
@ -736,18 +740,18 @@ function NetscriptFunctions(workerScript) {
}
if (!scriptname.endsWith(".lit") && !isScriptFilename(scriptname) &&
!scriptname.endsWith("txt")) {
throw makeRuntimeRejectMsg(workerScript, "Error: scp() does not work with this file type. It only works for .script, .lit, and .txt files");
throw makeRuntimeRejectMsg(workerScript, "ERROR: scp() does not work with this file type. It only works for .script, .lit, and .txt files");
}
var destServer, currServ;
if (arguments.length === 3) { //scriptname, source, destination
if (scriptname === undefined || ip1 === undefined || ip2 === undefined) {
throw makeRuntimeRejectMsg(workerScript, "Error: scp() call has incorrect number of arguments. Takes 2 or 3 arguments");
throw makeRuntimeRejectMsg(workerScript, "ERROR: scp() call has incorrect number of arguments. Takes 2 or 3 arguments");
}
destServer = getServer(ip2);
if (destServer == null) {
throw makeRuntimeRejectMsg(workerScript, "Error: Invalid hostname/ip passed into scp() command: " + ip);
throw makeRuntimeRejectMsg(workerScript, "ERROR: Invalid hostname/ip passed into scp() command: " + ip);
}
currServ = getServer(ip1);
@ -756,11 +760,11 @@ function NetscriptFunctions(workerScript) {
}
} else if (arguments.length === 2) { //scriptname, destination
if (scriptname === undefined || ip1 === undefined) {
throw makeRuntimeRejectMsg(workerScript, "Error: scp() call has incorrect number of arguments. Takes 2 or 3 arguments");
throw makeRuntimeRejectMsg(workerScript, "ERROR: scp() call has incorrect number of arguments. Takes 2 or 3 arguments");
}
destServer = getServer(ip1);
if (destServer == null) {
throw makeRuntimeRejectMsg(workerScript, "Error: Invalid hostname/ip passed into scp() command: " + ip);
throw makeRuntimeRejectMsg(workerScript, "ERROR: Invalid hostname/ip passed into scp() command: " + ip);
}
currServ = getServer(workerScript.serverIp);
@ -1287,7 +1291,7 @@ function NetscriptFunctions(workerScript) {
throw makeRuntimeRejectMsg(workerScript, "Invalid stock symbol passed into buyStock()");
}
if (shares < 0 || isNaN(shares)) {
workerScript.scriptRef.log("Error: Invalid 'shares' argument passed to buyStock()");
workerScript.scriptRef.log("ERROR: Invalid 'shares' argument passed to buyStock()");
return 0;
}
shares = Math.round(shares);
@ -1328,7 +1332,7 @@ function NetscriptFunctions(workerScript) {
throw makeRuntimeRejectMsg(workerScript, "Invalid stock symbol passed into sellStock()");
}
if (shares < 0 || isNaN(shares)) {
workerScript.scriptRef.log("Error: Invalid 'shares' argument passed to sellStock()");
workerScript.scriptRef.log("ERROR: Invalid 'shares' argument passed to sellStock()");
return 0;
}
shares = Math.round(shares);
@ -1498,30 +1502,30 @@ function NetscriptFunctions(workerScript) {
var hostnameStr = String(hostname);
hostnameStr = hostnameStr.replace(/\s+/g, '');
if (hostnameStr == "") {
workerScript.scriptRef.log("Error: Passed empty string for hostname argument of purchaseServer()");
workerScript.scriptRef.log("ERROR: Passed empty string for hostname argument of purchaseServer()");
return "";
}
if (Player.purchasedServers.length >= CONSTANTS.PurchasedServerLimit) {
workerScript.scriptRef.log("Error: You have reached the maximum limit of " + CONSTANTS.PurchasedServerLimit +
workerScript.scriptRef.log("ERROR: You have reached the maximum limit of " + CONSTANTS.PurchasedServerLimit +
" servers. You cannot purchase any more.");
return "";
}
ram = Math.round(ram);
if (isNaN(ram) || !powerOfTwo(ram)) {
workerScript.scriptRef.log("Error: purchaseServer() failed due to invalid ram argument. Must be numeric and a power of 2");
workerScript.scriptRef.log("ERROR: purchaseServer() failed due to invalid ram argument. Must be numeric and a power of 2");
return "";
}
if (ram > CONSTANTS.PurchasedServerMaxRam) {
workerScript.scriptRef.log("Error: purchasedServer() failed because specified RAM was too high. Maximum RAM on a purchased server is " + CONSTANTS.PurchasedServerMaxRam + "GB");
workerScript.scriptRef.log("ERROR: purchasedServer() failed because specified RAM was too high. Maximum RAM on a purchased server is " + CONSTANTS.PurchasedServerMaxRam + "GB");
return "";
}
var cost = ram * CONSTANTS.BaseCostFor1GBOfRamServer;
if (Player.money.lt(cost)) {
workerScript.scriptRef.log("Error: Not enough money to purchase server. Need $" + formatNumber(cost, 2));
workerScript.scriptRef.log("ERROR: Not enough money to purchase server. Need $" + formatNumber(cost, 2));
return "";
}
var newServ = new Server({
@ -1554,12 +1558,12 @@ function NetscriptFunctions(workerScript) {
hostnameStr = hostnameStr.replace(/\s\s+/g, '');
var server = GetServerByHostname(hostnameStr);
if (server == null) {
workerScript.scriptRef.log("Error: Could not find server with hostname " + hostnameStr + ". deleteServer() failed");
workerScript.scriptRef.log("ERROR: Could not find server with hostname " + hostnameStr + ". deleteServer() failed");
return false;
}
if (!server.purchasedByPlayer || server.hostname === "home") {
workerScript.scriptRef.log("Error: Server " + server.hostname + " is not a purchased server. " +
workerScript.scriptRef.log("ERROR: Server " + server.hostname + " is not a purchased server. " +
"Cannot be deleted. deleteServer() failed");
return false;
}
@ -1568,19 +1572,19 @@ function NetscriptFunctions(workerScript) {
//Can't delete server you're currently connected to
if (server.isConnectedTo) {
workerScript.scriptRef.log("Error: deleteServer() failed because you are currently connected to the server you are trying to delete");
workerScript.scriptRef.log("ERROR: deleteServer() failed because you are currently connected to the server you are trying to delete");
return false;
}
//A server cannot delete itself
if (ip === workerScript.serverIp) {
workerScript.scriptRef.log("Error: Cannot call deleteServer() on self. deleteServer() failed");
workerScript.scriptRef.log("ERROR: Cannot call deleteServer() on self. deleteServer() failed");
return false;
}
//Delete all scripts running on server
if (server.runningScripts.length > 0) {
workerScript.scriptRef.log("Error: Cannot delete server " + server.hostname + " because it still has scripts running.");
workerScript.scriptRef.log("ERROR: Cannot delete server " + server.hostname + " because it still has scripts running.");
return false;
}
@ -1595,7 +1599,7 @@ function NetscriptFunctions(workerScript) {
}
if (!found) {
workerScript.scriptRef.log("Error: Could not identify server " + server.hostname +
workerScript.scriptRef.log("ERROR: Could not identify server " + server.hostname +
"as a purchased server. This is likely a bug please contact game dev");
return false;
}
@ -1616,7 +1620,7 @@ function NetscriptFunctions(workerScript) {
}
}
//Wasn't found on home computer
workerScript.scriptRef.log("Error: Could not find server " + server.hostname +
workerScript.scriptRef.log("ERROR: Could not find server " + server.hostname +
"as a purchased server. This is likely a bug please contact game dev");
return false;
},
@ -1630,7 +1634,7 @@ function NetscriptFunctions(workerScript) {
if (hostname) {
var server = getServer(ip);
if (server == null) {
throw makeRuntimeRejectMsg(workerScript, "ERR: Could not find server in getPurchasedServers(). This is a bug please report to game dev");
throw makeRuntimeRejectMsg(workerScript, "ERROR: Could not find server in getPurchasedServers(). This is a bug please report to game dev");
}
res.push(server.hostname);
} else {
@ -1648,7 +1652,7 @@ function NetscriptFunctions(workerScript) {
//Port 1-10
port = Math.round(port);
if (port < 1 || port > CONSTANTS.NumNetscriptPorts) {
throw makeRuntimeRejectMsg(workerScript, "ERR: Trying to write to invalid port: " + port + ". Only ports 1-" + CONSTANTS.NumNetscriptPorts + " are valid.");
throw makeRuntimeRejectMsg(workerScript, "ERROR: Trying to write to invalid port: " + port + ". Only ports 1-" + CONSTANTS.NumNetscriptPorts + " are valid.");
}
var port = NetscriptPorts[port-1];
if (port == null || !(port instanceof NetscriptPort)) {
@ -1685,11 +1689,11 @@ function NetscriptFunctions(workerScript) {
//Port 1-10
port = Math.round(port);
if (port < 1 || port > CONSTANTS.NumNetscriptPorts) {
throw makeRuntimeRejectMsg(workerScript, "ERR: Trying to read from invalid port: " + port + ". Only ports 1-" + CONSTANTS.NumNetscriptPorts + " are valid.");
throw makeRuntimeRejectMsg(workerScript, "ERROR: Trying to read from invalid port: " + port + ". Only ports 1-" + CONSTANTS.NumNetscriptPorts + " are valid.");
}
var port = NetscriptPorts[port-1];
if (port == null || !(port instanceof NetscriptPort)) {
throw makeRuntimeRejectMsg(workerScript, "ERR: Could not find port: " + port + ". This is a bug contact the game developer");
throw makeRuntimeRejectMsg(workerScript, "ERROR: Could not find port: " + port + ". This is a bug contact the game developer");
}
return port.read();
} else if (isString(port)) { //Read from text file
@ -1714,15 +1718,15 @@ function NetscriptFunctions(workerScript) {
}
updateDynamicRam("peek", CONSTANTS.ScriptReadWriteRamCost);
if (isNaN(port)) {
throw makeRuntimeRejectMsg(workerScript, "ERR: peek() called with invalid argument. Must be a port number between 1 and " + CONSTANTS.NumNetscriptPorts);
throw makeRuntimeRejectMsg(workerScript, "ERROR: peek() called with invalid argument. Must be a port number between 1 and " + CONSTANTS.NumNetscriptPorts);
}
port = Math.round(port);
if (port < 1 || port > CONSTANTS.NumNetscriptPorts) {
throw makeRuntimeRejectMsg(workerScript, "ERR: peek() called with invalid argument. Must be a port number between 1 and " + CONSTANTS.NumNetscriptPorts);
throw makeRuntimeRejectMsg(workerScript, "ERROR: peek() called with invalid argument. Must be a port number between 1 and " + CONSTANTS.NumNetscriptPorts);
}
var port = NetscriptPorts[port-1];
if (port == null || !(port instanceof NetscriptPort)) {
throw makeRuntimeRejectMsg(workerScript, "ERR: Could not find port: " + port + ". This is a bug contact the game developer");
throw makeRuntimeRejectMsg(workerScript, "ERROR: Could not find port: " + port + ". This is a bug contact the game developer");
}
return port.peek();
},
@ -1734,11 +1738,11 @@ function NetscriptFunctions(workerScript) {
if (!isNaN(port)) { //Clear port
port = Math.round(port);
if (port < 1 || port > CONSTANTS.NumNetscriptPorts) {
throw makeRuntimeRejectMsg(workerScript, "ERR: Trying to clear invalid port: " + port + ". Only ports 1-" + CONSTANTS.NumNetscriptPorts + " are valid");
throw makeRuntimeRejectMsg(workerScript, "ERROR: Trying to clear invalid port: " + port + ". Only ports 1-" + CONSTANTS.NumNetscriptPorts + " are valid");
}
var port = NetscriptPorts[port-1];
if (port == null || !(port instanceof NetscriptPort)) {
throw makeRuntimeRejectMsg(workerScript, "ERR: Could not find port: " + port + ". This is a bug contact the game developer");
throw makeRuntimeRejectMsg(workerScript, "ERROR: Could not find port: " + port + ". This is a bug contact the game developer");
}
return port.clear();
} else if (isString(port)) { //Clear text file
@ -1762,15 +1766,15 @@ function NetscriptFunctions(workerScript) {
}
updateDynamicRam("getPortHandle", CONSTANTS.ScriptReadWriteRamCost * 10);
if (isNaN(port)) {
throw makeRuntimeRejectMsg(workerScript, "ERR: Invalid argument passed into getPortHandle(). Must be an integer between 1 and " + CONSTANTS.NumNetscriptPorts);
throw makeRuntimeRejectMsg(workerScript, "ERROR: Invalid argument passed into getPortHandle(). Must be an integer between 1 and " + CONSTANTS.NumNetscriptPorts);
}
port = Math.round(port);
if (port < 1 || port > CONSTANTS.NumNetscriptPorts) {
throw makeRuntimeRejectMsg(workerScript, "ERR: getPortHandle() called with invalid port number: " + port + ". Only ports 1-" + CONSTANTS.NumNetscriptPorts + " are valid");
throw makeRuntimeRejectMsg(workerScript, "ERROR: getPortHandle() called with invalid port number: " + port + ". Only ports 1-" + CONSTANTS.NumNetscriptPorts + " are valid");
}
var port = NetscriptPorts[port-1];
if (port == null || !(port instanceof NetscriptPort)) {
throw makeRuntimeRejectMsg(workerScript, "ERR: Could not find port: " + port + ". This is a bug contact the game developer");
throw makeRuntimeRejectMsg(workerScript, "ERROR: Could not find port: " + port + ". This is a bug contact the game developer");
}
return port;
},
@ -3251,157 +3255,293 @@ function NetscriptFunctions(workerScript) {
//Bladeburner API
bladeburner : {
isContractName : function(name) {
if (workerScript.checkingRam) {
return updateStaticRam("isContractName", CONSTANTS.ScriptBladeburnerApiBaseRamCost / 10);
}
updateDynamicRam("isContractName", CONSTANTS.ScriptBladeburnerApiBaseRamCost / 10);
if (Player.bladeburner instanceof Bladeburner && (Player.bitNodeN === 7 || hasBladeburner2079SF)) {
return Player.bladeburner.isContractNameNetscriptFn(name);
}
throw makeRuntimeRejectMsg(workerScript, "isContractName() failed because you do not currently have access to the Bladeburner API. This is either because you are not currently employed " +
"at the Bladeburner division or because you do not have Source-File 7");
},
isOperationName : function(name) {
if (Player.bladeburner instanceof Bladeburner && (Player.bitNodeN === 7 || hasBladeburner2079SF)) {
if (workerScript.checkingRam) {
return updateStaticRam("isOperationName", CONSTANTS.ScriptBladeburnerApiBaseRamCost / 10);
}
throw makeRuntimeRejectMsg(workerScript, "isContractName() failed because you do not currently have access to the Bladeburner API. This is either because you are not currently employed " +
updateDynamicRam("isOperationName", CONSTANTS.ScriptBladeburnerApiBaseRamCost / 10);
if (Player.bladeburner instanceof Bladeburner && (Player.bitNodeN === 7 || hasBladeburner2079SF)) {
return Player.bladeburner.isOperationNameNetscriptFn(name);
}
throw makeRuntimeRejectMsg(workerScript, "isOperationName() failed because you do not currently have access to the Bladeburner API. This is either because you are not currently employed " +
"at the Bladeburner division or because you do not have Source-File 7");
},
isBlackOpName : function(name) {
if (Player.bladeburner instanceof Bladeburner && (Player.bitNodeN === 7 || hasBladeburner2079SF)) {
if (workerScript.checkingRam) {
return updateStaticRam("isBlackOpName", CONSTANTS.ScriptBladeburnerApiBaseRamCost / 10);
}
throw makeRuntimeRejectMsg(workerScript, "isContractName() failed because you do not currently have access to the Bladeburner API. This is either because you are not currently employed " +
updateDynamicRam("isBlackOpName", CONSTANTS.ScriptBladeburnerApiBaseRamCost / 10);
if (Player.bladeburner instanceof Bladeburner && (Player.bitNodeN === 7 || hasBladeburner2079SF)) {
return Player.bladeburner.isBlackOpNameNetscriptFn(name);
}
throw makeRuntimeRejectMsg(workerScript, "isBlackOpName() failed because you do not currently have access to the Bladeburner API. This is either because you are not currently employed " +
"at the Bladeburner division or because you do not have Source-File 7");
},
isGeneralActionName : function(name) {
if (Player.bladeburner instanceof Bladeburner && (Player.bitNodeN === 7 || hasBladeburner2079SF)) {
if (workerScript.checkingRam) {
return updateStaticRam("isGeneralActionName", CONSTANTS.ScriptBladeburnerApiBaseRamCost / 10);
}
throw makeRuntimeRejectMsg(workerScript, "isContractName() failed because you do not currently have access to the Bladeburner API. This is either because you are not currently employed " +
updateDynamicRam("isGeneralActionName", CONSTANTS.ScriptBladeburnerApiBaseRamCost / 10);
if (Player.bladeburner instanceof Bladeburner && (Player.bitNodeN === 7 || hasBladeburner2079SF)) {
return Player.bladeburner.isGeneralActionNameNetscriptFn(name);
}
throw makeRuntimeRejectMsg(workerScript, "isGeneralActionName() failed because you do not currently have access to the Bladeburner API. This is either because you are not currently employed " +
"at the Bladeburner division or because you do not have Source-File 7");
},
isSkillName : function(name) {
if (Player.bladeburner instanceof Bladeburner && (Player.bitNodeN === 7 || hasBladeburner2079SF)) {
if (workerScript.checkingRam) {
return updateStaticRam("isSkillName", CONSTANTS.ScriptBladeburnerApiBaseRamCost / 10);
}
throw makeRuntimeRejectMsg(workerScript, "isContractName() failed because you do not currently have access to the Bladeburner API. This is either because you are not currently employed " +
updateDynamicRam("isSkillName", CONSTANTS.ScriptBladeburnerApiBaseRamCost / 10);
if (Player.bladeburner instanceof Bladeburner && (Player.bitNodeN === 7 || hasBladeburner2079SF)) {
return Player.bladeburner.isSkillNameNetscriptFn(name);
}
throw makeRuntimeRejectMsg(workerScript, "isSkillName() failed because you do not currently have access to the Bladeburner API. This is either because you are not currently employed " +
"at the Bladeburner division or because you do not have Source-File 7");
},
startAction : function(type, name) {
if (Player.bladeburner instanceof Bladeburner && (Player.bitNodeN === 7 || hasBladeburner2079SF)) {
startAction : function(type="", name="") {
if (workerScript.checkingRam) {
return updateStaticRam("startAction", CONSTANTS.ScriptBladeburnerApiBaseRamCost);
}
throw makeRuntimeRejectMsg(workerScript, "isContractName() failed because you do not currently have access to the Bladeburner API. This is either because you are not currently employed " +
updateDynamicRam("startAction", CONSTANTS.ScriptBladeburnerApiBaseRamCost);
if (Player.bladeburner instanceof Bladeburner && (Player.bitNodeN === 7 || hasBladeburner2079SF)) {
try {
return Player.bladeburner.startActionNetscriptFn(type, name, workerScript);
} catch(e) {
throw makeRuntimeRejectMsg(workerScript, "Bladeburner.startAction() failed with exception: " + e);
}
}
throw makeRuntimeRejectMsg(workerScript, "startAction() failed because you do not currently have access to the Bladeburner API. This is either because you are not currently employed " +
"at the Bladeburner division or because you do not have Source-File 7");
},
stopAction : function() {
if (Player.bladeburner instanceof Bladeburner && (Player.bitNodeN === 7 || hasBladeburner2079SF)) {
if (workerScript.checkingRam) {
return updateStaticRam("stopAction", CONSTANTS.ScriptBladeburnerApiBaseRamCost / 2);
}
throw makeRuntimeRejectMsg(workerScript, "isContractName() failed because you do not currently have access to the Bladeburner API. This is either because you are not currently employed " +
updateDynamicRam("stopAction", CONSTANTS.ScriptBladeburnerApiBaseRamCost / 2);
if (Player.bladeburner instanceof Bladeburner && (Player.bitNodeN === 7 || hasBladeburner2079SF)) {
return Player.bladeburner.resetAction();
}
throw makeRuntimeRejectMsg(workerScript, "stopAction() failed because you do not currently have access to the Bladeburner API. This is either because you are not currently employed " +
"at the Bladeburner division or because you do not have Source-File 7");
},
getActionTime : function(type="", name="") {
if (Player.bladeburner instanceof Bladeburner && (Player.bitNodeN === 7 || hasBladeburner2079SF)) {
if (workerScript.checkingRam) {
return updateStaticRam("getActionTime", CONSTANTS.ScriptBladeburnerApiBaseRamCost);
}
throw makeRuntimeRejectMsg(workerScript, "isContractName() failed because you do not currently have access to the Bladeburner API. This is either because you are not currently employed " +
updateDynamicRam("getActionTime", CONSTANTS.ScriptBladeburnerApiBaseRamCost);
if (Player.bladeburner instanceof Bladeburner && (Player.bitNodeN === 7 || hasBladeburner2079SF)) {
try {
return Player.bladeburner.getActionTimeNetscriptFn(type, name, workerScript);
} catch(e) {
throw makeRuntimeRejectMsg(workerScript, "Bladeburner.getActionTime() failed with exception: " + e);
}
}
throw makeRuntimeRejectMsg(workerScript, "getActionTime() failed because you do not currently have access to the Bladeburner API. This is either because you are not currently employed " +
"at the Bladeburner division or because you do not have Source-File 7");
},
getActionEstimatedSuccessChance : function(type="", name="") {
if (Player.bladeburner instanceof Bladeburner && (Player.bitNodeN === 7 || hasBladeburner2079SF)) {
if (workerScript.checkingRam) {
return updateStaticRam("getActionEstimatedSuccessChance", CONSTANTS.ScriptBladeburnerApiBaseRamCost);
}
throw makeRuntimeRejectMsg(workerScript, "isContractName() failed because you do not currently have access to the Bladeburner API. This is either because you are not currently employed " +
updateDynamicRam("getActionEstimatedSuccessChance", CONSTANTS.ScriptBladeburnerApiBaseRamCost);
if (Player.bladeburner instanceof Bladeburner && (Player.bitNodeN === 7 || hasBladeburner2079SF)) {
try {
return Player.bladeburner.getActionEstimatedSuccessChanceNetscriptFn(type, name, workerScript);
} catch(e) {
throw makeRuntimeRejectMsg(workerScript, "Bladeburner.getActionEstimatedSuccessChance() failed with exception: " + e);
}
}
throw makeRuntimeRejectMsg(workerScript, "getActionEstimatedSuccessChance() failed because you do not currently have access to the Bladeburner API. This is either because you are not currently employed " +
"at the Bladeburner division or because you do not have Source-File 7");
},
getActionCountRemaining : function(type="", name="") {
if (Player.bladeburner instanceof Bladeburner && (Player.bitNodeN === 7 || hasBladeburner2079SF)) {
if (workerScript.checkingRam) {
return updateStaticRam("getActionCountRemaining", CONSTANTS.ScriptBladeburnerApiBaseRamCost);
}
throw makeRuntimeRejectMsg(workerScript, "isContractName() failed because you do not currently have access to the Bladeburner API. This is either because you are not currently employed " +
updateDynamicRam("getActionCountRemaining", CONSTANTS.ScriptBladeburnerApiBaseRamCost);
if (Player.bladeburner instanceof Bladeburner && (Player.bitNodeN === 7 || hasBladeburner2079SF)) {
try {
return Player.bladeburner.getActionCountRemainingNetscriptFn(type, name, workerScript);
} catch(e) {
throw makeRuntimeRejectMsg(workerScript, "Bladeburner.getActionCountRemaining() failed with exception: " + e);
}
}
throw makeRuntimeRejectMsg(workerScript, "getActionCountRemaining() failed because you do not currently have access to the Bladeburner API. This is either because you are not currently employed " +
"at the Bladeburner division or because you do not have Source-File 7");
},
getRank : function() {
if (Player.bladeburner instanceof Bladeburner && (Player.bitNodeN === 7 || hasBladeburner2079SF)) {
if (workerScript.checkingRam) {
return updateStaticRam("getRank", CONSTANTS.ScriptBladeburnerApiBaseRamCost);
}
throw makeRuntimeRejectMsg(workerScript, "isContractName() failed because you do not currently have access to the Bladeburner API. This is either because you are not currently employed " +
updateDynamicRam("getRank", CONSTANTS.ScriptBladeburnerApiBaseRamCost);
if (Player.bladeburner instanceof Bladeburner && (Player.bitNodeN === 7 || hasBladeburner2079SF)) {
return Player.bladeburner.rank;
}
throw makeRuntimeRejectMsg(workerScript, "getRank() failed because you do not currently have access to the Bladeburner API. This is either because you are not currently employed " +
"at the Bladeburner division or because you do not have Source-File 7");
},
getSkillPoints : function() {
if (Player.bladeburner instanceof Bladeburner && (Player.bitNodeN === 7 || hasBladeburner2079SF)) {
if (workerScript.checkingRam) {
return updateStaticRam("getSkillPoints", CONSTANTS.ScriptBladeburnerApiBaseRamCost);
}
throw makeRuntimeRejectMsg(workerScript, "isContractName() failed because you do not currently have access to the Bladeburner API. This is either because you are not currently employed " +
updateDynamicRam("getSkillPoints", CONSTANTS.ScriptBladeburnerApiBaseRamCost);
if (Player.bladeburner instanceof Bladeburner && (Player.bitNodeN === 7 || hasBladeburner2079SF)) {
return Player.bladeburner.skillPoints;
}
throw makeRuntimeRejectMsg(workerScript, "getSkillPoints() failed because you do not currently have access to the Bladeburner API. This is either because you are not currently employed " +
"at the Bladeburner division or because you do not have Source-File 7");
},
getSkillLevel : function(skillName="") {
if (Player.bladeburner instanceof Bladeburner && (Player.bitNodeN === 7 || hasBladeburner2079SF)) {
if (workerScript.checkingRam) {
return updateStaticRam("getSkillLevel", CONSTANTS.ScriptBladeburnerApiBaseRamCost);
}
throw makeRuntimeRejectMsg(workerScript, "isContractName() failed because you do not currently have access to the Bladeburner API. This is either because you are not currently employed " +
updateDynamicRam("getSkillLevel", CONSTANTS.ScriptBladeburnerApiBaseRamCost);
if (Player.bladeburner instanceof Bladeburner && (Player.bitNodeN === 7 || hasBladeburner2079SF)) {
try {
return Player.bladeburner.getSkillLevelNetscriptFn(skillName, workerScript);
} catch(e) {
throw makeRuntimeRejectMsg(workerScript, "Bladeburner.getSkillLevel() failed with exception: " + e);
}
}
throw makeRuntimeRejectMsg(workerScript, "getSkillLevel() failed because you do not currently have access to the Bladeburner API. This is either because you are not currently employed " +
"at the Bladeburner division or because you do not have Source-File 7");
},
upgradeSkill : function(skillName) {
if (Player.bladeburner instanceof Bladeburner && (Player.bitNodeN === 7 || hasBladeburner2079SF)) {
if (workerScript.checkingRam) {
return updateStaticRam("upgradeSkill", CONSTANTS.ScriptBladeburnerApiBaseRamCost);
}
throw makeRuntimeRejectMsg(workerScript, "isContractName() failed because you do not currently have access to the Bladeburner API. This is either because you are not currently employed " +
updateDynamicRam("upgradeSkill", CONSTANTS.ScriptBladeburnerApiBaseRamCost);
if (Player.bladeburner instanceof Bladeburner && (Player.bitNodeN === 7 || hasBladeburner2079SF)) {
try {
return Player.bladeburner.upgradeSkillNetscriptFn(skillName, workerScript);
} catch(e) {
throw makeRuntimeRejectMsg(workerScript, "Bladeburner.upgradeSkill() failed with exception: " + e);
}
}
throw makeRuntimeRejectMsg(workerScript, "upgradeSkill() failed because you do not currently have access to the Bladeburner API. This is either because you are not currently employed " +
"at the Bladeburner division or because you do not have Source-File 7");
},
getTeamSize : function() {
if (Player.bladeburner instanceof Bladeburner && (Player.bitNodeN === 7 || hasBladeburner2079SF)) {
getTeamSize : function(type="", name="") {
if (workerScript.checkingRam) {
return updateStaticRam("getTeamSize", CONSTANTS.ScriptBladeburnerApiBaseRamCost);
}
throw makeRuntimeRejectMsg(workerScript, "isContractName() failed because you do not currently have access to the Bladeburner API. This is either because you are not currently employed " +
updateDynamicRam("getTeamSize", CONSTANTS.ScriptBladeburnerApiBaseRamCost);
if (Player.bladeburner instanceof Bladeburner && (Player.bitNodeN === 7 || hasBladeburner2079SF)) {
try {
return Player.bladeburner.getTeamSizeNetscriptFn(type, name, workerScript);
} catch(e) {
throw makeRuntimeRejectMsg(workerScript, "Bladeburner.getTeamSize() failed with exception: " + e);
}
}
throw makeRuntimeRejectMsg(workerScript, "getTeamSize() failed because you do not currently have access to the Bladeburner API. This is either because you are not currently employed " +
"at the Bladeburner division or because you do not have Source-File 7");
},
setTeamSize : function(type="", name="", size) {
if (Player.bladeburner instanceof Bladeburner && (Player.bitNodeN === 7 || hasBladeburner2079SF)) {
if (workerScript.checkingRam) {
return updateStaticRam("setTeamSize", CONSTANTS.ScriptBladeburnerApiBaseRamCost);
}
throw makeRuntimeRejectMsg(workerScript, "isContractName() failed because you do not currently have access to the Bladeburner API. This is either because you are not currently employed " +
updateDynamicRam("setTeamSize", CONSTANTS.ScriptBladeburnerApiBaseRamCost);
if (Player.bladeburner instanceof Bladeburner && (Player.bitNodeN === 7 || hasBladeburner2079SF)) {
try {
return Player.bladeburner.setTeamSizeNetscriptFn(type, name, size, workerScript);
} catch(e) {
throw makeRuntimeRejectMsg(workerScript, "Bladeburner.setTeamSize() failed with exception: " + e);
}
}
throw makeRuntimeRejectMsg(workerScript, "setTeamSize() failed because you do not currently have access to the Bladeburner API. This is either because you are not currently employed " +
"at the Bladeburner division or because you do not have Source-File 7");
},
getCityEstimatedPopulation : function(cityName) {
if (Player.bladeburner instanceof Bladeburner && (Player.bitNodeN === 7 || hasBladeburner2079SF)) {
if (workerScript.checkingRam) {
return updateStaticRam("getCityEstimatedPopulation", CONSTANTS.ScriptBladeburnerApiBaseRamCost);
}
throw makeRuntimeRejectMsg(workerScript, "isContractName() failed because you do not currently have access to the Bladeburner API. This is either because you are not currently employed " +
updateDynamicRam("getCityEstimatedPopulation", CONSTANTS.ScriptBladeburnerApiBaseRamCost);
if (Player.bladeburner instanceof Bladeburner && (Player.bitNodeN === 7 || hasBladeburner2079SF)) {
try {
return Player.bladeburner.getCityEstimatedPopulationNetscriptFn(cityName, workerScript);
} catch(e) {
throw makeRuntimeRejectMsg(workerScript, "Bladeburner.getCityEstimatedPopulation() failed with exception: " + e);
}
}
throw makeRuntimeRejectMsg(workerScript, "getCityEstimatedPopulation() failed because you do not currently have access to the Bladeburner API. This is either because you are not currently employed " +
"at the Bladeburner division or because you do not have Source-File 7");
},
getCityEstimatedCommunities : function(cityName) {
if (Player.bladeburner instanceof Bladeburner && (Player.bitNodeN === 7 || hasBladeburner2079SF)) {
if (workerScript.checkingRam) {
return updateStaticRam("getCityEstimatedCommunities", CONSTANTS.ScriptBladeburnerApiBaseRamCost);
}
throw makeRuntimeRejectMsg(workerScript, "isContractName() failed because you do not currently have access to the Bladeburner API. This is either because you are not currently employed " +
updateDynamicRam("getCityEstimatedCommunities", CONSTANTS.ScriptBladeburnerApiBaseRamCost);
if (Player.bladeburner instanceof Bladeburner && (Player.bitNodeN === 7 || hasBladeburner2079SF)) {
try {
return Player.bladeburner.getCityEstimatedCommunitiesNetscriptFn(cityName, workerScript);
} catch(e) {
throw makeRuntimeRejectMsg(workerScript, "Bladeburner.getCityEstimatedCommunities() failed with exception: " + e);
}
}
throw makeRuntimeRejectMsg(workerScript, "getCityEstimatedCommunities() failed because you do not currently have access to the Bladeburner API. This is either because you are not currently employed " +
"at the Bladeburner division or because you do not have Source-File 7");
},
getCityChaos : function(cityName) {
if (Player.bladeburner instanceof Bladeburner && (Player.bitNodeN === 7 || hasBladeburner2079SF)) {
if (workerScript.checkingRam) {
return updateStaticRam("getCityChaos", CONSTANTS.ScriptBladeburnerApiBaseRamCost);
}
throw makeRuntimeRejectMsg(workerScript, "isContractName() failed because you do not currently have access to the Bladeburner API. This is either because you are not currently employed " +
updateDynamicRam("getCityChaos", CONSTANTS.ScriptBladeburnerApiBaseRamCost);
if (Player.bladeburner instanceof Bladeburner && (Player.bitNodeN === 7 || hasBladeburner2079SF)) {
try {
return Player.bladeburner.getCityChaosNetscriptFn(cityName, workerScript);
} catch(e) {
throw makeRuntimeRejectMsg(workerScript, "Bladeburner.getCityChaos() failed with exception: " + e);
}
}
throw makeRuntimeRejectMsg(workerScript, "getCityChaos() failed because you do not currently have access to the Bladeburner API. This is either because you are not currently employed " +
"at the Bladeburner division or because you do not have Source-File 7");
},
switchCity : function(cityName) {
if (Player.bladeburner instanceof Bladeburner && (Player.bitNodeN === 7 || hasBladeburner2079SF)) {
if (workerScript.checkingRam) {
return updateStaticRam("switchCity", CONSTANTS.ScriptBladeburnerApiBaseRamCost);
}
throw makeRuntimeRejectMsg(workerScript, "isContractName() failed because you do not currently have access to the Bladeburner API. This is either because you are not currently employed " +
updateDynamicRam("switchCity", CONSTANTS.ScriptBladeburnerApiBaseRamCost);
if (Player.bladeburner instanceof Bladeburner && (Player.bitNodeN === 7 || hasBladeburner2079SF)) {
try {
return Player.bladeburner.switchCityNetscriptFn(cityName, workerScript);
} catch(e) {
throw makeRuntimeRejectMsg(workerScript, "Bladeburner.switchCity() failed with exception: " + e);
}
}
throw makeRuntimeRejectMsg(workerScript, "switchCity() failed because you do not currently have access to the Bladeburner API. This is either because you are not currently employed " +
"at the Bladeburner division or because you do not have Source-File 7");
},
getStamina : function() {
if (Player.bladeburner instanceof Bladeburner && (Player.bitNodeN === 7 || hasBladeburner2079SF)) {
if (workerScript.checkingRam) {
return updateStaticRam("getStamina", CONSTANTS.ScriptBladeburnerApiBaseRamCost);
}
throw makeRuntimeRejectMsg(workerScript, "isContractName() failed because you do not currently have access to the Bladeburner API. This is either because you are not currently employed " +
updateDynamicRam("getStamina", CONSTANTS.ScriptBladeburnerApiBaseRamCost);
if (Player.bladeburner instanceof Bladeburner && (Player.bitNodeN === 7 || hasBladeburner2079SF)) {
return [Player.bladeburner.stamina, Player.bladeburner.maxStamina];
}
throw makeRuntimeRejectMsg(workerScript, "getStamina() failed because you do not currently have access to the Bladeburner API. This is either because you are not currently employed " +
"at the Bladeburner division or because you do not have Source-File 7");
},
joinFaction : function() {
if (Player.bladeburner instanceof Bladeburner && (Player.bitNodeN === 7 || hasBladeburner2079SF)) {
joinBladeburnerFaction : function() {
if (workerScript.checkingRam) {
return updateStaticRam("joinBladeburnerFaction", CONSTANTS.ScriptBladeburnerApiBaseRamCost);
}
throw makeRuntimeRejectMsg(workerScript, "isContractName() failed because you do not currently have access to the Bladeburner API. This is either because you are not currently employed " +
updateDynamicRam("joinBladeburnerFaction", CONSTANTS.ScriptBladeburnerApiBaseRamCost);
if (Player.bladeburner instanceof Bladeburner && (Player.bitNodeN === 7 || hasBladeburner2079SF)) {
return Player.bladeburner.joinBladeburnerFactionNetscriptFn(workerScript);
}
throw makeRuntimeRejectMsg(workerScript, "joinBladeburnerFaction() failed because you do not currently have access to the Bladeburner API. This is either because you are not currently employed " +
"at the Bladeburner division or because you do not have Source-File 7");
}
}

@ -56,6 +56,14 @@ WorkerScript.prototype.getScript = function() {
return null;
}
WorkerScript.prototype.shouldLog = function(fn) {
return (this.disableLogs.ALL == null && this.disableLogs[fn] == null);
}
WorkerScript.prototype.log = function(txt) {
this.scriptRef.log(txt);
}
//Array containing all scripts that are running across all servers, to easily run them all
let workerScripts = [];

@ -299,8 +299,6 @@ PlayerObject.prototype.prestigeAugmentation = function() {
this.hacknetNodes.length = 0;
this.totalHacknetNodeProduction = 0;
this.bladeburner = 0;
}
PlayerObject.prototype.prestigeSourceFile = function() {
@ -391,8 +389,6 @@ PlayerObject.prototype.prestigeSourceFile = function() {
if (this.bitNodeN === 3) {this.money = new Decimal(150e9);}
this.corporation = 0;
this.bladeburner = 0;
this.playtimeSinceLastAug = 0;
this.scriptProdSinceLastAug = 0;
}

@ -2,6 +2,7 @@ import {deleteActiveScriptsItem} from "./ActiveScriptsUI.js";
import {Augmentations, augmentationExists,
initAugmentations, AugmentationNames} from "./Augmentations.js";
import {initBitNodeMultipliers} from "./BitNode.js";
import {Bladeburner} from "./Bladeburner.js";
import {writeCinematicText} from "./CinematicText.js";
import {Companies, Company, initCompanies} from "./Company.js";
import {Programs} from "./CreateProgram.js";
@ -125,8 +126,10 @@ function prestigeAugmentation() {
}
}
//Reset Bladeburner
Player.bladeburner = null;
//Cancel Bladeburner action
if (Player.bladeburner instanceof Bladeburner) {
Player.bladeburner.resetAction();
}
//BitNode 8: Ghost of Wall Street
if (Player.bitNodeN === 8) {Player.money = new Decimal(BitNode8StartingMoney);}

@ -209,7 +209,7 @@ function applySourceFile(srcFile) {
Player.crime_money_mult *= inc;
Player.crime_success_mult *= inc;
Player.hacknet_node_money_mult *= inc;
Player.hacknet_node_purchase_cost_mult *= dec;
Player.hacknet_node_ram_cost_mult *= dec;

@ -1,4 +1,5 @@
import {executeJSScript} from "../src/NetscriptJSEvaluator.js";
import {WorkerScript} from "../src/NetscriptWorker.js";
const chai = require("chai");
const chaiAsPromised = require("chai-as-promised");
@ -9,17 +10,19 @@ console.info('asdf');
describe('NSJS ScriptStore', function() {
it('should run an imported function', async function() {
const s = { filename: "", code: "export function main() { return 2; }" };
chai.expect(await executeJSScript(s)).to.equal(2);
const s = { filename: "", code: "export function main() { return 2; }", args:[]};
const worker = new WorkerScript(s);
chai.expect(await executeJSScript([], s)).to.equal(2);
});
/*
it('should handle recursive imports', async function() {
const s1 = { filename: "s1.js", code: "export function iAmRecursiveImport(x) { return x + 2; }" };
const s2 = { filename: "", code: `
import {iAmRecursiveImport} from \"s1.js\";
export function main() { return iAmRecursiveImport(3);
}`};
chai.expect(await executeJSScript(s2, [s1, s2])).to.equal(5);
chai.expect(await executeJSScript([s1, s2], s2)).to.equal(5);
});
it (`should correctly reference the passed global env`, async function() {
@ -45,5 +48,5 @@ describe('NSJS ScriptStore', function() {
export function main() {}
`}
executeJSScript(s2, [s1, s2]).should.eventually.throw();
});
});
});*/
});

@ -11,7 +11,7 @@
<script src="https://unpkg.com/mocha@4.0.1/mocha.js"></script>
<script>mocha.setup('bdd')</script>
<script type="module" src="../dist/tests.bundle.js"></script>
<script type="module" src="tests.bundle.js"></script>
<script type="module">
mocha.checkLeaks();
mocha.run();

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

@ -16,12 +16,12 @@ module.exports = {
],
target: "web",
entry: {
engine: "./src/engine.js",
tests: "./tests/index.js",
"dist/engine": "./src/engine.js",
"tests/tests": "./tests/index.js",
},
devtool: "nosources-source-map",
output: {
path: path.resolve(__dirname, "dist"),
path: path.resolve(__dirname, "./"),
filename: "[name].bundle.js",
devtoolModuleFilenameTemplate: "[id]"
},