mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-12-27 16:37:33 +01:00
Began attempting to implement a multi-upgrade function for bb
This commit is contained in:
parent
6f017bf4f6
commit
709fc3ab63
@ -17,7 +17,7 @@ import { IAction } from "./IAction";
|
||||
import { IPlayer } from "../PersonObjects/IPlayer";
|
||||
import { createTaskTracker, ITaskTracker } from "../PersonObjects/ITaskTracker";
|
||||
import { IPerson } from "../PersonObjects/IPerson";
|
||||
import { IRouter, Page } from "../ui/Router";
|
||||
import { IRouter } from "../ui/Router";
|
||||
import { ConsoleHelpText } from "./data/Help";
|
||||
import { exceptionAlert } from "../utils/helpers/exceptionAlert";
|
||||
import { getRandomInt } from "../utils/helpers/getRandomInt";
|
||||
@ -35,7 +35,6 @@ import { getTimestamp } from "../utils/helpers/getTimestamp";
|
||||
import { joinFaction } from "../Faction/FactionHelpers";
|
||||
import { WorkerScript } from "../Netscript/WorkerScript";
|
||||
import { FactionNames } from "../Faction/data/FactionNames";
|
||||
import { BlackOperationNames } from "./data/BlackOperationNames";
|
||||
import { KEY } from "../utils/helpers/keyCodes";
|
||||
|
||||
interface BlackOpsAttempt {
|
||||
|
@ -292,13 +292,18 @@ export function NetscriptBladeburner(player: IPlayer, workerScript: WorkerScript
|
||||
},
|
||||
upgradeSkill:
|
||||
(ctx: NetscriptContext) =>
|
||||
(_skillName: unknown): boolean => {
|
||||
(_skillName: unknown, count = 1): number => {
|
||||
const skillName = ctx.helper.string("skillName", _skillName);
|
||||
checkBladeburnerAccess(ctx);
|
||||
const bladeburner = player.bladeburner;
|
||||
if (bladeburner === null) throw new Error("Should not be called without Bladeburner");
|
||||
try {
|
||||
return bladeburner.upgradeSkillNetscriptFn(skillName, workerScript);
|
||||
for(let i=0; i<count; i++){
|
||||
if(!bladeburner.upgradeSkillNetscriptFn(skillName, workerScript)){
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return count;
|
||||
} catch (e: any) {
|
||||
throw ctx.makeRuntimeErrorMsg(e);
|
||||
}
|
||||
|
2
src/ScriptEditor/NetscriptDefinitions.d.ts
vendored
2
src/ScriptEditor/NetscriptDefinitions.d.ts
vendored
@ -3101,7 +3101,7 @@ export interface Bladeburner {
|
||||
* @param skillName - Name of skill to be upgraded. Case-sensitive and must be an exact match
|
||||
* @returns true if the skill is successfully upgraded, and false otherwise.
|
||||
*/
|
||||
upgradeSkill(name: string): boolean;
|
||||
upgradeSkill(name: string, count: number): number;
|
||||
|
||||
/**
|
||||
* Get team size.
|
||||
|
Loading…
Reference in New Issue
Block a user