mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2026-04-16 06:18:42 +02:00
MISC: Use FactionName enum in relevant APIs (#2101)
This commit is contained in:
@@ -15,14 +15,14 @@ Bribe a faction. You must satisfy these conditions:
|
||||
**Signature:**
|
||||
|
||||
```typescript
|
||||
bribe(factionName: string, amountCash: number): boolean;
|
||||
bribe(factionName: FactionName, amountCash: number): boolean;
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
| Parameter | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| factionName | string | Faction name |
|
||||
| factionName | [FactionName](./bitburner.factionname.md) | Faction name |
|
||||
| amountCash | number | Amount of money to bribe |
|
||||
|
||||
**Returns:**
|
||||
|
||||
@@ -7,5 +7,5 @@
|
||||
**Signature:**
|
||||
|
||||
```typescript
|
||||
factionName: string;
|
||||
factionName: FactionName;
|
||||
```
|
||||
|
||||
@@ -21,7 +21,7 @@ An object representing the current work for a faction
|
||||
|
||||
| Property | Modifiers | Type | Description |
|
||||
| --- | --- | --- | --- |
|
||||
| [factionName](./bitburner.factionworktask.factionname.md) | | string | |
|
||||
| [factionName](./bitburner.factionworktask.factionname.md) | | [FactionName](./bitburner.factionname.md) | |
|
||||
| [factionWorkType](./bitburner.factionworktask.factionworktype.md) | | [FactionWorkType](./bitburner.factionworktype.md) | |
|
||||
| [type](./bitburner.factionworktask.type.md) | | "FACTION" | |
|
||||
|
||||
|
||||
@@ -9,14 +9,14 @@ Create a gang.
|
||||
**Signature:**
|
||||
|
||||
```typescript
|
||||
createGang(faction: string): boolean;
|
||||
createGang(faction: FactionName): boolean;
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
| Parameter | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| faction | string | Name of the faction that you want to create a gang with. This faction must allow this action, and you must be its member. |
|
||||
| faction | [FactionName](./bitburner.factionname.md) | Name of the faction that you want to create a gang with. This faction must allow this action, and you must be its member. |
|
||||
|
||||
**Returns:**
|
||||
|
||||
|
||||
@@ -9,11 +9,11 @@ List all current faction invitations.
|
||||
**Signature:**
|
||||
|
||||
```typescript
|
||||
checkFactionInvitations(): string[];
|
||||
checkFactionInvitations(): FactionName[];
|
||||
```
|
||||
**Returns:**
|
||||
|
||||
string\[\]
|
||||
[FactionName](./bitburner.factionname.md)<!-- -->\[\]
|
||||
|
||||
Array with the name of all Factions you currently have outstanding invitations from.
|
||||
|
||||
|
||||
@@ -9,14 +9,14 @@ Donate to a faction.
|
||||
**Signature:**
|
||||
|
||||
```typescript
|
||||
donateToFaction(faction: string, amount: number): boolean;
|
||||
donateToFaction(faction: FactionName, amount: number): boolean;
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
| Parameter | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| faction | string | Name of faction to donate to. |
|
||||
| faction | [FactionName](./bitburner.factionname.md) | Name of faction to donate to. |
|
||||
| amount | number | Amount of money to donate. |
|
||||
|
||||
**Returns:**
|
||||
|
||||
@@ -9,7 +9,7 @@ Get a list of faction(s) that have a specific Augmentation.
|
||||
**Signature:**
|
||||
|
||||
```typescript
|
||||
getAugmentationFactions(augName: string): string[];
|
||||
getAugmentationFactions(augName: string): FactionName[];
|
||||
```
|
||||
|
||||
## Parameters
|
||||
@@ -20,7 +20,7 @@ getAugmentationFactions(augName: string): string[];
|
||||
|
||||
**Returns:**
|
||||
|
||||
string\[\]
|
||||
[FactionName](./bitburner.factionname.md)<!-- -->\[\]
|
||||
|
||||
Array containing the names of all factions.
|
||||
|
||||
|
||||
@@ -9,14 +9,14 @@ Get a list of augmentation available from a faction.
|
||||
**Signature:**
|
||||
|
||||
```typescript
|
||||
getAugmentationsFromFaction(faction: string): string[];
|
||||
getAugmentationsFromFaction(faction: FactionName): string[];
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
| Parameter | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| faction | string | Name of faction. |
|
||||
| faction | [FactionName](./bitburner.factionname.md) | Name of faction. |
|
||||
|
||||
**Returns:**
|
||||
|
||||
|
||||
@@ -9,14 +9,14 @@ Get a list of enemies of a faction.
|
||||
**Signature:**
|
||||
|
||||
```typescript
|
||||
getFactionEnemies(faction: string): string[];
|
||||
getFactionEnemies(faction: FactionName): string[];
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
| Parameter | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| faction | string | Name of faction. |
|
||||
| faction | [FactionName](./bitburner.factionname.md) | Name of faction. |
|
||||
|
||||
**Returns:**
|
||||
|
||||
|
||||
@@ -9,14 +9,14 @@ Get faction favor.
|
||||
**Signature:**
|
||||
|
||||
```typescript
|
||||
getFactionFavor(faction: string): number;
|
||||
getFactionFavor(faction: FactionName): number;
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
| Parameter | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| faction | string | Name of faction. |
|
||||
| faction | [FactionName](./bitburner.factionname.md) | Name of faction. |
|
||||
|
||||
**Returns:**
|
||||
|
||||
|
||||
@@ -9,14 +9,14 @@ Get faction favor gain.
|
||||
**Signature:**
|
||||
|
||||
```typescript
|
||||
getFactionFavorGain(faction: string): number;
|
||||
getFactionFavorGain(faction: FactionName): number;
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
| Parameter | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| faction | string | Name of faction. |
|
||||
| faction | [FactionName](./bitburner.factionname.md) | Name of faction. |
|
||||
|
||||
**Returns:**
|
||||
|
||||
|
||||
@@ -9,14 +9,14 @@ List conditions for being invited to a faction.
|
||||
**Signature:**
|
||||
|
||||
```typescript
|
||||
getFactionInviteRequirements(faction: string): PlayerRequirement[];
|
||||
getFactionInviteRequirements(faction: FactionName): PlayerRequirement[];
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
| Parameter | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| faction | string | Name of the faction |
|
||||
| faction | [FactionName](./bitburner.factionname.md) | Name of the faction |
|
||||
|
||||
**Returns:**
|
||||
|
||||
|
||||
@@ -9,14 +9,14 @@ Get faction reputation.
|
||||
**Signature:**
|
||||
|
||||
```typescript
|
||||
getFactionRep(faction: string): number;
|
||||
getFactionRep(faction: FactionName): number;
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
| Parameter | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| faction | string | Name of faction to work for. |
|
||||
| faction | [FactionName](./bitburner.factionname.md) | Name of faction to work for. |
|
||||
|
||||
**Returns:**
|
||||
|
||||
|
||||
@@ -9,14 +9,14 @@ Get the work types of a faction.
|
||||
**Signature:**
|
||||
|
||||
```typescript
|
||||
getFactionWorkTypes(faction: string): FactionWorkType[];
|
||||
getFactionWorkTypes(faction: FactionName): FactionWorkType[];
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
| Parameter | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| faction | string | Name of the faction. |
|
||||
| faction | [FactionName](./bitburner.factionname.md) | Name of the faction. |
|
||||
|
||||
**Returns:**
|
||||
|
||||
|
||||
@@ -9,14 +9,14 @@ Join a faction.
|
||||
**Signature:**
|
||||
|
||||
```typescript
|
||||
joinFaction(faction: string): boolean;
|
||||
joinFaction(faction: FactionName): boolean;
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
| Parameter | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| faction | string | Name of faction to join. |
|
||||
| faction | [FactionName](./bitburner.factionname.md) | Name of faction to join. |
|
||||
|
||||
**Returns:**
|
||||
|
||||
|
||||
@@ -9,14 +9,14 @@ Purchase an augmentation
|
||||
**Signature:**
|
||||
|
||||
```typescript
|
||||
purchaseAugmentation(faction: string, augmentation: string): boolean;
|
||||
purchaseAugmentation(faction: FactionName, augmentation: string): boolean;
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
| Parameter | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| faction | string | Name of faction to purchase Augmentation from. |
|
||||
| faction | [FactionName](./bitburner.factionname.md) | Name of faction to purchase Augmentation from. |
|
||||
| augmentation | string | Name of Augmentation to purchase. |
|
||||
|
||||
**Returns:**
|
||||
|
||||
@@ -9,14 +9,14 @@ Work for a faction.
|
||||
**Signature:**
|
||||
|
||||
```typescript
|
||||
workForFaction(faction: string, workType: FactionWorkType, focus?: boolean): boolean;
|
||||
workForFaction(faction: FactionName, workType: FactionWorkType, focus?: boolean): boolean;
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
| Parameter | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| faction | string | Name of faction to work for. |
|
||||
| faction | [FactionName](./bitburner.factionname.md) | Name of faction to work for. |
|
||||
| workType | [FactionWorkType](./bitburner.factionworktype.md) | Type of work to perform for the faction. |
|
||||
| focus | boolean | _(Optional)_ Acquire player focus on this work operation. Optional. Defaults to true. |
|
||||
|
||||
|
||||
@@ -9,7 +9,11 @@ Set a sleeve to work for a faction.
|
||||
**Signature:**
|
||||
|
||||
```typescript
|
||||
setToFactionWork(sleeveNumber: number, factionName: string, factionWorkType: FactionWorkType): boolean | undefined;
|
||||
setToFactionWork(
|
||||
sleeveNumber: number,
|
||||
factionName: FactionName,
|
||||
factionWorkType: FactionWorkType,
|
||||
): boolean | undefined;
|
||||
```
|
||||
|
||||
## Parameters
|
||||
@@ -17,7 +21,7 @@ setToFactionWork(sleeveNumber: number, factionName: string, factionWorkType: Fac
|
||||
| Parameter | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| sleeveNumber | number | Index of the sleeve to work for the faction. |
|
||||
| factionName | string | Name of the faction to work for. |
|
||||
| factionName | [FactionName](./bitburner.factionname.md) | Name of the faction to work for. |
|
||||
| factionWorkType | [FactionWorkType](./bitburner.factionworktype.md) | Name of the action to perform for this faction. |
|
||||
|
||||
**Returns:**
|
||||
|
||||
@@ -11,8 +11,8 @@
|
||||
type SleeveFactionTask = {
|
||||
type: "FACTION";
|
||||
factionWorkType: FactionWorkType;
|
||||
factionName: string;
|
||||
factionName: FactionName;
|
||||
};
|
||||
```
|
||||
**References:** [FactionWorkType](./bitburner.factionworktype.md)
|
||||
**References:** [FactionWorkType](./bitburner.factionworktype.md)<!-- -->, [FactionName](./bitburner.factionname.md)
|
||||
|
||||
|
||||
40
src/ScriptEditor/NetscriptDefinitions.d.ts
vendored
40
src/ScriptEditor/NetscriptDefinitions.d.ts
vendored
@@ -1114,7 +1114,7 @@ type SleeveCrimeTask = {
|
||||
type SleeveFactionTask = {
|
||||
type: "FACTION";
|
||||
factionWorkType: FactionWorkType;
|
||||
factionName: string;
|
||||
factionName: FactionName;
|
||||
};
|
||||
|
||||
/** @public */
|
||||
@@ -1761,7 +1761,7 @@ export interface CrimeTask extends BaseTask {
|
||||
export interface FactionWorkTask extends BaseTask {
|
||||
type: "FACTION";
|
||||
factionWorkType: FactionWorkType;
|
||||
factionName: string;
|
||||
factionName: FactionName;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2252,7 +2252,7 @@ export interface Singularity {
|
||||
* ]
|
||||
* ```
|
||||
*/
|
||||
getFactionInviteRequirements(faction: string): PlayerRequirement[];
|
||||
getFactionInviteRequirements(faction: FactionName): PlayerRequirement[];
|
||||
|
||||
/**
|
||||
* Get a list of enemies of a faction.
|
||||
@@ -2266,7 +2266,7 @@ export interface Singularity {
|
||||
* @param faction - Name of faction.
|
||||
* @returns Array containing the names of all enemies of the faction.
|
||||
*/
|
||||
getFactionEnemies(faction: string): string[];
|
||||
getFactionEnemies(faction: FactionName): string[];
|
||||
|
||||
/**
|
||||
* List all current faction invitations.
|
||||
@@ -2279,7 +2279,7 @@ export interface Singularity {
|
||||
*
|
||||
* @returns Array with the name of all Factions you currently have outstanding invitations from.
|
||||
*/
|
||||
checkFactionInvitations(): string[];
|
||||
checkFactionInvitations(): FactionName[];
|
||||
|
||||
/**
|
||||
* Join a faction.
|
||||
@@ -2292,7 +2292,7 @@ export interface Singularity {
|
||||
* @param faction - Name of faction to join.
|
||||
* @returns True if player joined the faction, and false otherwise.
|
||||
*/
|
||||
joinFaction(faction: string): boolean;
|
||||
joinFaction(faction: FactionName): boolean;
|
||||
|
||||
/**
|
||||
* Work for a faction.
|
||||
@@ -2320,7 +2320,7 @@ export interface Singularity {
|
||||
* @param focus - Acquire player focus on this work operation. Optional. Defaults to true.
|
||||
* @returns True if the player starts working, and false otherwise.
|
||||
*/
|
||||
workForFaction(faction: string, workType: FactionWorkType, focus?: boolean): boolean;
|
||||
workForFaction(faction: FactionName, workType: FactionWorkType, focus?: boolean): boolean;
|
||||
|
||||
/**
|
||||
* Get the work types of a faction.
|
||||
@@ -2332,7 +2332,7 @@ export interface Singularity {
|
||||
* @param faction - Name of the faction.
|
||||
* @returns The work types of the faction.
|
||||
*/
|
||||
getFactionWorkTypes(faction: string): FactionWorkType[];
|
||||
getFactionWorkTypes(faction: FactionName): FactionWorkType[];
|
||||
|
||||
/**
|
||||
* Get faction reputation.
|
||||
@@ -2345,7 +2345,7 @@ export interface Singularity {
|
||||
* @param faction - Name of faction to work for.
|
||||
* @returns Amount of reputation you have for the specified faction.
|
||||
*/
|
||||
getFactionRep(faction: string): number;
|
||||
getFactionRep(faction: FactionName): number;
|
||||
|
||||
/**
|
||||
* Get faction favor.
|
||||
@@ -2358,7 +2358,7 @@ export interface Singularity {
|
||||
* @param faction - Name of faction.
|
||||
* @returns Amount of favor you have for the specified faction.
|
||||
*/
|
||||
getFactionFavor(faction: string): number;
|
||||
getFactionFavor(faction: FactionName): number;
|
||||
|
||||
/**
|
||||
* Get faction favor gain.
|
||||
@@ -2372,7 +2372,7 @@ export interface Singularity {
|
||||
* @param faction - Name of faction.
|
||||
* @returns Amount of favor you will gain for the specified faction when you reset by installing Augmentations.
|
||||
*/
|
||||
getFactionFavorGain(faction: string): number;
|
||||
getFactionFavorGain(faction: FactionName): number;
|
||||
|
||||
/**
|
||||
* Donate to a faction.
|
||||
@@ -2391,7 +2391,7 @@ export interface Singularity {
|
||||
* @param amount - Amount of money to donate.
|
||||
* @returns True if the money was donated, and false otherwise.
|
||||
*/
|
||||
donateToFaction(faction: string, amount: number): boolean;
|
||||
donateToFaction(faction: FactionName, amount: number): boolean;
|
||||
|
||||
/**
|
||||
* Create a program.
|
||||
@@ -2524,7 +2524,7 @@ export interface Singularity {
|
||||
* @param augName - Name of Augmentation.
|
||||
* @returns Array containing the names of all factions.
|
||||
*/
|
||||
getAugmentationFactions(augName: string): string[];
|
||||
getAugmentationFactions(augName: string): FactionName[];
|
||||
|
||||
/**
|
||||
* Get a list of augmentation available from a faction.
|
||||
@@ -2538,7 +2538,7 @@ export interface Singularity {
|
||||
* @param faction - Name of faction.
|
||||
* @returns Array containing the names of all Augmentations.
|
||||
*/
|
||||
getAugmentationsFromFaction(faction: string): string[];
|
||||
getAugmentationsFromFaction(faction: FactionName): string[];
|
||||
|
||||
/**
|
||||
* Get the pre-requisite of an augmentation.
|
||||
@@ -2601,7 +2601,7 @@ export interface Singularity {
|
||||
* @param augmentation - Name of Augmentation to purchase.
|
||||
* @returns True if the Augmentation is successfully purchased, and false otherwise.
|
||||
*/
|
||||
purchaseAugmentation(faction: string, augmentation: string): boolean;
|
||||
purchaseAugmentation(faction: FactionName, augmentation: string): boolean;
|
||||
|
||||
/**
|
||||
* Get the stats of an augmentation.
|
||||
@@ -4032,7 +4032,7 @@ export interface Gang {
|
||||
* @param faction - Name of the faction that you want to create a gang with. This faction must allow this action, and you must be its member.
|
||||
* @returns True if the gang was created, false otherwise.
|
||||
*/
|
||||
createGang(faction: string): boolean;
|
||||
createGang(faction: FactionName): boolean;
|
||||
|
||||
/**
|
||||
* Check if you're in a gang.
|
||||
@@ -4977,7 +4977,11 @@ export interface Sleeve {
|
||||
* @param factionWorkType - Name of the action to perform for this faction.
|
||||
* @returns True if the sleeve started working for this faction, false otherwise. Can also throw on errors.
|
||||
*/
|
||||
setToFactionWork(sleeveNumber: number, factionName: string, factionWorkType: FactionWorkType): boolean | undefined;
|
||||
setToFactionWork(
|
||||
sleeveNumber: number,
|
||||
factionName: FactionName,
|
||||
factionWorkType: FactionWorkType,
|
||||
): boolean | undefined;
|
||||
|
||||
/**
|
||||
* Set a sleeve to work for a company.
|
||||
@@ -9523,7 +9527,7 @@ export interface Corporation extends WarehouseAPI, OfficeAPI {
|
||||
* @param amountCash - Amount of money to bribe
|
||||
* @returns true if successful, false if not
|
||||
*/
|
||||
bribe(factionName: string, amountCash: number): boolean;
|
||||
bribe(factionName: FactionName, amountCash: number): boolean;
|
||||
|
||||
/**
|
||||
* Get corporation data.
|
||||
|
||||
Reference in New Issue
Block a user