bitburner-src/src/Player.ts

19 lines
531 B
TypeScript

import { sanitizeExploits } from "./Exploits/Exploit";
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 {
const player = JSON.parse(saveString, Reviver);
player.money = parseFloat(player.money + "");
player.exploits = sanitizeExploits(player.exploits);
return player;
}