make green checkboxes

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

View file

@ -249,11 +249,11 @@ function HKCheckCompletion(jsonObject) {
/**
* 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} 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 b = ["<b>", "</b>"];
@ -262,7 +262,7 @@ function PrepareHTMLString(divId, textPrefix = "Unknown Completion Element: ", t
let span = ["<span class='spoiler-span'>", "</span>"];
let spoilerSpan = ["<span class='spoiler-text'>", "</span>"];
if (divId.id === "hk-hints") {
if (section.id === "hk-hints") {
span[0] = "<span>";
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.
*/
function CurrentDataTrue(divId = "") {
completionSymbol = SYMBOL_TRUE;
if (divId) {
divId.percent++;
if (divId.id === "hk-equipment") divId.percent++; // double % for equipment
}
function CurrentDataTrue(section = {}, entry = "") {
section.percent++;
if (section.id === "hk-equipment") section.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
* @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
*/
function CheckPlayTime(divId, playTime) {
function CheckPlayTime(section, playTime) {
let seconds = Math.floor(playTime);
let minutes = Math.floor((seconds / 60) % 60);
let hours = Math.floor(seconds / 3600);
let sec = Math.floor(seconds % 60);
divId.entries.timePlayed.timeH = hours;
divId.entries.timePlayed.timeM = minutes;
divId.entries.timePlayed.timeS = sec;
section.entries.timePlayed.timeH = hours;
section.entries.timePlayed.timeM = minutes;
section.entries.timePlayed.timeS = sec;
if (sec < 10) sec = "0" + sec;
if (minutes < 10) minutes = "0" + minutes;
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
* @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
*/
function CheckCompletionPercent(divId, completionPercentage) {
function CheckCompletionPercent(section, completionPercentage) {
(completionPercentage >= 112) ? CurrentDataTrue(): CurrentDataFalse();
/* (completionPercentage >= 112) ? CurrentDataTrue(): CurrentDataFalse(); */
divId.percent = completionPercentage;
divId.entries.gameCompletion.spoiler = completionPercentage;
section.percent = completionPercentage;
section.entries.gameCompletion.spoiler = completionPercentage;
let textFill = "Game Completion:" + pSpan + "<b>" + completionPercentage + " %</b>" + pSpan + "(out of " + divId.maxPercent + " %)";
// document.getElementById(divId.id).innerHTML += divStart + completionSymbol + textFill + divEnd;
let 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
* @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
*/
function CheckSaveFileVersion(divId, saveVersion = HK.sections.intro.entries.saveVersion.spoiler) {
function CheckSaveFileVersion(section, saveVersion = HK.sections.intro.entries.saveVersion.spoiler) {
CurrentDataBlank();
divId.entries.saveVersion.spoiler = `${saveVersion}`;
section.entries.saveVersion.spoiler = `${saveVersion}`;
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
* @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} 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) {
divId.entries.health.permadeathMode = true;
section.entries.health.permadeathMode = true;
} else {
divId.entries.health.permadeathMode = false;
section.entries.health.permadeathMode = false;
}
/* let icon = SYMBOL_EMPTY;
@ -397,15 +397,15 @@ function CheckHealthMasks(divId, masks = 5, permadeathMode = 0) {
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
* @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
*/
function CheckSoulOrbs(divId, totalSoul) {
function CheckSoulOrbs(section, totalSoul) {
let icon = SYMBOL_EMPTY;
let textFill = "<span>Soul:</span>";
@ -417,15 +417,15 @@ function CheckSoulOrbs(divId, totalSoul) {
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
* @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
*/
function CheckGeo(divId, geoValue = 0, geoPoolValue = 0) {
function CheckGeo(section, geoValue = 0, geoPoolValue = 0) {
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>`;
@ -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
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
* @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} 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 {
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.
* @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} playerData Reference/pointer to specific data where to search (playerData)
* @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 {
textPrefix,
@ -522,7 +522,7 @@ function CheckIfDataTrue(divId, dataObject, playerData, worldData = []) {
switch (i) {
case "gotCharm_36":
// 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;
case "gotCharm_37":
@ -540,10 +540,10 @@ function CheckIfDataTrue(divId, dataObject, playerData, worldData = []) {
break;
}
if (i === "grimmChildLevel") {
(playerData.grimmChildLevel >= 4) ? CurrentDataTrue(divId): CurrentDataFalse();
(playerData.grimmChildLevel >= 4) ? CurrentDataTrue(section, i): CurrentDataFalse();
break;
}
(playerData[i] === true) ? CurrentDataTrue(divId): CurrentDataFalse();
(playerData[i] === true) ? CurrentDataTrue(section, i): CurrentDataFalse();
break;
case "bossGruzMother":
@ -564,7 +564,7 @@ function CheckIfDataTrue(divId, dataObject, playerData, worldData = []) {
case "vesselFragmentCityOfTears":
case "vesselFragmentDeepnest":
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;
case "pantheonMaster":
@ -577,7 +577,7 @@ function CheckIfDataTrue(divId, dataObject, playerData, worldData = []) {
textPrefix = `<del>${textPrefix}</del>`;
break;
} else if (checkText === "PantheonCompleted") {
CurrentDataTrue(divId);
CurrentDataTrue(section, i);
break;
} else {
CurrentDataFalse();
@ -585,22 +585,22 @@ function CheckIfDataTrue(divId, dataObject, playerData, worldData = []) {
break;
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.
* @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} playerData Reference/pointer to specific data where to search
*/
function CheckSpellLevel(divId, dataObject, playerData) {
function CheckSpellLevel(section, dataObject, playerData) {
let sFillText = "";
@ -608,43 +608,43 @@ function CheckSpellLevel(divId, dataObject, playerData) {
switch (i) {
case "vengefulSpirit":
case "shadeSoul":
(playerData.fireballLevel >= dataObject[i].fireballLevel) ? CurrentDataTrue(divId): CurrentDataFalse();
sFillText += PrepareHTMLString(divId, dataObject[i].name, dataObject[i].spoiler, dataObject[i].wiki);
(playerData.fireballLevel >= dataObject[i].fireballLevel) ? CurrentDataTrue(section, i): CurrentDataFalse();
sFillText += PrepareHTMLString(section, dataObject[i].name, dataObject[i].spoiler, dataObject[i].wiki);
break;
case "desolateDive":
case "descendingDark":
(playerData.quakeLevel >= dataObject[i].quakeLevel) ? CurrentDataTrue(divId): CurrentDataFalse();
sFillText += PrepareHTMLString(divId, dataObject[i].name, dataObject[i].spoiler, dataObject[i].wiki);
(playerData.quakeLevel >= dataObject[i].quakeLevel) ? CurrentDataTrue(section, i): CurrentDataFalse();
sFillText += PrepareHTMLString(section, dataObject[i].name, dataObject[i].spoiler, dataObject[i].wiki);
break;
case "howlingWraiths":
case "abyssShriek":
(playerData.screamLevel >= dataObject[i].screamLevel) ? CurrentDataTrue(divId): CurrentDataFalse();
sFillText += PrepareHTMLString(divId, dataObject[i].name, dataObject[i].spoiler, dataObject[i].wiki);
(playerData.screamLevel >= dataObject[i].screamLevel) ? CurrentDataTrue(section, i): CurrentDataFalse();
sFillText += PrepareHTMLString(section, dataObject[i].name, dataObject[i].spoiler, dataObject[i].wiki);
break;
default:
break;
}
}
// AppendHTML(divId, sFillText);
// AppendHTML(section, sFillText);
}
/**
* 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} playerData Reference/pointer to specific data where to search
*/
function CheckWarriorDreams(divId, dataObject, playerData) {
function CheckWarriorDreams(section, dataObject, playerData) {
let sFillText = "";
for (let i in dataObject) {
(playerData[i] >= 2) ? CurrentDataTrue(divId): CurrentDataFalse();
sFillText += PrepareHTMLString(divId, dataObject[i].name, dataObject[i].spoiler, dataObject[i].wiki);
(playerData[i] >= 2) ? CurrentDataTrue(section, i): CurrentDataFalse();
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.
* @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} 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
// same as names in the database object
@ -678,12 +678,12 @@ function CheckNailUpgrades(divId, dataObject, playerData) {
let sFillText = "";
for (let i = 0; i < 5; i++) {
(playerData.nailSmithUpgrades >= i) ? CurrentDataTrue(divId): CurrentDataFalse();
sFillText += PrepareHTMLString(divId, dataObject[nail[i]].name, dataObject[nail[i]].spoiler, dataObject[nail[i]].wiki);
(playerData.nailSmithUpgrades >= i) ? CurrentDataTrue(section, nail[i]): CurrentDataFalse();
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.
* @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 {object} dataObject Object containing data to be verified
* @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 size = ObjectLength(dataObject);
let sFillText = "";
@ -734,22 +734,22 @@ function CheckWorldDataTrue(divId, idText, dataObject, worldData) {
// Display the items as they were initially ordered
for (let i = 0; i < size; i++) {
CurrentDataFalse();
if (orderedArray[i][4] === true) CurrentDataTrue(divId);
sFillText += PrepareHTMLString(divId, orderedArray[i][1], orderedArray[i][2], orderedArray[i][3]);
if (orderedArray[i][4] === true) CurrentDataTrue(section);
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.
* @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} 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} 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 {
textPrefix,
@ -835,7 +835,7 @@ function CheckAdditionalThings(divId, dataObject, playerData, worldData, sceneDa
break;
}
}
(amount >= dataObject[i].max) ? CurrentDataTrue(): CurrentDataBlank();
(amount >= dataObject[i].max) ? CurrentDataTrue(section, i): CurrentDataBlank();
break;
case "geoPool":
@ -843,7 +843,7 @@ function CheckAdditionalThings(divId, dataObject, playerData, worldData, sceneDa
case "jinnEggsSold":
case "xunFlowerBrokeTimes":
textPrefix += ": " + Math.abs(playerData[i]);
(i === "geoPool" && playerData[i] > 0) ? CurrentDataBlank(): CurrentDataTrue();
(i === "geoPool" && playerData[i] > 0) ? CurrentDataBlank(): CurrentDataTrue(section, i);
if (i === "jinnEggsSold") {
// fade out if not on Steel Soul
@ -863,7 +863,7 @@ function CheckAdditionalThings(divId, dataObject, playerData, worldData, sceneDa
activated = CountGeoRocks(discoveredTotal, "broken");
textPrefix += `: ${notActivated} | ${activated} | ${discoveredTotal}`;
CurrentDataTrue();
CurrentDataTrue(section, i);
break;
case "itemsDiscovered":
@ -873,23 +873,23 @@ function CheckAdditionalThings(divId, dataObject, playerData, worldData, sceneDa
activated = CountItems(discoveredTotal, "active");
textPrefix += `: ${notActivated} | ${activated} | ${discoveredTotal}`;
CurrentDataTrue();
CurrentDataTrue(section, i);
break;
case "shopkeeperKey":
(playerData.hasSlykey === true || playerData.gaveSlykey === true) ? CurrentDataTrue(): CurrentDataFalse();
(playerData.hasSlykey === true || playerData.gaveSlykey === true) ? CurrentDataTrue(section, i): CurrentDataFalse();
break;
case "elegantKey":
(playerData.hasWhiteKey === true || playerData.usedWhiteKey === true) ? CurrentDataTrue(): CurrentDataFalse();
(playerData.hasWhiteKey === true || playerData.usedWhiteKey === true) ? CurrentDataTrue(section, i): CurrentDataFalse();
break;
case "loveKey":
(playerData.hasLoveKey === true || playerData.openedLoveDoor === true) ? CurrentDataTrue(): CurrentDataFalse();
(playerData.hasLoveKey === true || playerData.openedLoveDoor === true) ? CurrentDataTrue(section, i): CurrentDataFalse();
break;
case "paleOreSeer": // #2
(playerData.dreamReward3 === true) ? CurrentDataTrue(): CurrentDataFalse();
(playerData.dreamReward3 === true) ? CurrentDataTrue(section, i): CurrentDataFalse();
break;
/* -------------------- Interactables ------------------------------- */
@ -906,7 +906,7 @@ function CheckAdditionalThings(divId, dataObject, playerData, worldData, sceneDa
case "mantisVillageFloorLever":
case "pathOfPainEntrance":
case "whiteLadyRoom":
(FindWorldItem(dataObject[i].id, dataObject[i].sceneName)) ? CurrentDataTrue(): CurrentDataFalse();
(FindWorldItem(dataObject[i].id, dataObject[i].sceneName)) ? CurrentDataTrue(section, i): CurrentDataFalse();
break;
case "relicsWandererJournal":
@ -914,7 +914,7 @@ function CheckAdditionalThings(divId, dataObject, playerData, worldData, sceneDa
case "relicsKingsIdol":
case "relicsArcaneEgg":
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;
break;
@ -923,7 +923,7 @@ function CheckAdditionalThings(divId, dataObject, playerData, worldData, sceneDa
CurrentDataBlank();
textPrefix = `<del>${textPrefix}</del>`;
} else {
(playerData[i].completed === true) ? CurrentDataTrue(): CurrentDataFalse();
(playerData[i].completed === true) ? CurrentDataTrue(section, i): CurrentDataFalse();
}
break;
@ -933,11 +933,11 @@ function CheckAdditionalThings(divId, dataObject, playerData, worldData, sceneDa
textPrefix = `<del>${textPrefix}</del>`;
break;
}
(playerData[i] == 0) ? CurrentDataTrue(): CurrentDataFalse();
(playerData[i] == 0) ? CurrentDataTrue(section, i): CurrentDataFalse();
break;
case "killsBigBuzzer":
(playerData[i] == 0) ? CurrentDataTrue(): CurrentDataFalse();
(playerData[i] == 0) ? CurrentDataTrue(section, i): CurrentDataFalse();
break;
case "killedVoidIdol_1":
@ -946,8 +946,8 @@ function CheckAdditionalThings(divId, dataObject, playerData, worldData, sceneDa
textPrefix = `<del>${textPrefix}</del>`;
break;
}
(playerData[i] === true) ? CurrentDataTrue(): CurrentDataFalse();
if (playerData[i] === false && (playerData.killedVoidIdol_2 === true || playerData.killedVoidIdol_3 === true)) CurrentDataTrue();
(playerData[i] === true) ? CurrentDataTrue(section, i): CurrentDataFalse();
if (playerData[i] === false && (playerData.killedVoidIdol_2 === true || playerData.killedVoidIdol_3 === true)) CurrentDataTrue(section, i);
break;
case "killedVoidIdol_2":
@ -956,8 +956,8 @@ function CheckAdditionalThings(divId, dataObject, playerData, worldData, sceneDa
textPrefix = `<del>${textPrefix}</del>`;
break;
}
(playerData[i] === true) ? CurrentDataTrue(): CurrentDataFalse();
if (playerData[i] === false && playerData.killedVoidIdol_3 === true) CurrentDataTrue();
(playerData[i] === true) ? CurrentDataTrue(section, i): CurrentDataFalse();
if (playerData[i] === false && playerData.killedVoidIdol_3 === true) CurrentDataTrue(section, i);
break;
case "greyPrinceDefeated":
@ -969,7 +969,7 @@ function CheckAdditionalThings(divId, dataObject, playerData, worldData, sceneDa
} else if (playerData.zoteDead === true || (playerData.zoteRescuedBuzzer === false && playerData.hasWalljump === true)) {
textPrefix = `<del>${textPrefix}</del>`;
}
(playerData[i] === true) ? CurrentDataTrue(): CurrentDataBlank();
(playerData[i] === true) ? CurrentDataTrue(section, i): CurrentDataBlank();
if (playerData.zoteRescuedBuzzer === true && playerData[i] === false) CurrentDataFalse();
break;
@ -978,11 +978,11 @@ function CheckAdditionalThings(divId, dataObject, playerData, worldData, sceneDa
if (playerData.zoteDead === true) {
textPrefix = dataObject[i].nameNeglect;
textSuffix = dataObject[i].spoilerNeglect;
CurrentDataTrue();
CurrentDataTrue(section, i);
} else if (playerData.killedZote === true) {
textPrefix = dataObject[i].nameRivalry;
textSuffix = dataObject[i].spoilerRivalry;
CurrentDataTrue();
CurrentDataTrue(section, i);
} else if (playerData.zoteRescuedBuzzer === false) {
if (playerData.hasWalljump === false) {
textPrefix = dataObject[i].nameTrappedVengefly;
@ -1009,11 +1009,11 @@ function CheckAdditionalThings(divId, dataObject, playerData, worldData, sceneDa
if (playerData.nailsmithKilled === true) {
textPrefix = dataObject[i].namePurity;
textSuffix = dataObject[i].spoilerPurity;
CurrentDataTrue();
CurrentDataTrue(section, i);
} else if (playerData.nailsmithConvoArt === true) {
textPrefix = dataObject[i].nameHappyCouple;
textSuffix = dataObject[i].spoilerHappyCouple;
CurrentDataTrue();
CurrentDataTrue(section, i);
} else if (playerData.nailsmithSpared === true) {
textPrefix = dataObject[i].nameSheoHutWaiting;
textSuffix = dataObject[i].spoilerSheoHutWaiting;
@ -1024,7 +1024,7 @@ function CheckAdditionalThings(divId, dataObject, playerData, worldData, sceneDa
break;
case "mrMushroomState":
sFillText += CheckMrMushroomState(divId, dataObject[i], playerData[i]);
sFillText += CheckMrMushroomState(section, dataObject[i], playerData[i]);
break;
default:
@ -1035,7 +1035,7 @@ function CheckAdditionalThings(divId, dataObject, playerData, worldData, sceneDa
break;
}
else if (playerData[i] === true) {
CurrentDataTrue();
CurrentDataTrue(section, i);
}
else {
CurrentDataFalse();
@ -1043,10 +1043,10 @@ function CheckAdditionalThings(divId, dataObject, playerData, worldData, sceneDa
} // end switch (i)
if (i === "mrMushroomState") continue;
sFillText += PrepareHTMLString(divId, textPrefix, textSuffix, wiki);
sFillText += PrepareHTMLString(section, textPrefix, textSuffix, wiki);
} // end for (let i in dataObject)
// AppendHTML(divId, sFillText);
// AppendHTML(section, sFillText);
// ==========================================
// -------------- Methods ---------------- //
@ -1194,7 +1194,7 @@ function CheckAdditionalThings(divId, dataObject, playerData, worldData, sceneDa
}
// 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;
if (!length) {
@ -1203,7 +1203,7 @@ function CheckAdditionalThings(divId, dataObject, playerData, worldData, sceneDa
console.groupCollapsed(`%cUnrescued Grubs (${length}):`, "color: #16c60c; font-weight: 700;");
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();
@ -1215,23 +1215,23 @@ function CheckAdditionalThings(divId, dataObject, playerData, worldData, sceneDa
/**
* 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 {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 = "";
if (mrMushroomState > 1) {
for (let i = 1; i <= 7; i++) {
(mrMushroomState > i) ? CurrentDataTrue(): CurrentDataFalse();
sFillText += PrepareHTMLString(divId, `${dataObject.name} #${i}`, dataObject["spoiler" + i], dataObject.wiki);
(mrMushroomState > i) ? CurrentDataTrue(section, "mrMushroomState"): CurrentDataFalse();
sFillText += PrepareHTMLString(section, `${dataObject.name} #${i}`, dataObject["spoiler" + i], dataObject.wiki);
}
} else {
CurrentDataFalse();
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.
* @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} playerData object containing HK Player 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
*/
function CheckHintsTrue(divId, dataObject, playerData, worldData) {
function CheckHintsTrue(section, dataObject, playerData, worldData) {
let sFillText = "";
if (playerData.killedHollowKnight === true) {
// 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;
}
@ -1263,7 +1263,7 @@ function CheckHintsTrue(divId, dataObject, playerData, worldData) {
if (playerData[i] >= 1) {
continue;
} else {
sFillText += PrepareHTMLString(divId, "", dataObject[i].spoiler);
sFillText += PrepareHTMLString(section, "", dataObject[i].spoiler);
break;
}
} else if (i === "Crossroads_04") {
@ -1278,7 +1278,7 @@ function CheckHintsTrue(divId, dataObject, playerData, worldData) {
if (GruzMotherDefeated) {
continue; // next dataObject (i)
} else {
sFillText += PrepareHTMLString(divId, "", dataObject[i].spoiler);
sFillText += PrepareHTMLString(section, "", dataObject[i].spoiler);
break;
}
} else if (i === "dungDefenderOrHornet2") {
@ -1287,7 +1287,7 @@ function CheckHintsTrue(divId, dataObject, playerData, worldData) {
} else if (playerData.hornetOutskirtsDefeated === true) {
continue;
} else { // if no Dung Defender or Hornet 2
sFillText += PrepareHTMLString(divId, "", dataObject[i].spoiler);
sFillText += PrepareHTMLString(section, "", dataObject[i].spoiler);
break;
}
} else if (i === "ismaTearOrShadeCloak") {
@ -1297,20 +1297,20 @@ function CheckHintsTrue(divId, dataObject, playerData, worldData) {
if (playerData.hasShadowDash === true) {
continue;
} else { // if Kings Brand but no Shade Cloak
sFillText += PrepareHTMLString(divId, "", dataObject[i].spoiler);
sFillText += PrepareHTMLString(section, "", dataObject[i].spoiler);
break;
}
} else { // if no Isma's Tear or Kings Brand
sFillText += PrepareHTMLString(divId, "", dataObject[i].spoiler);
sFillText += PrepareHTMLString(section, "", dataObject[i].spoiler);
break;
}
} else { // if anything from the hints list is not done
sFillText += PrepareHTMLString(divId, "", dataObject[i].spoiler);
sFillText += PrepareHTMLString(section, "", dataObject[i].spoiler);
break;
}
} // end: for (let i in dataObject)
// AppendHTML(divId, sFillText);
// AppendHTML(section, sFillText);
} // function CheckHintsTrue()
/**

View file

@ -146,7 +146,7 @@ function GenerateInnerHTML(db) {
textFill = SectionStart(sections[section]);
/* 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) {
textFill += CompletionFill(sections[section]);
} else {