From cdb61693c8356f48d48b27514c0c6c2f4fdbb10e Mon Sep 17 00:00:00 2001 From: ReznoRMichael Date: Wed, 30 Sep 2020 17:53:12 +0200 Subject: [PATCH] Area Maps --- HKCheckCompletion.js | 26 +++++++++++++++++++++++++- index.html | 3 ++- loadJson.js | 2 +- 3 files changed, 28 insertions(+), 3 deletions(-) diff --git a/HKCheckCompletion.js b/HKCheckCompletion.js index 07fa037..af16478 100644 --- a/HKCheckCompletion.js +++ b/HKCheckCompletion.js @@ -376,6 +376,10 @@ const HK_ESSENTIAL = { }; const HK_ACHIEVEMENTS = { + areaMaps: ["Area Maps", "Cornifer and Iselda (out of 13)", 13, [ + "mapCrossroads", "mapGreenpath", "mapFogCanyon", "mapRoyalGardens", "mapFungalWastes", "mapCity", "mapWaterways", "mapMines", "mapDeepnest", "mapCliffs", "mapOutskirts", "mapRestingGrounds", "mapAbyss" + ] + ], hasJournal: ["Hunter's Journal", "Greenpath: Hunter"], hasHuntersMark: ["Hunter's Mark", "Greenpath: Hunter"], journalEntriesCompleted: ["Creatures Encountered", "Hunter's Journal (164 max)", 164], @@ -407,6 +411,7 @@ const HK_STATISTICS = { fragileGreed_unbreakable: ["Unbreakable Greed", "Divine: 9000 Geo"], fragileHealth_unbreakable: ["Unbreakable Heart", "Divine: 12000 Geo"], fragileStrength_unbreakable: ["Unbreakable Strength", "Divine: 15000 Geo"], + killedMenderBug: ["Menderbug", "Forgotten Crossroads + destroy sign"], whiteDefenderDefeats: ["White Defender times defeated", "Royal Waterways (5 max)", 5], greyPrinceDefeats: ["Grey Prince Zote times defeated", "Dirtmouth (10 max)", 10], }; @@ -944,11 +949,25 @@ function CheckAdditionalThings(divId, dataObject, playerData, worldData) { return false; } + /** + * Counts the number of maps the player has acquired (from the list in an array) + * @param {array} mapArray Array of strings with area map names + * @returns {number} + */ + function CountMaps(mapArray) { + let totalMaps = 0; + for (i = 0, len = mapArray.length; i < len; i++) { + if (playerData[mapArray[i]] === true) totalMaps++ + } + return totalMaps; + } + for (let i in dataObject) { textPrefix = dataObject[i][0]; (dataObject[i][1]) ? textSuffix = dataObject[i][1]: textSuffix = ""; switch (i) { + case "areaMaps": case "grubsCollected": case "dreamOrbs": case "fountainGeo": @@ -959,7 +978,12 @@ function CheckAdditionalThings(divId, dataObject, playerData, worldData) { case "journalNotesCompleted": case "whiteDefenderDefeats": case "greyPrinceDefeats": - let amount = playerData[i]; + let amount = 0; + if (i === "areaMaps") { + amount = CountMaps(dataObject[i][3]); + } else { + amount = playerData[i]; + } if (i === "stationsOpened") { if (playerData.openedHiddenStation === true) amount++; } diff --git a/index.html b/index.html index 53ea435..6950ac9 100644 --- a/index.html +++ b/index.html @@ -32,6 +32,7 @@ @@ -91,7 +92,7 @@ - + diff --git a/loadJson.js b/loadJson.js index 721d6e2..95cc3c7 100644 --- a/loadJson.js +++ b/loadJson.js @@ -45,7 +45,7 @@ function loadJSON(filename, callback) { xobj.send(null); } -loadJSON("save/" + fileName[0], +loadJSON("save/" + fileName[5], function JSONparse(response) { // Parse JSON string into object jsonObj = JSON.parse(response);