File tree Expand file tree Collapse file tree 5 files changed +42
-0
lines changed Expand file tree Collapse file tree 5 files changed +42
-0
lines changed Original file line number Diff line number Diff line change
1
+ <!-- Do not edit this file. It is automatically generated by API Documenter. -->
2
+
3
+ [ Home] ( ./index.md ) > ; [ bitburner] ( ./bitburner.md ) > ; [ Singularity] ( ./bitburner.singularity.md ) > ; [ getSaveData] ( ./bitburner.singularity.getsavedata.md )
4
+
5
+ ## Singularity.getSaveData() method
6
+
7
+ This function returns the save data.
8
+
9
+ ** Signature:**
10
+
11
+ ``` typescript
12
+ getSaveData (): Promise < Uint8Array > ;
13
+ ```
14
+ ** Returns:**
15
+
16
+ Promise< ; Uint8Array> ;
17
+
18
+ ## Remarks
19
+
20
+ RAM cost: 1 GB \* 16/4/1
21
+
Original file line number Diff line number Diff line change @@ -56,6 +56,7 @@ This API requires Source-File 4 to use. The RAM cost of all these functions is m
56
56
| [getFactionWorkTypes (faction )](./bitburner .singularity .getfactionworktypes .md ) | Get the work types of a faction . |
57
57
| [getOwnedAugmentations (purchased )](./bitburner .singularity .getownedaugmentations .md ) | Get a list of owned augmentation . |
58
58
| [getOwnedSourceFiles ()](./bitburner .singularity .getownedsourcefiles .md ) | Get a list of acquired Source -Files . |
59
+ | [getSaveData ()](./bitburner .singularity .getsavedata .md ) | This function returns the save data . |
59
60
| [getUpgradeHomeCoresCost ()](./bitburner .singularity .getupgradehomecorescost .md ) | Get the price of upgrading home cores . |
60
61
| [getUpgradeHomeRamCost ()](./bitburner .singularity .getupgradehomeramcost .md ) | Get the price of upgrading home RAM . |
61
62
| [goToLocation (locationName )](./bitburner .singularity .gotolocation .md ) | Go to a location . |
Original file line number Diff line number Diff line change @@ -215,6 +215,7 @@ const singularity = {
215
215
installAugmentations : SF4Cost ( RamCostConstants . SingularityFn3 ) ,
216
216
isFocused : SF4Cost ( 0.1 ) ,
217
217
setFocus : SF4Cost ( 0.1 ) ,
218
+ getSaveData : SF4Cost ( RamCostConstants . SingularityFn1 / 2 ) ,
218
219
exportGame : SF4Cost ( RamCostConstants . SingularityFn1 / 2 ) ,
219
220
exportGameBonus : SF4Cost ( RamCostConstants . SingularityFn1 / 4 ) ,
220
221
b1tflum3 : SF4Cost ( 16 ) ,
Original file line number Diff line number Diff line change @@ -1169,6 +1169,17 @@ export function NetscriptSingularity(): InternalAPI<ISingularity> {
1169
1169
if ( ! Player . currentWork ) return null ;
1170
1170
return Player . currentWork . APICopy ( ) ;
1171
1171
} ,
1172
+ getSaveData : ( ctx ) => async ( ) => {
1173
+ helpers . checkSingularityAccess ( ctx ) ;
1174
+ const saveData = await saveObject . getSaveData ( ) ;
1175
+ if ( typeof saveData === "string" ) {
1176
+ // saveData is the base64-encoded json save string. A base64-encoded string only uses ASCII characters, so it's
1177
+ // fine to use new TextEncoder().encode() to encode it to a Uint8Array.
1178
+ return new TextEncoder ( ) . encode ( saveData ) ;
1179
+ }
1180
+ // saveData is the compressed json save string.
1181
+ return saveData ;
1182
+ } ,
1172
1183
exportGame : ( ctx ) => ( ) => {
1173
1184
helpers . checkSingularityAccess ( ctx ) ;
1174
1185
onExport ( ) ;
Original file line number Diff line number Diff line change @@ -1793,6 +1793,14 @@ export interface BitNodeBooleanOptions {
1793
1793
* @public
1794
1794
*/
1795
1795
export interface Singularity {
1796
+ /**
1797
+ * This function returns the save data.
1798
+ *
1799
+ * @remarks
1800
+ * RAM cost: 1 GB * 16/4/1
1801
+ */
1802
+ getSaveData ( ) : Promise < Uint8Array > ;
1803
+
1796
1804
/**
1797
1805
* Backup game save.
1798
1806
* @remarks
You can’t perform that action at this time.
0 commit comments