From aed01b09794d36226a66aaa1d81d94ccfaf0093c Mon Sep 17 00:00:00 2001 From: myCatsName <141260118+myCatsName@users.noreply.github.com> Date: Sat, 5 Aug 2023 22:04:36 -0600 Subject: [PATCH] NETSCRIPT: added ns.singularity.getAugmentationFactions (#706) --- ...ner.singularity.getaugmentationfactions.md | 32 +++++++++++++++++++ markdown/bitburner.singularity.md | 1 + src/Netscript/RamCostGenerator.ts | 1 + src/NetscriptFunctions/Singularity.ts | 6 ++++ src/ScriptEditor/NetscriptDefinitions.d.ts | 15 +++++++++ 5 files changed, 55 insertions(+) create mode 100644 markdown/bitburner.singularity.getaugmentationfactions.md diff --git a/markdown/bitburner.singularity.getaugmentationfactions.md b/markdown/bitburner.singularity.getaugmentationfactions.md new file mode 100644 index 000000000..6fb45e275 --- /dev/null +++ b/markdown/bitburner.singularity.getaugmentationfactions.md @@ -0,0 +1,32 @@ + + +[Home](./index.md) > [bitburner](./bitburner.md) > [Singularity](./bitburner.singularity.md) > [getAugmentationFactions](./bitburner.singularity.getaugmentationfactions.md) + +## Singularity.getAugmentationFactions() method + +Get a list of faction(s) that have a specific Augmentation. + +**Signature:** + +```typescript +getAugmentationFactions(augName: string): string[]; +``` + +## Parameters + +| Parameter | Type | Description | +| --- | --- | --- | +| augName | string | Name of Augmentation. | + +**Returns:** + +string\[\] + +Array containing the names of all factions. + +## Remarks + +RAM cost: 5 GB \* 16/4/1 + +Returns an array containing the names (as strings) of all factions that offer the specified Augmentation. If no factions offer the Augmentation, a blank array is returned. + diff --git a/markdown/bitburner.singularity.md b/markdown/bitburner.singularity.md index adf1e26dc..4f7faf82e 100644 --- a/markdown/bitburner.singularity.md +++ b/markdown/bitburner.singularity.md @@ -31,6 +31,7 @@ This API requires Source-File 4 to use. The RAM cost of all these functions is m | [exportGame()](./bitburner.singularity.exportgame.md) | Backup game save. | | [exportGameBonus()](./bitburner.singularity.exportgamebonus.md) | Returns Backup save bonus availability. | | [getAugmentationBasePrice(augName)](./bitburner.singularity.getaugmentationbaseprice.md) | Get base price of an augmentation. | +| [getAugmentationFactions(augName)](./bitburner.singularity.getaugmentationfactions.md) | Get a list of faction(s) that have a specific Augmentation. | | [getAugmentationPrereq(augName)](./bitburner.singularity.getaugmentationprereq.md) | Get the pre-requisite of an augmentation. | | [getAugmentationPrice(augName)](./bitburner.singularity.getaugmentationprice.md) | Get price of an augmentation. | | [getAugmentationRepReq(augName)](./bitburner.singularity.getaugmentationrepreq.md) | Get reputation requirement of an augmentation. | diff --git a/src/Netscript/RamCostGenerator.ts b/src/Netscript/RamCostGenerator.ts index 365faab99..f73a1ad13 100644 --- a/src/Netscript/RamCostGenerator.ts +++ b/src/Netscript/RamCostGenerator.ts @@ -189,6 +189,7 @@ const singularity = { getCrimeStats: SF4Cost(RamCostConstants.SingularityFn3), getOwnedAugmentations: SF4Cost(RamCostConstants.SingularityFn3), getOwnedSourceFiles: SF4Cost(RamCostConstants.SingularityFn3), + getAugmentationFactions: SF4Cost(RamCostConstants.SingularityFn3), getAugmentationsFromFaction: SF4Cost(RamCostConstants.SingularityFn3), getAugmentationPrereq: SF4Cost(RamCostConstants.SingularityFn3), getAugmentationPrice: SF4Cost(RamCostConstants.SingularityFn3 / 2), diff --git a/src/NetscriptFunctions/Singularity.ts b/src/NetscriptFunctions/Singularity.ts index 651d2c834..ea89f98a2 100644 --- a/src/NetscriptFunctions/Singularity.ts +++ b/src/NetscriptFunctions/Singularity.ts @@ -95,6 +95,12 @@ export function NetscriptSingularity(): InternalAPI { getOwnedSourceFiles: () => () => { return [...Player.sourceFiles].map(([n, lvl]) => ({ n, lvl })); }, + getAugmentationFactions: (ctx) => (_augName) => { + helpers.checkSingularityAccess(ctx); + const augName = getEnumHelper("AugmentationName").nsGetMember(ctx, _augName); + const aug = Augmentations[augName]; + return aug.factions.slice(); + }, getAugmentationsFromFaction: (ctx) => (_facName) => { helpers.checkSingularityAccess(ctx); const facName = getEnumHelper("FactionName").nsGetMember(ctx, _facName); diff --git a/src/ScriptEditor/NetscriptDefinitions.d.ts b/src/ScriptEditor/NetscriptDefinitions.d.ts index 974b8779f..6d44d037c 100644 --- a/src/ScriptEditor/NetscriptDefinitions.d.ts +++ b/src/ScriptEditor/NetscriptDefinitions.d.ts @@ -2103,6 +2103,21 @@ export interface Singularity { */ getOwnedSourceFiles(): SourceFileLvl[]; + /** + * Get a list of faction(s) that have a specific Augmentation. + * @remarks + * RAM cost: 5 GB * 16/4/1 + * + * + * Returns an array containing the names (as strings) of all factions + * that offer the specified Augmentation. + * If no factions offer the Augmentation, a blank array is returned. + * + * @param augName - Name of Augmentation. + * @returns Array containing the names of all factions. + */ + getAugmentationFactions(augName: string): string[]; + /** * Get a list of augmentation available from a faction. * @remarks