mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-11-18 05:33:54 +01:00
Bladeburner API Improvements: Added getCurrentAction(). getSkillLevel() now fails if no argument is passed
This commit is contained in:
parent
3ffc820519
commit
e97861f42b
4
dist/engine.bundle.js
vendored
4
dist/engine.bundle.js
vendored
@ -23599,6 +23599,10 @@ Bladeburner.prototype.getActionIdFromTypeAndName = function(type="", name="") {
|
||||
}
|
||||
}
|
||||
|
||||
Bladeburner.prototype.getTypeAndNameFromActionId = function(actionId) {
|
||||
|
||||
}
|
||||
|
||||
Bladeburner.prototype.getContractNamesNetscriptFn = function() {
|
||||
return Object.keys(this.contracts);
|
||||
}
|
||||
|
@ -3275,6 +3275,21 @@ Bladeburner.prototype.getActionIdFromTypeAndName = function(type="", name="") {
|
||||
}
|
||||
}
|
||||
|
||||
Bladeburner.prototype.getTypeAndNameFromActionId = function(actionId) {
|
||||
var res = {};
|
||||
let types = Object.keys(ActionTypes);
|
||||
for (let i = 0; i < types.length; ++i) {
|
||||
if (actionId.type === ActionTypes[types[i]]) {
|
||||
res.type = types[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (res.type == null) {res.type = "Idle";}
|
||||
|
||||
res.name = actionId.name != null ? actionId.name : "Idle";
|
||||
return res;
|
||||
}
|
||||
|
||||
Bladeburner.prototype.getContractNamesNetscriptFn = function() {
|
||||
return Object.keys(this.contracts);
|
||||
}
|
||||
@ -3424,9 +3439,7 @@ Bladeburner.prototype.getSkillLevelNetscriptFn = function(skillName, workerScrip
|
||||
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;
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (!Skills.hasOwnProperty(skillName)) {
|
||||
|
@ -488,8 +488,10 @@ let CONSTANTS = {
|
||||
|
||||
LatestUpdate:
|
||||
"v0.40.0<br>" +
|
||||
"* Added getCurrentAction() to Bladeburner API<br>" +
|
||||
"* getSkillLevel() in Bladeburner API now returns an error if no argument is passed in (as opposed to an object with all skill levels). This may break scripts<br>" +
|
||||
"* Minimum Netscript execution time reduced from 15ms to 10ms (configurable in Options)<br>" +
|
||||
"* HP is now reset (restored) when Augmenting<br>" +
|
||||
"* HP is now reset (restored) when Augmenting<br>" +
|
||||
"* Bug Fix: Infiltration buttons can no longer be clicked through NetscriptJS<br>"
|
||||
}
|
||||
|
||||
|
@ -3258,9 +3258,9 @@ function NetscriptFunctions(workerScript) {
|
||||
if (workerScript.checkingRam) {
|
||||
return updateStaticRam("getCurrentAction", CONSTANTS.ScriptBladeburnerApiBaseRamCost / 4);
|
||||
}
|
||||
updateDynamicRam("getCurrentAction", CONSTANTS.ScriptBladeburnerApiBaseRamCost / 2);
|
||||
updateDynamicRam("getCurrentAction", CONSTANTS.ScriptBladeburnerApiBaseRamCost / 4);
|
||||
if (Player.bladeburner instanceof Bladeburner && (Player.bitNodeN === 7 || hasBladeburner2079SF)) {
|
||||
return Player.bladeburner.resetAction();
|
||||
return Player.bladeburner.getTypeAndNameFromActionId(Player.bladeburner.action);
|
||||
}
|
||||
throw makeRuntimeRejectMsg(workerScript, "getCurrentAction() 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");
|
||||
|
Loading…
Reference in New Issue
Block a user