mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-11-17 13:13:49 +01:00
SINGULARITY: Add ns.singularity.getFactionWorkTypes (#1425)
This commit is contained in:
parent
0d8cc54c99
commit
5a8f0e99af
32
markdown/bitburner.singularity.getfactionworktypes.md
Normal file
32
markdown/bitburner.singularity.getfactionworktypes.md
Normal file
@ -0,0 +1,32 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [bitburner](./bitburner.md) > [Singularity](./bitburner.singularity.md) > [getFactionWorkTypes](./bitburner.singularity.getfactionworktypes.md)
|
||||
|
||||
## Singularity.getFactionWorkTypes() method
|
||||
|
||||
Get the work types of a faction.
|
||||
|
||||
**Signature:**
|
||||
|
||||
```typescript
|
||||
getFactionWorkTypes(faction: string): FactionWorkType[];
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
| Parameter | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| faction | string | Name of the faction. |
|
||||
|
||||
**Returns:**
|
||||
|
||||
[FactionWorkType](./bitburner.factionworktype.md)<!-- -->\[\]
|
||||
|
||||
The work types of the faction.
|
||||
|
||||
## Remarks
|
||||
|
||||
RAM cost: 1 GB \* 16/4/1
|
||||
|
||||
This function returns an array containing the work types of the specified faction.
|
||||
|
@ -53,6 +53,7 @@ This API requires Source-File 4 to use. The RAM cost of all these functions is m
|
||||
| [getFactionFavorGain(faction)](./bitburner.singularity.getfactionfavorgain.md) | Get faction favor gain. |
|
||||
| [getFactionInviteRequirements(faction)](./bitburner.singularity.getfactioninviterequirements.md) | List conditions for being invited to a faction. |
|
||||
| [getFactionRep(faction)](./bitburner.singularity.getfactionrep.md) | Get faction reputation. |
|
||||
| [getFactionWorkTypes(faction)](./bitburner.singularity.getfactionworktypes.md) | Get the work types of a faction. |
|
||||
| [getOwnedAugmentations(purchased)](./bitburner.singularity.getownedaugmentations.md) | Get a list of owned augmentation. |
|
||||
| [getOwnedSourceFiles()](./bitburner.singularity.getownedsourcefiles.md) | Get a list of acquired Source-Files. |
|
||||
| [getUpgradeHomeCoresCost()](./bitburner.singularity.getupgradehomecorescost.md) | Get the price of upgrading home cores. |
|
||||
|
@ -186,6 +186,7 @@ const singularity = {
|
||||
checkFactionInvitations: SF4Cost(RamCostConstants.SingularityFn2),
|
||||
joinFaction: SF4Cost(RamCostConstants.SingularityFn2),
|
||||
workForFaction: SF4Cost(RamCostConstants.SingularityFn2),
|
||||
getFactionWorkTypes: SF4Cost(RamCostConstants.SingularityFn2 / 3),
|
||||
getFactionRep: SF4Cost(RamCostConstants.SingularityFn2 / 3),
|
||||
getFactionFavor: SF4Cost(RamCostConstants.SingularityFn2 / 3),
|
||||
getFactionFavorGain: SF4Cost(RamCostConstants.SingularityFn2 / 4),
|
||||
|
@ -827,7 +827,7 @@ export function NetscriptSingularity(): InternalAPI<ISingularity> {
|
||||
|
||||
// if the player is in a gang and the target faction is any of the gang faction, fail
|
||||
if (Player.gang && faction.name === Player.getGangFaction().name) {
|
||||
helpers.log(ctx, () => `You can't work for '${facName}' because youre managing a gang for it`);
|
||||
helpers.log(ctx, () => `You can't work for '${facName}' because you are managing a gang for it`);
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -913,6 +913,26 @@ export function NetscriptSingularity(): InternalAPI<ISingularity> {
|
||||
return false;
|
||||
}
|
||||
},
|
||||
getFactionWorkTypes: (ctx) => (_facName) => {
|
||||
helpers.checkSingularityAccess(ctx);
|
||||
const facName = getEnumHelper("FactionName").nsGetMember(ctx, _facName);
|
||||
// Gang does not offer normal work.
|
||||
if (Player.gang?.facName === facName) {
|
||||
return [];
|
||||
}
|
||||
const factionInfo = Factions[facName].getInfo();
|
||||
const workTypes = [];
|
||||
if (factionInfo.offerHackingWork) {
|
||||
workTypes.push(FactionWorkType.hacking);
|
||||
}
|
||||
if (factionInfo.offerFieldWork) {
|
||||
workTypes.push(FactionWorkType.field);
|
||||
}
|
||||
if (factionInfo.offerSecurityWork) {
|
||||
workTypes.push(FactionWorkType.security);
|
||||
}
|
||||
return workTypes;
|
||||
},
|
||||
getFactionRep: (ctx) => (_facName) => {
|
||||
helpers.checkSingularityAccess(ctx);
|
||||
const facName = getEnumHelper("FactionName").nsGetMember(ctx, _facName);
|
||||
@ -941,7 +961,7 @@ export function NetscriptSingularity(): InternalAPI<ISingularity> {
|
||||
return false;
|
||||
}
|
||||
if (Player.gang && faction.name === Player.getGangFaction().name) {
|
||||
helpers.log(ctx, () => `You can't donate to '${facName}' because youre managing a gang for it`);
|
||||
helpers.log(ctx, () => `You can't donate to '${facName}' because you are managing a gang for it`);
|
||||
return false;
|
||||
}
|
||||
if (faction.name === FactionName.ChurchOfTheMachineGod || faction.name === FactionName.Bladeburners) {
|
||||
|
12
src/ScriptEditor/NetscriptDefinitions.d.ts
vendored
12
src/ScriptEditor/NetscriptDefinitions.d.ts
vendored
@ -2149,6 +2149,18 @@ export interface Singularity {
|
||||
*/
|
||||
workForFaction(faction: string, workType: FactionWorkType | `${FactionWorkType}`, focus?: boolean): boolean;
|
||||
|
||||
/**
|
||||
* Get the work types of a faction.
|
||||
* @remarks
|
||||
* RAM cost: 1 GB * 16/4/1
|
||||
*
|
||||
* This function returns an array containing the work types of the specified faction.
|
||||
*
|
||||
* @param faction - Name of the faction.
|
||||
* @returns The work types of the faction.
|
||||
*/
|
||||
getFactionWorkTypes(faction: string): FactionWorkType[];
|
||||
|
||||
/**
|
||||
* Get faction reputation.
|
||||
* @remarks
|
||||
|
Loading…
Reference in New Issue
Block a user