diff --git a/markdown/bitburner.singularity.getunlockedachievements.md b/markdown/bitburner.singularity.getunlockedachievements.md new file mode 100644 index 000000000..c4f16858a --- /dev/null +++ b/markdown/bitburner.singularity.getunlockedachievements.md @@ -0,0 +1,23 @@ + + +[Home](./index.md) > [bitburner](./bitburner.md) > [Singularity](./bitburner.singularity.md) > [getUnlockedAchievements](./bitburner.singularity.getunlockedachievements.md) + +## Singularity.getUnlockedAchievements() method + +Get a list of all unlocked achievements. + +**Signature:** + +```typescript +getUnlockedAchievements(): string[]; +``` +**Returns:** + +string\[\] + +- A list containing all of the IDs of achievements that the player has unlocked. + +## Remarks + +Ram cost: 5 GB \* 16/4/1 + diff --git a/markdown/bitburner.singularity.md b/markdown/bitburner.singularity.md index 096f48907..301809b6f 100644 --- a/markdown/bitburner.singularity.md +++ b/markdown/bitburner.singularity.md @@ -58,6 +58,7 @@ This API requires Source-File 4 to use. The RAM cost of all these functions is m | [getOwnedAugmentations(purchased)](./bitburner.singularity.getownedaugmentations.md) | Get a list of owned augmentation. | | [getOwnedSourceFiles()](./bitburner.singularity.getownedsourcefiles.md) | Get a list of acquired Source-Files. | | [getSaveData()](./bitburner.singularity.getsavedata.md) | This function returns the save data. | +| [getUnlockedAchievements()](./bitburner.singularity.getunlockedachievements.md) | Get a list of all unlocked achievements. | | [getUpgradeHomeCoresCost()](./bitburner.singularity.getupgradehomecorescost.md) | Get the price of upgrading home cores. | | [getUpgradeHomeRamCost()](./bitburner.singularity.getupgradehomeramcost.md) | Get the price of upgrading home RAM. | | [goToLocation(locationName)](./bitburner.singularity.gotolocation.md) | Go to a location. | diff --git a/src/Netscript/RamCostGenerator.ts b/src/Netscript/RamCostGenerator.ts index dd97e6126..a18dca39f 100644 --- a/src/Netscript/RamCostGenerator.ts +++ b/src/Netscript/RamCostGenerator.ts @@ -222,6 +222,7 @@ const singularity = { b1tflum3: SF4Cost(16), destroyW0r1dD43m0n: SF4Cost(32), getCurrentWork: SF4Cost(0.5), + getUnlockedAchievements: SF4Cost(RamCostConstants.SingularityFn3), } as const; const format = { diff --git a/src/NetscriptFunctions/Singularity.ts b/src/NetscriptFunctions/Singularity.ts index 6800840b5..9f84071cf 100644 --- a/src/NetscriptFunctions/Singularity.ts +++ b/src/NetscriptFunctions/Singularity.ts @@ -1186,6 +1186,10 @@ export function NetscriptSingularity(): InternalAPI { helpers.checkSingularityAccess(ctx); return canGetBonus(); }, + getUnlockedAchievements: (ctx) => () => { + helpers.checkSingularityAccess(ctx); + return Object.values(Player.achievements).map((a) => a.ID); + }, }; // Removed functions diff --git a/src/ScriptEditor/NetscriptDefinitions.d.ts b/src/ScriptEditor/NetscriptDefinitions.d.ts index 4a6348b51..22ccf131d 100644 --- a/src/ScriptEditor/NetscriptDefinitions.d.ts +++ b/src/ScriptEditor/NetscriptDefinitions.d.ts @@ -2805,6 +2805,15 @@ export interface Singularity { * @returns - An object representing the current work. Fields depend on the kind of work. */ getCurrentWork(): Task | null; + + /** + * Get a list of all unlocked achievements. + * @remarks + * Ram cost: 5 GB * 16/4/1 + * + * @returns - A list containing all of the IDs of achievements that the player has unlocked. + */ + getUnlockedAchievements(): string[]; } /**