API: Add karma to ns.getPlayer() & document ns.heart.break() (#1131)

This commit is contained in:
LJ 2024-03-04 07:35:54 -07:00 committed by GitHub
parent 65082f677e
commit a5f5c81912
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 12 additions and 0 deletions

@ -1683,6 +1683,7 @@ export const ns: InternalAPI<NSFull> = {
jobs: structuredClone(Player.jobs), jobs: structuredClone(Player.jobs),
factions: Player.factions.slice(), factions: Player.factions.slice(),
entropy: Player.entropy, entropy: Player.entropy,
karma: Player.karma,
}; };
setDeprecatedProperties(data, { setDeprecatedProperties(data, {
playtimeSinceLastAug: { playtimeSinceLastAug: {

@ -108,6 +108,7 @@ export function NetscriptFormulas(): InternalAPI<IFormulas> {
jobs: {}, jobs: {},
factions: [], factions: [],
entropy: 0, entropy: 0,
karma: 0,
}), }),
mockPerson: () => (): IPerson => ({ mockPerson: () => (): IPerson => ({
hp: { current: 0, max: 0 }, hp: { current: 0, max: 0 },

@ -48,6 +48,7 @@ interface Player extends Person {
factions: string[]; factions: string[];
totalPlaytime: number; totalPlaytime: number;
location: string; location: string;
karma: number;
} }
/** @public */ /** @public */
@ -5513,6 +5514,15 @@ export interface NS {
*/ */
growthAnalyzeSecurity(threads: number, hostname?: string, cores?: number): number; growthAnalyzeSecurity(threads: number, hostname?: string, cores?: number): number;
readonly heart: {
/**
* Get your current karma.
* @remarks
* RAM cost: 0 GB
*/
break(): number;
};
/** /**
* Suspends the script for n milliseconds. * Suspends the script for n milliseconds.
* @remarks * @remarks