max completion % depending on the save file version
This commit is contained in:
parent
9a62dd1fce
commit
f1275d00db
5 changed files with 394 additions and 333 deletions
113
build/app.js
113
build/app.js
|
|
@ -145,7 +145,7 @@ function HKCheckCompletion(jsonObject) {
|
||||||
|
|
||||||
CheckPlayTime(_hk_database_js__WEBPACK_IMPORTED_MODULE_0__.default.sections.intro, HKPlayerData.playTime); // ---------------- Game Completion Status ----------------- //
|
CheckPlayTime(_hk_database_js__WEBPACK_IMPORTED_MODULE_0__.default.sections.intro, HKPlayerData.playTime); // ---------------- Game Completion Status ----------------- //
|
||||||
|
|
||||||
CheckCompletionPercent(_hk_database_js__WEBPACK_IMPORTED_MODULE_0__.default.sections.intro, HKPlayerData.completionPercentage); // ---------------- Game Completion Status ----------------- //
|
CheckCompletionPercent(_hk_database_js__WEBPACK_IMPORTED_MODULE_0__.default.sections.intro, HKPlayerData); // ---------------- Game Completion Status ----------------- //
|
||||||
|
|
||||||
CheckSaveFileVersion(_hk_database_js__WEBPACK_IMPORTED_MODULE_0__.default.sections.intro, HKPlayerData.version); // ---------------- Fleur Divide ----------------- //
|
CheckSaveFileVersion(_hk_database_js__WEBPACK_IMPORTED_MODULE_0__.default.sections.intro, HKPlayerData.version); // ---------------- Fleur Divide ----------------- //
|
||||||
// AppendHTML(HK.sections.intro, FLEUR_DIVIDE);
|
// AppendHTML(HK.sections.intro, FLEUR_DIVIDE);
|
||||||
|
|
@ -263,8 +263,21 @@ function PrepareHTMLString(section) {
|
||||||
function CurrentDataTrue() {
|
function CurrentDataTrue() {
|
||||||
var section = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
var section = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
||||||
var entry = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "";
|
var entry = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "";
|
||||||
|
|
||||||
|
/* Increase section percentage except the Game Status and Hints sections */
|
||||||
|
switch (section.id) {
|
||||||
|
case "hk-intro":
|
||||||
|
case "hk-hints":
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "hk-equipment":
|
||||||
|
// double % for equipment
|
||||||
|
section.percent += 2;
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
section.percent++;
|
section.percent++;
|
||||||
if (section.id === "hk-equipment") section.percent++; // double % for equipment
|
}
|
||||||
|
|
||||||
section.entries[entry].icon = "green";
|
section.entries[entry].icon = "green";
|
||||||
}
|
}
|
||||||
|
|
@ -323,11 +336,43 @@ function CheckPlayTime(section, playTime) {
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
function CheckCompletionPercent(section, completionPercentage) {
|
function CheckCompletionPercent(section, playerData) {
|
||||||
completionPercentage >= 112 ? CurrentDataTrue(section, "gameCompletion") : CurrentDataFalse(section, "gameCompletion");
|
var completionPercentage = Math.round(playerData.completionPercentage);
|
||||||
|
var maxPercent = 0;
|
||||||
|
/* Normal (current) game version behaviour: 112% */
|
||||||
|
|
||||||
|
section.maxPercent = section.maxPercentDefault;
|
||||||
|
maxPercent = section.maxPercentDefault;
|
||||||
|
section.entries.gameCompletion.spoilerAfter = section.entries.gameCompletion.spoilerAfterDefault;
|
||||||
section.percent = completionPercentage;
|
section.percent = completionPercentage;
|
||||||
section.entries.gameCompletion.spoiler = completionPercentage;
|
section.entries.gameCompletion.spoiler = completionPercentage;
|
||||||
var textFill = "Game Completion:" + pSpan + "<b>" + completionPercentage + " %</b>" + pSpan + "(out of " + section.maxPercent + " %)"; // document.getElementById(section.id).innerHTML += divStart + completionSymbol + textFill + divEnd;
|
/* Lifeblood behaviour: 107% */
|
||||||
|
|
||||||
|
if (!playerData.hasOwnProperty("hasGodfinder")) {
|
||||||
|
section.maxPercent = section.maxPercentLifeblood;
|
||||||
|
maxPercent = section.maxPercentLifeblood;
|
||||||
|
section.entries.gameCompletion.spoilerAfter = section.entries.gameCompletion.spoilerAfterLifeblood;
|
||||||
|
}
|
||||||
|
/* Grimm Troupe bahaviour: 106% */
|
||||||
|
|
||||||
|
|
||||||
|
if (!playerData.hasOwnProperty("killedHiveKnight")) {
|
||||||
|
section.maxPercent = section.maxPercentGrimmTroupe;
|
||||||
|
maxPercent = section.maxPercentGrimmTroupe;
|
||||||
|
section.entries.gameCompletion.spoilerAfter = section.entries.gameCompletion.spoilerAfterGrimmTroupe;
|
||||||
|
}
|
||||||
|
/* Base Game behaviour with no Content Packs: 100% */
|
||||||
|
|
||||||
|
|
||||||
|
if (!playerData.hasOwnProperty("gotCharm_37")) {
|
||||||
|
section.maxPercent = section.maxPercentBaseGame;
|
||||||
|
maxPercent = section.maxPercentBaseGame;
|
||||||
|
section.entries.gameCompletion.spoilerAfter = section.entries.gameCompletion.spoilerAfterBaseGame;
|
||||||
|
}
|
||||||
|
|
||||||
|
completionPercentage >= maxPercent ? CurrentDataTrue(section, "gameCompletion") : CurrentDataFalse(section, "gameCompletion");
|
||||||
|
/* 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
|
* Reads the "version" string from the save file and appends it to the selected div ID element
|
||||||
|
|
@ -2692,6 +2737,10 @@ var HK = {
|
||||||
id: "hk-intro",
|
id: "hk-intro",
|
||||||
percent: 0,
|
percent: 0,
|
||||||
maxPercent: 112,
|
maxPercent: 112,
|
||||||
|
maxPercentDefault: 112,
|
||||||
|
maxPercentBaseGame: 100,
|
||||||
|
maxPercentGrimmTroupe: 106,
|
||||||
|
maxPercentLifeblood: 107,
|
||||||
entries: {
|
entries: {
|
||||||
timePlayed: {
|
timePlayed: {
|
||||||
id: "timePlayed",
|
id: "timePlayed",
|
||||||
|
|
@ -2707,7 +2756,11 @@ var HK = {
|
||||||
icon: "red",
|
icon: "red",
|
||||||
name: "Game Completion:",
|
name: "Game Completion:",
|
||||||
spoiler: 0,
|
spoiler: 0,
|
||||||
spoilerAfter: "(out of 112 %)"
|
spoilerAfter: "(out of 112 %)",
|
||||||
|
spoilerAfterDefault: "(out of 112 %)",
|
||||||
|
spoilerAfterBaseGame: "(out of 100 %)",
|
||||||
|
spoilerAfterGrimmTroupe: "(out of 106 %)",
|
||||||
|
spoilerAfterLifeblood: "(out of 107 %)"
|
||||||
},
|
},
|
||||||
saveVersion: {
|
saveVersion: {
|
||||||
id: "saveVersion",
|
id: "saveVersion",
|
||||||
|
|
@ -5580,7 +5633,7 @@ function CompletionFill(section) {
|
||||||
|
|
||||||
|
|
||||||
if (section.id != "hk-intro") cp += "/";
|
if (section.id != "hk-intro") cp += "/";
|
||||||
fillText = "<div class='percent-box".concat(cl, "'>").concat(section.id === "hk-intro" ? cp : cp + section.maxPercent, "%</div>");
|
fillText = "<div class='percent-box".concat(cl, "'>").concat(section.id === "hk-intro" ? cp : "".concat(cp).concat(section.maxPercent), "%</div>");
|
||||||
}
|
}
|
||||||
|
|
||||||
return "\t".concat(h2id).concat(h2).concat(fillText, "</h2>\n");
|
return "\t".concat(h2id).concat(h2).concat(fillText, "</h2>\n");
|
||||||
|
|
@ -5595,7 +5648,6 @@ function SingleEntryFill(obj) {
|
||||||
let iconRed = SYMBOL_FALSE;
|
let iconRed = SYMBOL_FALSE;
|
||||||
let iconClock = SYMBOL_CLOCK;
|
let iconClock = SYMBOL_CLOCK;
|
||||||
let iconNull = SYMBOL_EMPTY;
|
let iconNull = SYMBOL_EMPTY;
|
||||||
|
|
||||||
let textPrefix = "";
|
let textPrefix = "";
|
||||||
let textSuffix = "";
|
let textSuffix = "";
|
||||||
let textFill = "";
|
let textFill = "";
|
||||||
|
|
@ -5609,7 +5661,6 @@ function SingleEntryFill(obj) {
|
||||||
let geoNormalImage = `<img src='${GEO_IMAGE}' class='geo-symbol' alt='geo symbol image' title='Geo'>`;
|
let geoNormalImage = `<img src='${GEO_IMAGE}' class='geo-symbol' alt='geo symbol image' title='Geo'>`;
|
||||||
let geoShadeImage = `<img src='${GEO_SHADE_IMAGE}' class='geo-symbol' alt='shade geo symbol image' title='Shade Geo'>`;
|
let geoShadeImage = `<img src='${GEO_SHADE_IMAGE}' class='geo-symbol' alt='shade geo symbol image' title='Shade Geo'>`;
|
||||||
let wiki = "";
|
let wiki = "";
|
||||||
|
|
||||||
let div = `<div class='single-entry'>`;
|
let div = `<div class='single-entry'>`;
|
||||||
let divFlex = `<div class='flex-container align-center'>`;
|
let divFlex = `<div class='flex-container align-center'>`;
|
||||||
let b = ["<b>", "</b>"];
|
let b = ["<b>", "</b>"];
|
||||||
|
|
@ -5621,7 +5672,6 @@ function SingleEntryFill(obj) {
|
||||||
if (entry.hasOwnProperty("icon")) {
|
if (entry.hasOwnProperty("icon")) {
|
||||||
|
|
||||||
switch (entry.icon) {
|
switch (entry.icon) {
|
||||||
|
|
||||||
case "clock":
|
case "clock":
|
||||||
icon = iconClock;
|
icon = iconClock;
|
||||||
break;
|
break;
|
||||||
|
|
@ -5637,120 +5687,89 @@ function SingleEntryFill(obj) {
|
||||||
} else {
|
} else {
|
||||||
icon = iconRed;
|
icon = iconRed;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (entry.hasOwnProperty("name")) {
|
if (entry.hasOwnProperty("name")) {
|
||||||
textPrefix = entry.name;
|
textPrefix = entry.name;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (entry.hasOwnProperty("spoiler")) {
|
if (entry.hasOwnProperty("spoiler")) {
|
||||||
textSuffix = entry.spoiler;
|
textSuffix = entry.spoiler;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (entry.hasOwnProperty("wiki")) {
|
if (entry.hasOwnProperty("wiki")) {
|
||||||
wiki = entry.wiki;
|
wiki = entry.wiki;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!textPrefix.length) b = ["", ""];
|
if (!textPrefix.length) b = ["", ""];
|
||||||
if (wiki.length) b = [`<a class="wiki" href="${WIKI_LINK}${wiki}" target="_blank">`, "</a>"];
|
if (wiki.length) b = [`<a class="wiki" href="${WIKI_LINK}${wiki}" target="_blank">`, "</a>"];
|
||||||
|
|
||||||
// #################### Different behaviour depending on the section #######################
|
// #################### Different behaviour depending on the section #######################
|
||||||
|
|
||||||
switch (section) {
|
switch (section) {
|
||||||
|
|
||||||
case "intro":
|
case "intro":
|
||||||
b = ["", ""];
|
b = ["", ""];
|
||||||
span = ["<b>", "</b>"];
|
span = ["<b>", "</b>"];
|
||||||
|
|
||||||
// Different text and images for each entry in the "Game Status" section
|
// Different text and images for each entry in the "Game Status" section
|
||||||
|
|
||||||
switch (entry.id) {
|
switch (entry.id) {
|
||||||
case "gameCompletion":
|
case "gameCompletion":
|
||||||
textSuffix = `${entry.spoiler} %`;
|
textSuffix = `${entry.spoiler} %`;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "health":
|
case "health":
|
||||||
div = divFlex;
|
div = divFlex;
|
||||||
span = ["", ""];
|
span = ["", ""];
|
||||||
|
|
||||||
(entry.permadeathMode) ? Img = maskSteel: Img = maskNormal;
|
(entry.permadeathMode) ? Img = maskSteel: Img = maskNormal;
|
||||||
|
|
||||||
for (let i = 0, total = entry.amountTotal; i < total; i++) {
|
for (let i = 0, total = entry.amountTotal; i < total; i++) {
|
||||||
textSuffix += Img;
|
textSuffix += Img;
|
||||||
}
|
}
|
||||||
|
|
||||||
textSuffix += `${p}<sup>(${entry.amountTotal})</sup>`;
|
textSuffix += `${p}<sup>(${entry.amountTotal})</sup>`;
|
||||||
|
|
||||||
p = "";
|
p = "";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "soul":
|
case "soul":
|
||||||
div = divFlex;
|
div = divFlex;
|
||||||
span = ["", ""];
|
span = ["", ""];
|
||||||
Img = soulNormal;
|
Img = soulNormal;
|
||||||
|
|
||||||
for (let i = 0, total = Math.round(entry.amountTotal / 33); i < total; i++) {
|
for (let i = 0, total = Math.round(entry.amountTotal / 33); i < total; i++) {
|
||||||
textSuffix += Img;
|
textSuffix += Img;
|
||||||
}
|
}
|
||||||
|
|
||||||
textSuffix += `${p}<sup>(${Math.round(entry.amountTotal / 33)})</sup>`;
|
textSuffix += `${p}<sup>(${Math.round(entry.amountTotal / 33)})</sup>`;
|
||||||
|
|
||||||
p = "";
|
p = "";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "notches":
|
case "notches":
|
||||||
div = divFlex;
|
div = divFlex;
|
||||||
span = ["", ""];
|
span = ["", ""];
|
||||||
|
|
||||||
// First, check filled (used) notches and fill them (skips if no filled notches)
|
// First, check filled (used) notches and fill them (skips if no filled notches)
|
||||||
if (entry.amountFilled > 0) {
|
if (entry.amountFilled > 0) {
|
||||||
for (let i = 0, total = entry.amountFilled; i < total; i++) {
|
for (let i = 0, total = entry.amountFilled; i < total; i++) {
|
||||||
textSuffix += notchFilledImage;
|
textSuffix += notchFilledImage;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Second, check overcharmed notches and fill them (skips if player is not overcharmed)
|
// Second, check overcharmed notches and fill them (skips if player is not overcharmed)
|
||||||
if (entry.amountOvercharmed > 0) {
|
if (entry.amountOvercharmed > 0) {
|
||||||
for (let i = 0, total = entry.amountOvercharmed; i < total; i++) {
|
for (let i = 0, total = entry.amountOvercharmed; i < total; i++) {
|
||||||
textSuffix += notchOvercharmedImage;
|
textSuffix += notchOvercharmedImage;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Last, fill all unused notches
|
// Last, fill all unused notches
|
||||||
if (entry.amountUnused > 0) {
|
if (entry.amountUnused > 0) {
|
||||||
for (let i = 0, total = entry.amountUnused; i < total; i++) {
|
for (let i = 0, total = entry.amountUnused; i < total; i++) {
|
||||||
textSuffix += notchNormalImage;
|
textSuffix += notchNormalImage;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
textSuffix += `${p}<sup>(${entry.amountTotal})</sup>`;
|
textSuffix += `${p}<sup>(${entry.amountTotal})</sup>`;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "geo":
|
case "geo":
|
||||||
div = divFlex;
|
div = divFlex;
|
||||||
span = ["", ""];
|
span = ["", ""];
|
||||||
|
|
||||||
textSuffix += `${geoNormalImage}<b>${entry.amount}</b>`;
|
textSuffix += `${geoNormalImage}<b>${entry.amount}</b>`;
|
||||||
// Show Shade Geo value and image only if Shade has at least 1 Geo on it
|
// Show Shade Geo value and image only if Shade has at least 1 Geo on it
|
||||||
if (entry.amountShade > 0) textSuffix += `${p}+${geoShadeImage}<b>${entry.amountShade}</b>`;
|
if (entry.amountShade > 0) textSuffix += `${p}+${geoShadeImage}<b>${entry.amountShade}</b>`;
|
||||||
|
|
||||||
// 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 (entry.amount > 0 && entry.amountShade > 0) textSuffix += `${p}=${p}<b>${entry.amountTotal}</b>`;
|
if (entry.amount > 0 && entry.amountShade > 0) textSuffix += `${p}=${p}<b>${entry.amountTotal}</b>`;
|
||||||
|
|
||||||
p = "";
|
p = "";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
}
|
}
|
||||||
|
|
||||||
// Optimized only for the "intro" section!
|
// Optimized only for the "intro" section!
|
||||||
if (entry.hasOwnProperty("spoilerAfter")) {
|
if (entry.hasOwnProperty("spoilerAfter")) {
|
||||||
spoilerAfter = `</b> ${entry.spoilerAfter}`;
|
spoilerAfter = `</b> ${entry.spoilerAfter}`;
|
||||||
span[1] = "";
|
span[1] = "";
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "hints":
|
case "hints":
|
||||||
b = ["", ""];
|
b = ["", ""];
|
||||||
span = ["<span>", "</span>"];
|
span = ["<span>", "</span>"];
|
||||||
|
|
@ -5758,10 +5777,8 @@ function SingleEntryFill(obj) {
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
||||||
span = ["<span class='spoiler-span'>", "</span>"];
|
span = ["<span class='spoiler-span'>", "</span>"];
|
||||||
spoiler = ["<span class='spoiler-text'>", "</span>"];
|
spoiler = ["<span class='spoiler-text'>", "</span>"];
|
||||||
|
|
||||||
if (entry.hasOwnProperty("amount")) {
|
if (entry.hasOwnProperty("amount")) {
|
||||||
if (entry.hasOwnProperty("disabled")) {
|
if (entry.hasOwnProperty("disabled")) {
|
||||||
if (entry.disabled !== true) {
|
if (entry.disabled !== true) {
|
||||||
|
|
@ -5771,34 +5788,25 @@ function SingleEntryFill(obj) {
|
||||||
textPrefix += `: ${entry.amount}`;
|
textPrefix += `: ${entry.amount}`;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (entry.hasOwnProperty("amountTotal")) {
|
if (entry.hasOwnProperty("amountTotal")) {
|
||||||
textPrefix += ` / ${entry.amountTotal}`;
|
textPrefix += ` / ${entry.amountTotal}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (entry.hasOwnProperty("id")) {
|
if (entry.hasOwnProperty("id")) {
|
||||||
|
|
||||||
switch (entry.id) {
|
switch (entry.id) {
|
||||||
|
|
||||||
case "geoRocks":
|
case "geoRocks":
|
||||||
case "itemsDiscovered":
|
case "itemsDiscovered":
|
||||||
textPrefix += `: ${entry.notActivated} | ${entry.activated} | ${entry.discoveredTotal}`;
|
textPrefix += `: ${entry.notActivated} | ${entry.activated} | ${entry.discoveredTotal}`;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "zoteStatus":
|
case "zoteStatus":
|
||||||
case "nailsmithStatus":
|
case "nailsmithStatus":
|
||||||
if (entry.hasOwnProperty("currentName") && entry.hasOwnProperty("currentSpoiler")) {
|
if (entry.hasOwnProperty("currentName") && entry.hasOwnProperty("currentSpoiler")) {
|
||||||
textPrefix = entry[entry.currentName];
|
textPrefix = entry[entry.currentName];
|
||||||
textSuffix = entry[entry.currentSpoiler];
|
textSuffix = entry[entry.currentSpoiler];
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (entry.hasOwnProperty("disabled")) {
|
if (entry.hasOwnProperty("disabled")) {
|
||||||
if (entry.disabled === true) {
|
if (entry.disabled === true) {
|
||||||
textPrefix = `<del>${textPrefix}</del>`;
|
textPrefix = `<del>${textPrefix}</del>`;
|
||||||
|
|
@ -5808,7 +5816,6 @@ function SingleEntryFill(obj) {
|
||||||
if (textSuffix.length && textPrefix.length) textSuffix = `— ${textSuffix}`;
|
if (textSuffix.length && textPrefix.length) textSuffix = `— ${textSuffix}`;
|
||||||
if (textPrefix.includes("<del>")) textSuffix = `<del>${textSuffix}</del>`;
|
if (textPrefix.includes("<del>")) textSuffix = `<del>${textSuffix}</del>`;
|
||||||
}
|
}
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* return [
|
/* return [
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
|
|
@ -152,7 +152,7 @@ function HKCheckCompletion(jsonObject) {
|
||||||
|
|
||||||
// ---------------- Game Completion Status ----------------- //
|
// ---------------- Game Completion Status ----------------- //
|
||||||
|
|
||||||
CheckCompletionPercent(HK.sections.intro, HKPlayerData.completionPercentage);
|
CheckCompletionPercent(HK.sections.intro, HKPlayerData);
|
||||||
|
|
||||||
// ---------------- Game Completion Status ----------------- //
|
// ---------------- Game Completion Status ----------------- //
|
||||||
|
|
||||||
|
|
@ -336,8 +336,22 @@ function PrepareHTMLString(section, textPrefix = "Unknown Completion Element: ",
|
||||||
*/
|
*/
|
||||||
function CurrentDataTrue(section = {}, entry = "") {
|
function CurrentDataTrue(section = {}, entry = "") {
|
||||||
|
|
||||||
|
/* Increase section percentage except the Game Status and Hints sections */
|
||||||
|
switch (section.id) {
|
||||||
|
|
||||||
|
case "hk-intro":
|
||||||
|
case "hk-hints":
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "hk-equipment":
|
||||||
|
|
||||||
|
// double % for equipment
|
||||||
|
section.percent += 2;
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
section.percent++;
|
section.percent++;
|
||||||
if (section.id === "hk-equipment") section.percent++; // double % for equipment
|
}
|
||||||
|
|
||||||
section.entries[entry].icon = "green";
|
section.entries[entry].icon = "green";
|
||||||
}
|
}
|
||||||
|
|
@ -396,14 +410,46 @@ function CheckPlayTime(section, playTime) {
|
||||||
* @param {object} section 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(section, completionPercentage) {
|
function CheckCompletionPercent(section, playerData) {
|
||||||
|
|
||||||
(completionPercentage >= 112) ? CurrentDataTrue(section, "gameCompletion"): CurrentDataFalse(section, "gameCompletion");
|
let completionPercentage = Math.round(playerData.completionPercentage);
|
||||||
|
let maxPercent = 0;
|
||||||
|
|
||||||
|
/* Normal (current) game version behaviour: 112% */
|
||||||
|
section.maxPercent = section.maxPercentDefault;
|
||||||
|
maxPercent = section.maxPercentDefault;
|
||||||
|
section.entries.gameCompletion.spoilerAfter = section.entries.gameCompletion.spoilerAfterDefault;
|
||||||
|
|
||||||
section.percent = completionPercentage;
|
section.percent = completionPercentage;
|
||||||
section.entries.gameCompletion.spoiler = completionPercentage;
|
section.entries.gameCompletion.spoiler = completionPercentage;
|
||||||
|
|
||||||
let textFill = "Game Completion:" + pSpan + "<b>" + completionPercentage + " %</b>" + pSpan + "(out of " + section.maxPercent + " %)";
|
/* Lifeblood behaviour: 107% */
|
||||||
|
if (!playerData.hasOwnProperty("hasGodfinder")) {
|
||||||
|
|
||||||
|
section.maxPercent = section.maxPercentLifeblood;
|
||||||
|
maxPercent = section.maxPercentLifeblood;
|
||||||
|
section.entries.gameCompletion.spoilerAfter = section.entries.gameCompletion.spoilerAfterLifeblood;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Grimm Troupe bahaviour: 106% */
|
||||||
|
if (!playerData.hasOwnProperty("killedHiveKnight")) {
|
||||||
|
|
||||||
|
section.maxPercent = section.maxPercentGrimmTroupe;
|
||||||
|
maxPercent = section.maxPercentGrimmTroupe;
|
||||||
|
section.entries.gameCompletion.spoilerAfter = section.entries.gameCompletion.spoilerAfterGrimmTroupe;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Base Game behaviour with no Content Packs: 100% */
|
||||||
|
if (!playerData.hasOwnProperty("gotCharm_37")) {
|
||||||
|
|
||||||
|
section.maxPercent = section.maxPercentBaseGame;
|
||||||
|
maxPercent = section.maxPercentBaseGame;
|
||||||
|
section.entries.gameCompletion.spoilerAfter = section.entries.gameCompletion.spoilerAfterBaseGame;
|
||||||
|
}
|
||||||
|
|
||||||
|
(completionPercentage >= maxPercent) ? CurrentDataTrue(section, "gameCompletion"): CurrentDataFalse(section, "gameCompletion");
|
||||||
|
|
||||||
|
/* let textFill = "Game Completion:" + pSpan + "<b>" + completionPercentage + " %</b>" + pSpan + "(out of " + section.maxPercent + " %)"; */
|
||||||
// document.getElementById(section.id).innerHTML += divStart + completionSymbol + textFill + divEnd;
|
// document.getElementById(section.id).innerHTML += divStart + completionSymbol + textFill + divEnd;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,10 @@ const HK = {
|
||||||
id: "hk-intro",
|
id: "hk-intro",
|
||||||
percent: 0,
|
percent: 0,
|
||||||
maxPercent: 112,
|
maxPercent: 112,
|
||||||
|
maxPercentDefault: 112,
|
||||||
|
maxPercentBaseGame: 100,
|
||||||
|
maxPercentGrimmTroupe: 106,
|
||||||
|
maxPercentLifeblood: 107,
|
||||||
entries: {
|
entries: {
|
||||||
timePlayed: {
|
timePlayed: {
|
||||||
id: "timePlayed",
|
id: "timePlayed",
|
||||||
|
|
@ -32,6 +36,10 @@ const HK = {
|
||||||
name: "Game Completion:",
|
name: "Game Completion:",
|
||||||
spoiler: 0,
|
spoiler: 0,
|
||||||
spoilerAfter: "(out of 112 %)",
|
spoilerAfter: "(out of 112 %)",
|
||||||
|
spoilerAfterDefault: "(out of 112 %)",
|
||||||
|
spoilerAfterBaseGame: "(out of 100 %)",
|
||||||
|
spoilerAfterGrimmTroupe: "(out of 106 %)",
|
||||||
|
spoilerAfterLifeblood: "(out of 107 %)",
|
||||||
},
|
},
|
||||||
saveVersion: {
|
saveVersion: {
|
||||||
id: "saveVersion",
|
id: "saveVersion",
|
||||||
|
|
|
||||||
|
|
@ -502,7 +502,7 @@ function SectionStart(section) {
|
||||||
/**
|
/**
|
||||||
* Replaces the h2 titles with max percent values as read from the database
|
* Replaces the h2 titles with max percent values as read from the database
|
||||||
*/
|
*/
|
||||||
function CompletionFillNoSave(section) {
|
function CompletionFillNoSave(section) {
|
||||||
|
|
||||||
let id = "";
|
let id = "";
|
||||||
let h2 = "";
|
let h2 = "";
|
||||||
|
|
@ -528,7 +528,7 @@ function SectionStart(section) {
|
||||||
/**
|
/**
|
||||||
* Replaces the h2 titles with a current percent/max percent values as read from the database
|
* Replaces the h2 titles with a current percent/max percent values as read from the database
|
||||||
*/
|
*/
|
||||||
function CompletionFill(section) {
|
function CompletionFill(section) {
|
||||||
|
|
||||||
let h2 = section.h2;
|
let h2 = section.h2;
|
||||||
let h2id = `<h2 id="h2-${section.id}">`;
|
let h2id = `<h2 id="h2-${section.id}">`;
|
||||||
|
|
@ -572,7 +572,7 @@ function SectionStart(section) {
|
||||||
// needed for Game Status to show percentage properly (adds a slash for all boxes except the Game Status one)
|
// needed for Game Status to show percentage properly (adds a slash for all boxes except the Game Status one)
|
||||||
if (section.id != "hk-intro") cp += "/";
|
if (section.id != "hk-intro") cp += "/";
|
||||||
|
|
||||||
fillText = `<div class='percent-box${cl}'>${(section.id === "hk-intro") ? cp: cp + section.maxPercent}%</div>`;
|
fillText = `<div class='percent-box${cl}'>${(section.id === "hk-intro") ? cp: `${cp}${section.maxPercent}`}%</div>`;
|
||||||
}
|
}
|
||||||
|
|
||||||
return `\t${h2id}${h2}${fillText}</h2>\n`;
|
return `\t${h2id}${h2}${fillText}</h2>\n`;
|
||||||
|
|
@ -581,7 +581,7 @@ function SectionStart(section) {
|
||||||
|
|
||||||
/* function SingleEntryFill(section, entry) { */
|
/* function SingleEntryFill(section, entry) { */
|
||||||
function SingleEntryFill(obj) {
|
function SingleEntryFill(obj) {
|
||||||
/*
|
/*
|
||||||
let icon = "";
|
let icon = "";
|
||||||
let iconGreen = SYMBOL_TRUE;
|
let iconGreen = SYMBOL_TRUE;
|
||||||
let iconRed = SYMBOL_FALSE;
|
let iconRed = SYMBOL_FALSE;
|
||||||
|
|
@ -1016,7 +1016,7 @@ function StorageAvailable(type) {
|
||||||
* @param {string} elementId Element ID to update
|
* @param {string} elementId Element ID to update
|
||||||
* @param {string} textFill Updated contents (innerHTML)
|
* @param {string} textFill Updated contents (innerHTML)
|
||||||
*/
|
*/
|
||||||
function FillInnerHTML(elementId, textFill) {
|
function FillInnerHTML(elementId, textFill) {
|
||||||
|
|
||||||
const element = document.getElementById(elementId);
|
const element = document.getElementById(elementId);
|
||||||
element.innerHTML = textFill;
|
element.innerHTML = textFill;
|
||||||
|
|
@ -1028,7 +1028,7 @@ function StorageAvailable(type) {
|
||||||
* @param {string} tooltipId Element ID of the tooltip to update
|
* @param {string} tooltipId Element ID of the tooltip to update
|
||||||
* @param {string} tooltipFill Updated contents of the tooltip
|
* @param {string} tooltipFill Updated contents of the tooltip
|
||||||
*/
|
*/
|
||||||
function SelectCopyInputText(mouseEvent, tooltipId = "", tooltipFill = "") {
|
function SelectCopyInputText(mouseEvent, tooltipId = "", tooltipFill = "") {
|
||||||
|
|
||||||
const element = document.getElementById(mouseEvent.target.id);
|
const element = document.getElementById(mouseEvent.target.id);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue