diff --git a/markdown/bitburner.bladeburner.getactionestimatedsuccesschance.md b/markdown/bitburner.bladeburner.getactionestimatedsuccesschance.md index 9e94e63b9..5b028c00e 100644 --- a/markdown/bitburner.bladeburner.getactionestimatedsuccesschance.md +++ b/markdown/bitburner.bladeburner.getactionestimatedsuccesschance.md @@ -9,7 +9,7 @@ Get estimate success chance of an action. **Signature:** ```typescript -getActionEstimatedSuccessChance(type: string, name: string, sleeve?: number): [number, number]; +getActionEstimatedSuccessChance(type: string, name: string, sleeveNumber?: number): [number, number]; ``` ## Parameters @@ -18,7 +18,7 @@ getActionEstimatedSuccessChance(type: string, name: string, sleeve?: number): [n | --- | --- | --- | | type | string | Type of action. | | name | string | Name of action. Must be an exact match. | -| sleeve | number | _(Optional)_ Optional. Sleeve number to check for success. | +| sleeveNumber | number | _(Optional)_ Optional. Index of the sleeve to retrieve information. | **Returns:** diff --git a/markdown/bitburner.bladeburner.md b/markdown/bitburner.bladeburner.md index 6af1eaceb..df8461a3f 100644 --- a/markdown/bitburner.bladeburner.md +++ b/markdown/bitburner.bladeburner.md @@ -24,7 +24,7 @@ You have to be employed in the Bladeburner division and be in BitNode-7 or have | [getActionCountRemaining(type, name)](./bitburner.bladeburner.getactioncountremaining.md) | Get action count remaining. | | [getActionCurrentLevel(type, name)](./bitburner.bladeburner.getactioncurrentlevel.md) | Get the current level of an action. | | [getActionCurrentTime()](./bitburner.bladeburner.getactioncurrenttime.md) | Get the time elapsed on current action. | -| [getActionEstimatedSuccessChance(type, name, sleeve)](./bitburner.bladeburner.getactionestimatedsuccesschance.md) | Get estimate success chance of an action. | +| [getActionEstimatedSuccessChance(type, name, sleeveNumber)](./bitburner.bladeburner.getactionestimatedsuccesschance.md) | Get estimate success chance of an action. | | [getActionMaxLevel(type, name)](./bitburner.bladeburner.getactionmaxlevel.md) | Get the maximum level of an action. | | [getActionRepGain(type, name, level)](./bitburner.bladeburner.getactionrepgain.md) | Get the reputation gain of an action. | | [getActionSuccesses(type, name)](./bitburner.bladeburner.getactionsuccesses.md) | Get action successes. | diff --git a/src/NetscriptFunctions/Bladeburner.ts b/src/NetscriptFunctions/Bladeburner.ts index a16d1bfd3..15dc8beb6 100644 --- a/src/NetscriptFunctions/Bladeburner.ts +++ b/src/NetscriptFunctions/Bladeburner.ts @@ -120,16 +120,21 @@ export function NetscriptBladeburner(): InternalAPI { getActionEstimatedSuccessChance: (ctx) => (type, name, _sleeve) => { const bladeburner = getBladeburner(ctx); const action = getAction(ctx, type, name); - if (_sleeve != null) { - checkSleeveAPIAccess(ctx); - const sleeveNumber = helpers.number(ctx, "sleeve", _sleeve); - checkSleeveNumber(ctx, sleeveNumber); - if (action.type === BladeActionType.contract) { + if (_sleeve == null) { + return action.getSuccessRange(bladeburner, Player); + } + checkSleeveAPIAccess(ctx); + const sleeveNumber = helpers.number(ctx, "sleeve", _sleeve); + checkSleeveNumber(ctx, sleeveNumber); + switch (action.type) { + case BladeActionType.general: + return [1, 1]; + case BladeActionType.contract: { const sleevePerson = Player.sleeves[sleeveNumber]; return action.getSuccessRange(bladeburner, sleevePerson); - } else return [0, 0]; - } else { - return action.getSuccessRange(bladeburner, Player); + } + default: + return [0, 0]; } }, getActionRepGain: (ctx) => (type, name, _level) => { diff --git a/src/NetscriptFunctions/Sleeve.ts b/src/NetscriptFunctions/Sleeve.ts index 6657f7c75..c0e5f77bc 100644 --- a/src/NetscriptFunctions/Sleeve.ts +++ b/src/NetscriptFunctions/Sleeve.ts @@ -28,7 +28,6 @@ export const checkSleeveAPIAccess = function (ctx: NetscriptContext) { export const checkSleeveNumber = function (ctx: NetscriptContext, sleeveNumber: number) { if (sleeveNumber >= Player.sleeves.length || sleeveNumber < 0) { const msg = `Invalid sleeve number: ${sleeveNumber}`; - helpers.log(ctx, () => msg); throw helpers.errorMessage(ctx, msg); } }; diff --git a/src/ScriptEditor/NetscriptDefinitions.d.ts b/src/ScriptEditor/NetscriptDefinitions.d.ts index 2be6007b9..6f18d1f44 100644 --- a/src/ScriptEditor/NetscriptDefinitions.d.ts +++ b/src/ScriptEditor/NetscriptDefinitions.d.ts @@ -3145,10 +3145,10 @@ export interface Bladeburner { * * @param type - Type of action. * @param name - Name of action. Must be an exact match. - * @param sleeve - Optional. Sleeve number to check for success. + * @param sleeveNumber - Optional. Index of the sleeve to retrieve information. * @returns Estimated success chance for the specified action. */ - getActionEstimatedSuccessChance(type: string, name: string, sleeve?: number): [number, number]; + getActionEstimatedSuccessChance(type: string, name: string, sleeveNumber?: number): [number, number]; /** * Get the reputation gain of an action.