play time corrections

This commit is contained in:
ReznoRMichael 2020-08-30 03:22:16 +02:00
parent 946edb0023
commit 91eab72093
2 changed files with 6 additions and 5 deletions

View file

@ -274,20 +274,21 @@ function HKCheckCompletion(jsonObject) {
if (i === "completionPercentage") { if (i === "completionPercentage") {
if (HKPlayerData.completionPercentage >= 112) CurrentDataTrue(HKPlayerData.completionPercentage); if (HKPlayerData.completionPercentage >= 112) CurrentDataTrue(HKPlayerData.completionPercentage);
else CurrentDataFalse(HKPlayerData.completionPercentage); else CurrentDataFalse(HKPlayerData.completionPercentage);
FillHTML(DIV_ID.intro, "Hollow Knight Completion: ", " %"); FillHTML(DIV_ID.intro, "Game Completion: ", " %");
} }
// ---------------- Time Played ----------------- // // ---------------- Time Played ----------------- //
if (i === "playTime") { if (i === "playTime") {
let seconds = Math.floor(HKPlayerData.playTime); let seconds = Math.floor(HKPlayerData.playTime);
let minutes = Math.floor((seconds / 60) % 60); let minutes = Math.round((seconds / 60) % 60);
let hours = Math.floor(seconds / 3600); let hours = Math.round(seconds / 3600);
let sec = Math.floor(seconds % 60); let sec = Math.round(seconds % 60);
if (sec <= 10) sec = "0" + sec; if (sec <= 10) sec = "0" + sec;
if (minutes <= 10) minutes = "0" + minutes; if (minutes <= 10) minutes = "0" + minutes;
CurrentDataTrue(); CurrentDataTrue();
FillHTML(DIV_ID.intro, "Time Played: " + hours + " h " + minutes + " min " + sec + " sec"); FillHTML(DIV_ID.intro, "Time Played: " + hours + " h " + minutes + " min " + sec + " sec");
CurrentDataFalse();
} }
// ---------------- Bosses (Base Game) --------------------- // // ---------------- Bosses (Base Game) --------------------- //

View file

@ -31,7 +31,7 @@ function loadJSON(filename, callback) {
xobj.send(null); xobj.send(null);
} }
loadJSON(fileName[1], loadJSON(fileName[0],
function JSONparse(response) { function JSONparse(response) {
// Parse JSON string into object // Parse JSON string into object
jsonObj = JSON.parse(response); jsonObj = JSON.parse(response);