mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2026-04-17 23:08:36 +02:00
API: Expose ProgramName enum (#2492)
This commit is contained in:
@@ -50,7 +50,7 @@ Description
|
||||
|
||||
</td><td>
|
||||
|
||||
string
|
||||
[ProgramName](./bitburner.programname.md)
|
||||
|
||||
|
||||
</td><td>
|
||||
|
||||
@@ -7,5 +7,5 @@
|
||||
**Signature:**
|
||||
|
||||
```typescript
|
||||
programName: string;
|
||||
programName: ProgramName;
|
||||
```
|
||||
|
||||
@@ -2143,6 +2143,26 @@ Structured interface to requirements for joining a faction or company. For field
|
||||
|
||||
|
||||
|
||||
</td></tr>
|
||||
<tr><td>
|
||||
|
||||
[ProgramName](./bitburner.programname.md)
|
||||
|
||||
|
||||
</td><td>
|
||||
|
||||
|
||||
|
||||
</td></tr>
|
||||
<tr><td>
|
||||
|
||||
[ProgramNameEnumType](./bitburner.programnameenumtype.md)
|
||||
|
||||
|
||||
</td><td>
|
||||
|
||||
|
||||
|
||||
</td></tr>
|
||||
<tr><td>
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
|
||||
14
markdown/bitburner.programname.md
Normal file
14
markdown/bitburner.programname.md
Normal file
@@ -0,0 +1,14 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [bitburner](./bitburner.md) > [ProgramName](./bitburner.programname.md)
|
||||
|
||||
## ProgramName type
|
||||
|
||||
|
||||
**Signature:**
|
||||
|
||||
```typescript
|
||||
type ProgramName = _ValueOf<ProgramNameEnumType>;
|
||||
```
|
||||
**References:** [\_ValueOf](./bitburner._valueof.md)<!-- -->, [ProgramNameEnumType](./bitburner.programnameenumtype.md)
|
||||
|
||||
28
markdown/bitburner.programnameenumtype.md
Normal file
28
markdown/bitburner.programnameenumtype.md
Normal file
@@ -0,0 +1,28 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[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";
|
||||
};
|
||||
```
|
||||
@@ -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
|
||||
</th></tr></thead>
|
||||
<tbody><tr><td>
|
||||
|
||||
program
|
||||
programName
|
||||
|
||||
|
||||
</td><td>
|
||||
|
||||
string
|
||||
[ProgramName](./bitburner.programname.md)
|
||||
|
||||
|
||||
</td><td>
|
||||
|
||||
@@ -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
|
||||
|
||||
</td><td>
|
||||
|
||||
string
|
||||
[ProgramName](./bitburner.programname.md)
|
||||
|
||||
|
||||
</td><td>
|
||||
|
||||
@@ -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
|
||||
</th></tr></thead>
|
||||
<tbody><tr><td>
|
||||
|
||||
program
|
||||
programName
|
||||
|
||||
|
||||
</td><td>
|
||||
|
||||
string
|
||||
[ProgramName](./bitburner.programname.md)
|
||||
|
||||
|
||||
</td><td>
|
||||
|
||||
@@ -97,7 +97,7 @@ Connect to a server.
|
||||
</td></tr>
|
||||
<tr><td>
|
||||
|
||||
[createProgram(program, focus)](./bitburner.singularity.createprogram.md)
|
||||
[createProgram(programName, focus)](./bitburner.singularity.createprogram.md)
|
||||
|
||||
|
||||
</td><td>
|
||||
@@ -416,7 +416,7 @@ Get the work types of a faction.
|
||||
</td></tr>
|
||||
<tr><td>
|
||||
|
||||
[getHackingLevelRequirementOfProgram(program)](./bitburner.singularity.gethackinglevelrequirementofprogram.md)
|
||||
[getHackingLevelRequirementOfProgram(programName)](./bitburner.singularity.gethackinglevelrequirementofprogram.md)
|
||||
|
||||
|
||||
</td><td>
|
||||
|
||||
@@ -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
|
||||
|
||||
</td><td>
|
||||
|
||||
string
|
||||
[ProgramName](./bitburner.programname.md)
|
||||
|
||||
|
||||
</td><td>
|
||||
@@ -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}`);
|
||||
```
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
|
||||
39
src/ScriptEditor/NetscriptDefinitions.d.ts
vendored
39
src/ScriptEditor/NetscriptDefinitions.d.ts
vendored
@@ -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<FactionNameEnumType>;
|
||||
|
||||
/** @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<ProgramNameEnumType>;
|
||||
|
||||
/** @public */
|
||||
type CodingContractNameEnumType = {
|
||||
FindLargestPrimeFactor: "Find Largest Prime Factor";
|
||||
@@ -9460,6 +9482,7 @@ type NSEnums = {
|
||||
SpecialBladeburnerActionTypeForSleeve: SpecialBladeburnerActionEnumTypeForSleeve;
|
||||
FragmentType: FragmentEnumType;
|
||||
DarknetResponseCode: DarknetResponseCodeType;
|
||||
ProgramName: ProgramNameEnumType;
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user