diff --git a/src/Bladeburner.js b/src/Bladeburner.js index 2cc92823d..360634d48 100644 --- a/src/Bladeburner.js +++ b/src/Bladeburner.js @@ -3314,7 +3314,7 @@ Bladeburner.prototype.getSkillNamesNetscriptFn = function() { } Bladeburner.prototype.startActionNetscriptFn = function(type, name, workerScript) { - var errorLogText = "ERROR: Bladeburner.startAction() failed due to an invalid action specified. " + + 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); @@ -3326,19 +3326,19 @@ Bladeburner.prototype.startActionNetscriptFn = function(type, name, workerScript try { this.startAction(actionId); if (workerScript.shouldLog("startAction")) { - workerScript.scriptRef.log("Starting Bladeburner action with type " + type + " and name " + name); + 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 + + 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. " + + 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); @@ -3372,7 +3372,7 @@ Bladeburner.prototype.getActionTimeNetscriptFn = function(type, name, workerScri } Bladeburner.prototype.getActionEstimatedSuccessChanceNetscriptFn = function(type, name, workerScript) { - var errorLogText = "ERROR: Bladeburner.getActionEstimatedSuccessChance() failed due to an invalid action specified. " + + 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); @@ -3406,7 +3406,7 @@ Bladeburner.prototype.getActionEstimatedSuccessChanceNetscriptFn = function(type } Bladeburner.prototype.getActionCountRemainingNetscriptFn = function(type, name, workerScript) { - var errorLogText = "ERROR: Bladeburner.getActionCountRemaining() failed due to an invalid action specified. " + + 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); @@ -3438,7 +3438,7 @@ Bladeburner.prototype.getActionCountRemainingNetscriptFn = function(type, name, } Bladeburner.prototype.getSkillLevelNetscriptFn = function(skillName, workerScript) { - var errorLogText = "ERROR: Bladeburner.getSkillLevel() failed due to an invalid skill specified: " + + 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 === "") { @@ -3458,7 +3458,7 @@ Bladeburner.prototype.getSkillLevelNetscriptFn = function(skillName, workerScrip } Bladeburner.prototype.upgradeSkillNetscriptFn = function(skillName, workerScript) { - var errorLogText = "ERROR: Bladeburner.upgradeSkill() failed due to an invalid skill specified: " + + 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); @@ -3472,9 +3472,16 @@ Bladeburner.prototype.upgradeSkillNetscriptFn = function(skillName, workerScript } var cost = skill.calculateCost(currentLevel); + if(skill.maxLvl && currentLevel >= skill.maxLvl) { + if (workerScript.shouldLog("upgradeSkill")) { + workerScript.log(`bladeburner.upgradeSkill() failed because ${skillName} is already maxed`); + } + return false; + } + if (this.skillPoints < cost) { if (workerScript.shouldLog("upgradeSkill")) { - workerScript.log("Bladeburner.upgradeSkill() failed because you do not have enough " + + workerScript.log("bladeburner.upgradeSkill() failed because you do not have enough " + "skill points to upgrade " + skillName + " (You have " + this.skillPoints + ", you need " + cost + ")"); } @@ -3497,7 +3504,7 @@ Bladeburner.prototype.getTeamSizeNetscriptFn = function(type, name, workerScript return this.teamSize; } - var errorLogText = "ERROR: Bladeburner.getTeamSize() failed due to an invalid action specified. " + + 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."; @@ -3523,7 +3530,7 @@ Bladeburner.prototype.getTeamSizeNetscriptFn = function(type, name, workerScript } Bladeburner.prototype.setTeamSizeNetscriptFn = function(type, name, size, workerScript) { - var errorLogText = "ERROR: Bladeburner.setTeamSize() failed due to an invalid action specified. " + + 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); @@ -3535,7 +3542,7 @@ Bladeburner.prototype.setTeamSizeNetscriptFn = function(type, name, size, worker if (actionId.type !== ActionTypes["Operation"] && actionId.type !== ActionTypes["BlackOp"] && actionId.type !== ActionTypes["BlackOperation"]) { - workerScript.log("ERROR: Bladeburner.setTeamSize() failed. This function " + + workerScript.log("ERROR: bladeburner.setTeamSize() failed. This function " + "only works for Operations and BlackOps"); return -1; } @@ -3548,7 +3555,7 @@ Bladeburner.prototype.setTeamSizeNetscriptFn = function(type, name, size, worker var sanitizedSize = Math.round(size); if (isNaN(sanitizedSize)) { - workerScript.log("ERROR: Bladeburner.setTeamSize() failed due to an invalid 'size' argument: " + size); + workerScript.log("ERROR: bladeburner.setTeamSize() failed due to an invalid 'size' argument: " + size); return -1; } if (this.teamSize < sanitizedSize) {sanitizedSize = this.teamSize;} @@ -3561,7 +3568,7 @@ Bladeburner.prototype.setTeamSizeNetscriptFn = function(type, name, size, worker Bladeburner.prototype.getCityEstimatedPopulationNetscriptFn = function(cityName, workerScript) { if (!this.cities.hasOwnProperty(cityName)) { - workerScript.log("ERROR: Bladeburner.getCityEstimatedPopulation() failed because the specified " + + workerScript.log("ERROR: bladeburner.getCityEstimatedPopulation() failed because the specified " + "city was invalid: " + cityName + ". Note that this city argument is case-sensitive"); return -1; } @@ -3570,7 +3577,7 @@ Bladeburner.prototype.getCityEstimatedPopulationNetscriptFn = function(cityName, Bladeburner.prototype.getCityEstimatedCommunitiesNetscriptFn = function(cityName, workerScript) { if (!this.cities.hasOwnProperty(cityName)) { - workerScript.log("ERROR: Bladeburner.getCityEstimatedCommunities() failed because the specified " + + workerScript.log("ERROR: bladeburner.getCityEstimatedCommunities() failed because the specified " + "city was invalid: " + cityName + ". Note that this city argument is case-sensitive"); return -1; } @@ -3579,7 +3586,7 @@ Bladeburner.prototype.getCityEstimatedCommunitiesNetscriptFn = function(cityName Bladeburner.prototype.getCityChaosNetscriptFn = function(cityName, workerScript) { if (!this.cities.hasOwnProperty(cityName)) { - workerScript.log("ERROR: Bladeburner.getCityChaos() failed because the specified " + + workerScript.log("ERROR: bladeburner.getCityChaos() failed because the specified " + "city was invalid: " + cityName + ". Note that this city argument is case-sensitive"); return -1; } @@ -3588,7 +3595,7 @@ Bladeburner.prototype.getCityChaosNetscriptFn = function(cityName, workerScript) Bladeburner.prototype.switchCityNetscriptFn = function(cityName, workerScript) { if (!this.cities.hasOwnProperty(cityName)) { - workerScript.log("ERROR: Bladeburner.switchCity() failed because the specified " + + workerScript.log("ERROR: bladeburner.switchCity() failed because the specified " + "city was invalid: " + cityName + ". Note that this city argument is case-sensitive"); return false; }