SINGULARITY: Added aug and node identifiers (timestamps of last resets) (#472)

This commit is contained in:
G4mingJon4s 2023-04-12 19:13:42 +02:00 committed by GitHub
parent f761eed377
commit d01ba91654
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 86 additions and 32 deletions

@ -23,7 +23,5 @@ interface Player extends Person
| [location](./bitburner.player.location.md) | | string | | | [location](./bitburner.player.location.md) | | string | |
| [money](./bitburner.player.money.md) | | number | | | [money](./bitburner.player.money.md) | | number | |
| [numPeopleKilled](./bitburner.player.numpeoplekilled.md) | | number | | | [numPeopleKilled](./bitburner.player.numpeoplekilled.md) | | number | |
| [playtimeSinceLastAug](./bitburner.player.playtimesincelastaug.md) | | number | |
| [playtimeSinceLastBitnode](./bitburner.player.playtimesincelastbitnode.md) | | number | |
| [totalPlaytime](./bitburner.player.totalplaytime.md) | | number | | | [totalPlaytime](./bitburner.player.totalplaytime.md) | | number | |

@ -1,11 +0,0 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [bitburner](./bitburner.md) &gt; [Player](./bitburner.player.md) &gt; [playtimeSinceLastAug](./bitburner.player.playtimesincelastaug.md)
## Player.playtimeSinceLastAug property
**Signature:**
```typescript
playtimeSinceLastAug: number;
```

@ -1,11 +0,0 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [bitburner](./bitburner.md) &gt; [Player](./bitburner.player.md) &gt; [playtimeSinceLastBitnode](./bitburner.player.playtimesincelastbitnode.md)
## Player.playtimeSinceLastBitnode property
**Signature:**
```typescript
playtimeSinceLastBitnode: number;
```

@ -0,0 +1,23 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [bitburner](./bitburner.md) &gt; [Singularity](./bitburner.singularity.md) &gt; [getLastAugReset](./bitburner.singularity.getlastaugreset.md)
## Singularity.getLastAugReset() method
Get the last timestamp from when you installed augmentations.
**Signature:**
```typescript
getLastAugReset(): number;
```
**Returns:**
number
The timestamp in milliseconds from your last augmentation install.
## Remarks
RAM cost: 0.5 GB \* 16/4/1

@ -0,0 +1,23 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [bitburner](./bitburner.md) &gt; [Singularity](./bitburner.singularity.md) &gt; [getLastNodeReset](./bitburner.singularity.getlastnodereset.md)
## Singularity.getLastNodeReset() method
Get the last timestamp from when you finished a bitnode.
**Signature:**
```typescript
getLastNodeReset(): number;
```
**Returns:**
number
The timestamp in milliseconds from your last bitnode finish.
## Remarks
RAM cost: 0.5 GB \* 16/4/1

@ -50,6 +50,8 @@ This API requires Source-File 4 to use. The RAM cost of all these functions is m
| [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. |
| [getFactionRep(faction)](./bitburner.singularity.getfactionrep.md) | Get faction reputation. | | [getFactionRep(faction)](./bitburner.singularity.getfactionrep.md) | Get faction reputation. |
| [getLastAugReset()](./bitburner.singularity.getlastaugreset.md) | Get the last timestamp from when you installed augmentations. |
| [getLastNodeReset()](./bitburner.singularity.getlastnodereset.md) | Get the last timestamp from when you finished a bitnode. |
| [getOwnedAugmentations(purchased)](./bitburner.singularity.getownedaugmentations.md) | Get a list of owned augmentation. | | [getOwnedAugmentations(purchased)](./bitburner.singularity.getownedaugmentations.md) | Get a list of owned augmentation. |
| [getOwnedSourceFiles()](./bitburner.singularity.getownedsourcefiles.md) | Get a list of acquired Source-Files. | | [getOwnedSourceFiles()](./bitburner.singularity.getownedsourcefiles.md) | Get a list of acquired Source-Files. |
| [getUpgradeHomeCoresCost()](./bitburner.singularity.getupgradehomecorescost.md) | Get the price of upgrading home cores. | | [getUpgradeHomeCoresCost()](./bitburner.singularity.getupgradehomecorescost.md) | Get the price of upgrading home cores. |

@ -204,6 +204,8 @@ const singularity = {
b1tflum3: SF4Cost(16), b1tflum3: SF4Cost(16),
destroyW0r1dD43m0n: SF4Cost(32), destroyW0r1dD43m0n: SF4Cost(32),
getCurrentWork: SF4Cost(0.5), getCurrentWork: SF4Cost(0.5),
getLastAugReset: SF4Cost(0.5),
getLastNodeReset: SF4Cost(0.5),
} as const; } as const;
// Gang API // Gang API

@ -1782,8 +1782,6 @@ export const ns: InternalAPI<NSFull> = {
location: Player.location, location: Player.location,
bitNodeN: Player.bitNodeN, bitNodeN: Player.bitNodeN,
totalPlaytime: Player.totalPlaytime, totalPlaytime: Player.totalPlaytime,
playtimeSinceLastAug: Player.playtimeSinceLastAug,
playtimeSinceLastBitnode: Player.playtimeSinceLastBitnode,
jobs: cloneDeep(Player.jobs), jobs: cloneDeep(Player.jobs),
factions: Player.factions.slice(), factions: Player.factions.slice(),
entropy: Player.entropy, entropy: Player.entropy,

@ -97,8 +97,6 @@ export function NetscriptFormulas(): InternalAPI<IFormulas> {
location: "", location: "",
bitNodeN: 0, bitNodeN: 0,
totalPlaytime: 0, totalPlaytime: 0,
playtimeSinceLastAug: 0,
playtimeSinceLastBitnode: 0,
jobs: {}, jobs: {},
factions: [], factions: [],
entropy: 0, entropy: 0,

@ -1253,6 +1253,14 @@ export function NetscriptSingularity(): InternalAPI<ISingularity> {
helpers.checkSingularityAccess(ctx); helpers.checkSingularityAccess(ctx);
return canGetBonus(); return canGetBonus();
}, },
getLastAugReset: (ctx) => () => {
helpers.checkSingularityAccess(ctx);
return Player.lastAugReset;
},
getLastNodeReset: (ctx) => () => {
helpers.checkSingularityAccess(ctx);
return Player.lastNodeReset;
},
}; };
Object.assign(singularityAPI, { Object.assign(singularityAPI, {
getAugmentationCost: removedFunction( getAugmentationCost: removedFunction(

@ -53,6 +53,8 @@ export class PlayerObject extends Person implements IPlayer {
moneySourceB = new MoneySourceTracker(); moneySourceB = new MoneySourceTracker();
playtimeSinceLastAug = 0; playtimeSinceLastAug = 0;
playtimeSinceLastBitnode = 0; playtimeSinceLastBitnode = 0;
lastAugReset = -1;
lastNodeReset = -1;
purchasedServers: string[] = []; purchasedServers: string[] = [];
scriptProdSinceLastAug = 0; scriptProdSinceLastAug = 0;
sleeves: Sleeve[] = []; sleeves: Sleeve[] = [];

@ -111,6 +111,7 @@ export function prestigeAugmentation(this: PlayerObject): void {
// Statistics Trackers // Statistics Trackers
this.playtimeSinceLastAug = 0; this.playtimeSinceLastAug = 0;
this.lastAugReset = this.lastUpdate;
this.scriptProdSinceLastAug = 0; this.scriptProdSinceLastAug = 0;
this.moneySourceA.reset(); this.moneySourceA.reset();
@ -154,6 +155,7 @@ export function prestigeSourceFile(this: PlayerObject): void {
this.moneySourceB.reset(); this.moneySourceB.reset();
this.playtimeSinceLastBitnode = 0; this.playtimeSinceLastBitnode = 0;
this.lastNodeReset = this.lastUpdate;
this.augmentations = []; this.augmentations = [];
} }

@ -657,9 +657,13 @@ function evaluateVersionCompatibility(ver: string | number): void {
// Prior to v2.2.0, sleeve shock was 0 to 100 internally but displayed as 100 to 0. This unifies them as 100 to 0. // Prior to v2.2.0, sleeve shock was 0 to 100 internally but displayed as 100 to 0. This unifies them as 100 to 0.
for (const sleeve of Player.sleeves) sleeve.shock = 100 - sleeve.shock; for (const sleeve of Player.sleeves) sleeve.shock = 100 - sleeve.shock;
} }
if (ver < 31) {
if (anyPlayer.hashManager !== undefined) { if (anyPlayer.hashManager !== undefined) {
anyPlayer.hashManager.upgrades["Company Favor"] ??= 0; anyPlayer.hashManager.upgrades["Company Favor"] ??= 0;
} }
anyPlayer.lastAugReset ??= anyPlayer.lastUpdate - anyPlayer.playtimeSinceLastAug;
anyPlayer.lastNodeReset ??= anyPlayer.lastUpdate - anyPlayer.playtimeSinceLastBitnode;
}
} }
function loadGame(saveString: string): boolean { function loadGame(saveString: string): boolean {

@ -52,8 +52,6 @@ interface Player extends Person {
factions: string[]; factions: string[];
bitNodeN: number; bitNodeN: number;
totalPlaytime: number; totalPlaytime: number;
playtimeSinceLastAug: number;
playtimeSinceLastBitnode: number;
location: string; location: string;
} }
@ -2363,6 +2361,24 @@ export interface Singularity {
* @returns - An object representing the current work. Fields depend on the kind of work. * @returns - An object representing the current work. Fields depend on the kind of work.
*/ */
getCurrentWork(): any | null; getCurrentWork(): any | null;
/**
* Get the last timestamp from when you installed augmentations.
* @remarks
* RAM cost: 0.5 GB * 16/4/1
*
* @returns The timestamp in milliseconds from your last augmentation install.
*/
getLastAugReset(): number;
/**
* Get the last timestamp from when you finished a bitnode.
* @remarks
* RAM cost: 0.5 GB * 16/4/1
*
* @returns The timestamp in milliseconds from your last bitnode finish.
*/
getLastNodeReset(): number;
} }
/** /**