add Grimm Troupe, clone objects

This commit is contained in:
ReznoRMichael 2020-08-25 02:04:02 +02:00
parent cecfa61e77
commit 94d1a88199
3 changed files with 32 additions and 14 deletions

4
.gitignore vendored
View file

@ -1 +1,3 @@
plain.json plain.json
reznor88banish.json
reznor112grimm.json

View file

@ -22,6 +22,8 @@ var divEnd = [
var strongStart = "<strong>" var strongStart = "<strong>"
var strongEnd = "</strong>" var strongEnd = "</strong>"
// ---------------- Hollow Knight Data Constant Objects ----------------- //
const DIV_ID = { const DIV_ID = {
intro: "hk-intro", intro: "hk-intro",
bosses: "hk-bosses", bosses: "hk-bosses",
@ -116,6 +118,13 @@ const HK_WARRIORDREAMS = {
aladarSlugDefeated: "Gorb" aladarSlugDefeated: "Gorb"
}; };
const HK_GRIMMTROUPE = {
gotCharm_40: "Grimmchild / Carefree Melody",
gotCharm_38: "Dreamshield",
gotCharm_37: "Sprintmaster",
gotCharm_39: "Weaversong",
};
const HK_LIFEBLOOD = { const HK_LIFEBLOOD = {
killedHiveKnight: "Hive Knight" killedHiveKnight: "Hive Knight"
}; };
@ -129,13 +138,20 @@ function HKCheckCompletion(jsonObject) {
// start benchmark // start benchmark
let countBegin = new Date(); let countBegin = new Date();
// Pre-Cleaning for safety // Pre-Cleaning all divs for safety
for (i in DIV_ID) { for (i in DIV_ID) {
document.getElementById(DIV_ID[i]).innerHTML = ""; document.getElementById(DIV_ID[i]).innerHTML = "";
} }
// Shallow Clone const objects (used for destructive functions)
let HK_BOSSES_temp = Object.assign({}, HK_BOSSES); let HK_BOSSES_temp = Object.assign({}, HK_BOSSES);
let HK_COLOSSEUM_temp = Object.assign({}, HK_COLOSSEUM);
let HK_DREAMERS_temp = Object.assign({}, HK_DREAMERS);
let HK_DREAMNAIL_temp = Object.assign({}, HK_DREAMNAIL);
let HK_EQUIPMENT_temp = Object.assign({}, HK_EQUIPMENT);
let HK_NAILARTS_temp = Object.assign({}, HK_NAILARTS);
let HK_WARRIORDREAMS_temp = Object.assign({}, HK_WARRIORDREAMS); let HK_WARRIORDREAMS_temp = Object.assign({}, HK_WARRIORDREAMS);
let HK_GRIMMTROUPE_temp = Object.assign({}, HK_GRIMMTROUPE);
let HK_LIFEBLOOD_temp = Object.assign({}, HK_LIFEBLOOD); let HK_LIFEBLOOD_temp = Object.assign({}, HK_LIFEBLOOD);
let HK_GODMASTER_temp = Object.assign({}, HK_GODMASTER); let HK_GODMASTER_temp = Object.assign({}, HK_GODMASTER);
@ -148,30 +164,30 @@ function HKCheckCompletion(jsonObject) {
// ---------------- Game Completion Status ----------------- // // ---------------- Game Completion Status ----------------- //
if (i === "completionPercentage") { if (i === "completionPercentage") {
if (HKPlayerData.completionPercentage >= 112) currentDataTrue(); 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, "Hollow Knight Completion", " %");
} }
// ---------------- Bosses (Base Game) --------------------- // // ---------------- Bosses (Base Game) --------------------- //
checkIfDataTrue(DIV_ID.bosses, HK_BOSSES_temp, HKPlayerData); if (HK_BOSSES_temp) checkIfDataTrue(DIV_ID.bosses, HK_BOSSES_temp, HKPlayerData);
// ---------------- Colosseum of Fools --------------------- // // ---------------- Colosseum of Fools --------------------- //
checkIfDataTrue(DIV_ID.colosseum, HK_COLOSSEUM, HKPlayerData); if (HK_COLOSSEUM_temp) checkIfDataTrue(DIV_ID.colosseum, HK_COLOSSEUM_temp, HKPlayerData);
// ---------------- Dreamers --------------------- // // ---------------- Dreamers --------------------- //
checkIfDataTrue(DIV_ID.dreamers, HK_DREAMERS, HKPlayerData); if (HK_DREAMERS_temp) checkIfDataTrue(DIV_ID.dreamers, HK_DREAMERS_temp, HKPlayerData);
// ---------------- Dream Nail and Essence --------------------- // // ---------------- Dream Nail and Essence --------------------- //
checkIfDataTrue(DIV_ID.dreamNail, HK_DREAMNAIL, HKPlayerData); if (HK_DREAMNAIL_temp) checkIfDataTrue(DIV_ID.dreamNail, HK_DREAMNAIL_temp, HKPlayerData);
// ---------------- Equipment --------------------- // // ---------------- Equipment --------------------- //
checkIfDataTrue(DIV_ID.equipment, HK_EQUIPMENT, HKPlayerData); if (HK_EQUIPMENT_temp) checkIfDataTrue(DIV_ID.equipment, HK_EQUIPMENT_temp, HKPlayerData);
// ---------------- Mask Shards --------------------- // // ---------------- Mask Shards --------------------- //
@ -179,7 +195,7 @@ function HKCheckCompletion(jsonObject) {
// ---------------- Nail Arts --------------------- // // ---------------- Nail Arts --------------------- //
checkIfDataTrue(DIV_ID.nailArts, HK_NAILARTS, HKPlayerData); if (HK_NAILARTS_temp) checkIfDataTrue(DIV_ID.nailArts, HK_NAILARTS_temp, HKPlayerData);
// ---------------- Nail Upgrades --------------------- // // ---------------- Nail Upgrades --------------------- //
@ -196,7 +212,7 @@ function HKCheckCompletion(jsonObject) {
// ---------------- Spells --------------------- // // ---------------- Spells --------------------- //
checkSpellLevel(DIV_ID.spells, HK_SPELLS, HKPlayerData); if (HK_SPELLS) checkSpellLevel(DIV_ID.spells, HK_SPELLS, HKPlayerData);
// ---------------- Vessel Fragments --------------------- // // ---------------- Vessel Fragments --------------------- //
@ -204,15 +220,15 @@ function HKCheckCompletion(jsonObject) {
// ---------------- Warrior Dreams --------------------- // // ---------------- Warrior Dreams --------------------- //
checkWarriorDreams(DIV_ID.warriorDreams, HK_WARRIORDREAMS_temp, HKPlayerData); if (HK_WARRIORDREAMS_temp) checkWarriorDreams(DIV_ID.warriorDreams, HK_WARRIORDREAMS_temp, HKPlayerData);
// ---------------- Grimm Troupe Content Pack --------------------- // // ---------------- Grimm Troupe Content Pack --------------------- //
// if (HK_GRIMMTROUPE_temp) checkIfDataTrue(DIV_ID.grimmTroupe, HK_GRIMMTROUPE_temp, HKPlayerData);
// ---------------- Lifeblood Content Pack --------------------- // // ---------------- Lifeblood Content Pack --------------------- //
checkIfDataTrue(DIV_ID.lifeblood, HK_LIFEBLOOD_temp, HKPlayerData); if (HK_LIFEBLOOD_temp) checkIfDataTrue(DIV_ID.lifeblood, HK_LIFEBLOOD_temp, HKPlayerData);
// ---------------- Godmaster Content Pack --------------------- // // ---------------- Godmaster Content Pack --------------------- //

View file

@ -16,7 +16,7 @@ function loadJSON( callback ) {
async: true (asynchronous) or false (synchronous) async: true (asynchronous) or false (synchronous)
user: optional user name user: optional user name
psw: optional password */ psw: optional password */
xobj.open( 'GET', 'plain.json', true ); // Path to the file xobj.open( 'GET', 'reznor88banish.json', true ); // Path to the file
// Defines a function to be called when the readyState property changes // Defines a function to be called when the readyState property changes
xobj.onreadystatechange = function GetResponseText() { xobj.onreadystatechange = function GetResponseText() {