additional things added

This commit is contained in:
ReznoRMichael 2020-09-25 13:58:14 +02:00
parent 92a35b4812
commit d937a21d55
2 changed files with 30 additions and 9 deletions

View file

@ -125,6 +125,10 @@ const DIV_ID = {
essential: { essential: {
h2: "Game Completion Essentials", h2: "Game Completion Essentials",
id: "hk-essential" id: "hk-essential"
},
additional: {
h2: "Additional Information",
id: "hk-additional"
} }
}; };
@ -342,7 +346,7 @@ const HK_GODMASTER_DOORS = [
const HK_ESSENTIAL = { const HK_ESSENTIAL = {
grubsCollected: ["Grubs Rescued", "out of 46 total", 46], grubsCollected: ["Grubs Rescued", "out of 46 total", 46],
dreamOrbs: ["Essence Collected", "Dream Nail: 2400 for completion", 2400], dreamOrbs: ["Essence Collected", "Dream Nail + 2400 for completion", 2400],
slyRescued: ["Sly Rescued", "Forgotten Crossroads"], slyRescued: ["Sly Rescued", "Forgotten Crossroads"],
brettaRescued: ["Bretta Rescued", "Fungal Wastes"], brettaRescued: ["Bretta Rescued", "Fungal Wastes"],
hasLantern: ["Lumafly Lantern", "Sly: 1800 Geo"], hasLantern: ["Lumafly Lantern", "Sly: 1800 Geo"],
@ -364,6 +368,12 @@ const HK_ESSENTIAL = {
nightmareLanternLit: ["Nightmare Lantern Lit", "Howling Cliffs"] nightmareLanternLit: ["Nightmare Lantern Lit", "Howling Cliffs"]
}; };
const HK_ADDITIONAL = {
nailDamage: ["Nail Damage", "Nailsmith upgrades", 21],
hasDreamGate: ["Dream Gate", "Seer: 900 Essence"],
dreamOrbsSpent: ["Essence spent", "Dream Nail", 1],
};
/** /**
* Checks Hollow Knight game completion by analyzing the save file * Checks Hollow Knight game completion by analyzing the save file
* @param {object} jsonObject Decoded save data in JavaScript Object Notation form (JSON) * @param {object} jsonObject Decoded save data in JavaScript Object Notation form (JSON)
@ -538,7 +548,15 @@ function HKCheckCompletion(jsonObject) {
// ------------------------- Essential Things ----------------------------- // // ------------------------- Essential Things ----------------------------- //
CheckEssential(DIV_ID.essential, HK_ESSENTIAL, HKPlayerData, HKWorldItems); CheckAdditionalThings(DIV_ID.essential, HK_ESSENTIAL, HKPlayerData, HKWorldItems);
// ---------------- Fleur Divide ----------------- //
AppendHTML(DIV_ID.essential, FLEUR_DIVIDE);
// ------------------------- Additional Things ----------------------------- //
CheckAdditionalThings(DIV_ID.additional, HK_ADDITIONAL, HKPlayerData, HKWorldItems);
// ------------------------- Hints ----------------------------- // // ------------------------- Hints ----------------------------- //
@ -849,7 +867,7 @@ function CheckWorldDataTrue(divId, idText, dataObject, worldData) {
* @param {object} playerData Reference/pointer to specific data where to search * @param {object} playerData Reference/pointer to specific data where to search
* @param {object} worldData Reference/pointer to specific data where to search * @param {object} worldData Reference/pointer to specific data where to search
*/ */
function CheckEssential(divId, dataObject, playerData, worldData) { function CheckAdditionalThings(divId, dataObject, playerData, worldData) {
let textPrefix = ""; let textPrefix = "";
let textSuffix = ""; let textSuffix = "";
@ -873,13 +891,15 @@ function CheckEssential(divId, dataObject, playerData, worldData) {
for (let i in dataObject) { for (let i in dataObject) {
textPrefix = dataObject[i][0]; textPrefix = dataObject[i][0];
textSuffix = dataObject[i][1]; (dataObject[i][1]) ? textSuffix = dataObject[i][1]: textSuffix = "";
switch (i) { switch (i) {
case "grubsCollected": case "grubsCollected":
case "dreamOrbs": case "dreamOrbs":
case "fountainGeo": case "fountainGeo":
textPrefix += ": " + playerData[i]; case "nailDamage":
case "dreamOrbsSpent":
textPrefix += ": " + Math.abs(playerData[i]);
(playerData[i] >= dataObject[i][2]) ? CurrentDataTrue(): CurrentDataInfo(); (playerData[i] >= dataObject[i][2]) ? CurrentDataTrue(): CurrentDataInfo();
break; break;
case "shopkeeperKey": case "shopkeeperKey":
@ -1058,10 +1078,10 @@ function InitialHTMLPopulate(divIdObj) {
FillHTML(divIdObj.hints, HK_HINTS.fireballLevel[0], HK_HINTS.fireballLevel[1]); FillHTML(divIdObj.hints, HK_HINTS.fireballLevel[0], HK_HINTS.fireballLevel[1]);
// Temp arrays storing references (addresses) to objects for looping through them (duplicates important) // Temp arrays storing references (addresses) to objects for looping through them (duplicates important)
let hkObjArray = [HK_BOSSES, HK_BOSSES_WORLD, HK_CHARMS, HK_EQUIPMENT, HK_NAILARTS, HK_MASKSHARDS, HK_MASKSHARDS_WORLD, HK_VESSELFRAGMENTS, HK_VESSELFRAGMENTS_WORLD, HK_DREAMERS, HK_COLOSSEUM, HK_DREAMNAIL, HK_WARRIORDREAMS, HK_GRIMMTROUPE, HK_LIFEBLOOD, HK_GODMASTER, HK_ESSENTIAL]; let hkObjArray = [HK_BOSSES, HK_BOSSES_WORLD, HK_CHARMS, HK_EQUIPMENT, HK_NAILARTS, HK_MASKSHARDS, HK_MASKSHARDS_WORLD, HK_VESSELFRAGMENTS, HK_VESSELFRAGMENTS_WORLD, HK_DREAMERS, HK_COLOSSEUM, HK_DREAMNAIL, HK_WARRIORDREAMS, HK_GRIMMTROUPE, HK_LIFEBLOOD, HK_GODMASTER, HK_ESSENTIAL, HK_ADDITIONAL];
// duplicates and order important - must be the same as in hkObjArray[] // duplicates and order important - must be the same as in hkObjArray[]
let divObjArray = [divIdObj.bosses, divIdObj.bosses, divIdObj.charms, divIdObj.equipment, divIdObj.nailArts, divIdObj.maskShards, divIdObj.maskShards, divIdObj.vesselFragments, divIdObj.vesselFragments, divIdObj.dreamers, divIdObj.colosseum, divIdObj.dreamNail, divIdObj.warriorDreams, divIdObj.grimmTroupe, divIdObj.lifeblood, divIdObj.godmaster, divIdObj.essential]; let divObjArray = [divIdObj.bosses, divIdObj.bosses, divIdObj.charms, divIdObj.equipment, divIdObj.nailArts, divIdObj.maskShards, divIdObj.maskShards, divIdObj.vesselFragments, divIdObj.vesselFragments, divIdObj.dreamers, divIdObj.colosseum, divIdObj.dreamNail, divIdObj.warriorDreams, divIdObj.grimmTroupe, divIdObj.lifeblood, divIdObj.godmaster, divIdObj.essential, divIdObj.additional];
// Looped filling to reduce redundancy // Looped filling to reduce redundancy
do { do {
@ -1091,8 +1111,9 @@ function InitialHTMLPopulate(divIdObj) {
FillHTML(divIdObj.godmaster, HK_GODMASTER_DOORS[i][0], HK_GODMASTER_DOORS[i][1]); FillHTML(divIdObj.godmaster, HK_GODMASTER_DOORS[i][0], HK_GODMASTER_DOORS[i][1]);
} }
// Fleur Divide // Fleur Dividers
AppendHTML(divIdObj.godmaster, FLEUR_DIVIDE); AppendHTML(divIdObj.godmaster, FLEUR_DIVIDE);
AppendHTML(divIdObj.essential, FLEUR_DIVIDE);
} }
/** /**

View file

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