NETSCRIPT: Added cyclesWorked to certain sleeve.getTask returns, and added bladeburner.getActionSuccesses (#324)

This commit is contained in:
Zelow79
2023-01-15 23:50:54 -05:00
committed by GitHub
parent 6f0b3d07b8
commit 5f923a348c
6 changed files with 27 additions and 2 deletions

View File

@@ -249,6 +249,7 @@ const bladeburner = {
getActionMaxLevel: RamCostConstants.BladeburnerApiBase,
getActionCurrentLevel: RamCostConstants.BladeburnerApiBase,
getActionAutolevel: RamCostConstants.BladeburnerApiBase,
getActionSuccesses: RamCostConstants.BladeburnerApiBase,
setActionAutolevel: RamCostConstants.BladeburnerApiBase,
setActionLevel: RamCostConstants.BladeburnerApiBase,
getRank: RamCostConstants.BladeburnerApiBase,

View File

@@ -172,6 +172,13 @@ export function NetscriptBladeburner(): InternalAPI<INetscriptBladeburner> {
const action = getBladeburnerActionObject(ctx, type, name);
return action.autoLevel;
},
getActionSuccesses: (ctx) => (_type, _name) => {
const type = helpers.string(ctx, "type", _type);
const name = helpers.string(ctx, "name", _name);
checkBladeburnerAccess(ctx);
const action = getBladeburnerActionObject(ctx, type, name);
return action.successes;
},
setActionAutolevel:
(ctx) =>
(_type, _name, _autoLevel = true) => {

View File

@@ -67,6 +67,7 @@ export class SleeveBladeburnerWork extends Work {
type: WorkType.BLADEBURNER as "BLADEBURNER",
actionType: this.actionType,
actionName: this.actionName,
cyclesWorked: this.cyclesWorked,
};
}

View File

@@ -51,6 +51,7 @@ export class SleeveCrimeWork extends Work {
return {
type: WorkType.CRIME as "CRIME",
crimeType: this.crimeType,
cyclesWorked: this.cyclesWorked,
};
}

View File

@@ -32,6 +32,7 @@ export class SleeveInfiltrateWork extends Work {
APICopy() {
return {
type: WorkType.INFILTRATE as "INFILTRATE",
cyclesWorked: this.cyclesWorked,
};
}

View File

@@ -874,6 +874,7 @@ type SleeveBladeburnerTask = {
type: "BLADEBURNER";
actionType: "General" | "Contracts";
actionName: string;
cyclesWorked: number;
};
/** @public */
@@ -887,7 +888,7 @@ type SleeveClassTask = {
type SleeveCompanyTask = { type: "COMPANY"; companyName: string };
/** @public */
type SleeveCrimeTask = { type: "CRIME"; crimeType: CrimeType | `${CrimeType}` };
type SleeveCrimeTask = { type: "CRIME"; crimeType: CrimeType | `${CrimeType}`; cyclesWorked: number };
/** @public */
type SleeveFactionTask = {
@@ -897,7 +898,7 @@ type SleeveFactionTask = {
};
/** @public */
type SleeveInfiltrateTask = { type: "INFILTRATE" };
type SleeveInfiltrateTask = { type: "INFILTRATE"; cyclesWorked: number };
/** @public */
type SleeveRecoveryTask = { type: "RECOVERY" };
@@ -2870,6 +2871,19 @@ export type Bladeburner = {
*/
getActionAutolevel(type: string, name: string): boolean;
/**
* Get action successes.
* @remarks
* RAM cost: 4 GB
*
* Return a number with how many successes you have with action.
*
* @param type - Type of action.
* @param name - Name of action. Must be an exact match.
* @returns a number with how many successes you have with action.
*/
getActionSuccesses(type: string, name: string): number;
/**
* Set an action autolevel.
* @remarks