Time played calculation
This commit is contained in:
parent
b7fbe4603b
commit
22cff630ee
4 changed files with 20 additions and 8 deletions
3
.gitignore
vendored
3
.gitignore
vendored
|
|
@ -5,4 +5,5 @@ images/
|
|||
plain.json
|
||||
reznor88banish.json
|
||||
reznor112grimm.json
|
||||
reznor100.json
|
||||
reznor100.json
|
||||
reznor0.json
|
||||
|
|
@ -239,6 +239,17 @@ function HKCheckCompletion(jsonObject) {
|
|||
fillHTML(DIV_ID.intro, "Hollow Knight Completion: ", " %");
|
||||
}
|
||||
|
||||
if (i === "playTime") {
|
||||
let seconds = Math.floor(HKPlayerData.playTime);
|
||||
let minutes = Math.floor((seconds / 60) % 60);
|
||||
let hours = Math.floor(seconds / 3600);
|
||||
let sec = Math.floor(seconds % 60);
|
||||
if (sec <= 10) sec = "0" + sec;
|
||||
if (minutes <= 10) minutes = "0" + minutes;
|
||||
currentDataTrue();
|
||||
fillHTML(DIV_ID.intro, "Time Played: " + hours + "h " + minutes + "min " + sec + "sec");
|
||||
}
|
||||
|
||||
// ---------------- Bosses (Base Game) --------------------- //
|
||||
|
||||
if (HK_BOSSES_temp) checkIfDataTrue(DIV_ID.bosses, HK_BOSSES_temp, HKPlayerData);
|
||||
|
|
@ -385,8 +396,8 @@ function HKReadTextArea() {
|
|||
let contents = document.getElementById(textAreaId).value;
|
||||
|
||||
if(contents.length) {
|
||||
let jsonObj = JSON.parse(contents);
|
||||
HKCheckCompletion(jsonObj);
|
||||
// console.log(jsonObj);
|
||||
let jsonObject = JSON.parse(contents);
|
||||
HKCheckCompletion(jsonObject);
|
||||
// console.log(jsonObject);
|
||||
}
|
||||
}
|
||||
|
|
@ -24,7 +24,7 @@
|
|||
<link rel="icon" href="../favicon.png">
|
||||
|
||||
<!-- Global site tag (gtag.js) - Google Analytics -->
|
||||
<!-- <script src="loadJson.js"></script> -->
|
||||
<script src="loadJson.js"></script>
|
||||
<script src="HKCheckCompletion.js"></script>
|
||||
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-136831794-2"></script>
|
||||
<script>
|
||||
|
|
@ -66,7 +66,7 @@
|
|||
|
||||
<div style="margin-bottom: 20px;"></div>
|
||||
|
||||
<h2>Game Completion Status</h2>
|
||||
<h2>Game Status</h2>
|
||||
<div id="hk-intro"></div>
|
||||
|
||||
<h2>Bosses (WIP)</h2>
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ function loadJSON(callback) {
|
|||
|
||||
xobj.overrideMimeType("application/json");
|
||||
|
||||
let fileName = ["reznor88banish.json", "reznor112grimm.json", "reznor100.json"];
|
||||
let fileName = ["reznor88banish.json", "reznor112grimm.json", "reznor100.json", "reznor0.json"];
|
||||
|
||||
// Specifies the request
|
||||
/* method: the request type GET or POST
|
||||
|
|
@ -18,7 +18,7 @@ function loadJSON(callback) {
|
|||
async: true (asynchronous) or false (synchronous)
|
||||
user: optional user name
|
||||
psw: optional password */
|
||||
xobj.open('GET', fileName[0], true); // Path to the file
|
||||
xobj.open('GET', fileName[1], true); // Path to the file
|
||||
|
||||
// Defines a function to be called when the readyState property changes
|
||||
xobj.onreadystatechange = function GetResponseText() {
|
||||
|
|
|
|||
Loading…
Reference in a new issue