From 2f8ab8d045b684ba1583d9c0a21c73f3b2ac3cdc Mon Sep 17 00:00:00 2001 From: silvereengames Date: Wed, 4 Sep 2024 10:49:02 -0400 Subject: [PATCH] coins! --- public/iframe.html | 8 ++++---- public/index.css | 21 +++++++++++++++++++++ public/load.html | 6 +++--- public/settings/index.html | 25 ++++++++++++++++++------- 4 files changed, 46 insertions(+), 14 deletions(-) diff --git a/public/iframe.html b/public/iframe.html index ca4f8aa..1d39387 100644 --- a/public/iframe.html +++ b/public/iframe.html @@ -84,15 +84,15 @@ }; function countTime() { - localStorage.setItem('timeplayed', parseInt(localStorage.getItem('timeplayed')) + 1) - console.log(localStorage.getItem('timeplayed')) + localStorage.setItem('timeplayed', parseInt(localStorage.getItem('timeplayed')) + 1); + console.log(localStorage.getItem('timeplayed')); } if (localStorage.getItem('timeplayed') !== null) { - setInterval(countTime, 1000) + var timer = setInterval(countTime, 1000); } else { localStorage.setItem('timeplayed', 0); - setInterval(countTime, 1000) + var timer = setInterval(countTime, 1000); } diff --git a/public/settings/index.html b/public/settings/index.html index 6cb6274..ece62a1 100644 --- a/public/settings/index.html +++ b/public/settings/index.html @@ -102,6 +102,7 @@

Stats

Time Played:

Time using proxy:

Total time:

+

Total coins:

@@ -221,7 +222,7 @@

Other info

Credits

-
+

Project Lead

Silvereen

@@ -392,13 +393,21 @@

Code Stuff

window.open('../iframe.html') } + if (localStorage.getItem('timeplayed') == null) { + localStorage.setItem('timeplayed', 0); + } + + if (localStorage.getItem('timesearched') == null) { + localStorage.setItem('timesearched', 0); + } + const hours = document.getElementById('timeplayed'); const timeplayedSeconds = parseInt(localStorage.getItem('timeplayed')); if (timeplayedSeconds >= 3600) { - hours.innerHTML = Math.round(timeplayedSeconds / 60 / 60) + " Hours"; + hours.innerHTML = Math.round(timeplayedSeconds / 60 / 60*10)/10 + " Hours"; } else if (timeplayedSeconds >= 60) { - hours.innerHTML = Math.round(timeplayedSeconds / 60) + " Minutes"; + hours.innerHTML = Math.round(timeplayedSeconds / 60*10)/10 + " Minutes"; } else { hours.innerHTML = Math.round(timeplayedSeconds) + " Seconds"; } @@ -407,9 +416,9 @@

Code Stuff

const timesearchedSeconds = parseInt(localStorage.getItem('timesearched')); if (timesearchedSeconds >= 3600) { - timesearched.innerHTML = Math.round(timesearchedSeconds / 60 / 60) + " Hours"; + timesearched.innerHTML = Math.round(timesearchedSeconds / 60 / 60*10)/10 + " Hours"; } else if (timesearchedSeconds >= 60) { - timesearched.innerHTML = Math.round(timesearchedSeconds / 60) + " Minutes"; + timesearched.innerHTML = Math.round(timesearchedSeconds / 60*10)/10 + " Minutes"; } else { timesearched.innerHTML = Math.round(timesearchedSeconds) + " Seconds"; } @@ -417,13 +426,15 @@

Code Stuff

const totaltime = document.getElementById('totaltime'); const totalTimeSeconds = timeplayedSeconds + timesearchedSeconds; if (totalTimeSeconds >= 3600) { - totaltime.innerHTML = Math.round(totalTimeSeconds / 60 / 60) + " Hours"; + totaltime.innerHTML = Math.round(totalTimeSeconds / 60 / 60*10)/10 + " Hours"; } else if (totalTimeSeconds >= 60) { - totaltime.innerHTML = Math.round(totalTimeSeconds / 60) + " Minutes"; + totaltime.innerHTML = Math.round(totalTimeSeconds / 60*10)/10 + " Minutes"; } else { totaltime.innerHTML = Math.round(totalTimeSeconds) + " Seconds"; } + const coins = Math.round((timeplayedSeconds + timesearchedSeconds)/30) + document.getElementById('coins').innerHTML = coins+" Coins" let obj = new Date(); let day = obj.getUTCDate();