make green checkboxes

This commit is contained in:
ReznoRMichael 2021-07-05 23:08:00 +02:00
parent 6711137862
commit acc9cb97ce
4 changed files with 245 additions and 246 deletions

View file

@ -163,7 +163,7 @@ function HKCheckCompletion(jsonObject) {
(0,_page_functions_js__WEBPACK_IMPORTED_MODULE_1__.CheckboxHintsToggle)(); (0,_page_functions_js__WEBPACK_IMPORTED_MODULE_1__.CheckboxHintsToggle)();
(0,_page_functions_js__WEBPACK_IMPORTED_MODULE_1__.CheckboxSpoilersToggle)(); (0,_page_functions_js__WEBPACK_IMPORTED_MODULE_1__.CheckboxSpoilersToggle)();
/* focus the text area after analyzing the save, without scrolling the document */ /* focus the text area after analyzing the save, without scrolling the document (too slow) */
/* document.getElementById("save-area").focus({preventScroll: true}); */ /* document.getElementById("save-area").focus({preventScroll: true}); */
// finish and show benchmark // finish and show benchmark
@ -174,13 +174,13 @@ function HKCheckCompletion(jsonObject) {
} }
/** /**
* Generates and appends a new entry inside the HTML of a given ID * Generates and appends a new entry inside the HTML of a given ID
* @param {object} divId object containing div ID and h2 title of the HTML element * @param {object} section object containing div ID and h2 title of the HTML element
* @param {string} textPrefix Main name of the entry * @param {string} textPrefix Main name of the entry
* @param {string} textSuffix Optional suffix after the main name (spoilers: locations, costs etc.) * @param {string} textSuffix Optional suffix after the main name (spoilers: locations, costs etc.)
*/ */
function PrepareHTMLString(divId) { function PrepareHTMLString(section) {
var textPrefix = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "Unknown Completion Element: "; var textPrefix = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "Unknown Completion Element: ";
var textSuffix = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "Unknown Description Element"; var textSuffix = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "Unknown Description Element";
var wiki = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : ""; var wiki = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : "";
@ -191,7 +191,7 @@ function PrepareHTMLString(divId) {
var span = ["<span class='spoiler-span'>", "</span>"]; var span = ["<span class='spoiler-span'>", "</span>"];
var spoilerSpan = ["<span class='spoiler-text'>", "</span>"]; var spoilerSpan = ["<span class='spoiler-text'>", "</span>"];
if (divId.id === "hk-hints") { if (section.id === "hk-hints") {
span[0] = "<span>"; span[0] = "<span>";
icon = ""; icon = "";
} // let dash = ""; } // let dash = "";
@ -208,13 +208,12 @@ function PrepareHTMLString(divId) {
function CurrentDataTrue() { function CurrentDataTrue() {
var divId = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ""; var section = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
completionSymbol = SYMBOL_TRUE; var entry = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "";
section.percent++;
if (section.id === "hk-equipment") section.percent++; // double % for equipment
if (divId) { section.entries[entry].icon = "green";
divId.percent++;
if (divId.id === "hk-equipment") divId.percent++; // double % for equipment
}
} }
/** /**
* Switches global variable to a "not completed" symbol * Switches global variable to a "not completed" symbol
@ -242,67 +241,67 @@ function CurrentDataBlank() {
} }
/** /**
* Fills HTML with the playTime value of the save file * Fills HTML with the playTime value of the save file
* @param {object} divId ID of the HTML element for data appending * @param {object} section ID of the HTML element for data appending
* @param {number} playTime Number of total gameplay time in seconds * @param {number} playTime Number of total gameplay time in seconds
*/ */
function CheckPlayTime(divId, playTime) { function CheckPlayTime(section, playTime) {
var seconds = Math.floor(playTime); var seconds = Math.floor(playTime);
var minutes = Math.floor(seconds / 60 % 60); var minutes = Math.floor(seconds / 60 % 60);
var hours = Math.floor(seconds / 3600); var hours = Math.floor(seconds / 3600);
var sec = Math.floor(seconds % 60); var sec = Math.floor(seconds % 60);
divId.entries.timePlayed.timeH = hours; section.entries.timePlayed.timeH = hours;
divId.entries.timePlayed.timeM = minutes; section.entries.timePlayed.timeM = minutes;
divId.entries.timePlayed.timeS = sec; section.entries.timePlayed.timeS = sec;
if (sec < 10) sec = "0" + sec; if (sec < 10) sec = "0" + sec;
if (minutes < 10) minutes = "0" + minutes; if (minutes < 10) minutes = "0" + minutes;
var textFill = "Time Played:" + pSpan + "<b>" + hours + " h " + minutes + " min " + sec + " sec</b>"; var textFill = "Time Played:" + pSpan + "<b>" + hours + " h " + minutes + " min " + sec + " sec</b>";
divId.entries.timePlayed.spoiler = hours + " h " + minutes + " min " + sec + " sec"; // document.getElementById(divId.id).innerHTML += divStart + SYMBOL_CLOCK + textFill + divEnd; section.entries.timePlayed.spoiler = hours + " h " + minutes + " min " + sec + " sec"; // document.getElementById(section.id).innerHTML += divStart + SYMBOL_CLOCK + textFill + divEnd;
} }
/** /**
* Searches for completionPercentage in playerData and fills HTML with the value of the save file * Searches for completionPercentage in playerData and fills HTML with the value of the save file
* @param {object} divId ID of the HTML element for data appending * @param {object} section ID of the HTML element for data appending
* @param {number} completionPercentage Number of completion percentage * @param {number} completionPercentage Number of completion percentage
*/ */
function CheckCompletionPercent(divId, completionPercentage) { function CheckCompletionPercent(section, completionPercentage) {
completionPercentage >= 112 ? CurrentDataTrue() : CurrentDataFalse(); /* (completionPercentage >= 112) ? CurrentDataTrue(): CurrentDataFalse(); */
divId.percent = completionPercentage; section.percent = completionPercentage;
divId.entries.gameCompletion.spoiler = completionPercentage; section.entries.gameCompletion.spoiler = completionPercentage;
var textFill = "Game Completion:" + pSpan + "<b>" + completionPercentage + " %</b>" + pSpan + "(out of " + divId.maxPercent + " %)"; // document.getElementById(divId.id).innerHTML += divStart + completionSymbol + textFill + divEnd; var textFill = "Game Completion:" + pSpan + "<b>" + completionPercentage + " %</b>" + pSpan + "(out of " + section.maxPercent + " %)"; // document.getElementById(section.id).innerHTML += divStart + completionSymbol + textFill + divEnd;
} }
/** /**
* Reads the "version" string from the save file and appends it to the selected div ID element * Reads the "version" string from the save file and appends it to the selected div ID element
* @param {object} divId ID of the HTML element for data appending * @param {object} section ID of the HTML element for data appending
* @param {string} saveVersion Save File version in format 0.0.0.0 * @param {string} saveVersion Save File version in format 0.0.0.0
*/ */
function CheckSaveFileVersion(divId) { function CheckSaveFileVersion(section) {
var saveVersion = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _hk_database_js__WEBPACK_IMPORTED_MODULE_0__.default.sections.intro.entries.saveVersion.spoiler; var saveVersion = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _hk_database_js__WEBPACK_IMPORTED_MODULE_0__.default.sections.intro.entries.saveVersion.spoiler;
CurrentDataBlank(); CurrentDataBlank();
divId.entries.saveVersion.spoiler = "".concat(saveVersion); section.entries.saveVersion.spoiler = "".concat(saveVersion);
var textFill = "Save Version:".concat(pSpan, "<b>").concat(saveVersion, "</b>").concat(pSpan); // document.getElementById(divId.id).innerHTML += divStart + completionSymbol + textFill + divEnd; var textFill = "Save Version:".concat(pSpan, "<b>").concat(saveVersion, "</b>").concat(pSpan); // document.getElementById(section.id).innerHTML += divStart + completionSymbol + textFill + divEnd;
} }
/** /**
* Fills HTML with appropriate number of health mask images * Fills HTML with appropriate number of health mask images
* @param {object} divId ID of the HTML element for data appending * @param {object} section ID of the HTML element for data appending
* @param {number} masks Number of max health masks from the save (baseline without charms and lifeblood) * @param {number} masks Number of max health masks from the save (baseline without charms and lifeblood)
* @param {number} permadeathMode Value of permadeathMode property. 0 = Normal, 1 = Steel Soul, 2 = Steel Soul broken save * @param {number} permadeathMode Value of permadeathMode property. 0 = Normal, 1 = Steel Soul, 2 = Steel Soul broken save
*/ */
function CheckHealthMasks(divId) { function CheckHealthMasks(section) {
var masks = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 5; var masks = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 5;
var permadeathMode = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0; var permadeathMode = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
divId.entries.health.masks = masks; section.entries.health.masks = masks;
if (permadeathMode > 0) { if (permadeathMode > 0) {
divId.entries.health.permadeathMode = true; section.entries.health.permadeathMode = true;
} else { } else {
divId.entries.health.permadeathMode = false; section.entries.health.permadeathMode = false;
} }
/* let icon = SYMBOL_EMPTY; /* let icon = SYMBOL_EMPTY;
let textFill = "<span>Health:</span>"; let textFill = "<span>Health:</span>";
@ -314,17 +313,17 @@ function CheckHealthMasks(divId) {
for (let i = 0; i < masks; i++) { for (let i = 0; i < masks; i++) {
maskImages += maskImg; maskImages += maskImg;
} */ } */
// document.getElementById(divId.id).innerHTML += divStartCenter + icon + textFill + maskImages + divEnd; // document.getElementById(section.id).innerHTML += divStartCenter + icon + textFill + maskImages + divEnd;
} }
/** /**
* Fills HTML with appropriate number of soul orbs images * Fills HTML with appropriate number of soul orbs images
* @param {object} divId ID of the HTML element for data appending * @param {object} section ID of the HTML element for data appending
* @param {number} totalSoul Number of max Soul reserve from the save. 99 = full Soul Orb * @param {number} totalSoul Number of max Soul reserve from the save. 99 = full Soul Orb
*/ */
function CheckSoulOrbs(divId, totalSoul) { function CheckSoulOrbs(section, totalSoul) {
var icon = SYMBOL_EMPTY; var icon = SYMBOL_EMPTY;
var textFill = "<span>Soul:</span>"; var textFill = "<span>Soul:</span>";
var soulImages = ""; var soulImages = "";
@ -333,17 +332,17 @@ function CheckSoulOrbs(divId, totalSoul) {
for (var i = 0, total = totalSoul / 33; i < total; i++) { for (var i = 0, total = totalSoul / 33; i < total; i++) {
soulImages += soulImg; soulImages += soulImg;
} // document.getElementById(divId.id).innerHTML += divStartCenter + icon + textFill + soulImages + divEnd; } // document.getElementById(section.id).innerHTML += divStartCenter + icon + textFill + soulImages + divEnd;
} }
/** /**
* Fills HTML with the Geo value of the save file * Fills HTML with the Geo value of the save file
* @param {object} divId ID of the HTML element for data appending * @param {object} section ID of the HTML element for data appending
* @param {number} geoValue Number of total Geo value * @param {number} geoValue Number of total Geo value
*/ */
function CheckGeo(divId) { function CheckGeo(section) {
var geoValue = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0; var geoValue = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
var geoPoolValue = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0; var geoPoolValue = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
var icon = SYMBOL_EMPTY; var icon = SYMBOL_EMPTY;
@ -351,17 +350,17 @@ function CheckGeo(divId) {
if (geoPoolValue > 0) textFill += "\n ".concat(pSpan, "+<img src='").concat(_img_geo_shade_png__WEBPACK_IMPORTED_MODULE_10__, "' class='geo-symbol' alt='shade geo symbol image' title='Shade Geo'><b>").concat(geoPoolValue, "</b>"); // Show also total Geo (Geo + Shade Geo) if player has at least 1 geo alongside the shade geo if (geoPoolValue > 0) textFill += "\n ".concat(pSpan, "+<img src='").concat(_img_geo_shade_png__WEBPACK_IMPORTED_MODULE_10__, "' class='geo-symbol' alt='shade geo symbol image' title='Shade Geo'><b>").concat(geoPoolValue, "</b>"); // Show also total Geo (Geo + Shade Geo) if player has at least 1 geo alongside the shade geo
if (geoValue > 0 && geoPoolValue > 0) textFill += "".concat(pSpan, "=").concat(pSpan, "<b>").concat(geoValue + geoPoolValue, "</b>"); // document.getElementById(divId.id).innerHTML += divStartCenter + icon + textFill + divEnd; if (geoValue > 0 && geoPoolValue > 0) textFill += "".concat(pSpan, "=").concat(pSpan, "<b>").concat(geoValue + geoPoolValue, "</b>"); // document.getElementById(section.id).innerHTML += divStartCenter + icon + textFill + divEnd;
} }
/** /**
* Fills HTML with appropriate number of notch images * Fills HTML with appropriate number of notch images
* @param {object} divId ID of the HTML element for data appending * @param {object} section ID of the HTML element for data appending
* @param {number} totalNotches Number of total Charm Notches the player has. 11 = max * @param {number} totalNotches Number of total Charm Notches the player has. 11 = max
* @param {number} filledNotches Number of total used Charm Notches (including overcharmed notches). 15 = max * @param {number} filledNotches Number of total used Charm Notches (including overcharmed notches). 15 = max
*/ */
function CheckNotches(divId) { function CheckNotches(section) {
var totalNotches = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 3; var totalNotches = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 3;
var filledNotches = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0; var filledNotches = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
var _ = 0, var _ = 0,
@ -400,19 +399,19 @@ function CheckNotches(divId) {
for (var _i2 = 0; _i2 < unusedNotches; _i2++) { for (var _i2 = 0; _i2 < unusedNotches; _i2++) {
notchImages += notchNormalImage; notchImages += notchNormalImage;
} }
} // document.getElementById(divId.id).innerHTML += divStartCenter + icon + textFill + notchImages + divEnd; } // document.getElementById(section.id).innerHTML += divStartCenter + icon + textFill + notchImages + divEnd;
} }
/** /**
* Verifies if the data in a specific object is true or false, and appends HTML accordingly. * Verifies if the data in a specific object is true or false, and appends HTML accordingly.
* @param {object} divId ID of the HTML element for data appending * @param {object} section ID of the HTML element for data appending
* @param {object} dataObject Object containing data to be verified (use copy - data inside this object will be deleted) * @param {object} dataObject Object containing data to be verified (use copy - data inside this object will be deleted)
* @param {object} playerData Reference/pointer to specific data where to search (playerData) * @param {object} playerData Reference/pointer to specific data where to search (playerData)
* @param {Array} worldData Reference/pointer to specific data where to search (sceneData.persistentBoolItems) * @param {Array} worldData Reference/pointer to specific data where to search (sceneData.persistentBoolItems)
*/ */
function CheckIfDataTrue(divId, dataObject, playerData) { function CheckIfDataTrue(section, dataObject, playerData) {
var worldData = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : []; var worldData = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : [];
var _ref = "", var _ref = "",
textPrefix = _ref.textPrefix, textPrefix = _ref.textPrefix,
@ -429,7 +428,7 @@ function CheckIfDataTrue(divId, dataObject, playerData) {
switch (i) { switch (i) {
case "gotCharm_36": case "gotCharm_36":
// prevents green checkbox and adding 1% when only got one white fragment // prevents green checkbox and adding 1% when only got one white fragment
playerData.gotQueenFragment === true && playerData.gotKingFragment === true ? CurrentDataTrue(divId) : CurrentDataFalse(); playerData.gotQueenFragment === true && playerData.gotKingFragment === true ? CurrentDataTrue(section, i) : CurrentDataFalse();
break; break;
case "gotCharm_37": case "gotCharm_37":
@ -448,11 +447,11 @@ function CheckIfDataTrue(divId, dataObject, playerData) {
} }
if (i === "grimmChildLevel") { if (i === "grimmChildLevel") {
playerData.grimmChildLevel >= 4 ? CurrentDataTrue(divId) : CurrentDataFalse(); playerData.grimmChildLevel >= 4 ? CurrentDataTrue(section, i) : CurrentDataFalse();
break; break;
} }
playerData[i] === true ? CurrentDataTrue(divId) : CurrentDataFalse(); playerData[i] === true ? CurrentDataTrue(section, i) : CurrentDataFalse();
break; break;
case "bossGruzMother": case "bossGruzMother":
@ -473,7 +472,7 @@ function CheckIfDataTrue(divId, dataObject, playerData) {
case "vesselFragmentCityOfTears": case "vesselFragmentCityOfTears":
case "vesselFragmentDeepnest": case "vesselFragmentDeepnest":
case "vesselFragmentFountain": case "vesselFragmentFountain":
WorldDataActivated(dataObject[i].id, dataObject[i].sceneName, worldData) ? CurrentDataTrue(divId) : CurrentDataFalse(); WorldDataActivated(dataObject[i].id, dataObject[i].sceneName, worldData) ? CurrentDataTrue(section, i) : CurrentDataFalse();
break; break;
case "pantheonMaster": case "pantheonMaster":
@ -487,7 +486,7 @@ function CheckIfDataTrue(divId, dataObject, playerData) {
textPrefix = "<del>".concat(textPrefix, "</del>"); textPrefix = "<del>".concat(textPrefix, "</del>");
break; break;
} else if (checkText === "PantheonCompleted") { } else if (checkText === "PantheonCompleted") {
CurrentDataTrue(divId); CurrentDataTrue(section, i);
break; break;
} else { } else {
CurrentDataFalse(); CurrentDataFalse();
@ -496,65 +495,65 @@ function CheckIfDataTrue(divId, dataObject, playerData) {
break; break;
default: default:
playerData[i] === true ? CurrentDataTrue(divId) : CurrentDataFalse(); playerData[i] === true ? CurrentDataTrue(section, i) : CurrentDataFalse();
} }
sFillText += PrepareHTMLString(divId, textPrefix, textSuffix, wiki); sFillText += PrepareHTMLString(section, textPrefix, textSuffix, wiki);
} // AppendHTML(divId, sFillText); } // AppendHTML(section, sFillText);
} }
/** /**
* Verifies if the data in a specific object is 0 or > 0, and appends HTML accordingly. * Verifies if the data in a specific object is 0 or > 0, and appends HTML accordingly.
* @param {object} divId ID of the HTML element for data appending * @param {object} section ID of the HTML element for data appending
* @param {object} dataObject Object containing data to be verified (use copy - data inside this object will be deleted) * @param {object} dataObject Object containing data to be verified (use copy - data inside this object will be deleted)
* @param {object} playerData Reference/pointer to specific data where to search * @param {object} playerData Reference/pointer to specific data where to search
*/ */
function CheckSpellLevel(divId, dataObject, playerData) { function CheckSpellLevel(section, dataObject, playerData) {
var sFillText = ""; var sFillText = "";
for (var i in dataObject) { for (var i in dataObject) {
switch (i) { switch (i) {
case "vengefulSpirit": case "vengefulSpirit":
case "shadeSoul": case "shadeSoul":
playerData.fireballLevel >= dataObject[i].fireballLevel ? CurrentDataTrue(divId) : CurrentDataFalse(); playerData.fireballLevel >= dataObject[i].fireballLevel ? CurrentDataTrue(section, i) : CurrentDataFalse();
sFillText += PrepareHTMLString(divId, dataObject[i].name, dataObject[i].spoiler, dataObject[i].wiki); sFillText += PrepareHTMLString(section, dataObject[i].name, dataObject[i].spoiler, dataObject[i].wiki);
break; break;
case "desolateDive": case "desolateDive":
case "descendingDark": case "descendingDark":
playerData.quakeLevel >= dataObject[i].quakeLevel ? CurrentDataTrue(divId) : CurrentDataFalse(); playerData.quakeLevel >= dataObject[i].quakeLevel ? CurrentDataTrue(section, i) : CurrentDataFalse();
sFillText += PrepareHTMLString(divId, dataObject[i].name, dataObject[i].spoiler, dataObject[i].wiki); sFillText += PrepareHTMLString(section, dataObject[i].name, dataObject[i].spoiler, dataObject[i].wiki);
break; break;
case "howlingWraiths": case "howlingWraiths":
case "abyssShriek": case "abyssShriek":
playerData.screamLevel >= dataObject[i].screamLevel ? CurrentDataTrue(divId) : CurrentDataFalse(); playerData.screamLevel >= dataObject[i].screamLevel ? CurrentDataTrue(section, i) : CurrentDataFalse();
sFillText += PrepareHTMLString(divId, dataObject[i].name, dataObject[i].spoiler, dataObject[i].wiki); sFillText += PrepareHTMLString(section, dataObject[i].name, dataObject[i].spoiler, dataObject[i].wiki);
break; break;
default: default:
break; break;
} }
} // AppendHTML(divId, sFillText); } // AppendHTML(section, sFillText);
} }
/** /**
* Verifies if the data in a specific object is 0 or > 0, and appends HTML accordingly. * Verifies if the data in a specific object is 0 or > 0, and appends HTML accordingly.
* @param {object} divId ID of the HTML element for data appending * @param {object} section ID of the HTML element for data appending
* @param {object} dataObject Object containing data to be verified * @param {object} dataObject Object containing data to be verified
* @param {object} playerData Reference/pointer to specific data where to search * @param {object} playerData Reference/pointer to specific data where to search
*/ */
function CheckWarriorDreams(divId, dataObject, playerData) { function CheckWarriorDreams(section, dataObject, playerData) {
var sFillText = ""; var sFillText = "";
for (var i in dataObject) { for (var i in dataObject) {
playerData[i] >= 2 ? CurrentDataTrue(divId) : CurrentDataFalse(); playerData[i] >= 2 ? CurrentDataTrue(section, i) : CurrentDataFalse();
sFillText += PrepareHTMLString(divId, dataObject[i].name, dataObject[i].spoiler, dataObject[i].wiki); sFillText += PrepareHTMLString(section, dataObject[i].name, dataObject[i].spoiler, dataObject[i].wiki);
} // AppendHTML(divId, sFillText); } // AppendHTML(section, sFillText);
} }
/** /**
@ -575,13 +574,13 @@ function CheckGodmasterDoors(dataObject, playerData) {
} }
/** /**
* Verifies the level of player's nail upgrades, and appends HTML accordingly. * Verifies the level of player's nail upgrades, and appends HTML accordingly.
* @param {object} divId ID of the HTML element for data appending * @param {object} section ID of the HTML element for data appending
* @param {object} dataObject Object containing nail upgrades data to be verified * @param {object} dataObject Object containing nail upgrades data to be verified
* @param {object} playerData Reference/pointer to specific data where to search in the save file * @param {object} playerData Reference/pointer to specific data where to search in the save file
*/ */
function CheckNailUpgrades(divId, dataObject, playerData) { function CheckNailUpgrades(section, dataObject, playerData) {
// appends "Nail" to every array element // appends "Nail" to every array element
// same as names in the database object // same as names in the database object
var nail = ["old", "sharpened", "channeled", "coiled", "pure"].map(function (element) { var nail = ["old", "sharpened", "channeled", "coiled", "pure"].map(function (element) {
@ -590,12 +589,12 @@ function CheckNailUpgrades(divId, dataObject, playerData) {
var sFillText = ""; var sFillText = "";
for (var i = 0; i < 5; i++) { for (var i = 0; i < 5; i++) {
playerData.nailSmithUpgrades >= i ? CurrentDataTrue(divId) : CurrentDataFalse(); playerData.nailSmithUpgrades >= i ? CurrentDataTrue(section, nail[i]) : CurrentDataFalse();
sFillText += PrepareHTMLString(divId, dataObject[nail[i]].name, dataObject[nail[i]].spoiler, dataObject[nail[i]].wiki); sFillText += PrepareHTMLString(section, dataObject[nail[i]].name, dataObject[nail[i]].spoiler, dataObject[nail[i]].wiki);
} }
if (divId.percent) divId.percent--; // subject one for the Old Nail if (section.percent) section.percent--; // subject one for the Old Nail
// AppendHTML(divId, sFillText); // AppendHTML(section, sFillText);
} }
/** /**
* Verifies if the specific Interactable (Item, Boss, Chest etc.) is activated. Returns true or false. * Verifies if the specific Interactable (Item, Boss, Chest etc.) is activated. Returns true or false.
@ -619,14 +618,14 @@ function WorldDataActivated(idText, sceneNameText, worldData) {
} }
/** /**
* Verifies if the data in a specific object are true or false, and appends HTML accordingly. Creates a copy of dataObject. * Verifies if the data in a specific object are true or false, and appends HTML accordingly. Creates a copy of dataObject.
* @param {object} divId ID of the HTML element for data appending * @param {object} section ID of the HTML element for data appending
* @param {string} idText Text string inside save data to search for * @param {string} idText Text string inside save data to search for
* @param {object} dataObject Object containing data to be verified * @param {object} dataObject Object containing data to be verified
* @param {object} worldData Reference/pointer to specific data where to search * @param {object} worldData Reference/pointer to specific data where to search
*/ */
function CheckWorldDataTrue(divId, idText, dataObject, worldData) { function CheckWorldDataTrue(section, idText, dataObject, worldData) {
var orderedArray = []; var orderedArray = [];
var size = (0,_hk_functions_js__WEBPACK_IMPORTED_MODULE_2__.ObjectLength)(dataObject); var size = (0,_hk_functions_js__WEBPACK_IMPORTED_MODULE_2__.ObjectLength)(dataObject);
var sFillText = ""; // Order the items before displaying them (creates a copy of dataObject) var sFillText = ""; // Order the items before displaying them (creates a copy of dataObject)
@ -647,14 +646,14 @@ function CheckWorldDataTrue(divId, idText, dataObject, worldData) {
for (var _i4 = 0; _i4 < size; _i4++) { for (var _i4 = 0; _i4 < size; _i4++) {
CurrentDataFalse(); CurrentDataFalse();
if (orderedArray[_i4][4] === true) CurrentDataTrue(divId); if (orderedArray[_i4][4] === true) CurrentDataTrue(section);
sFillText += PrepareHTMLString(divId, orderedArray[_i4][1], orderedArray[_i4][2], orderedArray[_i4][3]); sFillText += PrepareHTMLString(section, orderedArray[_i4][1], orderedArray[_i4][2], orderedArray[_i4][3]);
} // AppendHTML(divId, sFillText); } // AppendHTML(section, sFillText);
} }
/** /**
* Verifies if the data in a specific object are true or false, or checks what values they have, and appends HTML accordingly. * Verifies if the data in a specific object are true or false, or checks what values they have, and appends HTML accordingly.
* @param {object} divId ID of the HTML element for data appending * @param {object} section ID of the HTML element for data appending
* @param {object} dataObject Object containing data to be verified * @param {object} dataObject Object containing data to be verified
* @param {object} playerData Reference/pointer to specific data where to search (playerData) * @param {object} playerData Reference/pointer to specific data where to search (playerData)
* @param {object} worldData Reference/pointer to specific data where to search (sceneData.persistentBoolItems) * @param {object} worldData Reference/pointer to specific data where to search (sceneData.persistentBoolItems)
@ -662,7 +661,7 @@ function CheckWorldDataTrue(divId, idText, dataObject, worldData) {
*/ */
function CheckAdditionalThings(divId, dataObject, playerData, worldData, sceneData) { function CheckAdditionalThings(section, dataObject, playerData, worldData, sceneData) {
var _ref2 = "", var _ref2 = "",
textPrefix = _ref2.textPrefix, textPrefix = _ref2.textPrefix,
textSuffix = _ref2.textSuffix, textSuffix = _ref2.textSuffix,
@ -744,7 +743,7 @@ function CheckAdditionalThings(divId, dataObject, playerData, worldData, sceneDa
} }
} }
amount >= dataObject[i].max ? CurrentDataTrue() : CurrentDataBlank(); amount >= dataObject[i].max ? CurrentDataTrue(section, i) : CurrentDataBlank();
break; break;
case "geoPool": case "geoPool":
@ -752,7 +751,7 @@ function CheckAdditionalThings(divId, dataObject, playerData, worldData, sceneDa
case "jinnEggsSold": case "jinnEggsSold":
case "xunFlowerBrokeTimes": case "xunFlowerBrokeTimes":
textPrefix += ": " + Math.abs(playerData[i]); textPrefix += ": " + Math.abs(playerData[i]);
i === "geoPool" && playerData[i] > 0 ? CurrentDataBlank() : CurrentDataTrue(); i === "geoPool" && playerData[i] > 0 ? CurrentDataBlank() : CurrentDataTrue(section, i);
if (i === "jinnEggsSold") { if (i === "jinnEggsSold") {
// fade out if not on Steel Soul // fade out if not on Steel Soul
@ -770,7 +769,7 @@ function CheckAdditionalThings(divId, dataObject, playerData, worldData, sceneDa
notActivated = CountGeoRocks(discoveredTotal, "unbroken"); notActivated = CountGeoRocks(discoveredTotal, "unbroken");
activated = CountGeoRocks(discoveredTotal, "broken"); activated = CountGeoRocks(discoveredTotal, "broken");
textPrefix += ": ".concat(notActivated, " | ").concat(activated, " | ").concat(discoveredTotal); textPrefix += ": ".concat(notActivated, " | ").concat(activated, " | ").concat(discoveredTotal);
CurrentDataTrue(); CurrentDataTrue(section, i);
break; break;
case "itemsDiscovered": case "itemsDiscovered":
@ -778,24 +777,24 @@ function CheckAdditionalThings(divId, dataObject, playerData, worldData, sceneDa
notActivated = CountItems(discoveredTotal, "notActivated"); notActivated = CountItems(discoveredTotal, "notActivated");
activated = CountItems(discoveredTotal, "active"); activated = CountItems(discoveredTotal, "active");
textPrefix += ": ".concat(notActivated, " | ").concat(activated, " | ").concat(discoveredTotal); textPrefix += ": ".concat(notActivated, " | ").concat(activated, " | ").concat(discoveredTotal);
CurrentDataTrue(); CurrentDataTrue(section, i);
break; break;
case "shopkeeperKey": case "shopkeeperKey":
playerData.hasSlykey === true || playerData.gaveSlykey === true ? CurrentDataTrue() : CurrentDataFalse(); playerData.hasSlykey === true || playerData.gaveSlykey === true ? CurrentDataTrue(section, i) : CurrentDataFalse();
break; break;
case "elegantKey": case "elegantKey":
playerData.hasWhiteKey === true || playerData.usedWhiteKey === true ? CurrentDataTrue() : CurrentDataFalse(); playerData.hasWhiteKey === true || playerData.usedWhiteKey === true ? CurrentDataTrue(section, i) : CurrentDataFalse();
break; break;
case "loveKey": case "loveKey":
playerData.hasLoveKey === true || playerData.openedLoveDoor === true ? CurrentDataTrue() : CurrentDataFalse(); playerData.hasLoveKey === true || playerData.openedLoveDoor === true ? CurrentDataTrue(section, i) : CurrentDataFalse();
break; break;
case "paleOreSeer": case "paleOreSeer":
// #2 // #2
playerData.dreamReward3 === true ? CurrentDataTrue() : CurrentDataFalse(); playerData.dreamReward3 === true ? CurrentDataTrue(section, i) : CurrentDataFalse();
break; break;
/* -------------------- Interactables ------------------------------- */ /* -------------------- Interactables ------------------------------- */
@ -820,7 +819,7 @@ function CheckAdditionalThings(divId, dataObject, playerData, worldData, sceneDa
case "mantisVillageFloorLever": case "mantisVillageFloorLever":
case "pathOfPainEntrance": case "pathOfPainEntrance":
case "whiteLadyRoom": case "whiteLadyRoom":
FindWorldItem(dataObject[i].id, dataObject[i].sceneName) ? CurrentDataTrue() : CurrentDataFalse(); FindWorldItem(dataObject[i].id, dataObject[i].sceneName) ? CurrentDataTrue(section, i) : CurrentDataFalse();
break; break;
case "relicsWandererJournal": case "relicsWandererJournal":
@ -828,7 +827,7 @@ function CheckAdditionalThings(divId, dataObject, playerData, worldData, sceneDa
case "relicsKingsIdol": case "relicsKingsIdol":
case "relicsArcaneEgg": case "relicsArcaneEgg":
total = playerData[dataObject[i].nameHeld] + playerData[dataObject[i].nameSold]; total = playerData[dataObject[i].nameHeld] + playerData[dataObject[i].nameSold];
total >= dataObject[i].max ? CurrentDataTrue() : CurrentDataBlank(); total >= dataObject[i].max ? CurrentDataTrue(section, i) : CurrentDataBlank();
textPrefix += ": " + total; textPrefix += ": " + total;
break; break;
@ -837,7 +836,7 @@ function CheckAdditionalThings(divId, dataObject, playerData, worldData, sceneDa
CurrentDataBlank(); CurrentDataBlank();
textPrefix = "<del>".concat(textPrefix, "</del>"); textPrefix = "<del>".concat(textPrefix, "</del>");
} else { } else {
playerData[i].completed === true ? CurrentDataTrue() : CurrentDataFalse(); playerData[i].completed === true ? CurrentDataTrue(section, i) : CurrentDataFalse();
} }
break; break;
@ -849,11 +848,11 @@ function CheckAdditionalThings(divId, dataObject, playerData, worldData, sceneDa
break; break;
} }
playerData[i] == 0 ? CurrentDataTrue() : CurrentDataFalse(); playerData[i] == 0 ? CurrentDataTrue(section, i) : CurrentDataFalse();
break; break;
case "killsBigBuzzer": case "killsBigBuzzer":
playerData[i] == 0 ? CurrentDataTrue() : CurrentDataFalse(); playerData[i] == 0 ? CurrentDataTrue(section, i) : CurrentDataFalse();
break; break;
case "killedVoidIdol_1": case "killedVoidIdol_1":
@ -863,8 +862,8 @@ function CheckAdditionalThings(divId, dataObject, playerData, worldData, sceneDa
break; break;
} }
playerData[i] === true ? CurrentDataTrue() : CurrentDataFalse(); playerData[i] === true ? CurrentDataTrue(section, i) : CurrentDataFalse();
if (playerData[i] === false && (playerData.killedVoidIdol_2 === true || playerData.killedVoidIdol_3 === true)) CurrentDataTrue(); if (playerData[i] === false && (playerData.killedVoidIdol_2 === true || playerData.killedVoidIdol_3 === true)) CurrentDataTrue(section, i);
break; break;
case "killedVoidIdol_2": case "killedVoidIdol_2":
@ -874,8 +873,8 @@ function CheckAdditionalThings(divId, dataObject, playerData, worldData, sceneDa
break; break;
} }
playerData[i] === true ? CurrentDataTrue() : CurrentDataFalse(); playerData[i] === true ? CurrentDataTrue(section, i) : CurrentDataFalse();
if (playerData[i] === false && playerData.killedVoidIdol_3 === true) CurrentDataTrue(); if (playerData[i] === false && playerData.killedVoidIdol_3 === true) CurrentDataTrue(section, i);
break; break;
case "greyPrinceDefeated": case "greyPrinceDefeated":
@ -888,7 +887,7 @@ function CheckAdditionalThings(divId, dataObject, playerData, worldData, sceneDa
textPrefix = "<del>".concat(textPrefix, "</del>"); textPrefix = "<del>".concat(textPrefix, "</del>");
} }
playerData[i] === true ? CurrentDataTrue() : CurrentDataBlank(); playerData[i] === true ? CurrentDataTrue(section, i) : CurrentDataBlank();
if (playerData.zoteRescuedBuzzer === true && playerData[i] === false) CurrentDataFalse(); if (playerData.zoteRescuedBuzzer === true && playerData[i] === false) CurrentDataFalse();
break; break;
@ -898,11 +897,11 @@ function CheckAdditionalThings(divId, dataObject, playerData, worldData, sceneDa
if (playerData.zoteDead === true) { if (playerData.zoteDead === true) {
textPrefix = dataObject[i].nameNeglect; textPrefix = dataObject[i].nameNeglect;
textSuffix = dataObject[i].spoilerNeglect; textSuffix = dataObject[i].spoilerNeglect;
CurrentDataTrue(); CurrentDataTrue(section, i);
} else if (playerData.killedZote === true) { } else if (playerData.killedZote === true) {
textPrefix = dataObject[i].nameRivalry; textPrefix = dataObject[i].nameRivalry;
textSuffix = dataObject[i].spoilerRivalry; textSuffix = dataObject[i].spoilerRivalry;
CurrentDataTrue(); CurrentDataTrue(section, i);
} else if (playerData.zoteRescuedBuzzer === false) { } else if (playerData.zoteRescuedBuzzer === false) {
if (playerData.hasWalljump === false) { if (playerData.hasWalljump === false) {
textPrefix = dataObject[i].nameTrappedVengefly; textPrefix = dataObject[i].nameTrappedVengefly;
@ -931,11 +930,11 @@ function CheckAdditionalThings(divId, dataObject, playerData, worldData, sceneDa
if (playerData.nailsmithKilled === true) { if (playerData.nailsmithKilled === true) {
textPrefix = dataObject[i].namePurity; textPrefix = dataObject[i].namePurity;
textSuffix = dataObject[i].spoilerPurity; textSuffix = dataObject[i].spoilerPurity;
CurrentDataTrue(); CurrentDataTrue(section, i);
} else if (playerData.nailsmithConvoArt === true) { } else if (playerData.nailsmithConvoArt === true) {
textPrefix = dataObject[i].nameHappyCouple; textPrefix = dataObject[i].nameHappyCouple;
textSuffix = dataObject[i].spoilerHappyCouple; textSuffix = dataObject[i].spoilerHappyCouple;
CurrentDataTrue(); CurrentDataTrue(section, i);
} else if (playerData.nailsmithSpared === true) { } else if (playerData.nailsmithSpared === true) {
textPrefix = dataObject[i].nameSheoHutWaiting; textPrefix = dataObject[i].nameSheoHutWaiting;
textSuffix = dataObject[i].spoilerSheoHutWaiting; textSuffix = dataObject[i].spoilerSheoHutWaiting;
@ -947,7 +946,7 @@ function CheckAdditionalThings(divId, dataObject, playerData, worldData, sceneDa
break; break;
case "mrMushroomState": case "mrMushroomState":
sFillText += CheckMrMushroomState(divId, dataObject[i], playerData[i]); sFillText += CheckMrMushroomState(section, dataObject[i], playerData[i]);
break; break;
default: default:
@ -957,7 +956,7 @@ function CheckAdditionalThings(divId, dataObject, playerData, worldData, sceneDa
textPrefix = "<del>".concat(dataObject[i].name, "</del>"); textPrefix = "<del>".concat(dataObject[i].name, "</del>");
break; break;
} else if (playerData[i] === true) { } else if (playerData[i] === true) {
CurrentDataTrue(); CurrentDataTrue(section, i);
} else { } else {
CurrentDataFalse(); CurrentDataFalse();
} }
@ -966,9 +965,9 @@ function CheckAdditionalThings(divId, dataObject, playerData, worldData, sceneDa
if (i === "mrMushroomState") continue; if (i === "mrMushroomState") continue;
sFillText += PrepareHTMLString(divId, textPrefix, textSuffix, wiki); sFillText += PrepareHTMLString(section, textPrefix, textSuffix, wiki);
} // end for (let i in dataObject) } // end for (let i in dataObject)
// AppendHTML(divId, sFillText); // AppendHTML(section, sFillText);
// ========================================== // ==========================================
// -------------- Methods ---------------- // // -------------- Methods ---------------- //
@ -1129,7 +1128,7 @@ function CheckAdditionalThings(divId, dataObject, playerData, worldData, sceneDa
} // Filtering the reference database Grub list to include only the missing values } // Filtering the reference database Grub list to include only the missing values
var missingGrubsList = divId.grubsList.filter(function (x) { var missingGrubsList = section.grubsList.filter(function (x) {
return !rescuedGrubsSceneList.includes(x); return !rescuedGrubsSceneList.includes(x);
}); });
var length = missingGrubsList.length; var length = missingGrubsList.length;
@ -1140,7 +1139,7 @@ function CheckAdditionalThings(divId, dataObject, playerData, worldData, sceneDa
console.groupCollapsed("%cUnrescued Grubs (".concat(length, "):"), "color: #16c60c; font-weight: 700;"); console.groupCollapsed("%cUnrescued Grubs (".concat(length, "):"), "color: #16c60c; font-weight: 700;");
for (var _i15 = 0; _i15 < length; _i15++) { for (var _i15 = 0; _i15 < length; _i15++) {
console.log("#".concat(divId.grubsList.indexOf(missingGrubsList[_i15]) + 1, " \uD83D\uDDFA\uFE0F ").concat((0,_hk_functions_js__WEBPACK_IMPORTED_MODULE_2__.TranslateMapName)(missingGrubsList[_i15]), " \u2328\uFE0F ").concat(missingGrubsList[_i15])); console.log("#".concat(section.grubsList.indexOf(missingGrubsList[_i15]) + 1, " \uD83D\uDDFA\uFE0F ").concat((0,_hk_functions_js__WEBPACK_IMPORTED_MODULE_2__.TranslateMapName)(missingGrubsList[_i15]), " \u2328\uFE0F ").concat(missingGrubsList[_i15]));
} }
console.groupEnd(); console.groupEnd();
@ -1151,26 +1150,26 @@ function CheckAdditionalThings(divId, dataObject, playerData, worldData, sceneDa
} }
/** /**
* Checks and fills all the 7 locations of Mr Mushroom. * Checks and fills all the 7 locations of Mr Mushroom.
* @param {object} divId ID of the HTML element for data appending * @param {object} section ID of the HTML element for data appending
* @param {object} dataObject object containing the Mr Mushroom name and spoilers/locations * @param {object} dataObject object containing the Mr Mushroom name and spoilers/locations
* @param {number} mrMushroomState playerData.mrMushroomState read from the save file. (0-8) * @param {number} mrMushroomState playerData.mrMushroomState read from the save file. (0-8)
*/ */
function CheckMrMushroomState(divId, dataObject) { function CheckMrMushroomState(section, dataObject) {
var mrMushroomState = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0; var mrMushroomState = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
var sFillText = ""; var sFillText = "";
if (mrMushroomState > 1) { if (mrMushroomState > 1) {
for (var i = 1; i <= 7; i++) { for (var i = 1; i <= 7; i++) {
mrMushroomState > i ? CurrentDataTrue() : CurrentDataFalse(); mrMushroomState > i ? CurrentDataTrue(section, "mrMushroomState") : CurrentDataFalse();
sFillText += PrepareHTMLString(divId, "".concat(dataObject.name, " #").concat(i), dataObject["spoiler" + i], dataObject.wiki); sFillText += PrepareHTMLString(section, "".concat(dataObject.name, " #").concat(i), dataObject["spoiler" + i], dataObject.wiki);
} }
} else { } else {
CurrentDataFalse(); CurrentDataFalse();
for (var _i16 = 1; _i16 <= 7; _i16++) { for (var _i16 = 1; _i16 <= 7; _i16++) {
sFillText += PrepareHTMLString(divId, "".concat(dataObject.name, " #").concat(_i16), dataObject["spoiler" + _i16], dataObject.wiki); sFillText += PrepareHTMLString(section, "".concat(dataObject.name, " #").concat(_i16), dataObject["spoiler" + _i16], dataObject.wiki);
} }
} }
@ -1178,7 +1177,7 @@ function CheckMrMushroomState(divId, dataObject) {
} }
/** /**
* Checks, validates and shows hints to the player depending on their save progression, in chronological order. Shows only hint for the last uncompleted event. If Hollow Knight is defeated, shows a dummy text. * Checks, validates and shows hints to the player depending on their save progression, in chronological order. Shows only hint for the last uncompleted event. If Hollow Knight is defeated, shows a dummy text.
* @param {object} divId object containing div hints ID and h2 title * @param {object} section object containing div hints ID and h2 title
* @param {object} dataObject object containing all hints data * @param {object} dataObject object containing all hints data
* @param {object} playerData object containing HK Player Data to look in * @param {object} playerData object containing HK Player Data to look in
* @param {object} worldData object containing HK World Data to look in * @param {object} worldData object containing HK World Data to look in
@ -1186,13 +1185,13 @@ function CheckMrMushroomState(divId, dataObject) {
*/ */
function CheckHintsTrue(divId, dataObject, playerData, worldData) { function CheckHintsTrue(section, dataObject, playerData, worldData) {
var sFillText = ""; var sFillText = "";
if (playerData.killedHollowKnight === true) { if (playerData.killedHollowKnight === true) {
// a text to show when player already finished their first playthrough (killed Hollow Knight first time) // a text to show when player already finished their first playthrough (killed Hollow Knight first time)
/* AppendHTML(divId, "...a successful Knight who doesn't need hints anymore. The Knight explores the world of Hallownest patiently in constant search of its remaining secrets..."); */ /* AppendHTML(section, "...a successful Knight who doesn't need hints anymore. The Knight explores the world of Hallownest patiently in constant search of its remaining secrets..."); */
return true; return true;
} }
@ -1203,7 +1202,7 @@ function CheckHintsTrue(divId, dataObject, playerData, worldData) {
if (playerData[i] >= 1) { if (playerData[i] >= 1) {
continue; continue;
} else { } else {
sFillText += PrepareHTMLString(divId, "", dataObject[i].spoiler); sFillText += PrepareHTMLString(section, "", dataObject[i].spoiler);
break; break;
} }
} else if (i === "Crossroads_04") { } else if (i === "Crossroads_04") {
@ -1219,7 +1218,7 @@ function CheckHintsTrue(divId, dataObject, playerData, worldData) {
if (GruzMotherDefeated) { if (GruzMotherDefeated) {
continue; // next dataObject (i) continue; // next dataObject (i)
} else { } else {
sFillText += PrepareHTMLString(divId, "", dataObject[i].spoiler); sFillText += PrepareHTMLString(section, "", dataObject[i].spoiler);
break; break;
} }
} else if (i === "dungDefenderOrHornet2") { } else if (i === "dungDefenderOrHornet2") {
@ -1229,7 +1228,7 @@ function CheckHintsTrue(divId, dataObject, playerData, worldData) {
continue; continue;
} else { } else {
// if no Dung Defender or Hornet 2 // if no Dung Defender or Hornet 2
sFillText += PrepareHTMLString(divId, "", dataObject[i].spoiler); sFillText += PrepareHTMLString(section, "", dataObject[i].spoiler);
break; break;
} }
} else if (i === "ismaTearOrShadeCloak") { } else if (i === "ismaTearOrShadeCloak") {
@ -1240,21 +1239,21 @@ function CheckHintsTrue(divId, dataObject, playerData, worldData) {
continue; continue;
} else { } else {
// if Kings Brand but no Shade Cloak // if Kings Brand but no Shade Cloak
sFillText += PrepareHTMLString(divId, "", dataObject[i].spoiler); sFillText += PrepareHTMLString(section, "", dataObject[i].spoiler);
break; break;
} }
} else { } else {
// if no Isma's Tear or Kings Brand // if no Isma's Tear or Kings Brand
sFillText += PrepareHTMLString(divId, "", dataObject[i].spoiler); sFillText += PrepareHTMLString(section, "", dataObject[i].spoiler);
break; break;
} }
} else { } else {
// if anything from the hints list is not done // if anything from the hints list is not done
sFillText += PrepareHTMLString(divId, "", dataObject[i].spoiler); sFillText += PrepareHTMLString(section, "", dataObject[i].spoiler);
break; break;
} }
} // end: for (let i in dataObject) } // end: for (let i in dataObject)
// AppendHTML(divId, sFillText); // AppendHTML(section, sFillText);
} // function CheckHintsTrue() } // function CheckHintsTrue()
@ -4884,7 +4883,7 @@ function GenerateInnerHTML(db) {
textFill = SectionStart(sections[section]); textFill = SectionStart(sections[section]);
/* creates a <h2> tag for the current section and fills with current%/max% /* creates a <h2> tag for the current section and fills with current%/max%
If the save file was not analyzed, then fill only max% on blue background*/ If the save file was not analyzed, then fill only max% on blue background */
if (db.saveAnalyzed === true) { if (db.saveAnalyzed === true) {
textFill += CompletionFill(sections[section]); textFill += CompletionFill(sections[section]);

File diff suppressed because one or more lines are too long

View file

@ -249,11 +249,11 @@ function HKCheckCompletion(jsonObject) {
/** /**
* Generates and appends a new entry inside the HTML of a given ID * Generates and appends a new entry inside the HTML of a given ID
* @param {object} divId object containing div ID and h2 title of the HTML element * @param {object} section object containing div ID and h2 title of the HTML element
* @param {string} textPrefix Main name of the entry * @param {string} textPrefix Main name of the entry
* @param {string} textSuffix Optional suffix after the main name (spoilers: locations, costs etc.) * @param {string} textSuffix Optional suffix after the main name (spoilers: locations, costs etc.)
*/ */
function PrepareHTMLString(divId, textPrefix = "Unknown Completion Element: ", textSuffix = "Unknown Description Element", wiki = "") { function PrepareHTMLString(section, textPrefix = "Unknown Completion Element: ", textSuffix = "Unknown Description Element", wiki = "") {
let icon = completionSymbol; let icon = completionSymbol;
let b = ["<b>", "</b>"]; let b = ["<b>", "</b>"];
@ -262,7 +262,7 @@ function PrepareHTMLString(divId, textPrefix = "Unknown Completion Element: ", t
let span = ["<span class='spoiler-span'>", "</span>"]; let span = ["<span class='spoiler-span'>", "</span>"];
let spoilerSpan = ["<span class='spoiler-text'>", "</span>"]; let spoilerSpan = ["<span class='spoiler-text'>", "</span>"];
if (divId.id === "hk-hints") { if (section.id === "hk-hints") {
span[0] = "<span>"; span[0] = "<span>";
icon = ""; icon = "";
} }
@ -282,12 +282,12 @@ function PrepareHTMLString(divId, textPrefix = "Unknown Completion Element: ", t
/** /**
* Switches global variable to a "completed" symbol. Adds +1 or +2 to percent property. * Switches global variable to a "completed" symbol. Adds +1 or +2 to percent property.
*/ */
function CurrentDataTrue(divId = "") { function CurrentDataTrue(section = {}, entry = "") {
completionSymbol = SYMBOL_TRUE;
if (divId) { section.percent++;
divId.percent++; if (section.id === "hk-equipment") section.percent++; // double % for equipment
if (divId.id === "hk-equipment") divId.percent++; // double % for equipment
} section.entries[entry].icon = "green";
} }
/** /**
@ -313,75 +313,75 @@ function CurrentDataBlank() {
/** /**
* Fills HTML with the playTime value of the save file * Fills HTML with the playTime value of the save file
* @param {object} divId ID of the HTML element for data appending * @param {object} section ID of the HTML element for data appending
* @param {number} playTime Number of total gameplay time in seconds * @param {number} playTime Number of total gameplay time in seconds
*/ */
function CheckPlayTime(divId, playTime) { function CheckPlayTime(section, playTime) {
let seconds = Math.floor(playTime); let seconds = Math.floor(playTime);
let minutes = Math.floor((seconds / 60) % 60); let minutes = Math.floor((seconds / 60) % 60);
let hours = Math.floor(seconds / 3600); let hours = Math.floor(seconds / 3600);
let sec = Math.floor(seconds % 60); let sec = Math.floor(seconds % 60);
divId.entries.timePlayed.timeH = hours; section.entries.timePlayed.timeH = hours;
divId.entries.timePlayed.timeM = minutes; section.entries.timePlayed.timeM = minutes;
divId.entries.timePlayed.timeS = sec; section.entries.timePlayed.timeS = sec;
if (sec < 10) sec = "0" + sec; if (sec < 10) sec = "0" + sec;
if (minutes < 10) minutes = "0" + minutes; if (minutes < 10) minutes = "0" + minutes;
let textFill = "Time Played:" + pSpan + "<b>" + hours + " h " + minutes + " min " + sec + " sec</b>"; let textFill = "Time Played:" + pSpan + "<b>" + hours + " h " + minutes + " min " + sec + " sec</b>";
divId.entries.timePlayed.spoiler = hours + " h " + minutes + " min " + sec + " sec"; section.entries.timePlayed.spoiler = hours + " h " + minutes + " min " + sec + " sec";
// document.getElementById(divId.id).innerHTML += divStart + SYMBOL_CLOCK + textFill + divEnd; // document.getElementById(section.id).innerHTML += divStart + SYMBOL_CLOCK + textFill + divEnd;
} }
/** /**
* Searches for completionPercentage in playerData and fills HTML with the value of the save file * Searches for completionPercentage in playerData and fills HTML with the value of the save file
* @param {object} divId ID of the HTML element for data appending * @param {object} section ID of the HTML element for data appending
* @param {number} completionPercentage Number of completion percentage * @param {number} completionPercentage Number of completion percentage
*/ */
function CheckCompletionPercent(divId, completionPercentage) { function CheckCompletionPercent(section, completionPercentage) {
(completionPercentage >= 112) ? CurrentDataTrue(): CurrentDataFalse(); /* (completionPercentage >= 112) ? CurrentDataTrue(): CurrentDataFalse(); */
divId.percent = completionPercentage; section.percent = completionPercentage;
divId.entries.gameCompletion.spoiler = completionPercentage; section.entries.gameCompletion.spoiler = completionPercentage;
let textFill = "Game Completion:" + pSpan + "<b>" + completionPercentage + " %</b>" + pSpan + "(out of " + divId.maxPercent + " %)"; let textFill = "Game Completion:" + pSpan + "<b>" + completionPercentage + " %</b>" + pSpan + "(out of " + section.maxPercent + " %)";
// document.getElementById(divId.id).innerHTML += divStart + completionSymbol + textFill + divEnd; // document.getElementById(section.id).innerHTML += divStart + completionSymbol + textFill + divEnd;
} }
/** /**
* Reads the "version" string from the save file and appends it to the selected div ID element * Reads the "version" string from the save file and appends it to the selected div ID element
* @param {object} divId ID of the HTML element for data appending * @param {object} section ID of the HTML element for data appending
* @param {string} saveVersion Save File version in format 0.0.0.0 * @param {string} saveVersion Save File version in format 0.0.0.0
*/ */
function CheckSaveFileVersion(divId, saveVersion = HK.sections.intro.entries.saveVersion.spoiler) { function CheckSaveFileVersion(section, saveVersion = HK.sections.intro.entries.saveVersion.spoiler) {
CurrentDataBlank(); CurrentDataBlank();
divId.entries.saveVersion.spoiler = `${saveVersion}`; section.entries.saveVersion.spoiler = `${saveVersion}`;
let textFill = `Save Version:${pSpan}<b>${saveVersion}</b>${pSpan}`; let textFill = `Save Version:${pSpan}<b>${saveVersion}</b>${pSpan}`;
// document.getElementById(divId.id).innerHTML += divStart + completionSymbol + textFill + divEnd; // document.getElementById(section.id).innerHTML += divStart + completionSymbol + textFill + divEnd;
} }
/** /**
* Fills HTML with appropriate number of health mask images * Fills HTML with appropriate number of health mask images
* @param {object} divId ID of the HTML element for data appending * @param {object} section ID of the HTML element for data appending
* @param {number} masks Number of max health masks from the save (baseline without charms and lifeblood) * @param {number} masks Number of max health masks from the save (baseline without charms and lifeblood)
* @param {number} permadeathMode Value of permadeathMode property. 0 = Normal, 1 = Steel Soul, 2 = Steel Soul broken save * @param {number} permadeathMode Value of permadeathMode property. 0 = Normal, 1 = Steel Soul, 2 = Steel Soul broken save
*/ */
function CheckHealthMasks(divId, masks = 5, permadeathMode = 0) { function CheckHealthMasks(section, masks = 5, permadeathMode = 0) {
divId.entries.health.masks = masks; section.entries.health.masks = masks;
if (permadeathMode > 0) { if (permadeathMode > 0) {
divId.entries.health.permadeathMode = true; section.entries.health.permadeathMode = true;
} else { } else {
divId.entries.health.permadeathMode = false; section.entries.health.permadeathMode = false;
} }
/* let icon = SYMBOL_EMPTY; /* let icon = SYMBOL_EMPTY;
@ -397,15 +397,15 @@ function CheckHealthMasks(divId, masks = 5, permadeathMode = 0) {
maskImages += maskImg; maskImages += maskImg;
} */ } */
// document.getElementById(divId.id).innerHTML += divStartCenter + icon + textFill + maskImages + divEnd; // document.getElementById(section.id).innerHTML += divStartCenter + icon + textFill + maskImages + divEnd;
} }
/** /**
* Fills HTML with appropriate number of soul orbs images * Fills HTML with appropriate number of soul orbs images
* @param {object} divId ID of the HTML element for data appending * @param {object} section ID of the HTML element for data appending
* @param {number} totalSoul Number of max Soul reserve from the save. 99 = full Soul Orb * @param {number} totalSoul Number of max Soul reserve from the save. 99 = full Soul Orb
*/ */
function CheckSoulOrbs(divId, totalSoul) { function CheckSoulOrbs(section, totalSoul) {
let icon = SYMBOL_EMPTY; let icon = SYMBOL_EMPTY;
let textFill = "<span>Soul:</span>"; let textFill = "<span>Soul:</span>";
@ -417,15 +417,15 @@ function CheckSoulOrbs(divId, totalSoul) {
soulImages += soulImg; soulImages += soulImg;
} }
// document.getElementById(divId.id).innerHTML += divStartCenter + icon + textFill + soulImages + divEnd; // document.getElementById(section.id).innerHTML += divStartCenter + icon + textFill + soulImages + divEnd;
} }
/** /**
* Fills HTML with the Geo value of the save file * Fills HTML with the Geo value of the save file
* @param {object} divId ID of the HTML element for data appending * @param {object} section ID of the HTML element for data appending
* @param {number} geoValue Number of total Geo value * @param {number} geoValue Number of total Geo value
*/ */
function CheckGeo(divId, geoValue = 0, geoPoolValue = 0) { function CheckGeo(section, geoValue = 0, geoPoolValue = 0) {
let icon = SYMBOL_EMPTY; let icon = SYMBOL_EMPTY;
let textFill = `<span>Geo:</span><img src='${GEO_IMAGE}' class='geo-symbol' alt='geo symbol image' title='Geo'><b>${geoValue}</b>`; let textFill = `<span>Geo:</span><img src='${GEO_IMAGE}' class='geo-symbol' alt='geo symbol image' title='Geo'><b>${geoValue}</b>`;
@ -437,16 +437,16 @@ function CheckGeo(divId, geoValue = 0, geoPoolValue = 0) {
// Show also total Geo (Geo + Shade Geo) if player has at least 1 geo alongside the shade geo // Show also total Geo (Geo + Shade Geo) if player has at least 1 geo alongside the shade geo
if (geoValue > 0 && geoPoolValue > 0) textFill += `${pSpan}=${pSpan}<b>${geoValue+geoPoolValue}</b>`; if (geoValue > 0 && geoPoolValue > 0) textFill += `${pSpan}=${pSpan}<b>${geoValue+geoPoolValue}</b>`;
// document.getElementById(divId.id).innerHTML += divStartCenter + icon + textFill + divEnd; // document.getElementById(section.id).innerHTML += divStartCenter + icon + textFill + divEnd;
} }
/** /**
* Fills HTML with appropriate number of notch images * Fills HTML with appropriate number of notch images
* @param {object} divId ID of the HTML element for data appending * @param {object} section ID of the HTML element for data appending
* @param {number} totalNotches Number of total Charm Notches the player has. 11 = max * @param {number} totalNotches Number of total Charm Notches the player has. 11 = max
* @param {number} filledNotches Number of total used Charm Notches (including overcharmed notches). 15 = max * @param {number} filledNotches Number of total used Charm Notches (including overcharmed notches). 15 = max
*/ */
function CheckNotches(divId, totalNotches = 3, filledNotches = 0) { function CheckNotches(section, totalNotches = 3, filledNotches = 0) {
let { let {
overcharmedNotches, overcharmedNotches,
@ -493,17 +493,17 @@ function CheckNotches(divId, totalNotches = 3, filledNotches = 0) {
} }
} }
// document.getElementById(divId.id).innerHTML += divStartCenter + icon + textFill + notchImages + divEnd; // document.getElementById(section.id).innerHTML += divStartCenter + icon + textFill + notchImages + divEnd;
} }
/** /**
* Verifies if the data in a specific object is true or false, and appends HTML accordingly. * Verifies if the data in a specific object is true or false, and appends HTML accordingly.
* @param {object} divId ID of the HTML element for data appending * @param {object} section ID of the HTML element for data appending
* @param {object} dataObject Object containing data to be verified (use copy - data inside this object will be deleted) * @param {object} dataObject Object containing data to be verified (use copy - data inside this object will be deleted)
* @param {object} playerData Reference/pointer to specific data where to search (playerData) * @param {object} playerData Reference/pointer to specific data where to search (playerData)
* @param {Array} worldData Reference/pointer to specific data where to search (sceneData.persistentBoolItems) * @param {Array} worldData Reference/pointer to specific data where to search (sceneData.persistentBoolItems)
*/ */
function CheckIfDataTrue(divId, dataObject, playerData, worldData = []) { function CheckIfDataTrue(section, dataObject, playerData, worldData = []) {
let { let {
textPrefix, textPrefix,
@ -522,7 +522,7 @@ function CheckIfDataTrue(divId, dataObject, playerData, worldData = []) {
switch (i) { switch (i) {
case "gotCharm_36": case "gotCharm_36":
// prevents green checkbox and adding 1% when only got one white fragment // prevents green checkbox and adding 1% when only got one white fragment
(playerData.gotQueenFragment === true && playerData.gotKingFragment === true) ? CurrentDataTrue(divId): CurrentDataFalse(); (playerData.gotQueenFragment === true && playerData.gotKingFragment === true) ? CurrentDataTrue(section, i): CurrentDataFalse();
break; break;
case "gotCharm_37": case "gotCharm_37":
@ -540,10 +540,10 @@ function CheckIfDataTrue(divId, dataObject, playerData, worldData = []) {
break; break;
} }
if (i === "grimmChildLevel") { if (i === "grimmChildLevel") {
(playerData.grimmChildLevel >= 4) ? CurrentDataTrue(divId): CurrentDataFalse(); (playerData.grimmChildLevel >= 4) ? CurrentDataTrue(section, i): CurrentDataFalse();
break; break;
} }
(playerData[i] === true) ? CurrentDataTrue(divId): CurrentDataFalse(); (playerData[i] === true) ? CurrentDataTrue(section, i): CurrentDataFalse();
break; break;
case "bossGruzMother": case "bossGruzMother":
@ -564,7 +564,7 @@ function CheckIfDataTrue(divId, dataObject, playerData, worldData = []) {
case "vesselFragmentCityOfTears": case "vesselFragmentCityOfTears":
case "vesselFragmentDeepnest": case "vesselFragmentDeepnest":
case "vesselFragmentFountain": case "vesselFragmentFountain":
(WorldDataActivated(dataObject[i].id, dataObject[i].sceneName, worldData)) ? CurrentDataTrue(divId): CurrentDataFalse(); (WorldDataActivated(dataObject[i].id, dataObject[i].sceneName, worldData)) ? CurrentDataTrue(section, i): CurrentDataFalse();
break; break;
case "pantheonMaster": case "pantheonMaster":
@ -577,7 +577,7 @@ function CheckIfDataTrue(divId, dataObject, playerData, worldData = []) {
textPrefix = `<del>${textPrefix}</del>`; textPrefix = `<del>${textPrefix}</del>`;
break; break;
} else if (checkText === "PantheonCompleted") { } else if (checkText === "PantheonCompleted") {
CurrentDataTrue(divId); CurrentDataTrue(section, i);
break; break;
} else { } else {
CurrentDataFalse(); CurrentDataFalse();
@ -585,22 +585,22 @@ function CheckIfDataTrue(divId, dataObject, playerData, worldData = []) {
break; break;
default: default:
(playerData[i] === true) ? CurrentDataTrue(divId): CurrentDataFalse(); (playerData[i] === true) ? CurrentDataTrue(section, i): CurrentDataFalse();
} }
sFillText += PrepareHTMLString(divId, textPrefix, textSuffix, wiki); sFillText += PrepareHTMLString(section, textPrefix, textSuffix, wiki);
} }
// AppendHTML(divId, sFillText); // AppendHTML(section, sFillText);
} }
/** /**
* Verifies if the data in a specific object is 0 or > 0, and appends HTML accordingly. * Verifies if the data in a specific object is 0 or > 0, and appends HTML accordingly.
* @param {object} divId ID of the HTML element for data appending * @param {object} section ID of the HTML element for data appending
* @param {object} dataObject Object containing data to be verified (use copy - data inside this object will be deleted) * @param {object} dataObject Object containing data to be verified (use copy - data inside this object will be deleted)
* @param {object} playerData Reference/pointer to specific data where to search * @param {object} playerData Reference/pointer to specific data where to search
*/ */
function CheckSpellLevel(divId, dataObject, playerData) { function CheckSpellLevel(section, dataObject, playerData) {
let sFillText = ""; let sFillText = "";
@ -608,43 +608,43 @@ function CheckSpellLevel(divId, dataObject, playerData) {
switch (i) { switch (i) {
case "vengefulSpirit": case "vengefulSpirit":
case "shadeSoul": case "shadeSoul":
(playerData.fireballLevel >= dataObject[i].fireballLevel) ? CurrentDataTrue(divId): CurrentDataFalse(); (playerData.fireballLevel >= dataObject[i].fireballLevel) ? CurrentDataTrue(section, i): CurrentDataFalse();
sFillText += PrepareHTMLString(divId, dataObject[i].name, dataObject[i].spoiler, dataObject[i].wiki); sFillText += PrepareHTMLString(section, dataObject[i].name, dataObject[i].spoiler, dataObject[i].wiki);
break; break;
case "desolateDive": case "desolateDive":
case "descendingDark": case "descendingDark":
(playerData.quakeLevel >= dataObject[i].quakeLevel) ? CurrentDataTrue(divId): CurrentDataFalse(); (playerData.quakeLevel >= dataObject[i].quakeLevel) ? CurrentDataTrue(section, i): CurrentDataFalse();
sFillText += PrepareHTMLString(divId, dataObject[i].name, dataObject[i].spoiler, dataObject[i].wiki); sFillText += PrepareHTMLString(section, dataObject[i].name, dataObject[i].spoiler, dataObject[i].wiki);
break; break;
case "howlingWraiths": case "howlingWraiths":
case "abyssShriek": case "abyssShriek":
(playerData.screamLevel >= dataObject[i].screamLevel) ? CurrentDataTrue(divId): CurrentDataFalse(); (playerData.screamLevel >= dataObject[i].screamLevel) ? CurrentDataTrue(section, i): CurrentDataFalse();
sFillText += PrepareHTMLString(divId, dataObject[i].name, dataObject[i].spoiler, dataObject[i].wiki); sFillText += PrepareHTMLString(section, dataObject[i].name, dataObject[i].spoiler, dataObject[i].wiki);
break; break;
default: default:
break; break;
} }
} }
// AppendHTML(divId, sFillText); // AppendHTML(section, sFillText);
} }
/** /**
* Verifies if the data in a specific object is 0 or > 0, and appends HTML accordingly. * Verifies if the data in a specific object is 0 or > 0, and appends HTML accordingly.
* @param {object} divId ID of the HTML element for data appending * @param {object} section ID of the HTML element for data appending
* @param {object} dataObject Object containing data to be verified * @param {object} dataObject Object containing data to be verified
* @param {object} playerData Reference/pointer to specific data where to search * @param {object} playerData Reference/pointer to specific data where to search
*/ */
function CheckWarriorDreams(divId, dataObject, playerData) { function CheckWarriorDreams(section, dataObject, playerData) {
let sFillText = ""; let sFillText = "";
for (let i in dataObject) { for (let i in dataObject) {
(playerData[i] >= 2) ? CurrentDataTrue(divId): CurrentDataFalse(); (playerData[i] >= 2) ? CurrentDataTrue(section, i): CurrentDataFalse();
sFillText += PrepareHTMLString(divId, dataObject[i].name, dataObject[i].spoiler, dataObject[i].wiki); sFillText += PrepareHTMLString(section, dataObject[i].name, dataObject[i].spoiler, dataObject[i].wiki);
} }
// AppendHTML(divId, sFillText); // AppendHTML(section, sFillText);
} }
/** /**
@ -665,11 +665,11 @@ function CheckGodmasterDoors(dataObject, playerData) {
/** /**
* Verifies the level of player's nail upgrades, and appends HTML accordingly. * Verifies the level of player's nail upgrades, and appends HTML accordingly.
* @param {object} divId ID of the HTML element for data appending * @param {object} section ID of the HTML element for data appending
* @param {object} dataObject Object containing nail upgrades data to be verified * @param {object} dataObject Object containing nail upgrades data to be verified
* @param {object} playerData Reference/pointer to specific data where to search in the save file * @param {object} playerData Reference/pointer to specific data where to search in the save file
*/ */
function CheckNailUpgrades(divId, dataObject, playerData) { function CheckNailUpgrades(section, dataObject, playerData) {
// appends "Nail" to every array element // appends "Nail" to every array element
// same as names in the database object // same as names in the database object
@ -678,12 +678,12 @@ function CheckNailUpgrades(divId, dataObject, playerData) {
let sFillText = ""; let sFillText = "";
for (let i = 0; i < 5; i++) { for (let i = 0; i < 5; i++) {
(playerData.nailSmithUpgrades >= i) ? CurrentDataTrue(divId): CurrentDataFalse(); (playerData.nailSmithUpgrades >= i) ? CurrentDataTrue(section, nail[i]): CurrentDataFalse();
sFillText += PrepareHTMLString(divId, dataObject[nail[i]].name, dataObject[nail[i]].spoiler, dataObject[nail[i]].wiki); sFillText += PrepareHTMLString(section, dataObject[nail[i]].name, dataObject[nail[i]].spoiler, dataObject[nail[i]].wiki);
} }
if (divId.percent) divId.percent--; // subject one for the Old Nail if (section.percent) section.percent--; // subject one for the Old Nail
// AppendHTML(divId, sFillText); // AppendHTML(section, sFillText);
} }
/** /**
@ -707,12 +707,12 @@ function WorldDataActivated(idText, sceneNameText, worldData) {
/** /**
* Verifies if the data in a specific object are true or false, and appends HTML accordingly. Creates a copy of dataObject. * Verifies if the data in a specific object are true or false, and appends HTML accordingly. Creates a copy of dataObject.
* @param {object} divId ID of the HTML element for data appending * @param {object} section ID of the HTML element for data appending
* @param {string} idText Text string inside save data to search for * @param {string} idText Text string inside save data to search for
* @param {object} dataObject Object containing data to be verified * @param {object} dataObject Object containing data to be verified
* @param {object} worldData Reference/pointer to specific data where to search * @param {object} worldData Reference/pointer to specific data where to search
*/ */
function CheckWorldDataTrue(divId, idText, dataObject, worldData) { function CheckWorldDataTrue(section, idText, dataObject, worldData) {
let orderedArray = []; let orderedArray = [];
let size = ObjectLength(dataObject); let size = ObjectLength(dataObject);
let sFillText = ""; let sFillText = "";
@ -734,22 +734,22 @@ function CheckWorldDataTrue(divId, idText, dataObject, worldData) {
// Display the items as they were initially ordered // Display the items as they were initially ordered
for (let i = 0; i < size; i++) { for (let i = 0; i < size; i++) {
CurrentDataFalse(); CurrentDataFalse();
if (orderedArray[i][4] === true) CurrentDataTrue(divId); if (orderedArray[i][4] === true) CurrentDataTrue(section);
sFillText += PrepareHTMLString(divId, orderedArray[i][1], orderedArray[i][2], orderedArray[i][3]); sFillText += PrepareHTMLString(section, orderedArray[i][1], orderedArray[i][2], orderedArray[i][3]);
} }
// AppendHTML(divId, sFillText); // AppendHTML(section, sFillText);
} }
/** /**
* Verifies if the data in a specific object are true or false, or checks what values they have, and appends HTML accordingly. * Verifies if the data in a specific object are true or false, or checks what values they have, and appends HTML accordingly.
* @param {object} divId ID of the HTML element for data appending * @param {object} section ID of the HTML element for data appending
* @param {object} dataObject Object containing data to be verified * @param {object} dataObject Object containing data to be verified
* @param {object} playerData Reference/pointer to specific data where to search (playerData) * @param {object} playerData Reference/pointer to specific data where to search (playerData)
* @param {object} worldData Reference/pointer to specific data where to search (sceneData.persistentBoolItems) * @param {object} worldData Reference/pointer to specific data where to search (sceneData.persistentBoolItems)
* @param {object} sceneData Reference/pointer to specific data where to search (sceneData) * @param {object} sceneData Reference/pointer to specific data where to search (sceneData)
*/ */
function CheckAdditionalThings(divId, dataObject, playerData, worldData, sceneData) { function CheckAdditionalThings(section, dataObject, playerData, worldData, sceneData) {
let { let {
textPrefix, textPrefix,
@ -835,7 +835,7 @@ function CheckAdditionalThings(divId, dataObject, playerData, worldData, sceneDa
break; break;
} }
} }
(amount >= dataObject[i].max) ? CurrentDataTrue(): CurrentDataBlank(); (amount >= dataObject[i].max) ? CurrentDataTrue(section, i): CurrentDataBlank();
break; break;
case "geoPool": case "geoPool":
@ -843,7 +843,7 @@ function CheckAdditionalThings(divId, dataObject, playerData, worldData, sceneDa
case "jinnEggsSold": case "jinnEggsSold":
case "xunFlowerBrokeTimes": case "xunFlowerBrokeTimes":
textPrefix += ": " + Math.abs(playerData[i]); textPrefix += ": " + Math.abs(playerData[i]);
(i === "geoPool" && playerData[i] > 0) ? CurrentDataBlank(): CurrentDataTrue(); (i === "geoPool" && playerData[i] > 0) ? CurrentDataBlank(): CurrentDataTrue(section, i);
if (i === "jinnEggsSold") { if (i === "jinnEggsSold") {
// fade out if not on Steel Soul // fade out if not on Steel Soul
@ -863,7 +863,7 @@ function CheckAdditionalThings(divId, dataObject, playerData, worldData, sceneDa
activated = CountGeoRocks(discoveredTotal, "broken"); activated = CountGeoRocks(discoveredTotal, "broken");
textPrefix += `: ${notActivated} | ${activated} | ${discoveredTotal}`; textPrefix += `: ${notActivated} | ${activated} | ${discoveredTotal}`;
CurrentDataTrue(); CurrentDataTrue(section, i);
break; break;
case "itemsDiscovered": case "itemsDiscovered":
@ -873,23 +873,23 @@ function CheckAdditionalThings(divId, dataObject, playerData, worldData, sceneDa
activated = CountItems(discoveredTotal, "active"); activated = CountItems(discoveredTotal, "active");
textPrefix += `: ${notActivated} | ${activated} | ${discoveredTotal}`; textPrefix += `: ${notActivated} | ${activated} | ${discoveredTotal}`;
CurrentDataTrue(); CurrentDataTrue(section, i);
break; break;
case "shopkeeperKey": case "shopkeeperKey":
(playerData.hasSlykey === true || playerData.gaveSlykey === true) ? CurrentDataTrue(): CurrentDataFalse(); (playerData.hasSlykey === true || playerData.gaveSlykey === true) ? CurrentDataTrue(section, i): CurrentDataFalse();
break; break;
case "elegantKey": case "elegantKey":
(playerData.hasWhiteKey === true || playerData.usedWhiteKey === true) ? CurrentDataTrue(): CurrentDataFalse(); (playerData.hasWhiteKey === true || playerData.usedWhiteKey === true) ? CurrentDataTrue(section, i): CurrentDataFalse();
break; break;
case "loveKey": case "loveKey":
(playerData.hasLoveKey === true || playerData.openedLoveDoor === true) ? CurrentDataTrue(): CurrentDataFalse(); (playerData.hasLoveKey === true || playerData.openedLoveDoor === true) ? CurrentDataTrue(section, i): CurrentDataFalse();
break; break;
case "paleOreSeer": // #2 case "paleOreSeer": // #2
(playerData.dreamReward3 === true) ? CurrentDataTrue(): CurrentDataFalse(); (playerData.dreamReward3 === true) ? CurrentDataTrue(section, i): CurrentDataFalse();
break; break;
/* -------------------- Interactables ------------------------------- */ /* -------------------- Interactables ------------------------------- */
@ -906,7 +906,7 @@ function CheckAdditionalThings(divId, dataObject, playerData, worldData, sceneDa
case "mantisVillageFloorLever": case "mantisVillageFloorLever":
case "pathOfPainEntrance": case "pathOfPainEntrance":
case "whiteLadyRoom": case "whiteLadyRoom":
(FindWorldItem(dataObject[i].id, dataObject[i].sceneName)) ? CurrentDataTrue(): CurrentDataFalse(); (FindWorldItem(dataObject[i].id, dataObject[i].sceneName)) ? CurrentDataTrue(section, i): CurrentDataFalse();
break; break;
case "relicsWandererJournal": case "relicsWandererJournal":
@ -914,7 +914,7 @@ function CheckAdditionalThings(divId, dataObject, playerData, worldData, sceneDa
case "relicsKingsIdol": case "relicsKingsIdol":
case "relicsArcaneEgg": case "relicsArcaneEgg":
total = playerData[dataObject[i].nameHeld] + playerData[dataObject[i].nameSold]; total = playerData[dataObject[i].nameHeld] + playerData[dataObject[i].nameSold];
(total >= dataObject[i].max) ? CurrentDataTrue(): CurrentDataBlank(); (total >= dataObject[i].max) ? CurrentDataTrue(section, i): CurrentDataBlank();
textPrefix += ": " + total; textPrefix += ": " + total;
break; break;
@ -923,7 +923,7 @@ function CheckAdditionalThings(divId, dataObject, playerData, worldData, sceneDa
CurrentDataBlank(); CurrentDataBlank();
textPrefix = `<del>${textPrefix}</del>`; textPrefix = `<del>${textPrefix}</del>`;
} else { } else {
(playerData[i].completed === true) ? CurrentDataTrue(): CurrentDataFalse(); (playerData[i].completed === true) ? CurrentDataTrue(section, i): CurrentDataFalse();
} }
break; break;
@ -933,11 +933,11 @@ function CheckAdditionalThings(divId, dataObject, playerData, worldData, sceneDa
textPrefix = `<del>${textPrefix}</del>`; textPrefix = `<del>${textPrefix}</del>`;
break; break;
} }
(playerData[i] == 0) ? CurrentDataTrue(): CurrentDataFalse(); (playerData[i] == 0) ? CurrentDataTrue(section, i): CurrentDataFalse();
break; break;
case "killsBigBuzzer": case "killsBigBuzzer":
(playerData[i] == 0) ? CurrentDataTrue(): CurrentDataFalse(); (playerData[i] == 0) ? CurrentDataTrue(section, i): CurrentDataFalse();
break; break;
case "killedVoidIdol_1": case "killedVoidIdol_1":
@ -946,8 +946,8 @@ function CheckAdditionalThings(divId, dataObject, playerData, worldData, sceneDa
textPrefix = `<del>${textPrefix}</del>`; textPrefix = `<del>${textPrefix}</del>`;
break; break;
} }
(playerData[i] === true) ? CurrentDataTrue(): CurrentDataFalse(); (playerData[i] === true) ? CurrentDataTrue(section, i): CurrentDataFalse();
if (playerData[i] === false && (playerData.killedVoidIdol_2 === true || playerData.killedVoidIdol_3 === true)) CurrentDataTrue(); if (playerData[i] === false && (playerData.killedVoidIdol_2 === true || playerData.killedVoidIdol_3 === true)) CurrentDataTrue(section, i);
break; break;
case "killedVoidIdol_2": case "killedVoidIdol_2":
@ -956,8 +956,8 @@ function CheckAdditionalThings(divId, dataObject, playerData, worldData, sceneDa
textPrefix = `<del>${textPrefix}</del>`; textPrefix = `<del>${textPrefix}</del>`;
break; break;
} }
(playerData[i] === true) ? CurrentDataTrue(): CurrentDataFalse(); (playerData[i] === true) ? CurrentDataTrue(section, i): CurrentDataFalse();
if (playerData[i] === false && playerData.killedVoidIdol_3 === true) CurrentDataTrue(); if (playerData[i] === false && playerData.killedVoidIdol_3 === true) CurrentDataTrue(section, i);
break; break;
case "greyPrinceDefeated": case "greyPrinceDefeated":
@ -969,7 +969,7 @@ function CheckAdditionalThings(divId, dataObject, playerData, worldData, sceneDa
} else if (playerData.zoteDead === true || (playerData.zoteRescuedBuzzer === false && playerData.hasWalljump === true)) { } else if (playerData.zoteDead === true || (playerData.zoteRescuedBuzzer === false && playerData.hasWalljump === true)) {
textPrefix = `<del>${textPrefix}</del>`; textPrefix = `<del>${textPrefix}</del>`;
} }
(playerData[i] === true) ? CurrentDataTrue(): CurrentDataBlank(); (playerData[i] === true) ? CurrentDataTrue(section, i): CurrentDataBlank();
if (playerData.zoteRescuedBuzzer === true && playerData[i] === false) CurrentDataFalse(); if (playerData.zoteRescuedBuzzer === true && playerData[i] === false) CurrentDataFalse();
break; break;
@ -978,11 +978,11 @@ function CheckAdditionalThings(divId, dataObject, playerData, worldData, sceneDa
if (playerData.zoteDead === true) { if (playerData.zoteDead === true) {
textPrefix = dataObject[i].nameNeglect; textPrefix = dataObject[i].nameNeglect;
textSuffix = dataObject[i].spoilerNeglect; textSuffix = dataObject[i].spoilerNeglect;
CurrentDataTrue(); CurrentDataTrue(section, i);
} else if (playerData.killedZote === true) { } else if (playerData.killedZote === true) {
textPrefix = dataObject[i].nameRivalry; textPrefix = dataObject[i].nameRivalry;
textSuffix = dataObject[i].spoilerRivalry; textSuffix = dataObject[i].spoilerRivalry;
CurrentDataTrue(); CurrentDataTrue(section, i);
} else if (playerData.zoteRescuedBuzzer === false) { } else if (playerData.zoteRescuedBuzzer === false) {
if (playerData.hasWalljump === false) { if (playerData.hasWalljump === false) {
textPrefix = dataObject[i].nameTrappedVengefly; textPrefix = dataObject[i].nameTrappedVengefly;
@ -1009,11 +1009,11 @@ function CheckAdditionalThings(divId, dataObject, playerData, worldData, sceneDa
if (playerData.nailsmithKilled === true) { if (playerData.nailsmithKilled === true) {
textPrefix = dataObject[i].namePurity; textPrefix = dataObject[i].namePurity;
textSuffix = dataObject[i].spoilerPurity; textSuffix = dataObject[i].spoilerPurity;
CurrentDataTrue(); CurrentDataTrue(section, i);
} else if (playerData.nailsmithConvoArt === true) { } else if (playerData.nailsmithConvoArt === true) {
textPrefix = dataObject[i].nameHappyCouple; textPrefix = dataObject[i].nameHappyCouple;
textSuffix = dataObject[i].spoilerHappyCouple; textSuffix = dataObject[i].spoilerHappyCouple;
CurrentDataTrue(); CurrentDataTrue(section, i);
} else if (playerData.nailsmithSpared === true) { } else if (playerData.nailsmithSpared === true) {
textPrefix = dataObject[i].nameSheoHutWaiting; textPrefix = dataObject[i].nameSheoHutWaiting;
textSuffix = dataObject[i].spoilerSheoHutWaiting; textSuffix = dataObject[i].spoilerSheoHutWaiting;
@ -1024,7 +1024,7 @@ function CheckAdditionalThings(divId, dataObject, playerData, worldData, sceneDa
break; break;
case "mrMushroomState": case "mrMushroomState":
sFillText += CheckMrMushroomState(divId, dataObject[i], playerData[i]); sFillText += CheckMrMushroomState(section, dataObject[i], playerData[i]);
break; break;
default: default:
@ -1035,7 +1035,7 @@ function CheckAdditionalThings(divId, dataObject, playerData, worldData, sceneDa
break; break;
} }
else if (playerData[i] === true) { else if (playerData[i] === true) {
CurrentDataTrue(); CurrentDataTrue(section, i);
} }
else { else {
CurrentDataFalse(); CurrentDataFalse();
@ -1043,10 +1043,10 @@ function CheckAdditionalThings(divId, dataObject, playerData, worldData, sceneDa
} // end switch (i) } // end switch (i)
if (i === "mrMushroomState") continue; if (i === "mrMushroomState") continue;
sFillText += PrepareHTMLString(divId, textPrefix, textSuffix, wiki); sFillText += PrepareHTMLString(section, textPrefix, textSuffix, wiki);
} // end for (let i in dataObject) } // end for (let i in dataObject)
// AppendHTML(divId, sFillText); // AppendHTML(section, sFillText);
// ========================================== // ==========================================
// -------------- Methods ---------------- // // -------------- Methods ---------------- //
@ -1194,7 +1194,7 @@ function CheckAdditionalThings(divId, dataObject, playerData, worldData, sceneDa
} }
// Filtering the reference database Grub list to include only the missing values // Filtering the reference database Grub list to include only the missing values
let missingGrubsList = divId.grubsList.filter(x => !rescuedGrubsSceneList.includes(x)); let missingGrubsList = section.grubsList.filter(x => !rescuedGrubsSceneList.includes(x));
let length = missingGrubsList.length; let length = missingGrubsList.length;
if (!length) { if (!length) {
@ -1203,7 +1203,7 @@ function CheckAdditionalThings(divId, dataObject, playerData, worldData, sceneDa
console.groupCollapsed(`%cUnrescued Grubs (${length}):`, "color: #16c60c; font-weight: 700;"); console.groupCollapsed(`%cUnrescued Grubs (${length}):`, "color: #16c60c; font-weight: 700;");
for (let i = 0; i < length; i++) { for (let i = 0; i < length; i++) {
console.log(`#${divId.grubsList.indexOf(missingGrubsList[i]) + 1} 🗺️ ${TranslateMapName(missingGrubsList[i])} ⌨️ ${missingGrubsList[i]}`); console.log(`#${section.grubsList.indexOf(missingGrubsList[i]) + 1} 🗺️ ${TranslateMapName(missingGrubsList[i])} ⌨️ ${missingGrubsList[i]}`);
} }
console.groupEnd(); console.groupEnd();
@ -1215,23 +1215,23 @@ function CheckAdditionalThings(divId, dataObject, playerData, worldData, sceneDa
/** /**
* Checks and fills all the 7 locations of Mr Mushroom. * Checks and fills all the 7 locations of Mr Mushroom.
* @param {object} divId ID of the HTML element for data appending * @param {object} section ID of the HTML element for data appending
* @param {object} dataObject object containing the Mr Mushroom name and spoilers/locations * @param {object} dataObject object containing the Mr Mushroom name and spoilers/locations
* @param {number} mrMushroomState playerData.mrMushroomState read from the save file. (0-8) * @param {number} mrMushroomState playerData.mrMushroomState read from the save file. (0-8)
*/ */
function CheckMrMushroomState(divId, dataObject, mrMushroomState = 0) { function CheckMrMushroomState(section, dataObject, mrMushroomState = 0) {
let sFillText = ""; let sFillText = "";
if (mrMushroomState > 1) { if (mrMushroomState > 1) {
for (let i = 1; i <= 7; i++) { for (let i = 1; i <= 7; i++) {
(mrMushroomState > i) ? CurrentDataTrue(): CurrentDataFalse(); (mrMushroomState > i) ? CurrentDataTrue(section, "mrMushroomState"): CurrentDataFalse();
sFillText += PrepareHTMLString(divId, `${dataObject.name} #${i}`, dataObject["spoiler" + i], dataObject.wiki); sFillText += PrepareHTMLString(section, `${dataObject.name} #${i}`, dataObject["spoiler" + i], dataObject.wiki);
} }
} else { } else {
CurrentDataFalse(); CurrentDataFalse();
for (let i = 1; i <= 7; i++) { for (let i = 1; i <= 7; i++) {
sFillText += PrepareHTMLString(divId, `${dataObject.name} #${i}`, dataObject["spoiler" + i], dataObject.wiki); sFillText += PrepareHTMLString(section, `${dataObject.name} #${i}`, dataObject["spoiler" + i], dataObject.wiki);
} }
} }
@ -1240,19 +1240,19 @@ function CheckMrMushroomState(divId, dataObject, mrMushroomState = 0) {
/** /**
* Checks, validates and shows hints to the player depending on their save progression, in chronological order. Shows only hint for the last uncompleted event. If Hollow Knight is defeated, shows a dummy text. * Checks, validates and shows hints to the player depending on their save progression, in chronological order. Shows only hint for the last uncompleted event. If Hollow Knight is defeated, shows a dummy text.
* @param {object} divId object containing div hints ID and h2 title * @param {object} section object containing div hints ID and h2 title
* @param {object} dataObject object containing all hints data * @param {object} dataObject object containing all hints data
* @param {object} playerData object containing HK Player Data to look in * @param {object} playerData object containing HK Player Data to look in
* @param {object} worldData object containing HK World Data to look in * @param {object} worldData object containing HK World Data to look in
* @returns {bool} true when defeated Hollow Knight, false if not * @returns {bool} true when defeated Hollow Knight, false if not
*/ */
function CheckHintsTrue(divId, dataObject, playerData, worldData) { function CheckHintsTrue(section, dataObject, playerData, worldData) {
let sFillText = ""; let sFillText = "";
if (playerData.killedHollowKnight === true) { if (playerData.killedHollowKnight === true) {
// a text to show when player already finished their first playthrough (killed Hollow Knight first time) // a text to show when player already finished their first playthrough (killed Hollow Knight first time)
/* AppendHTML(divId, "...a successful Knight who doesn't need hints anymore. The Knight explores the world of Hallownest patiently in constant search of its remaining secrets..."); */ /* AppendHTML(section, "...a successful Knight who doesn't need hints anymore. The Knight explores the world of Hallownest patiently in constant search of its remaining secrets..."); */
return true; return true;
} }
@ -1263,7 +1263,7 @@ function CheckHintsTrue(divId, dataObject, playerData, worldData) {
if (playerData[i] >= 1) { if (playerData[i] >= 1) {
continue; continue;
} else { } else {
sFillText += PrepareHTMLString(divId, "", dataObject[i].spoiler); sFillText += PrepareHTMLString(section, "", dataObject[i].spoiler);
break; break;
} }
} else if (i === "Crossroads_04") { } else if (i === "Crossroads_04") {
@ -1278,7 +1278,7 @@ function CheckHintsTrue(divId, dataObject, playerData, worldData) {
if (GruzMotherDefeated) { if (GruzMotherDefeated) {
continue; // next dataObject (i) continue; // next dataObject (i)
} else { } else {
sFillText += PrepareHTMLString(divId, "", dataObject[i].spoiler); sFillText += PrepareHTMLString(section, "", dataObject[i].spoiler);
break; break;
} }
} else if (i === "dungDefenderOrHornet2") { } else if (i === "dungDefenderOrHornet2") {
@ -1287,7 +1287,7 @@ function CheckHintsTrue(divId, dataObject, playerData, worldData) {
} else if (playerData.hornetOutskirtsDefeated === true) { } else if (playerData.hornetOutskirtsDefeated === true) {
continue; continue;
} else { // if no Dung Defender or Hornet 2 } else { // if no Dung Defender or Hornet 2
sFillText += PrepareHTMLString(divId, "", dataObject[i].spoiler); sFillText += PrepareHTMLString(section, "", dataObject[i].spoiler);
break; break;
} }
} else if (i === "ismaTearOrShadeCloak") { } else if (i === "ismaTearOrShadeCloak") {
@ -1297,20 +1297,20 @@ function CheckHintsTrue(divId, dataObject, playerData, worldData) {
if (playerData.hasShadowDash === true) { if (playerData.hasShadowDash === true) {
continue; continue;
} else { // if Kings Brand but no Shade Cloak } else { // if Kings Brand but no Shade Cloak
sFillText += PrepareHTMLString(divId, "", dataObject[i].spoiler); sFillText += PrepareHTMLString(section, "", dataObject[i].spoiler);
break; break;
} }
} else { // if no Isma's Tear or Kings Brand } else { // if no Isma's Tear or Kings Brand
sFillText += PrepareHTMLString(divId, "", dataObject[i].spoiler); sFillText += PrepareHTMLString(section, "", dataObject[i].spoiler);
break; break;
} }
} else { // if anything from the hints list is not done } else { // if anything from the hints list is not done
sFillText += PrepareHTMLString(divId, "", dataObject[i].spoiler); sFillText += PrepareHTMLString(section, "", dataObject[i].spoiler);
break; break;
} }
} // end: for (let i in dataObject) } // end: for (let i in dataObject)
// AppendHTML(divId, sFillText); // AppendHTML(section, sFillText);
} // function CheckHintsTrue() } // function CheckHintsTrue()
/** /**

View file

@ -146,7 +146,7 @@ function GenerateInnerHTML(db) {
textFill = SectionStart(sections[section]); textFill = SectionStart(sections[section]);
/* creates a <h2> tag for the current section and fills with current%/max% /* creates a <h2> tag for the current section and fills with current%/max%
If the save file was not analyzed, then fill only max% on blue background*/ If the save file was not analyzed, then fill only max% on blue background */
if (db.saveAnalyzed === true) { if (db.saveAnalyzed === true) {
textFill += CompletionFill(sections[section]); textFill += CompletionFill(sections[section]);
} else { } else {