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