Whispering Roots

This commit is contained in:
ReznoRMichael 2020-10-01 15:21:26 +02:00
parent 63fcf21e17
commit be4de5ad01
2 changed files with 20 additions and 1 deletions

View file

@ -408,6 +408,7 @@ const HK_STATISTICS = {
rancidEggs: ["Rancid Eggs", "Hallownest, Sly, Tuk"],
xunFlowerBrokeTimes: ["Delicate Flowers broken", "Resting Grounds: Grey Mourner"],
hasDreamGate: ["Dream Gate", "Seer: 900 Essence"],
whisperingRoots: ["Whispering Roots completed", "Dream Nail (out of 15)", 15],
fragileGreed_unbreakable: ["Unbreakable Greed", "Divine: 9000 Geo"],
fragileHealth_unbreakable: ["Unbreakable Heart", "Divine: 12000 Geo"],
fragileStrength_unbreakable: ["Unbreakable Strength", "Divine: 15000 Geo"],
@ -950,6 +951,21 @@ function CheckAdditionalThings(divId, dataObject, playerData, worldData) {
return false;
}
/**
* Searches for a given item that the player has found and returns the amount of them that the player completed.
* @param {string} itemId Name of the item
* @returns {number}
*/
function CountWorldItem(itemId = "") {
let total = 0;
for (let i = 0, length = worldData.length; i < length; i++) {
if (worldData[i].id === itemId) {
if (worldData[i].activated === true) total++;
}
}
return total;
}
/**
* 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
@ -975,6 +991,7 @@ function CheckAdditionalThings(divId, dataObject, playerData, worldData) {
case "nailDamage":
case "stationsOpened":
case "charmSlots":
case "whisperingRoots":
case "journalEntriesCompleted":
case "journalNotesCompleted":
case "whiteDefenderDefeats":
@ -982,6 +999,8 @@ function CheckAdditionalThings(divId, dataObject, playerData, worldData) {
let amount = 0;
if (i === "areaMaps") {
amount = CountMaps(dataObject[i][3]);
} else if (i === "whisperingRoots") {
amount = CountWorldItem("Dream Plant");
} else {
amount = playerData[i];
}

View file

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