mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-11-26 01:23:49 +01:00
SINGULARITY: Added aug and node identifiers (timestamps of last resets) (#472)
This commit is contained in:
parent
f761eed377
commit
d01ba91654
@ -23,7 +23,5 @@ interface Player extends Person
|
||||
| [location](./bitburner.player.location.md) | | string | |
|
||||
| [money](./bitburner.player.money.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 | |
|
||||
|
||||
|
@ -1,11 +0,0 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [bitburner](./bitburner.md) > [Player](./bitburner.player.md) > [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) > [bitburner](./bitburner.md) > [Player](./bitburner.player.md) > [playtimeSinceLastBitnode](./bitburner.player.playtimesincelastbitnode.md)
|
||||
|
||||
## Player.playtimeSinceLastBitnode property
|
||||
|
||||
**Signature:**
|
||||
|
||||
```typescript
|
||||
playtimeSinceLastBitnode: number;
|
||||
```
|
23
markdown/bitburner.singularity.getlastaugreset.md
Normal file
23
markdown/bitburner.singularity.getlastaugreset.md
Normal file
@ -0,0 +1,23 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [bitburner](./bitburner.md) > [Singularity](./bitburner.singularity.md) > [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
|
||||
|
23
markdown/bitburner.singularity.getlastnodereset.md
Normal file
23
markdown/bitburner.singularity.getlastnodereset.md
Normal file
@ -0,0 +1,23 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [bitburner](./bitburner.md) > [Singularity](./bitburner.singularity.md) > [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. |
|
||||
| [getFactionFavorGain(faction)](./bitburner.singularity.getfactionfavorgain.md) | Get faction favor gain. |
|
||||
| [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. |
|
||||
| [getOwnedSourceFiles()](./bitburner.singularity.getownedsourcefiles.md) | Get a list of acquired Source-Files. |
|
||||
| [getUpgradeHomeCoresCost()](./bitburner.singularity.getupgradehomecorescost.md) | Get the price of upgrading home cores. |
|
||||
|
@ -204,6 +204,8 @@ const singularity = {
|
||||
b1tflum3: SF4Cost(16),
|
||||
destroyW0r1dD43m0n: SF4Cost(32),
|
||||
getCurrentWork: SF4Cost(0.5),
|
||||
getLastAugReset: SF4Cost(0.5),
|
||||
getLastNodeReset: SF4Cost(0.5),
|
||||
} as const;
|
||||
|
||||
// Gang API
|
||||
|
@ -1782,8 +1782,6 @@ export const ns: InternalAPI<NSFull> = {
|
||||
location: Player.location,
|
||||
bitNodeN: Player.bitNodeN,
|
||||
totalPlaytime: Player.totalPlaytime,
|
||||
playtimeSinceLastAug: Player.playtimeSinceLastAug,
|
||||
playtimeSinceLastBitnode: Player.playtimeSinceLastBitnode,
|
||||
jobs: cloneDeep(Player.jobs),
|
||||
factions: Player.factions.slice(),
|
||||
entropy: Player.entropy,
|
||||
|
@ -97,8 +97,6 @@ export function NetscriptFormulas(): InternalAPI<IFormulas> {
|
||||
location: "",
|
||||
bitNodeN: 0,
|
||||
totalPlaytime: 0,
|
||||
playtimeSinceLastAug: 0,
|
||||
playtimeSinceLastBitnode: 0,
|
||||
jobs: {},
|
||||
factions: [],
|
||||
entropy: 0,
|
||||
|
@ -1253,6 +1253,14 @@ export function NetscriptSingularity(): InternalAPI<ISingularity> {
|
||||
helpers.checkSingularityAccess(ctx);
|
||||
return canGetBonus();
|
||||
},
|
||||
getLastAugReset: (ctx) => () => {
|
||||
helpers.checkSingularityAccess(ctx);
|
||||
return Player.lastAugReset;
|
||||
},
|
||||
getLastNodeReset: (ctx) => () => {
|
||||
helpers.checkSingularityAccess(ctx);
|
||||
return Player.lastNodeReset;
|
||||
},
|
||||
};
|
||||
Object.assign(singularityAPI, {
|
||||
getAugmentationCost: removedFunction(
|
||||
|
@ -53,6 +53,8 @@ export class PlayerObject extends Person implements IPlayer {
|
||||
moneySourceB = new MoneySourceTracker();
|
||||
playtimeSinceLastAug = 0;
|
||||
playtimeSinceLastBitnode = 0;
|
||||
lastAugReset = -1;
|
||||
lastNodeReset = -1;
|
||||
purchasedServers: string[] = [];
|
||||
scriptProdSinceLastAug = 0;
|
||||
sleeves: Sleeve[] = [];
|
||||
|
@ -111,6 +111,7 @@ export function prestigeAugmentation(this: PlayerObject): void {
|
||||
|
||||
// Statistics Trackers
|
||||
this.playtimeSinceLastAug = 0;
|
||||
this.lastAugReset = this.lastUpdate;
|
||||
this.scriptProdSinceLastAug = 0;
|
||||
this.moneySourceA.reset();
|
||||
|
||||
@ -154,6 +155,7 @@ export function prestigeSourceFile(this: PlayerObject): void {
|
||||
|
||||
this.moneySourceB.reset();
|
||||
this.playtimeSinceLastBitnode = 0;
|
||||
this.lastNodeReset = this.lastUpdate;
|
||||
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.
|
||||
for (const sleeve of Player.sleeves) sleeve.shock = 100 - sleeve.shock;
|
||||
}
|
||||
if (ver < 31) {
|
||||
if (anyPlayer.hashManager !== undefined) {
|
||||
anyPlayer.hashManager.upgrades["Company Favor"] ??= 0;
|
||||
}
|
||||
anyPlayer.lastAugReset ??= anyPlayer.lastUpdate - anyPlayer.playtimeSinceLastAug;
|
||||
anyPlayer.lastNodeReset ??= anyPlayer.lastUpdate - anyPlayer.playtimeSinceLastBitnode;
|
||||
}
|
||||
}
|
||||
|
||||
function loadGame(saveString: string): boolean {
|
||||
|
20
src/ScriptEditor/NetscriptDefinitions.d.ts
vendored
20
src/ScriptEditor/NetscriptDefinitions.d.ts
vendored
@ -52,8 +52,6 @@ interface Player extends Person {
|
||||
factions: string[];
|
||||
bitNodeN: number;
|
||||
totalPlaytime: number;
|
||||
playtimeSinceLastAug: number;
|
||||
playtimeSinceLastBitnode: number;
|
||||
location: string;
|
||||
}
|
||||
|
||||
@ -2363,6 +2361,24 @@ export interface Singularity {
|
||||
* @returns - An object representing the current work. Fields depend on the kind of work.
|
||||
*/
|
||||
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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user