From 58753f9c892674c7d8ca0bf07c29b59304ab5d89 Mon Sep 17 00:00:00 2001 From: danielyxie Date: Sun, 24 Jun 2018 22:07:05 -0500 Subject: [PATCH] Added Bladeburner functions and 'bladeburner' keyword to syntax highlighter for Netscript. Fixed a bug with bladeburner.getSkillLevel() Netscript fn --- dist/engine.bundle.js | 18 +++++++++++++++--- netscript.js | 11 ++++++++++- src/Bladeburner.js | 7 +++++-- 3 files changed, 30 insertions(+), 6 deletions(-) diff --git a/dist/engine.bundle.js b/dist/engine.bundle.js index e952d978f..1acf45161 100644 --- a/dist/engine.bundle.js +++ b/dist/engine.bundle.js @@ -29330,7 +29330,6 @@ Bladeburner.prototype.getGeneralActionNamesNetscriptFn = function(name) { } Bladeburner.prototype.getSkillNamesNetscriptFn = function(name) { - return Skills.hasOwnProperty(name); return Object.keys(Skills); } @@ -29473,7 +29472,11 @@ Bladeburner.prototype.getSkillLevelNetscriptFn = function(skillName, workerScrip return -1; } - return Skills[skillName]; + if (this.skills[skillName] == null) { + return 0; + } else { + return this.skills[skillName]; + } } Bladeburner.prototype.upgradeSkillNetscriptFn = function(skillName, workerScript) { @@ -100091,7 +100094,16 @@ let NetscriptFunctions = "installAugmentations|hacknetnodes|upgradeLevel|upgradeRam|upgradeCore|" + "getLevelUpgradeCost|getRamUpgradeCost|getCoreUpgradeCost|" + "getStockPrice|getStockPosition|buyStock|sellStock|shortStock|sellShort|" + - "placeOrder|cancelOrder"; + "placeOrder|cancelOrder|" + + + //Bladeburner functions + "bladeburner|getContractNames|getOperationNames|getBlackOpNames|" + + "getGeneralActionNames|getSkillNames|startAction|stopBladeburnerAction|" + + "getActionTime|getActionEstimatedSuccessChance|getActionCountRemaining|" + + "getRank|getSkillPoints|getSkillLevel|upgradeSkill|getTeamSize|" + + "setTeamSize|getCityEstimatedPopulation|getCityEstimatedCommunities|" + + "getCityChaos|switchCity|getStamina|joinBladeburnerFaction" + ; var NetscriptHighlightRules = function(options) { var keywordMapper = this.createKeywordMapper({ diff --git a/netscript.js b/netscript.js index 88fd9a03b..64444e18e 100644 --- a/netscript.js +++ b/netscript.js @@ -86,7 +86,16 @@ let NetscriptFunctions = "installAugmentations|hacknetnodes|upgradeLevel|upgradeRam|upgradeCore|" + "getLevelUpgradeCost|getRamUpgradeCost|getCoreUpgradeCost|" + "getStockPrice|getStockPosition|buyStock|sellStock|shortStock|sellShort|" + - "placeOrder|cancelOrder"; + "placeOrder|cancelOrder|" + + + //Bladeburner functions + "bladeburner|getContractNames|getOperationNames|getBlackOpNames|" + + "getGeneralActionNames|getSkillNames|startAction|stopBladeburnerAction|" + + "getActionTime|getActionEstimatedSuccessChance|getActionCountRemaining|" + + "getRank|getSkillPoints|getSkillLevel|upgradeSkill|getTeamSize|" + + "setTeamSize|getCityEstimatedPopulation|getCityEstimatedCommunities|" + + "getCityChaos|switchCity|getStamina|joinBladeburnerFaction" + ; var NetscriptHighlightRules = function(options) { var keywordMapper = this.createKeywordMapper({ diff --git a/src/Bladeburner.js b/src/Bladeburner.js index 55e8000c5..ae4bcbf4e 100644 --- a/src/Bladeburner.js +++ b/src/Bladeburner.js @@ -3285,7 +3285,6 @@ Bladeburner.prototype.getGeneralActionNamesNetscriptFn = function(name) { } Bladeburner.prototype.getSkillNamesNetscriptFn = function(name) { - return Skills.hasOwnProperty(name); return Object.keys(Skills); } @@ -3428,7 +3427,11 @@ Bladeburner.prototype.getSkillLevelNetscriptFn = function(skillName, workerScrip return -1; } - return Skills[skillName]; + if (this.skills[skillName] == null) { + return 0; + } else { + return this.skills[skillName]; + } } Bladeburner.prototype.upgradeSkillNetscriptFn = function(skillName, workerScript) {