From d3b10b4a60f88bb2e2660b71fd2c1b963835144c Mon Sep 17 00:00:00 2001 From: lowercasedonkey <lowercasedonkey@gmail.com> Date: Sun, 26 Jul 2020 23:38:01 -0400 Subject: [PATCH] wig dye --- src/js/salon.js | 76 +++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 71 insertions(+), 5 deletions(-) diff --git a/src/js/salon.js b/src/js/salon.js index f3fe58c862d..58da243baba 100644 --- a/src/js/salon.js +++ b/src/js/salon.js @@ -320,15 +320,20 @@ App.Medicine.Salon.hair = function(slave, {primaryHairColor = 0, secondaryHairCo const frag = new DocumentFragment(); let updatePrimary = (newVal) => { primaryHairColor = newVal; apply(); }; let updateSecondary = (newVal) => { secondaryHairColor = newVal; apply(); }; - const {His, his} = getPronouns(slave); - let div; - let p; + const {His, his, He} = getPronouns(slave); if (slave.bald !== 1) { frag.append(hairDye()); frag.append(hairStyle()); frag.append(hairLength()); frag.append(hairMaint()); + } else { + // Bald + if (slave.hStyle === "bald") { + frag.append(`${He} is completely bald.`); + } else { + frag.append(wigDye()); + } } return jQuery("#salonHair").empty().append(frag); @@ -336,7 +341,7 @@ App.Medicine.Salon.hair = function(slave, {primaryHairColor = 0, secondaryHairCo const frag = new DocumentFragment(); let div; let p; - frag.append(`${His} hair is ${slave.earTColor}.`); + frag.append(`${His} hair is ${slave.hColor}.`); div = document.createElement("div"); div.classList.add("choices"); @@ -353,7 +358,7 @@ App.Medicine.Salon.hair = function(slave, {primaryHairColor = 0, secondaryHairCo div.append(" or "); App.UI.DOM.appendNewElement("span", div, "choose a new one: ", "note"); } else { - App.UI.DOM.appendNewElement("span", div, `Choose a dye color before dyeing ${his} ears:`, "note"); + App.UI.DOM.appendNewElement("span", div, `Choose a dye color before dyeing ${his} hair:`, "note"); } frag.append(div); @@ -503,6 +508,65 @@ App.Medicine.Salon.hair = function(slave, {primaryHairColor = 0, secondaryHairCo return div; } + function wigDye() { + const frag = new DocumentFragment(); + let div; + let p; + frag.append(`${His} current wig is ${slave.hColor}.`); + + div = document.createElement("div"); + div.classList.add("choices"); + if (slave.origHColor !== slave.hColor) { + div.append( + App.UI.DOM.link( + "Remove wig", + () => { + slave.hStyle = "bald"; + slave.hLength = 0; + // I'm not going to charge you for taking off a fucking wig. + apply(); + } + ) + ); + div.append(" or "); + App.UI.DOM.appendNewElement("span", div, "choose a new one: ", "note"); + } else { + App.UI.DOM.appendNewElement("span", div, `Choose a wig color:`, "note"); + } + frag.append(div); + + div = document.createElement("div"); + div.classList.add("choices"); + div.append(`Colors:`); + div.append(createList(App.Medicine.Modification.Color.Primary, updatePrimary)); + frag.append(div); + + + div = document.createElement("div"); + div.classList.add("choices"); + div.append(`Highlights:`); + div.append(createList(App.Medicine.Modification.Color.Secondary, updateSecondary)); + frag.append(div); + + if (primaryHairColor !== 0) { + p = document.createElement("p"); + p.classList.add("choices"); + p.append( + App.UI.DOM.link( + `Change`, + () => { + slave.earTColor = (primaryHairColor + secondaryHairColor); + cashX(forceNeg(V.modCost), "slaveMod", slave); + App.Medicine.Salon.hair(slave); // discard selections after locking them in. + } + ) + ); + p.append(` ${his} wig color to ${primaryHairColor}${secondaryHairColor} now?`); + frag.append(p); + } + return frag; + } + function createList(array, method) { const links = []; for (const item of array) { @@ -522,6 +586,8 @@ App.Medicine.Salon.hair = function(slave, {primaryHairColor = 0, secondaryHairCo return App.UI.DOM.generateLinksStrip(links); } + + function apply() { App.Medicine.Salon.hair( slave, -- GitLab