bitburner-src/src/Player.ts

19 lines
547 B
TypeScript
Raw Normal View History

2021-03-09 02:31:34 +01:00
import { sanitizeExploits } from "./Exploits/Exploit";
2021-09-25 20:42:57 +02:00
import { Reviver } from "./utils/JSONReviver";
import type { PlayerObject } from "./PersonObjects/Player/PlayerObject";
export let Player: PlayerObject;
export function setPlayer(playerObj: PlayerObject): void {
Player = playerObj;
}
export function loadPlayer(saveString: string): PlayerObject {
2024-11-04 07:35:14 +01:00
const player = JSON.parse(saveString, Reviver) as PlayerObject;
player.money = parseFloat(player.money + "");
player.exploits = sanitizeExploits(player.exploits);
return player;
}