diff --git a/src/endWeek/saRecruitGirls.js b/src/endWeek/saRecruitGirls.js index 2780ac1f5b4062466dcd5aa34449c03f1da3ad8a..781b51e2c80e6e5921df4fdd31e4317554f60a12 100644 --- a/src/endWeek/saRecruitGirls.js +++ b/src/endWeek/saRecruitGirls.js @@ -1665,7 +1665,7 @@ App.SlaveAssignment.recruitGirls = (function() { } else if (slave.trust + slave.devotion < 175) { pushFS(`${He} is willing to take part in bloodletting, but the public doesn't find that believable.`); } else if (slave.bellyPreg >= 1500) { - pushFS(`${He} is willing to take part in bloodletting, but the public absolutely refuses to do such a thing to a pregnant $girl.`); + pushFS(`${He} is willing to take part in bloodletting, but the public absolutely refuses to do such a thing to a pregnant ${girl}.`); } else { pushFS(`${He} is willing to take part in bloodletting, but the public finds it wrong to impose on someone not in the absolute best of health.`); } @@ -1683,7 +1683,7 @@ App.SlaveAssignment.recruitGirls = (function() { } } if (slaveInt > 15) { - pushFS(`${He} puts ${his} mind to work as ${he} joins citizens in their prayers to each diety.`); + pushFS(`${He} puts ${his} mind to work as ${he} joins citizens in their prayers to each deity.`); FSdefend++; seed += 1; } else { diff --git a/src/interaction/siCustom.js b/src/interaction/siCustom.js index fe81a8a2ccf381ea7503fc1768650a0bfda92b6d..66754c49fbbd36f3442515492c7268b7e2a63002 100644 --- a/src/interaction/siCustom.js +++ b/src/interaction/siCustom.js @@ -1,858 +1,763 @@ -App.UI.SlaveInteract.custom = (function() { - let el; - let label; - let result; - let textbox; - return custom; - - function custom(slave) { - let title; - el = document.createElement('div'); - - el.appendChild(intro(slave)); - - title = document.createElement('h3'); - title.textContent = `Art`; - el.appendChild(title); - el.appendChild(customSlaveImage(slave)); - el.appendChild(customHairImage(slave)); - - title = document.createElement('h3'); - title.textContent = `Names`; - el.appendChild(title); - el.appendChild(playerTitle(slave)); - el.appendChild(slaveFullName(slave)); - - title = document.createElement('h3'); - title.textContent = `Description`; - el.appendChild(title); - el.appendChild(hair(slave)); - el.appendChild(eyeColor(slave)); - el.appendChild(customTattoo(slave)); - el.appendChild(customOriginStory(slave)); - el.appendChild(customDescription(slave)); - el.appendChild(customLabel(slave)); +App.UI.SlaveInteract.custom = function(slave) { + const el = document.createElement("p"); + el.id = "si-custom"; + el.append(custom()); + return el; + + function custom() { + const { + He, His, + he, his, him, + } = getPronouns(slave); + + const el = document.createElement('div'); + + el.appendChild(intro()); + + App.UI.DOM.appendNewElement("h3", el, `Art`); + el.appendChild(customSlaveImage()); + el.appendChild(customHairImage()); + + App.UI.DOM.appendNewElement("h3", el, `Names`); + el.appendChild(playerTitle()); + el.appendChild(slaveFullName()); + + App.UI.DOM.appendNewElement("h3", el, `Description`); + el.appendChild(hair()); + el.appendChild(eyeColor()); + el.appendChild(customTattoo()); + el.appendChild(customOriginStory()); + el.appendChild(customDescription()); + el.appendChild(customLabel()); return el; - } - function intro(slave) { - const frag = new DocumentFragment(); - let p; - p = document.createElement('p'); - p.id = "rename"; - frag.append(p); - - p = document.createElement('p'); - p.className = "scene-p"; - p.append(`You may enter custom descriptors for your slave's hair color, hair style, tattoos, or anything else here. After typing, press `); - p.appendChild(App.UI.DOM.makeElement("kbd", "enter")); - p.append(` to commit your change. These custom descriptors will appear in descriptions of your slave, but will have no gameplay effect. Changing them is free.`); - frag.append(p); - return frag; - } + function intro() { + const frag = new DocumentFragment(); + let p; + p = document.createElement('p'); + p.id = "rename"; + frag.append(p); + + p = document.createElement('p'); + p.className = "scene-p"; + p.append(`You may enter custom descriptors for your slave's hair color, hair style, tattoos, or anything else here. After typing, press `); + p.appendChild(App.UI.DOM.makeElement("kbd", "enter")); + p.append(` to commit your change. These custom descriptors will appear in descriptions of your slave, but will have no gameplay effect. Changing them is free.`); + frag.append(p); + return frag; + } - function playerTitle(slave) { - const { - // eslint-disable-next-line no-unused-vars - he, - him, - his, - hers, - himself, - boy, - He, - His - } = getPronouns(slave); - let playerTitle = document.createElement('p'); - label = document.createElement('div'); - if (slave.devotion >= -50) { - if (slave.custom.title !== "") { - label.textContent = `You have instructed ${him} to always refer to you as ${slave.custom.title}, which, should ${he} lisp, comes out as ${slave.custom.titleLisp}.`; - } else { - label.textContent = `You expect ${him} to refer to you as all your other slaves do.`; - } - result = document.createElement('div'); - result.id = "result"; - result.className = "choices"; - - let hiddenTextBox = document.createElement('span'); - let shownTextBox = document.createElement('span'); - if (slave.custom.title === "") { - hiddenTextBox.appendChild( - App.UI.DOM.link( - `Set a custom title for ${him} to address you as`, - () => { - jQuery('#result').empty().append(shownTextBox); - } - ) - ); - result.appendChild(hiddenTextBox); - shownTextBox.textContent = `Custom title: `; - textbox = App.UI.DOM.makeTextBox( - "", - v => { - slave.custom.title = v; - jQuery('#result').empty().append( - document.createTextNode(`${He}'ll try ${his} best to call you ${slave.custom.title}.`) - ); - slave.custom.titleLisp = lispReplace(slave.custom.title); - }); - shownTextBox.appendChild(textbox); - } else { - result.append(`${He}'s trying ${his} best to call you `); - textbox = App.UI.DOM.makeTextBox( - slave.custom.title, - v => { - slave.custom.title = v; - jQuery('#result').empty().append( - document.createTextNode(`${He}'ll try ${his} best to call you ${slave.custom.title}.`) - ); - slave.custom.titleLisp = lispReplace(slave.custom.title); - }); - result.appendChild(textbox); - result.appendChild( - App.UI.DOM.link( - ` Stop using a custom title`, - () => { - jQuery('#result').empty().append( - document.createTextNode(`${He} will no longer refer to you with a special title.`) - ); - slave.custom.title = ""; - slave.custom.titleLisp = ""; - } - ) - ); - } - label.appendChild(result); - } else { - label.textContent = `You must break ${his} will further before ${he} will refer to you by a new title. `; - if (SlaveStatsChecker.checkForLisp(slave)) { - if (slave.custom.titleLisp && slave.custom.titleLisp !== "") { - label.textContent += `For now, ${he} intends to keep calling you "${slave.custom.titleLisp}."`; + function playerTitle() { + let playerTitle = document.createElement('p'); + const label = document.createElement('div'); + let result; + if (slave.devotion >= -50) { + if (slave.custom.title !== "") { + label.textContent = `You have instructed ${him} to always refer to you as ${slave.custom.title}, which, should ${he} lisp, comes out as ${slave.custom.titleLisp}.`; + } else { + label.textContent = `You expect ${him} to refer to you as all your other slaves do.`; + } + result = document.createElement('div'); + result.id = "result"; + result.className = "choices"; + + let hiddenTextBox = document.createElement('span'); + let shownTextBox = document.createElement('span'); + if (slave.custom.title === "") { + hiddenTextBox.appendChild( + App.UI.DOM.link( + `Set a custom title for ${him} to address you as`, + () => { + jQuery('#result').empty().append(shownTextBox); + } + ) + ); + result.appendChild(hiddenTextBox); + shownTextBox.textContent = `Custom title: `; + shownTextBox.append( + App.UI.DOM.makeTextBox( + "", + v => { + slave.custom.title = v; + jQuery('#result').empty().append( + document.createTextNode(`${He}'ll try ${his} best to call you ${slave.custom.title}.`) + ); + slave.custom.titleLisp = lispReplace(slave.custom.title); + } + ) + ); + } else { + result.append(`${He}'s trying ${his} best to call you `); + result.append( + App.UI.DOM.makeTextBox( + slave.custom.title, + v => { + slave.custom.title = v; + jQuery('#result').empty().append( + document.createTextNode(`${He}'ll try ${his} best to call you ${slave.custom.title}.`) + ); + slave.custom.titleLisp = lispReplace(slave.custom.title); + } + ) + ); + result.appendChild( + App.UI.DOM.link( + ` Stop using a custom title`, + () => { + jQuery('#result').empty().append( + document.createTextNode(`${He} will no longer refer to you with a special title.`) + ); + slave.custom.title = ""; + slave.custom.titleLisp = ""; + } + ) + ); } + label.appendChild(result); } else { - if (slave.custom.title && slave.custom.title !== "") { - label.textContent += `For now, ${he} intends to keep calling you "${slave.custom.title}."`; + label.textContent = `You must break ${his} will further before ${he} will refer to you by a new title. `; + if (SlaveStatsChecker.checkForLisp(slave)) { + if (slave.custom.titleLisp && slave.custom.titleLisp !== "") { + label.textContent += `For now, ${he} intends to keep calling you "${slave.custom.titleLisp}."`; + } + } else { + if (slave.custom.title && slave.custom.title !== "") { + label.textContent += `For now, ${he} intends to keep calling you "${slave.custom.title}."`; + } } } - } - playerTitle.appendChild(label); - return playerTitle; - } - - function slaveFullName(slave) { - const { - // eslint-disable-next-line no-unused-vars - he, - him, - his, - hers, - himself, - boy, - He, - His - } = getPronouns(slave); - let slaveFullNameNode = document.createElement('span'); - if ( - ((slave.devotion >= -50 || slave.trust < -20) && (slave.birthName !== slave.slaveName)) || - (slave.devotion > 20 || slave.trust < -20) - ) { - slaveFullNameNode.appendChild(slaveName()); - slaveFullNameNode.appendChild(slaveSurname()); - } else { - slaveFullNameNode.textContent = `You must break ${his} will further before you can successfully force a new name on ${him}.`; - slaveFullNameNode.className = "note"; + playerTitle.appendChild(label); + return playerTitle; } - return slaveFullNameNode; - - function slaveName() { - const oldName = slave.slaveName; - const oldSurname = slave.slaveSurname; - // Slave Name - let slaveNameNode = document.createElement('p'); - label = document.createElement('div'); - result = document.createElement('div'); - result.id = "result"; - result.className = "choices"; - const linkArray = []; - - label.append(`Change ${his} given name`); - if (slave.birthName !== slave.slaveName) { - label.append(` (${his} birth name was ${slave.birthName})`); + function slaveFullName() { + let slaveFullNameNode = document.createElement('span'); + if ( + ((slave.devotion >= -50 || slave.trust < -20) && (slave.birthName !== slave.slaveName)) || + (slave.devotion > 20 || slave.trust < -20) + ) { + slaveFullNameNode.appendChild(slaveName()); + slaveFullNameNode.appendChild(slaveSurname()); + } else { + slaveFullNameNode.textContent = `You must break ${his} will further before you can successfully force a new name on ${him}.`; + slaveFullNameNode.className = "note"; } - label.append(`: `); - textbox = App.UI.DOM.makeTextBox( - slave.slaveName, - v => { - slave.slaveName = v; - updateName(slave, {oldName: oldName, oldSurname: oldSurname}); - }, - false, - ); - label.appendChild(textbox); + return slaveFullNameNode; + + function slaveName() { + const oldName = slave.slaveName; + const oldSurname = slave.slaveSurname; + // Slave Name + let slaveNameNode = document.createElement('p'); + let label = document.createElement('div'); + let result = document.createElement('div'); + result.id = "result"; + result.className = "choices"; + const linkArray = []; + + label.append(`Change ${his} given name`); + if (slave.birthName !== slave.slaveName) { + label.append(` (${his} birth name was ${slave.birthName})`); + } + label.append(`: `); - slaveNameNode.appendChild(label); + label.append( + App.UI.DOM.makeTextBox( + slave.slaveName, + v => { + slave.slaveName = v; + updateName(slave, {oldName: oldName, oldSurname: oldSurname}); + }, + false, + ) + ); - if (slave.slaveName === slave.birthName) { - linkArray.push(App.UI.DOM.disabledLink(`${He} has ${his} birth name`, [`Nothing to reset`])); - } else { - linkArray.push(App.UI.DOM.link( - `Restore ${his} birth name`, - () => { - slave.slaveName = slave.birthName; - updateName(slave, {oldName: oldName, oldSurname: oldSurname}); - }, - false, - )); - } + slaveNameNode.appendChild(label); + + if (slave.slaveName === slave.birthName) { + linkArray.push(App.UI.DOM.disabledLink(`${He} has ${his} birth name`, [`Nothing to reset`])); + } else { + linkArray.push(App.UI.DOM.link( + `Restore ${his} birth name`, + () => { + slave.slaveName = slave.birthName; + updateName(slave, {oldName: oldName, oldSurname: oldSurname}); + }, + false, + )); + } - if (V.arcologies[0].FSPastoralist !== "unset") { - if (slave.lactation > 0) { - linkArray.push(chooseThreeNames(`Choose a random cow name for ${him}`, setup.cowSlaveNames, "cow-names")); + if (V.arcologies[0].FSPastoralist !== "unset") { + if (slave.lactation > 0) { + linkArray.push(chooseThreeNames(`Choose a random cow name for ${him}`, setup.cowSlaveNames, "cow-names")); + } } - } - if (V.arcologies[0].FSIntellectualDependency !== "unset") { - if (slave.intelligence + slave.intelligenceImplant < -10) { - linkArray.push(chooseThreeNames(`Give ${him} a random stripper given name`, setup.bimboSlaveNames, "bimbo-names")); + if (V.arcologies[0].FSIntellectualDependency !== "unset") { + if (slave.intelligence + slave.intelligenceImplant < -10) { + linkArray.push(chooseThreeNames(`Give ${him} a random stripper given name`, setup.bimboSlaveNames, "bimbo-names")); + } } - } - if (V.arcologies[0].FSChattelReligionist !== "unset") { - linkArray.push(chooseThreeNames(`Give ${him} a random devotional given name`, setup.chattelReligionistSlaveNames, "devotional-names")); - } - result.append(App.UI.DOM.generateLinksStrip(linkArray)); - slaveNameNode.appendChild(result); - return slaveNameNode; - - function chooseThreeNames(title, array, id) { - const el = document.createElement("span"); - el.id = id; - el.append( - App.UI.DOM.link( - title, - () => { - linkGuts(); - } - ) - ); - return el; - function linkGuts() { - // Randomize the array - const shuffled = array.sort(() => 0.5 - Math.random()); - - // Get the first three new names - const names = []; - for (let i = 0; names.length < 3; i++) { - if (i > shuffled.length) { - break; - } - if (shuffled[i] !== slave.slaveName) { - names.push(shuffled[i]); + if (V.arcologies[0].FSChattelReligionist !== "unset") { + linkArray.push(chooseThreeNames(`Give ${him} a random devotional given name`, setup.chattelReligionistSlaveNames, "devotional-names")); + } + result.append(App.UI.DOM.generateLinksStrip(linkArray)); + slaveNameNode.appendChild(result); + return slaveNameNode; + + function chooseThreeNames(title, array, id) { + const el = document.createElement("span"); + el.id = id; + el.append( + App.UI.DOM.link( + title, + () => { + linkGuts(); + } + ) + ); + return el; + function linkGuts() { + // Randomize the array + const shuffled = array.sort(() => 0.5 - Math.random()); + + // Get the first three new names + const names = []; + for (let i = 0; names.length < 3; i++) { + if (i > shuffled.length) { + break; + } + if (shuffled[i] !== slave.slaveName) { + names.push(shuffled[i]); + } } - } - // return the three names as links - const nameLinks = []; - for (const name of names) { + // return the three names as links + const nameLinks = []; + for (const name of names) { + nameLinks.push( + App.UI.DOM.link( + name, + () => { + slave.slaveName = name; + updateName(slave, {oldName: oldName, oldSurname: oldSurname}); + } + ) + ); + } nameLinks.push( App.UI.DOM.link( - name, + "...", () => { - slave.slaveName = name; - updateName(slave, {oldName: oldName, oldSurname: oldSurname}); + linkGuts(); } ) ); + jQuery(`#${id}`).empty().append(App.UI.DOM.generateLinksStrip(nameLinks)); } - nameLinks.push( - App.UI.DOM.link( - "...", - () => { - linkGuts(); - } - ) - ); - jQuery(`#${id}`).empty().append(App.UI.DOM.generateLinksStrip(nameLinks)); } } - } - function slaveSurname() { - // Slave Surname - const oldName = slave.slaveName; - const oldSurname = slave.slaveSurname; - let slaveSurnameNode = document.createElement('p'); - label = document.createElement('div'); - result = document.createElement('div'); - result.id = "result"; - result.className = "choices"; - - label.append(`Change ${his} surname`); - if (slave.birthSurname !== slave.slaveSurname) { - label.append(` (${his} birth surname was ${slave.birthSurname})`); - } - label.append(`: `); - - textbox = App.UI.DOM.makeTextBox( - slave.slaveSurname, - v => { - slave.slaveSurname = textbox.value; - updateName(slave, {oldName: oldName, oldSurname: oldSurname}); - }, - false, - ); - label.appendChild(textbox); + function slaveSurname() { + // Slave Surname + const oldName = slave.slaveName; + const oldSurname = slave.slaveSurname; + const linkArray = []; + let slaveSurnameNode = document.createElement('p'); + let label = document.createElement('div'); + let result = document.createElement('div'); + result.id = "result"; + result.className = "choices"; + + label.append(`Change ${his} surname`); + if (slave.birthSurname !== slave.slaveSurname) { + label.append(` (${his} birth surname was ${slave.birthSurname})`); + } + label.append(`: `); - slaveSurnameNode.appendChild(label); + label.append( + App.UI.DOM.makeTextBox( + slave.slaveSurname, + v => { + slave.slaveSurname = v; + updateName(slave, {oldName: oldName, oldSurname: oldSurname}); + }, + false, + ) + ); - if (slave.slaveSurname === slave.birthSurname) { - result.append(` ${He} has ${his} birth surname`); - } else { - result.appendChild(App.UI.DOM.link( - ` Restore ${his} birth surname`, - () => { - slave.slaveSurname = slave.birthSurname; - updateName(slave, {oldName: oldName, oldSurname: oldSurname}); - }, - false, - )); - } + slaveSurnameNode.appendChild(label); - if (slave.slaveSurname) { - result.append(` | `); - result.appendChild(App.UI.DOM.link( - `Take ${his} surname away`, - () => { - slave.slaveSurname = 0; - updateName(slave, {oldName: oldName, oldSurname: oldSurname}); - }, - false, - )); - } - if (slave.relationship >= 5) { - const spouse = getSlave(slave.relationshipTarget); - if (spouse.slaveSurname && slave.slaveSurname !== spouse.slaveSurname) { - result.append(` | `); - const wifePronouns = getPronouns(spouse); - result.appendChild(App.UI.DOM.link( - `Give ${him} ${his} ${wifePronouns.wife}'s surname`, + if (slave.slaveSurname === slave.birthSurname) { + linkArray.push( + App.UI.DOM.disabledLink( + `Restore ${his} birth surname`, + [`${He} has ${his} birth surname`] + ) + ); + } else { + linkArray.push(App.UI.DOM.link( + ` Restore ${his} birth surname`, () => { - slave.slaveSurname = spouse.slaveSurname; + slave.slaveSurname = slave.birthSurname; updateName(slave, {oldName: oldName, oldSurname: oldSurname}); }, false, )); } - } - if (slave.relationship === -3) { - if (V.PC.slaveSurname && slave.slaveSurname !== V.PC.slaveSurname) { - result.append(` | `); - result.appendChild(App.UI.DOM.link( - `Give ${him} your surname`, + + if (slave.slaveSurname) { + linkArray.push(App.UI.DOM.link( + `Take ${his} surname away`, () => { - slave.slaveSurname = V.PC.slaveSurname; + slave.slaveSurname = 0; updateName(slave, {oldName: oldName, oldSurname: oldSurname}); }, false, )); } + if (slave.relationship >= 5) { + const spouse = getSlave(slave.relationshipTarget); + if (spouse.slaveSurname && slave.slaveSurname !== spouse.slaveSurname) { + const wifePronouns = getPronouns(spouse); + linkArray.push( + App.UI.DOM.link( + `Give ${him} ${his} ${wifePronouns.wife}'s surname`, + () => { + slave.slaveSurname = spouse.slaveSurname; + updateName(slave, {oldName: oldName, oldSurname: oldSurname}); + }, + false, + ) + ); + } + } + if (slave.relationship === -3) { + if (V.PC.slaveSurname && slave.slaveSurname !== V.PC.slaveSurname) { + linkArray.push( + App.UI.DOM.link( + `Give ${him} your surname`, + () => { + slave.slaveSurname = V.PC.slaveSurname; + updateName(slave, {oldName: oldName, oldSurname: oldSurname}); + }, + false, + ) + ); + } + } + if (V.arcologies[0].FSRomanRevivalist !== "unset") { + linkArray.push( + App.UI.DOM.link( + `Give ${him} a random full Roman name`, + () => { + slave.slaveName = setup.romanSlaveNames.random(); + slave.slaveSurname = setup.romanSlaveSurnames.random(); + updateName(slave, {oldName: oldName, oldSurname: oldSurname}); + }, + false, + ) + ); + } else if (V.arcologies[0].FSAztecRevivalist !== "unset") { + linkArray.push( + App.UI.DOM.link( + `Give ${him} a random full Aztec name`, + () => { + slave.slaveName = setup.aztecSlaveNames.random(); + slave.slaveSurname = 0; + updateName(slave, {oldName: oldName, oldSurname: oldSurname}); + }, + false, + ) + ); + } else if (V.arcologies[0].FSEgyptianRevivalist !== "unset") { + linkArray.push( + App.UI.DOM.link( + `Give ${him} a random full ancient Egyptian name`, + () => { + slave.slaveName = setup.ancientEgyptianSlaveNames.random(); + slave.slaveSurname = 0; + updateName(slave, {oldName: oldName, oldSurname: oldSurname}); + }, + false, + ) + ); + } else if (V.arcologies[0].FSEdoRevivalist !== "unset") { + linkArray.push( + App.UI.DOM.link( + `Give ${him} a random full feudal Japanese name`, + () => { + slave.slaveName = setup.edoSlaveNames.random(); + slave.slaveSurname = setup.edoSlaveSurnames.random(); + updateName(slave, {oldName: oldName, oldSurname: oldSurname}); + }, + false, + ) + ); + } + if (V.arcologies[0].FSDegradationist > -1) { + linkArray.push( + App.UI.DOM.link( + `Give ${him} a degrading full name`, + () => { + DegradingName(slave); + updateName(slave, {oldName: oldName, oldSurname: oldSurname}); + }, + false, + ) + ); + } + result.append(App.UI.DOM.generateLinksStrip(linkArray)); + slaveSurnameNode.appendChild(result); + return slaveSurnameNode; } - if (V.arcologies[0].FSRomanRevivalist !== "unset") { - result.append(` | `); - result.appendChild(App.UI.DOM.link( - `Give ${him} a random full Roman name`, - () => { - slave.slaveName = setup.romanSlaveNames.random(); - slave.slaveSurname = setup.romanSlaveSurnames.random(); - updateName(slave, {oldName: oldName, oldSurname: oldSurname}); - }, - false, - )); - } else if (V.arcologies[0].FSAztecRevivalist !== "unset") { - result.append(` | `); - result.appendChild(App.UI.DOM.link( - `Give ${him} a random full Aztec name`, - () => { - slave.slaveName = setup.aztecSlaveNames.random(); - slave.slaveSurname = 0; - updateName(slave, {oldName: oldName, oldSurname: oldSurname}); - }, - false, - )); - } else if (V.arcologies[0].FSEgyptianRevivalist !== "unset") { - result.append(` | `); - result.appendChild(App.UI.DOM.link( - `Give ${him} a random full ancient Egyptian name`, - () => { - slave.slaveName = setup.ancientEgyptianSlaveNames.random(); - slave.slaveSurname = 0; - updateName(slave, {oldName: oldName, oldSurname: oldSurname}); - }, - false, - )); - } else if (V.arcologies[0].FSEdoRevivalist !== "unset") { - result.append(` | `); - result.appendChild(App.UI.DOM.link( - `Give ${him} a random full feudal Japanese name`, - () => { - slave.slaveName = setup.edoSlaveNames.random(); - slave.slaveSurname = setup.edoSlaveSurnames.random(); - updateName(slave, {oldName: oldName, oldSurname: oldSurname}); - }, - false, - )); - } - if (V.arcologies[0].FSDegradationist > -1) { - result.append(` | `); - result.appendChild(App.UI.DOM.link( - `Give ${him} a degrading full name`, - () => { - DegradingName(slave); - updateName(slave, {oldName: oldName, oldSurname: oldSurname}); - }, - false, - )); + function updateName(slave, {oldName: oldName, oldSurname: oldSurname}) { + App.UI.SlaveInteract.rename(slave, {oldName: oldName, oldSurname: oldSurname}); + refresh(); } - slaveSurnameNode.appendChild(result); - return slaveSurnameNode; - } - function updateName(slave, {oldName: oldName, oldSurname: oldSurname}) { - App.UI.SlaveInteract.custom(slave); - App.UI.SlaveInteract.rename(slave, {oldName: oldName, oldSurname: oldSurname}); } - } - /** - * @param {App.Entity.SlaveState} slave - */ - function hair(slave) { - let hairNode = new DocumentFragment(); - const { - // eslint-disable-next-line no-unused-vars - he, - him, - his, - hers, - himself, - boy, - He, - His - } = getPronouns(slave); + function hair() { + let hairNode = new DocumentFragment(); + hairNode.appendChild(hairStyle()); + hairNode.appendChild(hairColor()); + return hairNode; + + function hairStyle() { + let hairStyleNode = document.createElement('p'); + let label = document.createElement('div'); + label.append(`Custom hair description: `); + + label.append( + App.UI.DOM.makeTextBox( + slave.hStyle, + v => { + slave.hStyle = v; + refresh(); + } + ) + ); - hairNode.appendChild(hairStyle()); - hairNode.appendChild(hairColor()); - return hairNode; + switch (slave.hStyle) { + case "tails": + case "dreadlocks": + case "cornrows": + label.append(` "${His} hair is in ${slave.hStyle}."`); + break; + case "ponytail": + label.append(` "${His} hair is in a ${slave.hStyle}."`); + break; + default: + label.append(` "${His} hair is ${slave.hStyle}."`); + break; + } + hairStyleNode.appendChild(label); - function hairStyle() { - let hairStyleNode = document.createElement('p'); - let label = document.createElement('div'); - label.append(`Custom hair description: `); + let choices = document.createElement('div'); + choices.className = "choices"; + choices.appendChild(App.UI.DOM.makeElement('span', ` For best results, use a short, uncapitalized and unpunctuated description; for example: 'back in a ponytail'`, 'note')); + hairStyleNode.appendChild(choices); + return hairStyleNode; + } - let textbox = App.UI.DOM.makeTextBox( - slave.hStyle, - v => { - slave.hStyle = v; - App.UI.SlaveInteract.custom(slave); - }); - label.appendChild(textbox); - - switch (slave.hStyle) { - case "tails": - case "dreadlocks": - case "cornrows": - label.append(` "${His} hair is in ${slave.hStyle}."`); - break; - case "ponytail": - label.append(` "${His} hair is in a ${slave.hStyle}."`); - break; - default: - label.append(` "${His} hair is ${slave.hStyle}."`); - break; + function hairColor() { + let hairStyleNode = document.createElement('p'); + let label = document.createElement('div'); + label.append(`Custom hair color: `); + label.append( + App.UI.DOM.makeTextBox( + slave.hColor, + v => { + slave.hColor = v; + refresh(); + } + ) + ); + label.append(` "${His} hair is ${slave.hColor}."`); + hairStyleNode.appendChild(label); + + let choices = document.createElement('div'); + choices.className = "choices"; + choices.appendChild(App.UI.DOM.makeElement('span', ` For best results, use a short, uncapitalized and unpunctuated description; for example: 'black with purple highlights'`, 'note')); + hairStyleNode.appendChild(choices); + return hairStyleNode; + } + } + + function eyeColor() { + let eyeColorNode = document.createElement('p'); + let label = document.createElement('div'); + if (getLenseCount(slave) > 0) { + label.textContent = `${He} is wearing ${App.Desc.eyesColor(slave, "", "lense", "lenses")}.`; + } else { + label.textContent = `${He} has ${App.Desc.eyesColor(slave)}.`; } - hairStyleNode.appendChild(label); + eyeColorNode.appendChild(label); let choices = document.createElement('div'); choices.className = "choices"; - choices.appendChild(App.UI.DOM.makeElement('span', ` For best results, use a short, uncapitalized and unpunctuated description; for example: 'back in a ponytail'`, 'note')); - hairStyleNode.appendChild(choices); - return hairStyleNode; - } - function hairColor() { - let hairStyleNode = document.createElement('p'); - let label = document.createElement('div'); - label.append(`Custom hair color: `); + let eye; + + if (hasLeftEye(slave)) { + eye = document.createElement('div'); + eye.append(`Custom left eye color: `); + eye.append( + App.UI.DOM.makeTextBox( + slave.eye.left.iris, + v => { + slave.eye.left.iris = v; + refresh(); + } + ) + ); + choices.appendChild(eye); + } + if (hasRightEye(slave)) { + eye = document.createElement('div'); + eye.append(`Custom right eye color: `); + eye.append( + App.UI.DOM.makeTextBox( + slave.eye.right.iris, + v => { + slave.eye.right.iris = v; + refresh(); + } + ) + ); + choices.appendChild(eye); + } + choices.appendChild(App.UI.DOM.makeElement('span', `For best results, use a short, uncapitalized and unpunctuated description; for example: 'blue'`, 'note')); + eyeColorNode.appendChild(choices); + return eyeColorNode; + } - let textbox = App.UI.DOM.makeTextBox( - slave.hColor, + function customTattoo() { + let el = document.createElement('p'); + el.append(`Change ${his} custom tattoo: `); + el.appendChild(App.UI.DOM.makeTextBox( + slave.custom.tattoo, v => { - slave.hColor = v; - App.UI.SlaveInteract.custom(slave); - }); - label.appendChild(textbox); - label.append(` "${His} hair is ${slave.hColor}."`); - hairStyleNode.appendChild(label); + slave.custom.tattoo = v; + refresh(); + })); let choices = document.createElement('div'); choices.className = "choices"; - choices.appendChild(App.UI.DOM.makeElement('span', ` For best results, use a short, uncapitalized and unpunctuated description; for example: 'black with purple highlights'`, 'note')); - hairStyleNode.appendChild(choices); - return hairStyleNode; - } - } + choices.appendChild(App.UI.DOM.makeElement('span', `For best results, use complete sentences; for example: '${He} has blue stars tattooed along ${his} cheekbones.'`, 'note')); + el.appendChild(choices); - /** - * @param {App.Entity.SlaveState} slave - */ - function eyeColor(slave) { - let eyeColorNode = document.createElement('p'); - const { - // eslint-disable-next-line no-unused-vars - he, - him, - his, - hers, - himself, - boy, - He, - His - } = getPronouns(slave); - let label = document.createElement('div'); - if (getLenseCount(slave) > 0) { - label.textContent = `${He} is wearing ${App.Desc.eyesColor(slave, "", "lense", "lenses")}.`; - } else { - label.textContent = `${He} has ${App.Desc.eyesColor(slave)}.`; + return el; } - eyeColorNode.appendChild(label); - let choices = document.createElement('div'); - choices.className = "choices"; + function customOriginStory() { + let el = document.createElement('p'); + el.append(`Change ${his} origin story: `); + el.appendChild(App.UI.DOM.makeTextBox( + slave.origin, + v => { + slave.origin = v; + refresh(); + })); - let eye; - let textbox; + let choices = document.createElement('div'); + choices.className = "choices"; + choices.appendChild(App.UI.DOM.makeElement('span', ` For best results, use complete, capitalized and punctuated sentences; for example: '${He} followed you home from the pet store.'`, 'note')); + el.appendChild(choices); - if (hasLeftEye(slave)) { - eye = document.createElement('div'); - eye.append(`Custom left eye color: `); - textbox = App.UI.DOM.makeTextBox( - slave.eye.left.iris, - v => { - slave.eye.left.iris = v; - App.UI.SlaveInteract.custom(slave); - }); - eye.appendChild(textbox); - choices.appendChild(eye); + return el; } - if (hasRightEye(slave)) { - eye = document.createElement('div'); - eye.append(`Custom right eye color: `); - textbox = App.UI.DOM.makeTextBox( - slave.eye.right.iris, - v => { - slave.eye.right.iris = v; - App.UI.SlaveInteract.custom(slave); - }); - eye.appendChild(textbox); - choices.appendChild(eye); - } - choices.appendChild(App.UI.DOM.makeElement('span', `For best results, use a short, uncapitalized and unpunctuated description; for example: 'blue'`, 'note')); - eyeColorNode.appendChild(choices); - return eyeColorNode; - } - /** - * @param {App.Entity.SlaveState} slave - */ - function customTattoo(slave) { - let el = document.createElement('p'); - const { - // eslint-disable-next-line no-unused-vars - he, - him, - his, - hers, - himself, - boy, - He, - His - } = getPronouns(slave); - el.append(`Change ${his} custom tattoo: `); - el.appendChild(App.UI.DOM.makeTextBox( - slave.custom.tattoo, - v => { - slave.custom.tattoo = v; - App.UI.SlaveInteract.custom(slave); - })); - - let choices = document.createElement('div'); - choices.className = "choices"; - choices.appendChild(App.UI.DOM.makeElement('span', `For best results, use complete sentences; for example: '${He} has blue stars tattooed along ${his} cheekbones.'`, 'note')); - el.appendChild(choices); + function customDescription() { + let el = document.createElement('p'); + el.append(`Change ${his} custom description: `); + el.appendChild( + App.UI.DOM.makeTextBox( + pronounsForSlaveProp(slave, slave.custom.desc), + v => { + slave.custom.desc = v; + refresh(); + } + ) + ); - return el; - } + let choices = document.createElement('div'); + choices.className = "choices"; + choices.appendChild(App.UI.DOM.makeElement('span', ` For best results, use complete, capitalized and punctuated sentences; for example: '${He} has a beauty mark above ${his} left nipple.'`, 'note')); + el.appendChild(choices); - function customOriginStory(slave) { - let el = document.createElement('p'); - const { - // eslint-disable-next-line no-unused-vars - he, - him, - his, - hers, - himself, - boy, - He, - His - } = getPronouns(slave); + return el; + } - el.append(`Change ${his} origin story: `); - el.appendChild(App.UI.DOM.makeTextBox( - slave.origin, - v => { - slave.origin = v; - App.UI.SlaveInteract.custom(slave); - })); + function customLabel() { + let el = document.createElement('p'); + el.append(`Change ${his} custom label: `); + el.appendChild(App.UI.DOM.makeTextBox( + slave.custom.label, + v => { + slave.custom.label = v; + refresh(); + })); - let choices = document.createElement('div'); - choices.className = "choices"; - choices.appendChild(App.UI.DOM.makeElement('span', ` For best results, use complete, capitalized and punctuated sentences; for example: '${He} followed you home from the pet store.'`, 'note')); - el.appendChild(choices); + let choices = document.createElement('div'); + choices.className = "choices"; + choices.appendChild(App.UI.DOM.makeElement('span', ` For best results, use a short phrase; for example: 'Breeder.'`, 'note')); + el.appendChild(choices); - return el; - } + return el; + } - function customDescription(slave) { - let el = document.createElement('p'); - const { - // eslint-disable-next-line no-unused-vars - he, - him, - his, - hers, - himself, - boy, - He, - His - } = getPronouns(slave); + function customSlaveImage() { + let el = document.createElement('p'); + el.append(`Assign ${him} a custom image: `); + + const textbox = document.createElement("INPUT"); + textbox.id = "customImageValue"; + el.appendChild(textbox); + + + let kbd = document.createElement('kbd'); + let select = document.createElement('SELECT'); + select.id = "customImageFormatSelector"; + select.style.border = "none"; + + let filetypes = [ + "png", + "jpg", + "gif", + "webm", + "webp", + "mp4" + ]; + + filetypes.forEach((fileType) => { + let el = document.createElement('OPTION'); + el.value = fileType; + el.text = fileType.toUpperCase(); + select.add(el); + }); + kbd.append(`.`); + kbd.appendChild(select); + el.appendChild(kbd); - el.append(`Change ${his} custom description: `); - el.appendChild(App.UI.DOM.makeTextBox( - pronounsForSlaveProp(slave, slave.custom.desc), - v => { - slave.custom.desc = v; - App.UI.SlaveInteract.custom(slave); - })); + el.appendChild( + App.UI.DOM.link( + ` Reset`, + () => { + slave.custom.image = null; + refresh(); + App.Art.refreshSlaveArt(slave, 3, "art-frame"); + }, + ) + ); - let choices = document.createElement('div'); - choices.className = "choices"; - choices.appendChild(App.UI.DOM.makeElement('span', ` For best results, use complete, capitalized and punctuated sentences; for example: '${He} has a beauty mark above ${his} left nipple.'`, 'note')); - el.appendChild(choices); + let choices = document.createElement('div'); + choices.className = "choices"; + let note = document.createElement('span'); + note.className = "note"; + note.append(`Place file in the `); - return el; - } + kbd = document.createElement('kbd'); + kbd.append(`resources`); + note.appendChild(kbd); - function customLabel(slave) { - let el = document.createElement('p'); - const { - // eslint-disable-next-line no-unused-vars - he, - him, - his, - hers, - himself, - boy, - He, - His - } = getPronouns(slave); + note.append(` folder. Choose the extension from the menu first, then enter the filename in the space and press enter. For example, for a file with the path `); - el.append(`Change ${his} custom label: `); - el.appendChild(App.UI.DOM.makeTextBox( - slave.custom.label, - v => { - slave.custom.label = v; - App.UI.SlaveInteract.custom(slave); - })); + kbd = document.createElement('kbd'); + kbd.textContent = `\\bin\\resources\\headgirl.`; + let filetypeDesc = document.createElement('span'); + filetypeDesc.id = "customImageFormatValue"; + filetypeDesc.textContent = "png"; + kbd.appendChild(filetypeDesc); + note.appendChild(kbd); - let choices = document.createElement('div'); - choices.className = "choices"; - choices.appendChild(App.UI.DOM.makeElement('span', ` For best results, use a short phrase; for example: 'Breeder.'`, 'note')); - el.appendChild(choices); + note.append(`, choose `); - return el; - } + kbd = document.createElement('kbd'); + kbd.textContent = `PNG`; + note.appendChild(kbd); + note.append(` then enter `); - function customSlaveImage(slave) { - let el = document.createElement('p'); - const { - // eslint-disable-next-line no-unused-vars - he, - him, - his, - hers, - himself, - boy, - He, - His - } = getPronouns(slave); - el.append(`Assign ${him} a custom image: `); - - let textbox = document.createElement("INPUT"); - textbox.id = "customImageValue"; - el.appendChild(textbox); - - - let kbd = document.createElement('kbd'); - let select = document.createElement('SELECT'); - select.id = "customImageFormatSelector"; - select.style.border = "none"; - - let filetypes = [ - "png", - "jpg", - "gif", - "webm", - "webp", - "mp4" - ]; - - filetypes.forEach((fileType) => { - let el = document.createElement('OPTION'); - el.value = fileType; - el.text = fileType.toUpperCase(); - select.add(el); - }); - kbd.append(`.`); - kbd.appendChild(select); - el.appendChild(kbd); - - el.appendChild( - App.UI.DOM.link( - ` Reset`, - () => { - slave.custom.image = null; - App.UI.SlaveInteract.custom(slave); - App.Art.refreshSlaveArt(slave, 3, "art-frame"); - }, - ) - ); - - let choices = document.createElement('div'); - choices.className = "choices"; - let note = document.createElement('span'); - note.className = "note"; - note.append(`Place file in the `); - - kbd = document.createElement('kbd'); - kbd.append(`resources`); - note.appendChild(kbd); - - note.append(` folder. Choose the extension from the menu first, then enter the filename in the space and press enter. For example, for a file with the path `); - - kbd = document.createElement('kbd'); - kbd.textContent = `\\bin\\resources\\headgirl.`; - let filetypeDesc = document.createElement('span'); - filetypeDesc.id = "customImageFormatValue"; - filetypeDesc.textContent = "png"; - kbd.appendChild(filetypeDesc); - note.appendChild(kbd); - - note.append(`, choose `); - - kbd = document.createElement('kbd'); - kbd.textContent = `PNG`; - note.appendChild(kbd); - - note.append(` then enter `); - - kbd = document.createElement('kbd'); - kbd.textContent = `headgirl`; - note.appendChild(kbd); - - note.append(`.`); - choices.appendChild(note); - el.appendChild(choices); - - jQuery(function() { - function activeSlave() { - return slave; - } + kbd = document.createElement('kbd'); + kbd.textContent = `headgirl`; + note.appendChild(kbd); - jQuery("#customImageFormatValue").text(activeSlave().custom.image === null ? "png" : activeSlave().custom.image.format); - jQuery("#customImageValue") - .val(activeSlave().custom.image === null ? - "" : activeSlave().custom.image.filename) - .on("change", function(e) { - const c = activeSlave().custom; - if (this.value.length === 0) { - c.image = null; - } else { - if (c.image === null) { - c.image = { - filename: this.value, - format: jQuery("#customImageFormatSelector").val() - }; - App.Art.refreshSlaveArt(slave, 3, "art-frame"); + note.append(`.`); + choices.appendChild(note); + el.appendChild(choices); + + jQuery(function() { + function activeSlave() { + return slave; + } + + jQuery("#customImageFormatValue").text(activeSlave().custom.image === null ? "png" : activeSlave().custom.image.format); + jQuery("#customImageValue") + .val(activeSlave().custom.image === null ? + "" : activeSlave().custom.image.filename) + .on("change", function(e) { + const c = activeSlave().custom; + if (this.value.length === 0) { + c.image = null; } else { - c.image.filename = this.value; - App.Art.refreshSlaveArt(slave, 3, "art-frame"); + if (c.image === null) { + c.image = { + filename: this.value, + format: jQuery("#customImageFormatSelector").val() + }; + App.Art.refreshSlaveArt(slave, 3, "art-frame"); + } else { + c.image.filename = this.value; + App.Art.refreshSlaveArt(slave, 3, "art-frame"); + } } - } - }); - jQuery("#customImageFormatSelector") - .val(activeSlave().custom.image ? activeSlave().custom.image.format : "png") - .on("change", function(e) { - if (activeSlave().custom.image !== null) { - activeSlave().custom.image.format = this.value; - } - jQuery("#customImageFormatValue").text(this.value); - }); - }); - return el; - } + }); + jQuery("#customImageFormatSelector") + .val(activeSlave().custom.image ? activeSlave().custom.image.format : "png") + .on("change", function(e) { + if (activeSlave().custom.image !== null) { + activeSlave().custom.image.format = this.value; + } + jQuery("#customImageFormatValue").text(this.value); + }); + }); + return el; + } - function customHairImage(slave) { - let el = document.createElement('p'); - const { - // eslint-disable-next-line no-unused-vars - he, - him, - his, - hers, - himself, - boy, - He, - His - } = getPronouns(slave); + function customHairImage() { + let el = document.createElement('p'); + if (V.seeImages === 1 && V.imageChoice === 1) { + if (!slave.custom.hairVector) { + slave.custom.hairVector = 0; + } + el.append(`Assign ${him} a custom hair SVG image: `); - if (V.seeImages === 1 && V.imageChoice === 1) { - if (!slave.custom.hairVector) { - slave.custom.hairVector = 0; - } - el.append(`Assign ${him} a custom hair SVG image: `); + el.appendChild(App.UI.DOM.makeTextBox( + slave.custom.hairVector, + v => { + slave.custom.hairVector = v; + refresh(); + })); - el.appendChild(App.UI.DOM.makeTextBox( - slave.custom.hairVector, - v => { - slave.custom.hairVector = v; - App.UI.SlaveInteract.custom(slave); - })); + el.appendChild( + App.UI.DOM.link( + ` Reset`, + () => { + slave.custom.hairVector = 0; + refresh(); + App.Art.refreshSlaveArt(slave, 3, "art-frame"); + }, + ) + ); + } - el.appendChild( - App.UI.DOM.link( - ` Reset`, - () => { - slave.custom.hairVector = 0; - App.UI.SlaveInteract.custom(slave); - App.Art.refreshSlaveArt(slave, 3, "art-frame"); - }, - ) - ); + return el; } + } - return el; + function refresh() { + jQuery("#si-custom").empty().append(custom()); } -})(); +}; diff --git a/src/interaction/siNavigation.js b/src/interaction/siNavigation.js index c7bfe5e5b0aece2af05aeff67fd3c50636a847f9..328123adbc1d207757c706b7d781c68154ccc8d0 100644 --- a/src/interaction/siNavigation.js +++ b/src/interaction/siNavigation.js @@ -6,15 +6,13 @@ */ App.UI.SlaveInteract.navigation = function(slave) { const p = document.createElement("p"); + const linkArray = []; p.classList.add("center"); if (V.cheatMode) { - const div = document.createElement("div"); - div.classList.add("note"); - div.append(App.UI.DOM.passageLink("Cheat Edit Slave", "MOD_Edit Slave Cheat", () => { V.cheater = 1; }), - " | ", - App.UI.DOM.passageLink("Cheat Edit Slave Alternative", "MOD_Edit Slave Cheat New", () => { V.cheater = 1; })); - p.append(div); + linkArray.push(App.UI.DOM.passageLink("Cheat Edit Slave", "MOD_Edit Slave Cheat", () => { V.cheater = 1; })); + linkArray.push(App.UI.DOM.passageLink("Cheat Edit Slave Alternative", "MOD_Edit Slave Cheat New", () => { V.cheater = 1; })); + App.UI.DOM.appendNewElement("div", p, App.UI.DOM.generateLinksStrip(linkArray), "note"); } App.UI.DOM.appendNewElement("span", p, App.UI.Hotkeys.hotkeys("prev-slave"), "hotkey"); diff --git a/src/interaction/siPhysicalRegimen.js b/src/interaction/siPhysicalRegimen.js index e7086dbd03e0c6cec08e797edc4af755100bf315..6e8a6e9665da2dfd269041f2923a040133961222 100644 --- a/src/interaction/siPhysicalRegimen.js +++ b/src/interaction/siPhysicalRegimen.js @@ -550,13 +550,12 @@ App.UI.SlaveInteract.physicalRegimen = function(slave) { let _reservedNursery = WombReserveCount(slave, "nursery"); let _WL = slave.womb.length; let el = document.createElement('div'); + const linkArray = []; if (V.incubator > 0) { if (slave.preg > 0 && slave.broodmother === 0 && slave.pregKnown === 1 && slave.eggType === "human") { if ((slave.assignment !== Job.DAIRY || V.dairyPregSetting === 0) && (slave.assignment !== Job.FARMYARD || V.farmyardBreeding === 0)) { let title = document.createElement('div'); - let link = document.createElement('div'); - link.className = "choices"; if (_WL - _reservedNursery === 0) { title.textContent = `${His} children are already reserved for ${V.nurseryName}`; title.style.fontStyle = "italic"; @@ -573,34 +572,30 @@ App.UI.SlaveInteract.physicalRegimen = function(slave) { title.textContent = `All ${_reservedIncubator} of ${his} children will be placed in ${V.incubatorName}. `; } if ((_reservedIncubator + _reservedNursery < _WL) && (V.reservedChildren < freeTanks)) { - link.appendChild( + linkArray.push( App.UI.DOM.link(`Keep another child`, () => wombUpdateIncubator(1, true)) ); if (_reservedIncubator > 0) { - link.append(` | `); - link.appendChild( + linkArray.push( App.UI.DOM.link(`Keep one less child`, () => wombUpdateIncubator(1, false)) ); } if (_reservedIncubator > 1) { - link.append(` | `); - link.appendChild( + linkArray.push( App.UI.DOM.link(`Keep none of ${his} children`, () => wombUpdateIncubator(9999, false)) ); } if ((V.reservedChildren + _WL - _reservedIncubator) <= freeTanks) { - link.append(` | `); - link.appendChild( + linkArray.push( App.UI.DOM.link(`Keep the rest of ${his} children`, () => wombUpdateIncubator(9999, true)) ); } } else if ((_reservedIncubator === _WL) || (V.reservedChildren === freeTanks) || (_reservedIncubator - _reservedNursery >= 0)) { - link.appendChild( + linkArray.push( App.UI.DOM.link(`Keep one less child`, () => wombUpdateIncubator(1, false)) ); if (_reservedIncubator > 1) { - link.append(` | `); - link.appendChild( + linkArray.push( App.UI.DOM.link(`Keep none of ${his} children`, () => wombUpdateIncubator(9999, false)) ); } @@ -618,13 +613,12 @@ App.UI.SlaveInteract.physicalRegimen = function(slave) { } tank.textContent += `.`; let _cCount = (_WL > 1 ? "a" : "the"); - link.appendChild( + linkArray.push( App.UI.DOM.link(`Keep ${_cCount} child`, () => wombUpdateIncubator(1, true)) ); title.appendChild(tank); if ((_WL > 1) && (V.reservedChildren + _WL) <= freeTanks) { - link.append(` | `); - link.appendChild( + linkArray.push( App.UI.DOM.link(`Keep all of ${his} children`, () => wombUpdateIncubator(9999, true)) ); } @@ -633,7 +627,7 @@ App.UI.SlaveInteract.physicalRegimen = function(slave) { } } el.append(title); - el.append(link); + App.UI.DOM.appendNewElement("div", el, App.UI.DOM.generateLinksStrip(linkArray), "choices"); } } } @@ -661,8 +655,7 @@ App.UI.SlaveInteract.physicalRegimen = function(slave) { if (slave.preg > 0 && slave.broodmother === 0 && slave.pregKnown === 1 && slave.eggType === "human") { if ((slave.assignment !== Job.DAIRY || V.dairyPregSetting === 0) && (slave.assignment !== Job.FARMYARD || V.farmyardBreeding === 0)) { let title = document.createElement('div'); - let link = document.createElement('div'); - link.className = "choices"; + const linkArray = []; if (_WL - reservedIncubator === 0) { V.reservedChildren = 0; title.textContent = `${His} children are already reserved for ${V.incubatorName}`; @@ -680,36 +673,32 @@ App.UI.SlaveInteract.physicalRegimen = function(slave) { title.textContent = `All ${reservedNursery} of ${his} children will be placed in ${V.nurseryName}. `; } if ((reservedIncubator + reservedNursery < _WL) && (V.reservedChildrenNursery < freeCribs)) { - link.appendChild( + linkArray.push( App.UI.DOM.link(`Keep another child`, () => wombUpdateNursery(1, true)) ); if (reservedNursery > 0) { - link.append(` | `); - link.appendChild( + linkArray.push( App.UI.DOM.link(`Keep one less child`, () => wombUpdateNursery(1, false)) ); } if (reservedNursery > 1) { - link.append(` | `); - link.appendChild( + linkArray.push( App.UI.DOM.link(`Keep none of ${his} children`, () => wombUpdateNursery(9999, false)) ); } if ((V.reservedChildrenNursery + _WL - reservedNursery) <= freeCribs) { - link.append(` | `); - link.appendChild( + linkArray.push( App.UI.DOM.link(`Keep the rest of ${his} children`, () => wombUpdateNursery(9999, true)) ); } } else if ((reservedNursery === _WL) || (V.reservedChildrenNursery === freeCribs) || (reservedNursery - reservedIncubator >= 0)) { - link.appendChild( + linkArray.push( App.UI.DOM.link(`Keep one less child`, () => wombUpdateNursery(1, false)) ); if (reservedNursery > 1) { - link.append(` | `); - link.appendChild( + linkArray.push( App.UI.DOM.link(`Keep none of ${his} children`, () => wombUpdateNursery(9999, false)) ); } @@ -727,13 +716,12 @@ App.UI.SlaveInteract.physicalRegimen = function(slave) { } crib.textContent += `.`; let _cCount = (_WL > 1 ? "a" : "the"); - link.appendChild( + linkArray.push( App.UI.DOM.link(`Keep ${_cCount} child`, () => wombUpdateNursery(1, true)) ); title.appendChild(crib); if ((_WL > 1) && (V.reservedChildrenNursery + _WL) <= freeCribs) { - link.append(` | `); - link.appendChild( + linkArray.push( App.UI.DOM.link(`Keep all of ${his} children`, () => wombUpdateNursery(9999, true)) ); } @@ -742,7 +730,7 @@ App.UI.SlaveInteract.physicalRegimen = function(slave) { } } el.append(title); - el.append(link); + App.UI.DOM.appendNewElement("div", el, App.UI.DOM.generateLinksStrip(linkArray), "choices"); } } } diff --git a/src/interaction/siUtilities.js b/src/interaction/siUtilities.js index b5569e4a240d44140c4a368d415f1925e08d96cc..88504c48ee5fce2f52bb385c1402a7148dbae3b2 100644 --- a/src/interaction/siUtilities.js +++ b/src/interaction/siUtilities.js @@ -60,11 +60,9 @@ App.UI.SlaveInteract.appendLabeledChoiceRow = function(parent, label, array, sla * @returns {HTMLSpanElement} */ App.UI.SlaveInteract.generateRows = function(array, slave, category, accessCheck = false, refresh) { - let row = document.createElement('span'); - let useSep = false; + const linkArray = []; for (let i = 0; i < array.length; i++) { let link; - const separator = document.createTextNode(` | `); const keys = Object.keys(array[i]); // Test to see if there was a problem with the key @@ -88,10 +86,6 @@ App.UI.SlaveInteract.generateRows = function(array, slave, category, accessCheck } } if (accessCheck === false || unlocked) { - if (i < array.length && i !== 0 && useSep === true) { // start with separator (after first loop); can't after since the last loop may not have any text. - row.appendChild(separator); - } - useSep = true; // First item may not appear and if it doesn't we don't want the second to start with a '|' // is it just text? if (array[i].disabled) { link = App.UI.DOM.disabledLink(array[i].text, [array[i].disabled]); @@ -119,11 +113,11 @@ App.UI.SlaveInteract.generateRows = function(array, slave, category, accessCheck link.appendChild(App.UI.DOM.makeElement('span', ` ${array[i].note}`, 'note')); } } - row.appendChild(link); + linkArray.push(link); } } - return row; + return App.UI.DOM.generateLinksStrip(linkArray); /** @param {RowItem} arrayOption */ function click(arrayOption) { diff --git a/src/interaction/siWork.js b/src/interaction/siWork.js index eef1e0ceccfa742b4eb7ab9748247c20cb41311e..d1de52c34a104653706ec5db657ee69174033d23 100644 --- a/src/interaction/siWork.js +++ b/src/interaction/siWork.js @@ -175,7 +175,7 @@ App.UI.SlaveInteract.work = function(slave) { function assignmentBlock() { let el = document.createElement('div'); let title = document.createElement('div'); - let separator = document.createTextNode(` | `); + const linkArray = []; title.append(`Assignment: `); let assign = document.createElement('span'); @@ -206,11 +206,10 @@ App.UI.SlaveInteract.work = function(slave) { title.appendChild(document.createTextNode(`Serving all your other slaves. `)); linkText = `Choose a specific slave to submit to`; } - title.appendChild(App.UI.DOM.passageLink(linkText, "Subordinate Targeting", () => { V.returnTo = "Slave Interact"; })); - title.append(separator); + linkArray.push(App.UI.DOM.passageLink(linkText, "Subordinate Targeting", () => { V.returnTo = "Slave Interact"; })); } if (slave.assignment !== Job.CHOICE) { - title.appendChild( + linkArray.push( App.UI.DOM.link( `Stay on this assignment for another month`, () => { @@ -220,6 +219,7 @@ App.UI.SlaveInteract.work = function(slave) { ) ); } + title.append(App.UI.DOM.generateLinksStrip(linkArray)); el.appendChild(title); let links = document.createElement('div'); @@ -623,20 +623,10 @@ App.UI.SlaveInteract.work = function(slave) { } function generateRows(sexArray) { - let row = document.createElement('span'); + const linkArray = []; for (let i = 0; i < sexArray.length; i++) { let link; - const separator = document.createTextNode(` | `); - const keys = Object.keys(sexArray[i]); - - // Test to see if there was a problem with the key - for (let j = 0; j < keys.length; j++) { - if (!["disabled", "goto", "note", "scene", "text", "update", "updateSlave"].includes(keys[j])) { - sexArray[i].text += " ERROR, THIS SCENE WAS NOT ENTERED CORRECTLY"; - console.log("Trash found while generateRows() was running: " + keys[j] + ": " + sexArray[i][keys[j]]); - break; - } - } + // is it just text? if (sexArray[i].disabled) { link = App.UI.DOM.disabledLink(sexArray[i].text, [sexArray[i].disabled]); @@ -659,13 +649,10 @@ App.UI.SlaveInteract.work = function(slave) { link.appendChild(App.UI.DOM.makeElement('span', sexArray[i].note, 'note')); } } - row.appendChild(link); - if (i < sexArray.length - 1) { - row.appendChild(separator); - } + linkArray.push(link); } - return row; + return App.UI.DOM.generateLinksStrip(linkArray); function click(sexOption) { if (sexOption.updateSlave) { diff --git a/src/uncategorized/jeSlaveDispute.tw b/src/uncategorized/jeSlaveDispute.tw index dfedb8a41eab985bef489fd720ef02c6972706d5..5be22f0481fd5c9b8579635e46c6d8b8bf76f11b 100644 --- a/src/uncategorized/jeSlaveDispute.tw +++ b/src/uncategorized/jeSlaveDispute.tw @@ -76,7 +76,7 @@ <<set _slave.stampTat = either("advertisements", "degradation", "rude words")>> <<case "majority deal">> <<set _ContractCost = 20000>> - <<set _slave = GenerateNewSlave("", , {minAge: $minimumSlaveAge, maxAge: 18, disableDisability: 1})>> + <<set _slave = GenerateNewSlave("", {minAge: $minimumSlaveAge, maxAge: 18, disableDisability: 1})>> <<set _slave.origin = "$He was raised to be a slave, since $he was mistakenly thought to be from good slave stock.">> <<set _slave.career = "a slave">> <<set _slave.devotion = random(10,15)>> @@ -97,7 +97,7 @@ <<set _slave.skill.entertainment = 0>> <<case "indenture deal">> <<set _ContractCost = 7500>> - <<set _slave = GenerateNewSlave("", , {minAge: 24, maxAge: 42, disableDisability: 1})>> + <<set _slave = GenerateNewSlave("", {minAge: 24, maxAge: 42, disableDisability: 1})>> <<run setHealth(_slave, jsRandom(-20, 20))>> <<set _slave.anus = 2>> <<if _slave.vagina > -1>> diff --git a/src/uncategorized/newGamePlus.tw b/src/uncategorized/newGamePlus.tw index f582693fbfdbe64819a34ad5ddee809f29d225c5..002b1ddecc9b030e4464f4ece09993e48faf2158 100644 --- a/src/uncategorized/newGamePlus.tw +++ b/src/uncategorized/newGamePlus.tw @@ -11,10 +11,11 @@ You have decided to start over and will be able to take a few things with you: a <br><br> -You <<if $cash >= _fee>>have<<else>>lack<</if>> the funds to bring more than $slavesToImportMax slaves with you (or your equivalent) to a new arcology. It will cost @@.yellowgreen;<<print cashFormat(_fee)>>@@ to insure another slave's safe transfer. <<if $cash >= _fee>> - You have @@.yellowgreen;<<print cashFormat($cash)>>@@ to spend. + You have allocated funds to bring up to $slavesToImportMax slaves with you (or your equivalent) to a new arcology. It will cost @@.yellowgreen;<<print cashFormat(_fee)>>@@ to insure another slave's safe transfer. You have @@.yellowgreen;<<print cashFormat($cash)>>@@ to spend. <br>[[Increase slave import capacity by 1.|New Game Plus][cashX(forceNeg(_fee), "capEx"), $slavesToImportMax++]] +<<else>> + You lack the @@.yellowgreen;<<= cashFormat(_fee)>>@@ needed to bring any more than $slavesToImportMax slaves with you (or your equivalent) to a new arcology. <</if>> <br> diff --git a/src/uncategorized/pePitFightInvite.tw b/src/uncategorized/pePitFightInvite.tw index 22acb6991def51d38e2925d1c6d6192390e4d6a5..a29aa34aa738e5ecdd1e391a540fa80c220fd609 100644 --- a/src/uncategorized/pePitFightInvite.tw +++ b/src/uncategorized/pePitFightInvite.tw @@ -11,7 +11,7 @@ <p>Gladiatorial combat between slaves has not yet reached the level of social acceptability it once enjoyed in Rome, but it's growing in popularity. For now, most fights are discreet affairs limited to select guests. Displaying a slave bodyguard is an excellent way to get yourself invited to participate, and $assistant.name has just passed on an invitation to a private fight next week, should you be willing to hazard a bodyguard.</p> <<if $pit>> - <p>Of course, <<= capFirstChar($pitName)>> in $arcologies[0].name sees regular fights<<if $pit.lethal>> to the death<</if>>, but there's something extra special about attending these outside fights<<if !$pit.lethal>>, especially with the very real risk of violent death<</if>>.</p> + <p>Of course, <<= capFirstChar($pit.name)>> in $arcologies[0].name sees regular fights<<if $pit.lethal>> to the death<</if>>, but there's something extra special about attending these outside fights<<if !$pit.lethal>>, especially with the very real risk of violent death<</if>>.</p> <</if>> <span id="result"> diff --git a/src/uncategorized/repBudget.tw b/src/uncategorized/repBudget.tw index cda30a1c977d23ed1c8d37638b2c8ba3a8ed0d42..cf5ede3ede73340a0804111e98284d78f22b9d63 100644 --- a/src/uncategorized/repBudget.tw +++ b/src/uncategorized/repBudget.tw @@ -82,7 +82,7 @@ <br> <</if>> - <<print budgetLine("pit", "<<if $pit>>[[capFirstChar($pitName)|Pit][$nextButton = \"Back to Budget\", $nextLink = \"Rep Budget\"]]<<else>><<= capFirstChar($pitName)>><</if>> ($pit.fighterIDs.length slaves)")>> + <<print budgetLine("pit", "<<if $pit>>[[capFirstChar($pit.name)|Pit][$nextButton = \"Back to Budget\", $nextLink = \"Rep Budget\"]] ($pit.fighterIDs.length slaves)<<else>>The Pit<</if>>")>> <<print budgetLine("servantsQuarters", "<<if $servantsQuarters>>[[Servants' Quarters][$nextButton = \"Back to Budget\", $nextLink = \"Rep Budget\"]]<<else>>Servants' Quarters<</if>> (_L.servantsQuarters slaves)")>>