Area Maps

This commit is contained in:
ReznoRMichael 2020-09-30 17:53:12 +02:00
parent 84536564b6
commit cdb61693c8
3 changed files with 28 additions and 3 deletions

View file

@ -376,6 +376,10 @@ const HK_ESSENTIAL = {
}; };
const HK_ACHIEVEMENTS = { 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"], hasJournal: ["Hunter's Journal", "Greenpath: Hunter"],
hasHuntersMark: ["Hunter's Mark", "Greenpath: Hunter"], hasHuntersMark: ["Hunter's Mark", "Greenpath: Hunter"],
journalEntriesCompleted: ["Creatures Encountered", "Hunter's Journal (164 max)", 164], journalEntriesCompleted: ["Creatures Encountered", "Hunter's Journal (164 max)", 164],
@ -407,6 +411,7 @@ const HK_STATISTICS = {
fragileGreed_unbreakable: ["Unbreakable Greed", "Divine: 9000 Geo"], fragileGreed_unbreakable: ["Unbreakable Greed", "Divine: 9000 Geo"],
fragileHealth_unbreakable: ["Unbreakable Heart", "Divine: 12000 Geo"], fragileHealth_unbreakable: ["Unbreakable Heart", "Divine: 12000 Geo"],
fragileStrength_unbreakable: ["Unbreakable Strength", "Divine: 15000 Geo"], fragileStrength_unbreakable: ["Unbreakable Strength", "Divine: 15000 Geo"],
killedMenderBug: ["Menderbug", "Forgotten Crossroads + destroy sign"],
whiteDefenderDefeats: ["White Defender times defeated", "Royal Waterways (5 max)", 5], whiteDefenderDefeats: ["White Defender times defeated", "Royal Waterways (5 max)", 5],
greyPrinceDefeats: ["Grey Prince Zote times defeated", "Dirtmouth (10 max)", 10], greyPrinceDefeats: ["Grey Prince Zote times defeated", "Dirtmouth (10 max)", 10],
}; };
@ -944,11 +949,25 @@ function CheckAdditionalThings(divId, dataObject, playerData, worldData) {
return false; 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) { for (let i in dataObject) {
textPrefix = dataObject[i][0]; textPrefix = dataObject[i][0];
(dataObject[i][1]) ? textSuffix = dataObject[i][1]: textSuffix = ""; (dataObject[i][1]) ? textSuffix = dataObject[i][1]: textSuffix = "";
switch (i) { switch (i) {
case "areaMaps":
case "grubsCollected": case "grubsCollected":
case "dreamOrbs": case "dreamOrbs":
case "fountainGeo": case "fountainGeo":
@ -959,7 +978,12 @@ function CheckAdditionalThings(divId, dataObject, playerData, worldData) {
case "journalNotesCompleted": case "journalNotesCompleted":
case "whiteDefenderDefeats": case "whiteDefenderDefeats":
case "greyPrinceDefeats": 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 (i === "stationsOpened") {
if (playerData.openedHiddenStation === true) amount++; if (playerData.openedHiddenStation === true) amount++;
} }

View file

@ -32,6 +32,7 @@
<!-- To do: <!-- To do:
- Upload a save file directly (option) - Upload a save file directly (option)
- Maps found (count)
- Hunter's Journal completion - Hunter's Journal completion
- Censored names H***** when not defeated/found? - Censored names H***** when not defeated/found?
--> -->
@ -91,7 +92,7 @@
</html> </html>
<!-- Instantly load test file (Debugging script) --> <!-- Instantly load test file (Debugging script) -->
<!-- <script src="loadJson.js"></script> --> <script src="loadJson.js"></script>
<!-- Main script --> <!-- Main script -->
<script src="HKCheckCompletion.js"></script> <script src="HKCheckCompletion.js"></script>

View file

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