fill notch images and amount
This commit is contained in:
parent
1c6b009d75
commit
9355accd09
5 changed files with 172 additions and 91 deletions
|
|
@ -450,25 +450,33 @@ function CheckGeo(section, geoValue = 0, geoPoolValue = 0) {
|
|||
* @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(section, totalNotches = 3, filledNotches = 0) {
|
||||
function CheckNotches(section, notchesTotal = 3, notchesFilled = 0) {
|
||||
|
||||
let {
|
||||
overcharmedNotches,
|
||||
unusedNotches
|
||||
notchesOvercharmed,
|
||||
notchesUnused
|
||||
} = 0;
|
||||
|
||||
section.entries.notches.amountTotal = notchesTotal;
|
||||
|
||||
// How many overcharmed notches images to show
|
||||
overcharmedNotches = filledNotches - totalNotches;
|
||||
if (overcharmedNotches < 1) overcharmedNotches = 0;
|
||||
notchesOvercharmed = notchesFilled - notchesTotal;
|
||||
if (notchesOvercharmed < 1) notchesOvercharmed = 0;
|
||||
|
||||
section.entries.notches.amountOvercharmed = notchesOvercharmed;
|
||||
|
||||
// How many unused notches images to show
|
||||
unusedNotches = totalNotches - filledNotches;
|
||||
if (unusedNotches < 1) unusedNotches = 0;
|
||||
notchesUnused = notchesTotal - notchesFilled;
|
||||
if (notchesUnused < 1) notchesUnused = 0;
|
||||
|
||||
section.entries.notches.amountUnused = notchesUnused;
|
||||
|
||||
// Correct number of filled/used notches images to show when player is overcharmed
|
||||
if (filledNotches > totalNotches) filledNotches = totalNotches;
|
||||
if (notchesFilled > notchesTotal) notchesFilled = notchesTotal;
|
||||
|
||||
let icon = SYMBOL_EMPTY;
|
||||
section.entries.notches.amountFilled = notchesFilled;
|
||||
|
||||
/* let icon = SYMBOL_EMPTY;
|
||||
let textFill = `<span>Notches:</span>${pSpan}`;
|
||||
|
||||
let notchImages = "";
|
||||
|
|
@ -477,25 +485,25 @@ function CheckNotches(section, totalNotches = 3, filledNotches = 0) {
|
|||
let notchOvercharmedImage = `<img src='${NOTCH_OVERCHARMED_IMAGE}' class='notch' alt='notch image' title='Charm Notch (Overcharmed)'>`;
|
||||
|
||||
// First check filled (used) notches and fill them (skips if no filled notches)
|
||||
if (filledNotches > 0) {
|
||||
for (let i = 0; i < filledNotches; i++) {
|
||||
if (notchesFilled > 0) {
|
||||
for (let i = 0; i < notchesFilled; i++) {
|
||||
notchImages += notchFilledImage;
|
||||
}
|
||||
}
|
||||
|
||||
// Second check overcharmed notches and fill them (skips if player is not overcharmed)
|
||||
if (overcharmedNotches > 0) {
|
||||
for (let i = 0; i < overcharmedNotches; i++) {
|
||||
if (notchesOvercharmed > 0) {
|
||||
for (let i = 0; i < notchesOvercharmed; i++) {
|
||||
notchImages += notchOvercharmedImage;
|
||||
}
|
||||
}
|
||||
|
||||
// Lastly, fill all unused notches
|
||||
if (unusedNotches > 0) {
|
||||
for (let i = 0; i < unusedNotches; i++) {
|
||||
if (notchesUnused > 0) {
|
||||
for (let i = 0; i < notchesUnused; i++) {
|
||||
notchImages += notchNormalImage;
|
||||
}
|
||||
}
|
||||
} */
|
||||
|
||||
// document.getElementById(section.id).innerHTML += divStartCenter + icon + textFill + notchImages + divEnd;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -59,7 +59,10 @@ const HK = {
|
|||
icon: "none",
|
||||
name: "Notches:",
|
||||
spoiler: "",
|
||||
amountTotal: 3
|
||||
amountTotal: 3,
|
||||
amountFilled: 0,
|
||||
amountUnused: 3,
|
||||
amountOvercharmed: 0
|
||||
},
|
||||
geo: {
|
||||
id: "geo",
|
||||
|
|
|
|||
|
|
@ -281,6 +281,9 @@ function SingleEntryFill(section, entry) {
|
|||
let maskNormal = `<img src='${HEALTH_MASK_IMAGE}' class='health-mask' alt='health mask image' title='Health Mask'>`;
|
||||
let maskSteel = `<img src='${HEALTH_MASK_STEEL_IMAGE}' class='health-mask' alt='steel health mask image' title='Steel Health Mask'>`;
|
||||
let soulNormal = `<img src='${SOUL_ORB_IMAGE}' class='soul-orb' alt='soul orb image' title='Single Soul Orb (one spell cast)'>`;
|
||||
let notchNormalImage = `<img src='${NOTCH_IMAGE}' class='notch' alt='notch image' title='Charm Notch (Free)'>`;
|
||||
let notchFilledImage = `<img src='${NOTCH_FILLED_IMAGE}' class='notch' alt='notch image' title='Charm Notch (Used)'>`;
|
||||
let notchOvercharmedImage = `<img src='${NOTCH_OVERCHARMED_IMAGE}' class='notch' alt='notch image' title='Charm Notch (Overcharmed)'>`;
|
||||
let wiki = "";
|
||||
|
||||
let div = `<div class='single-entry'>`;
|
||||
|
|
@ -348,7 +351,7 @@ function SingleEntryFill(section, entry) {
|
|||
|
||||
(entry.permadeathMode) ? Img = maskSteel: Img = maskNormal;
|
||||
|
||||
for (let i = 0; i < entry.amountTotal; i++) {
|
||||
for (let i = 0, total = entry.amountTotal; i < total; i++) {
|
||||
textSuffix += Img;
|
||||
}
|
||||
|
||||
|
|
@ -369,6 +372,35 @@ function SingleEntryFill(section, entry) {
|
|||
|
||||
break;
|
||||
|
||||
case "notches":
|
||||
div = divFlex;
|
||||
span = ["", ""];
|
||||
|
||||
/* First, check filled (used) notches and fill them (skips if no filled notches) */
|
||||
if (entry.amountFilled > 0) {
|
||||
for (let i = 0, total = entry.amountFilled; i < total; i++) {
|
||||
textSuffix += notchFilledImage;
|
||||
}
|
||||
}
|
||||
|
||||
/* Second, check overcharmed notches and fill them (skips if player is not overcharmed) */
|
||||
if (entry.amountOvercharmed > 0) {
|
||||
for (let i = 0, total = entry.amountOvercharmed; i < total; i++) {
|
||||
textSuffix += notchOvercharmedImage;
|
||||
}
|
||||
}
|
||||
|
||||
/* Last, fill all unused notches */
|
||||
if (entry.amountUnused > 0) {
|
||||
for (let i = 0, total = entry.amountUnused; i < total; i++) {
|
||||
textSuffix += notchNormalImage;
|
||||
}
|
||||
}
|
||||
|
||||
textSuffix += `${p}<sup>(${entry.amountTotal})</sup>`;
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue