1
0
Fork 0
mirror of https://github.com/Acamaeda/The-Modding-Tree.git synced 2024-11-24 17:31:50 +00:00

Save data is now linked to the mod id, ensuring no conflicts or overwrites.

This commit is contained in:
Acamaeda 2020-10-01 22:11:58 -04:00
parent 1a03a00321
commit 7929873a11
2 changed files with 4 additions and 3 deletions

View file

@ -4,7 +4,8 @@
const modInfo = { const modInfo = {
name: "The Modding Tree", name: "The Modding Tree",
id: "modbase", id: "modbase",
pointsName: "points" pointsName: "points",
offlineLimit: 1 // In hours
} }
</script> </script>
<title>The Modding Tree</title> <title>The Modding Tree</title>

View file

@ -55,7 +55,7 @@ function inChallenge(layer, id){
} }
function save() { function save() {
localStorage.setItem("prestige-tree", btoa(JSON.stringify(player))) localStorage.setItem(modInfo.id, btoa(JSON.stringify(player)))
} }
function fixSave() { function fixSave() {
@ -95,7 +95,7 @@ function fixSave() {
} }
function load() { function load() {
let get = localStorage.getItem("prestige-tree"); let get = localStorage.getItem(modInfo.id);
if (get===null || get===undefined) player = getStartPlayer() if (get===null || get===undefined) player = getStartPlayer()
else player = Object.assign(getStartPlayer(), JSON.parse(atob(get))) else player = Object.assign(getStartPlayer(), JSON.parse(atob(get)))
fixSave() fixSave()