bitburner-src/src/Player.ts

19 lines
531 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 {
const player = JSON.parse(saveString, Reviver);
player.money = parseFloat(player.money + "");
player.exploits = sanitizeExploits(player.exploits);
return player;
}