mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-11-08 08:43:53 +01:00
NETSCRIPT: Add Singularity.getFactionEnemies() (#1192)
This commit is contained in:
parent
6669c4da6a
commit
ae1ca8f9a6
32
markdown/bitburner.singularity.getfactionenemies.md
Normal file
32
markdown/bitburner.singularity.getfactionenemies.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) > [getFactionEnemies](./bitburner.singularity.getfactionenemies.md)
|
||||||
|
|
||||||
|
## Singularity.getFactionEnemies() method
|
||||||
|
|
||||||
|
Get a list of enemies of a faction.
|
||||||
|
|
||||||
|
**Signature:**
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
getFactionEnemies(faction: string): string[];
|
||||||
|
```
|
||||||
|
|
||||||
|
## Parameters
|
||||||
|
|
||||||
|
| Parameter | Type | Description |
|
||||||
|
| --- | --- | --- |
|
||||||
|
| faction | string | Name of faction. |
|
||||||
|
|
||||||
|
**Returns:**
|
||||||
|
|
||||||
|
string\[\]
|
||||||
|
|
||||||
|
Array containing the names of all enemies of the faction.
|
||||||
|
|
||||||
|
## Remarks
|
||||||
|
|
||||||
|
RAM cost: 3 GB \* 16/4/1
|
||||||
|
|
||||||
|
Returns an array containing the names (as strings) of all factions that are enemies of the specified faction.
|
||||||
|
|
@ -48,6 +48,7 @@ This API requires Source-File 4 to use. The RAM cost of all these functions is m
|
|||||||
| [getCurrentWork()](./bitburner.singularity.getcurrentwork.md) | Get the current work the player is doing. |
|
| [getCurrentWork()](./bitburner.singularity.getcurrentwork.md) | Get the current work the player is doing. |
|
||||||
| [getDarkwebProgramCost(programName)](./bitburner.singularity.getdarkwebprogramcost.md) | Check the price of an exploit on the dark web |
|
| [getDarkwebProgramCost(programName)](./bitburner.singularity.getdarkwebprogramcost.md) | Check the price of an exploit on the dark web |
|
||||||
| [getDarkwebPrograms()](./bitburner.singularity.getdarkwebprograms.md) | Get a list of programs offered on the dark web. |
|
| [getDarkwebPrograms()](./bitburner.singularity.getdarkwebprograms.md) | Get a list of programs offered on the dark web. |
|
||||||
|
| [getFactionEnemies(faction)](./bitburner.singularity.getfactionenemies.md) | Get a list of enemies of a faction. |
|
||||||
| [getFactionFavor(faction)](./bitburner.singularity.getfactionfavor.md) | Get faction favor. |
|
| [getFactionFavor(faction)](./bitburner.singularity.getfactionfavor.md) | Get faction favor. |
|
||||||
| [getFactionFavorGain(faction)](./bitburner.singularity.getfactionfavorgain.md) | Get faction favor gain. |
|
| [getFactionFavorGain(faction)](./bitburner.singularity.getfactionfavorgain.md) | Get faction favor gain. |
|
||||||
| [getFactionInviteRequirements(faction)](./bitburner.singularity.getfactioninviterequirements.md) | List conditions for being invited to a faction. |
|
| [getFactionInviteRequirements(faction)](./bitburner.singularity.getfactioninviterequirements.md) | List conditions for being invited to a faction. |
|
||||||
|
@ -182,6 +182,7 @@ const singularity = {
|
|||||||
getCompanyFavor: SF4Cost(RamCostConstants.SingularityFn2 / 3),
|
getCompanyFavor: SF4Cost(RamCostConstants.SingularityFn2 / 3),
|
||||||
getCompanyFavorGain: SF4Cost(RamCostConstants.SingularityFn2 / 4),
|
getCompanyFavorGain: SF4Cost(RamCostConstants.SingularityFn2 / 4),
|
||||||
getFactionInviteRequirements: SF4Cost(RamCostConstants.SingularityFn2),
|
getFactionInviteRequirements: SF4Cost(RamCostConstants.SingularityFn2),
|
||||||
|
getFactionEnemies: SF4Cost(RamCostConstants.SingularityFn2),
|
||||||
checkFactionInvitations: SF4Cost(RamCostConstants.SingularityFn2),
|
checkFactionInvitations: SF4Cost(RamCostConstants.SingularityFn2),
|
||||||
joinFaction: SF4Cost(RamCostConstants.SingularityFn2),
|
joinFaction: SF4Cost(RamCostConstants.SingularityFn2),
|
||||||
workForFaction: SF4Cost(RamCostConstants.SingularityFn2),
|
workForFaction: SF4Cost(RamCostConstants.SingularityFn2),
|
||||||
|
@ -768,6 +768,12 @@ export function NetscriptSingularity(): InternalAPI<ISingularity> {
|
|||||||
const fac = Factions[facName];
|
const fac = Factions[facName];
|
||||||
return [...fac.getInfo().inviteReqs].map((condition) => condition.toJSON());
|
return [...fac.getInfo().inviteReqs].map((condition) => condition.toJSON());
|
||||||
},
|
},
|
||||||
|
getFactionEnemies: (ctx) => (_facName) => {
|
||||||
|
helpers.checkSingularityAccess(ctx);
|
||||||
|
const facName = getEnumHelper("FactionName").nsGetMember(ctx, _facName);
|
||||||
|
const fac = Factions[facName];
|
||||||
|
return fac.getInfo().enemies.slice();
|
||||||
|
},
|
||||||
checkFactionInvitations: (ctx) => () => {
|
checkFactionInvitations: (ctx) => () => {
|
||||||
helpers.checkSingularityAccess(ctx);
|
helpers.checkSingularityAccess(ctx);
|
||||||
// Manually trigger a check for faction invites
|
// Manually trigger a check for faction invites
|
||||||
|
14
src/ScriptEditor/NetscriptDefinitions.d.ts
vendored
14
src/ScriptEditor/NetscriptDefinitions.d.ts
vendored
@ -2077,6 +2077,20 @@ export interface Singularity {
|
|||||||
*/
|
*/
|
||||||
getFactionInviteRequirements(faction: string): PlayerRequirement[];
|
getFactionInviteRequirements(faction: string): PlayerRequirement[];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get a list of enemies of a faction.
|
||||||
|
* @remarks
|
||||||
|
* RAM cost: 3 GB * 16/4/1
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* Returns an array containing the names (as strings) of all factions
|
||||||
|
* that are enemies of the specified faction.
|
||||||
|
*
|
||||||
|
* @param faction - Name of faction.
|
||||||
|
* @returns Array containing the names of all enemies of the faction.
|
||||||
|
*/
|
||||||
|
getFactionEnemies(faction: string): string[];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* List all current faction invitations.
|
* List all current faction invitations.
|
||||||
* @remarks
|
* @remarks
|
||||||
|
Loading…
Reference in New Issue
Block a user