From 68700ff01fd7d6bd9634b5bfeebc65522d41d2fc Mon Sep 17 00:00:00 2001 From: catloversg <152669316+catloversg@users.noreply.github.com> Date: Sat, 14 Feb 2026 02:51:42 +0700 Subject: [PATCH] API: Expose ProgramName enum (#2492) --- markdown/bitburner.createprogramworktask.md | 2 +- ...urner.createprogramworktask.programname.md | 2 +- markdown/bitburner.md | 20 ++++++++++ markdown/bitburner.nsenums.md | 3 +- markdown/bitburner.programname.md | 14 +++++++ markdown/bitburner.programnameenumtype.md | 28 +++++++++++++ .../bitburner.singularity.createprogram.md | 6 +-- ...urner.singularity.getdarkwebprogramcost.md | 4 +- ...ity.gethackinglevelrequirementofprogram.md | 6 +-- markdown/bitburner.singularity.md | 4 +- .../bitburner.singularity.purchaseprogram.md | 6 +-- src/Documentation/pages.ts | 4 ++ src/NetscriptFunctions.ts | 1 + src/ScriptEditor/NetscriptDefinitions.d.ts | 39 +++++++++++++++---- 14 files changed, 115 insertions(+), 24 deletions(-) create mode 100644 markdown/bitburner.programname.md create mode 100644 markdown/bitburner.programnameenumtype.md diff --git a/markdown/bitburner.createprogramworktask.md b/markdown/bitburner.createprogramworktask.md index 66e0872e5..6da7c9fc6 100644 --- a/markdown/bitburner.createprogramworktask.md +++ b/markdown/bitburner.createprogramworktask.md @@ -50,7 +50,7 @@ Description -string +[ProgramName](./bitburner.programname.md) diff --git a/markdown/bitburner.createprogramworktask.programname.md b/markdown/bitburner.createprogramworktask.programname.md index 92b50755a..8f656f401 100644 --- a/markdown/bitburner.createprogramworktask.programname.md +++ b/markdown/bitburner.createprogramworktask.programname.md @@ -7,5 +7,5 @@ **Signature:** ```typescript -programName: string; +programName: ProgramName; ``` diff --git a/markdown/bitburner.md b/markdown/bitburner.md index aec22f8f1..e996ebb4e 100644 --- a/markdown/bitburner.md +++ b/markdown/bitburner.md @@ -2143,6 +2143,26 @@ Structured interface to requirements for joining a faction or company. For field + + + +[ProgramName](./bitburner.programname.md) + + + + + + + + + +[ProgramNameEnumType](./bitburner.programnameenumtype.md) + + + + + + diff --git a/markdown/bitburner.nsenums.md b/markdown/bitburner.nsenums.md index 6730bb759..1779282c2 100644 --- a/markdown/bitburner.nsenums.md +++ b/markdown/bitburner.nsenums.md @@ -27,7 +27,8 @@ type NSEnums = { SpecialBladeburnerActionTypeForSleeve: SpecialBladeburnerActionEnumTypeForSleeve; FragmentType: FragmentEnumType; DarknetResponseCode: DarknetResponseCodeType; + ProgramName: ProgramNameEnumType; }; ``` -**References:** [CityNameEnumType](./bitburner.citynameenumtype.md), [CrimeEnumType](./bitburner.crimeenumtype.md), [FactionWorkEnumType](./bitburner.factionworkenumtype.md), [GymEnumType](./bitburner.gymenumtype.md), [JobNameEnumType](./bitburner.jobnameenumtype.md), [JobFieldEnumType](./bitburner.jobfieldenumtype.md), [LocationNameEnumType](./bitburner.locationnameenumtype.md), [ToastVariantEnumType](./bitburner.toastvariantenumtype.md), [UniversityClassEnumType](./bitburner.universityclassenumtype.md), [CompanyNameEnumType](./bitburner.companynameenumtype.md), [FactionNameEnumType](./bitburner.factionnameenumtype.md), [CodingContractNameEnumType](./bitburner.codingcontractnameenumtype.md), [PositionEnumType](./bitburner.positionenumtype.md), [OrderEnumType](./bitburner.orderenumtype.md), [BladeburnerActionEnumType](./bitburner.bladeburneractionenumtype.md), [SpecialBladeburnerActionEnumTypeForSleeve](./bitburner.specialbladeburneractionenumtypeforsleeve.md), [FragmentEnumType](./bitburner.fragmentenumtype.md), [DarknetResponseCodeType](./bitburner.darknetresponsecodetype.md) +**References:** [CityNameEnumType](./bitburner.citynameenumtype.md), [CrimeEnumType](./bitburner.crimeenumtype.md), [FactionWorkEnumType](./bitburner.factionworkenumtype.md), [GymEnumType](./bitburner.gymenumtype.md), [JobNameEnumType](./bitburner.jobnameenumtype.md), [JobFieldEnumType](./bitburner.jobfieldenumtype.md), [LocationNameEnumType](./bitburner.locationnameenumtype.md), [ToastVariantEnumType](./bitburner.toastvariantenumtype.md), [UniversityClassEnumType](./bitburner.universityclassenumtype.md), [CompanyNameEnumType](./bitburner.companynameenumtype.md), [FactionNameEnumType](./bitburner.factionnameenumtype.md), [CodingContractNameEnumType](./bitburner.codingcontractnameenumtype.md), [PositionEnumType](./bitburner.positionenumtype.md), [OrderEnumType](./bitburner.orderenumtype.md), [BladeburnerActionEnumType](./bitburner.bladeburneractionenumtype.md), [SpecialBladeburnerActionEnumTypeForSleeve](./bitburner.specialbladeburneractionenumtypeforsleeve.md), [FragmentEnumType](./bitburner.fragmentenumtype.md), [DarknetResponseCodeType](./bitburner.darknetresponsecodetype.md), [ProgramNameEnumType](./bitburner.programnameenumtype.md) diff --git a/markdown/bitburner.programname.md b/markdown/bitburner.programname.md new file mode 100644 index 000000000..be904331f --- /dev/null +++ b/markdown/bitburner.programname.md @@ -0,0 +1,14 @@ + + +[Home](./index.md) > [bitburner](./bitburner.md) > [ProgramName](./bitburner.programname.md) + +## ProgramName type + + +**Signature:** + +```typescript +type ProgramName = _ValueOf; +``` +**References:** [\_ValueOf](./bitburner._valueof.md), [ProgramNameEnumType](./bitburner.programnameenumtype.md) + diff --git a/markdown/bitburner.programnameenumtype.md b/markdown/bitburner.programnameenumtype.md new file mode 100644 index 000000000..1ce2a2ce8 --- /dev/null +++ b/markdown/bitburner.programnameenumtype.md @@ -0,0 +1,28 @@ + + +[Home](./index.md) > [bitburner](./bitburner.md) > [ProgramNameEnumType](./bitburner.programnameenumtype.md) + +## ProgramNameEnumType type + + +**Signature:** + +```typescript +type ProgramNameEnumType = { + nuke: "NUKE.exe"; + bruteSsh: "BruteSSH.exe"; + ftpCrack: "FTPCrack.exe"; + relaySmtp: "relaySMTP.exe"; + httpWorm: "HTTPWorm.exe"; + sqlInject: "SQLInject.exe"; + deepScan1: "DeepscanV1.exe"; + deepScan2: "DeepscanV2.exe"; + serverProfiler: "ServerProfiler.exe"; + autoLink: "AutoLink.exe"; + formulas: "Formulas.exe"; + bitFlume: "b1t_flum3.exe"; + flight: "fl1ght.exe"; + darkscape: "DarkscapeNavigator.exe"; + stormSeed: "STORM_SEED.exe"; +}; +``` diff --git a/markdown/bitburner.singularity.createprogram.md b/markdown/bitburner.singularity.createprogram.md index 47c969e96..2a42bb255 100644 --- a/markdown/bitburner.singularity.createprogram.md +++ b/markdown/bitburner.singularity.createprogram.md @@ -9,7 +9,7 @@ Create a program. **Signature:** ```typescript -createProgram(program: string, focus?: boolean): boolean; +createProgram(programName: ProgramName, focus?: boolean): boolean; ``` ## Parameters @@ -32,12 +32,12 @@ Description -program +programName -string +[ProgramName](./bitburner.programname.md) diff --git a/markdown/bitburner.singularity.getdarkwebprogramcost.md b/markdown/bitburner.singularity.getdarkwebprogramcost.md index cc3cb08de..67f260132 100644 --- a/markdown/bitburner.singularity.getdarkwebprogramcost.md +++ b/markdown/bitburner.singularity.getdarkwebprogramcost.md @@ -9,7 +9,7 @@ Check the price of an exploit on the dark web **Signature:** ```typescript -getDarkwebProgramCost(programName: string): number; +getDarkwebProgramCost(programName: ProgramName): number; ``` ## Parameters @@ -37,7 +37,7 @@ programName -string +[ProgramName](./bitburner.programname.md) diff --git a/markdown/bitburner.singularity.gethackinglevelrequirementofprogram.md b/markdown/bitburner.singularity.gethackinglevelrequirementofprogram.md index 63b25568b..8adad6049 100644 --- a/markdown/bitburner.singularity.gethackinglevelrequirementofprogram.md +++ b/markdown/bitburner.singularity.gethackinglevelrequirementofprogram.md @@ -9,7 +9,7 @@ Get the hacking level requirement of a program. **Signature:** ```typescript -getHackingLevelRequirementOfProgram(program: string): number; +getHackingLevelRequirementOfProgram(programName: ProgramName): number; ``` ## Parameters @@ -32,12 +32,12 @@ Description -program +programName -string +[ProgramName](./bitburner.programname.md) diff --git a/markdown/bitburner.singularity.md b/markdown/bitburner.singularity.md index 540bd8e9c..38902da32 100644 --- a/markdown/bitburner.singularity.md +++ b/markdown/bitburner.singularity.md @@ -97,7 +97,7 @@ Connect to a server. -[createProgram(program, focus)](./bitburner.singularity.createprogram.md) +[createProgram(programName, focus)](./bitburner.singularity.createprogram.md) @@ -416,7 +416,7 @@ Get the work types of a faction. -[getHackingLevelRequirementOfProgram(program)](./bitburner.singularity.gethackinglevelrequirementofprogram.md) +[getHackingLevelRequirementOfProgram(programName)](./bitburner.singularity.gethackinglevelrequirementofprogram.md) diff --git a/markdown/bitburner.singularity.purchaseprogram.md b/markdown/bitburner.singularity.purchaseprogram.md index 8c843657b..278410d7d 100644 --- a/markdown/bitburner.singularity.purchaseprogram.md +++ b/markdown/bitburner.singularity.purchaseprogram.md @@ -9,7 +9,7 @@ Purchase a program from the dark web. **Signature:** ```typescript -purchaseProgram(programName: string): boolean; +purchaseProgram(programName: ProgramName): boolean; ``` ## Parameters @@ -37,7 +37,7 @@ programName -string +[ProgramName](./bitburner.programname.md) @@ -64,7 +64,7 @@ This function allows you to automatically purchase programs. You MUST have a TOR ```js -const programName = "BruteSSH.exe"; +const programName = ns.enums.ProgramName.bruteSsh; const success = ns.singularity.purchaseProgram(programName); if (!success) ns.tprint(`ERROR: Failed to purchase ${programName}`); ``` diff --git a/src/Documentation/pages.ts b/src/Documentation/pages.ts index 885b576a8..1772241a0 100644 --- a/src/Documentation/pages.ts +++ b/src/Documentation/pages.ts @@ -1195,6 +1195,8 @@ import nsDoc_bitburner_product_rating_md from "../../markdown/bitburner.product. import nsDoc_bitburner_product_size_md from "../../markdown/bitburner.product.size.md?raw"; import nsDoc_bitburner_product_stats_md from "../../markdown/bitburner.product.stats.md?raw"; import nsDoc_bitburner_product_stored_md from "../../markdown/bitburner.product.stored.md?raw"; +import nsDoc_bitburner_programname_md from "../../markdown/bitburner.programname.md?raw"; +import nsDoc_bitburner_programnameenumtype_md from "../../markdown/bitburner.programnameenumtype.md?raw"; import nsDoc_bitburner_reactelement_key_md from "../../markdown/bitburner.reactelement.key.md?raw"; import nsDoc_bitburner_reactelement_md from "../../markdown/bitburner.reactelement.md?raw"; import nsDoc_bitburner_reactelement_props_md from "../../markdown/bitburner.reactelement.props.md?raw"; @@ -2784,6 +2786,8 @@ AllPages["nsDoc/bitburner.product.rating.md"] = nsDoc_bitburner_product_rating_m AllPages["nsDoc/bitburner.product.size.md"] = nsDoc_bitburner_product_size_md; AllPages["nsDoc/bitburner.product.stats.md"] = nsDoc_bitburner_product_stats_md; AllPages["nsDoc/bitburner.product.stored.md"] = nsDoc_bitburner_product_stored_md; +AllPages["nsDoc/bitburner.programname.md"] = nsDoc_bitburner_programname_md; +AllPages["nsDoc/bitburner.programnameenumtype.md"] = nsDoc_bitburner_programnameenumtype_md; AllPages["nsDoc/bitburner.reactelement.key.md"] = nsDoc_bitburner_reactelement_key_md; AllPages["nsDoc/bitburner.reactelement.md"] = nsDoc_bitburner_reactelement_md; AllPages["nsDoc/bitburner.reactelement.props.md"] = nsDoc_bitburner_reactelement_props_md; diff --git a/src/NetscriptFunctions.ts b/src/NetscriptFunctions.ts index 964d1c055..285c07bec 100644 --- a/src/NetscriptFunctions.ts +++ b/src/NetscriptFunctions.ts @@ -137,6 +137,7 @@ export const enums: NSEnums = { SpecialBladeburnerActionTypeForSleeve, FragmentType: FragmentTypeEnum, DarknetResponseCode: ResponseCodeEnum, + ProgramName: CompletedProgramName, }; for (const val of Object.values(enums)) Object.freeze(val); Object.freeze(enums); diff --git a/src/ScriptEditor/NetscriptDefinitions.d.ts b/src/ScriptEditor/NetscriptDefinitions.d.ts index 92456d650..6d0064512 100644 --- a/src/ScriptEditor/NetscriptDefinitions.d.ts +++ b/src/ScriptEditor/NetscriptDefinitions.d.ts @@ -1769,7 +1769,7 @@ export interface CompanyWorkTask extends BaseTask { */ export interface CreateProgramWorkTask extends BaseTask { type: "CREATE_PROGRAM"; - programName: string; + programName: ProgramName; } /** @@ -1988,14 +1988,14 @@ export interface Singularity { * * @example * ```js - * const programName = "BruteSSH.exe"; + * const programName = ns.enums.ProgramName.bruteSsh; * const success = ns.singularity.purchaseProgram(programName); * if (!success) ns.tprint(`ERROR: Failed to purchase ${programName}`); * ``` * @param programName - Name of program to purchase. * @returns True if the specified program is purchased or if you already own it, and false otherwise. */ - purchaseProgram(programName: string): boolean; + purchaseProgram(programName: ProgramName): boolean; /** * Check if the player is busy. @@ -2456,11 +2456,11 @@ export interface Singularity { * const success = ns.singularity.createProgram(programName); * if (!success) ns.tprint(`ERROR: Failed to start working on ${programName}`); * ``` - * @param program - Name of program to create. + * @param programName - Name of program to create. * @param focus - Acquire player focus on this program creation. Optional. Defaults to true. * @returns True if you successfully start working on the specified program, and false otherwise. */ - createProgram(program: string, focus?: boolean): boolean; + createProgram(programName: ProgramName, focus?: boolean): boolean; /** * Get the hacking level requirement of a program. @@ -2470,10 +2470,10 @@ export interface Singularity { * In order to create a program via UI or {@link Singularity.createProgram | createProgram}, your hacking level must * meet the requirement of that program. This API returns that value. * - * @param program - Name of program to create. + * @param programName - Name of program to create. * @returns Hacking level requirement. Return Infinity if the specified program cannot be created. */ - getHackingLevelRequirementOfProgram(program: string): number; + getHackingLevelRequirementOfProgram(programName: ProgramName): number; /** * Commit a crime. @@ -2823,7 +2823,7 @@ export interface Singularity { * (if not yet purchased), 0 if it has already been purchased, or -1 if Tor has not been * purchased. Throws an error if the specified program/exploit does not exist */ - getDarkwebProgramCost(programName: string): number; + getDarkwebProgramCost(programName: ProgramName): number; /** * b1t_flum3 into a different BN. @@ -9359,6 +9359,28 @@ type FactionNameEnumType = { /** @public */ type FactionName = _ValueOf; +/** @public */ +type ProgramNameEnumType = { + nuke: "NUKE.exe"; + bruteSsh: "BruteSSH.exe"; + ftpCrack: "FTPCrack.exe"; + relaySmtp: "relaySMTP.exe"; + httpWorm: "HTTPWorm.exe"; + sqlInject: "SQLInject.exe"; + deepScan1: "DeepscanV1.exe"; + deepScan2: "DeepscanV2.exe"; + serverProfiler: "ServerProfiler.exe"; + autoLink: "AutoLink.exe"; + formulas: "Formulas.exe"; + bitFlume: "b1t_flum3.exe"; + flight: "fl1ght.exe"; + darkscape: "DarkscapeNavigator.exe"; + stormSeed: "STORM_SEED.exe"; +}; + +/** @public */ +type ProgramName = _ValueOf; + /** @public */ type CodingContractNameEnumType = { FindLargestPrimeFactor: "Find Largest Prime Factor"; @@ -9460,6 +9482,7 @@ type NSEnums = { SpecialBladeburnerActionTypeForSleeve: SpecialBladeburnerActionEnumTypeForSleeve; FragmentType: FragmentEnumType; DarknetResponseCode: DarknetResponseCodeType; + ProgramName: ProgramNameEnumType; }; /**