diff --git a/css/gui/options.css b/css/gui/options.css index 8ccbff90610a12f831c659ece063201e03f0e916..606c2979f5d6e4b0988004447925d9002ed460b7 100644 --- a/css/gui/options.css +++ b/css/gui/options.css @@ -57,14 +57,6 @@ div.options-group button.off:hover { background-color: #6a1b16; } -div.options-group button.selected.neutral { - background-color: #4d4d00; -} - -div.options-group button.neutral:hover { - background-color: #666600; -} - div.options-group .comment { color: gray; font-style: italic; diff --git a/src/events/intro/introSummary.js b/src/events/intro/introSummary.js index 3cc3f2acc638c333dede5c18eabab4529b9efbbd..f030ba63f97ffd0573eb0a1609668ce0d34883a9 100644 --- a/src/events/intro/introSummary.js +++ b/src/events/intro/introSummary.js @@ -848,7 +848,7 @@ App.Intro.summary = function() { options = new App.UI.OptionsGroup(); options.addOption("Slave aging", "seeAge") - .addValue("Enabled", 1).on().addValue("Celebrate birthdays, but don't age.", 2).neutral().addValue("Disabled", 0).off(); + .addValue("Enabled", 1).on().addValue("Celebrate birthdays, but don't age.", 2).addValue("Disabled", 0).off(); options.addOption("Slave age distribution", "pedo_mode").addComment("In loli mode most new slaves are under the age of 18. May not apply to custom slaves and slaves from specific events.") .addValue("Loli mode", 1, () => V.minimumSlaveAge = 5).addValue("Normal mode", 0); diff --git a/src/events/intro/pcAppearance.js b/src/events/intro/pcAppearance.js index 8ab31e420728b43a1843e5db66534741ec7dff5b..c40fac981cf61649f4d3bbb3f4eac427c7ca2701 100644 --- a/src/events/intro/pcAppearance.js +++ b/src/events/intro/pcAppearance.js @@ -137,7 +137,7 @@ App.UI.Player.design = function() { } option = options.addOption("Player aging is", "playerAging") - .addValue("Enabled", 2).on().addValue("Celebrate birthdays, but don't age.", 1).neutral().addValue("Disabled", 0).off(); + .addValue("Enabled", 2).on().addValue("Celebrate birthdays, but don't age.", 1).addValue("Disabled", 0).off(); if (!V.cheatMode) { option.addComment("This option cannot be changed during the game."); } diff --git a/src/futureSocieties/fsDecoration.js b/src/futureSocieties/fsDecoration.js index 789d1f662bbd45416dc1300e911ce5c33aa5e5f5..a8521b78cbfef789adc354b16fcf7a540eea12f1 100644 --- a/src/futureSocieties/fsDecoration.js +++ b/src/futureSocieties/fsDecoration.js @@ -3,6 +3,9 @@ */ App.UI.facilityRedecoration = function() { const el = new DocumentFragment(); + /** + * @type {Map<string, string>} + */ const activeFacilities = new Map([]); const options = new App.UI.OptionsGroup(); const arc = V.arcologies[0]; @@ -60,67 +63,16 @@ App.UI.facilityRedecoration = function() { activeFacilities.set(V.masterSuiteName, "masterSuiteDecoration"); } - options.addOption(`Change style for all facilities`) - .addCustomDOM(modifyAll()); - - for (const [name, decoration] of activeFacilities) { - options.addOption(`The decoration style of ${name} is`) - .addCustomDOM(createPulldown(decoration)); - } - el.append(options.render()); - - return el; - - function createPulldown(variable) { - const select = document.createElement("select"); - select.classList.add("rajs-list"); - - // Standard decorations - const choice = App.UI.DOM.appendNewElement("option", select, "Standard"); - choice.value = "standard"; - if (V[variable] === "standard") { - choice.selected = true; - } - - // FS decorations - for (const decorationName of decorationNames) { - const choice = App.UI.DOM.makeElement("option", decorationName); - if (V[variable] === decorationName) { - choice.selected = true; - } - select.append(choice); - } - - select.onchange = () => { - const O = select.options[select.selectedIndex]; - if (O.value !== "standard") { - cashX(-5000, "capEx"); - } - V[variable] = O.value; - App.UI.reload(); - }; - return select; - } - - function modifyAll() { - const select = document.createElement("select"); - select.classList.add("rajs-list"); - - // Standard decorations - const standard = App.UI.DOM.appendNewElement("option", select, "Standard"); - standard.value = "standard"; - - // FS decorations - for (const decorationName of decorationNames) { - App.UI.DOM.appendNewElement("option", select, decorationName); - } - - // Round Robin - App.UI.DOM.appendNewElement("option", select, "Distribute Evenly"); - - select.onchange = () => { - const O = select.options[select.selectedIndex]; - if (O.value === "Distribute Evenly") { // Cycles through the list of available FS decorations, and distributes them to facilities round robin style. + // dummy variable to make sure the first option is selected by default + const currentSelected = {value: "none"}; + options.addOption(`The decoration style of ${name} is`, "value", currentSelected) + .addValue("(Select option)", "none") + .addValue("Standard", "standard") + .addValueList(decorationNames) + .addValue("Distribute Evenly", "even") + .addCallbackToEach(value => { + console.log(value); + if (value === "even") { // Cycles through the list of available FS decorations, and distributes them to facilities round robin style. let i = 0; for (const decoration of activeFacilities.values()) { cashX(-5000, "capEx"); @@ -132,17 +84,29 @@ App.UI.facilityRedecoration = function() { } } else { for (const decoration of activeFacilities.values()) { - if (O.value !== "standard") { + if (value !== "standard") { cashX(-5000, "capEx"); } - V[decoration] = O.value; + V[decoration] = value; } } - App.UI.reload(); - }; - select.selectedIndex = -1; - return select; + }) + .pulldown(); + + for (const [name, decoration] of activeFacilities) { + options.addOption(`The decoration style of ${name} is`, decoration) + .addValue("Standard", "standard") + .addValueList(decorationNames) + .addCallbackToEach(value => { + if (value !== "standard") { + cashX(-5000, "capEx"); + } + }) + .pulldown(); } + el.append(options.render()); + + return el; }; /** diff --git a/src/gui/options/options.js b/src/gui/options/options.js index 66a4e2d7febfb2387ba7159f7e052a46c99c9433..2c2934f6f84b1f09556c148836a94c82f64ed443 100644 --- a/src/gui/options/options.js +++ b/src/gui/options/options.js @@ -793,7 +793,7 @@ App.UI.optionsPassage = function() { .addValue("Shown", 1).on().addValue("Hidden", 0).off(); options.addOption("Slave aging", "seeAge") - .addValue("Enabled", 1).on().addValue("Celebrate birthdays, but don't age.", 2).neutral().addValue("Disabled", 0).off(); + .addValue("Enabled", 1).on().addValue("Celebrate birthdays, but don't age.", 2).addValue("Disabled", 0).off(); el.append(options.render()); @@ -1052,7 +1052,7 @@ App.UI.artOptions = function() { .addValue("Enabled", 1).on().addValue("Disabled", 0).off(); options.addOption("Height scaling", "seeHeight") - .addValue("All images", 2).on().addValue("Small images", 1).neutral().addValue("Disabled", 0).off(); + .addValue("All images", 2).on().addValue("Small images", 1).addValue("Disabled", 0).off(); options.addOption("Clothing erection bulges are", "showClothingErection") .addValue("Enabled", true).on().addValue("Disabled", false).off(); diff --git a/src/gui/options/optionsGroup.js b/src/gui/options/optionsGroup.js index 60fea477428a9de553d7cb954aec09e9d7fac8fa..9482d87a66730b4c736b1ead0c57c2c42c853e8d 100644 --- a/src/gui/options/optionsGroup.js +++ b/src/gui/options/optionsGroup.js @@ -37,9 +37,10 @@ App.UI.OptionsGroup = (function() { } /** - * @param {*} name - * @param {*} [value=name] - * @param {Function} [callback] + * @template {any} T + * @param {string} name + * @param {T|string} [value=name] + * @param {function(T|string):void} [callback] * @returns {Option} */ addValue(name, value = name, callback = undefined) { @@ -113,7 +114,7 @@ App.UI.OptionsGroup = (function() { * Adds a button that executes the callback when clicked AND reloads the passage * * @param {string} name - * @param {Function} callback + * @param {function():void} callback * @param {string} passage */ customButton(name, callback, passage) { @@ -147,7 +148,7 @@ App.UI.OptionsGroup = (function() { } /** - * @param {Function} callback gets executed on every button click. Selected value is given as argument. + * @param {function(any):void} callback gets executed on every button click. Selected value is given as argument. */ addCallback(callback) { this.valuePairs.last().callback = callback; @@ -155,7 +156,9 @@ App.UI.OptionsGroup = (function() { } /** - * @param {Function} callback gets executed on every button click. Selected value is given as argument. + * TODO Replace with a global callback + * + * @param {function(any):void} callback gets executed on every button click. Selected value is given as argument. */ addCallbackToEach(callback) { this.valuePairs.forEach(pair => pair.callback = callback); @@ -180,15 +183,6 @@ App.UI.OptionsGroup = (function() { return this; } - /** - * Mark option as neutral to style differently. - * @returns {Option} - */ - neutral() { - this.valuePairs.last().neutral = true; - return this; - } - /** * Puts the options in side a pulldown if there are at least 6. * Not counting text boxes or comments. @@ -228,8 +222,6 @@ App.UI.OptionsGroup = (function() { button.classList.add("on"); } else if (value.off) { button.classList.add("off"); - } else if (value.neutral) { - button.classList.add("neutral"); } if (value.mode === "custom") { button.onclick = () => { @@ -263,7 +255,7 @@ App.UI.OptionsGroup = (function() { button.onclick = () => { this.object[this.property] = value.value; if (value.callback) { - value.callback(); + value.callback(value.value); } App.UI.reload(); }; @@ -296,7 +288,7 @@ App.UI.OptionsGroup = (function() { } const originalObj = this.valuePairs.find(obj => obj.name === O.textContent); if (originalObj && typeof originalObj.callback === "function") { - originalObj.callback(); + originalObj.callback(originalObj.value); } App.UI.reload(); }; diff --git a/src/js/DefaultRules.js b/src/js/DefaultRules.js index dda5938b36cf8047b4c079e74f73472542576a79..f0d6cbadd60cca790f662475f2445c2297afa373 100644 --- a/src/js/DefaultRules.js +++ b/src/js/DefaultRules.js @@ -34,7 +34,7 @@ globalThis.DefaultRules = (function() { r = ""; ({he, him, his} = pronouns = getPronouns(slave)); const slaveReadOnly = createReadonlyProxy(slave); - const {rule, ruleIds} = runWithReadonlyProxy(()=>ProcessSlaveRules(slaveReadOnly)); + const {rule, ruleIds} = runWithReadonlyProxy(() => ProcessSlaveRules(slaveReadOnly)); slave.currentRules = ruleIds; if (ruleIds.length === 0) { return r; } // no rules apply @@ -134,7 +134,7 @@ globalThis.DefaultRules = (function() { r += `<span class="red">raWidgets missing case for assignment 'V.{rule.setAssignment}'.</span>`; return rule; } - const removeAssignment = ()=> { + const removeAssignment = () => { if (job.facility !== App.Entity.facilities.penthouse) { RAFacilityRemove(slave, rule); // before deleting rule.setAssignment } @@ -1185,12 +1185,11 @@ globalThis.DefaultRules = (function() { rule.growth.dick, rule.growth.balls ].every(r => r === null) // Check if all objects in list equal null - ){ + ) { ProcessOtherDrugs(slave, rule); return; } - /** @typedef {"lips" | "boobs" | "butt" | "dick" | "balls"} DrugTarget */ // Asset Growth const growthDrugs = new Set(["breast injections", "breast redistributors", "butt injections", "butt redistributors", "hyper breast injections", "hyper butt injections", "hyper penis enhancement", "hyper testicle enhancement", "intensive breast injections", "intensive butt injections", "intensive penis enhancement", "intensive testicle enhancement", "lip atrophiers", "lip injections", "penis atrophiers", "penis enhancement", "testicle atrophiers", "testicle enhancement"]); @@ -1741,7 +1740,7 @@ globalThis.DefaultRules = (function() { } } - if (rule.weight !== null || (rule.diet === "attractive") ) { + if (rule.weight !== null || (rule.diet === "attractive")) { weightRule(slave, rule); } if (rule.weight === null && rule.diet !== "attractive" && rule.muscles !== null) { @@ -1933,7 +1932,7 @@ globalThis.DefaultRules = (function() { */ function ProcessRest(slave, rule) { if ((rule.restRules !== undefined) && (rule.restRules !== null)) { - if (slave.rules.rest !== rule.restRules ) { + if (slave.rules.rest !== rule.restRules) { if ([Job.NURSE, Job.HEADGIRL, Job.TEACHER, Job.STEWARD, Job.MATRON, Job.FARMER, Job.MADAM, Job.WARDEN, Job.DJ, Job.MILKMAID].includes(slave.assignment)) { // These assignments enforce "restrictive", do not let RA attempt to change it. } else { @@ -1985,7 +1984,7 @@ globalThis.DefaultRules = (function() { function ProcessRelationship(slave, rule) { if ((slave.fetish !== "mindbroken")) { if ((rule.relationshipRules !== undefined) && (rule.relationshipRules !== null)) { - if (slave.rules.relationship !== rule.relationshipRules ) { + if (slave.rules.relationship !== rule.relationshipRules) { slave.rules.relationship = rule.relationshipRules; r += `<br>${slave.slaveName}'s relationship rules have been set to ${rule.relationshipRules}.`; } @@ -2009,6 +2008,7 @@ globalThis.DefaultRules = (function() { if ((rule.releaseRules !== undefined) && (rule.releaseRules !== null) && processReleaseProp(releaseProperties)) { r += `<br>${slave.slaveName}'s release rules have been set to: ${App.Utils.releaseSummaryLong(slave)}.`; } + function processReleaseProp(releaseProperties) { let changed = false; for (const property of releaseProperties) { @@ -2029,7 +2029,7 @@ globalThis.DefaultRules = (function() { */ function ProcessLactation(slave, rule) { if ((rule.lactationRules !== undefined) && (rule.lactationRules !== null)) { - if (slave.rules.lactation !== rule.lactationRules ) { + if (slave.rules.lactation !== rule.lactationRules) { if ((rule.lactationRules === "induce" && slave.lactation === 0) || (rule.lactationRules === "maintain" && slave.lactation === 1) || (rule.lactationRules === "none")) { slave.rules.lactation = rule.lactationRules; r += `<br>${slave.slaveName}'s lactation rules have been set to ${rule.lactationRules}.`; @@ -2044,7 +2044,7 @@ globalThis.DefaultRules = (function() { */ function ProcessMobility(slave, rule) { if ((rule.mobilityRules !== undefined) && (rule.mobilityRules !== null)) { - if (slave.rules.mobility !== rule.mobilityRules ) { + if (slave.rules.mobility !== rule.mobilityRules) { slave.rules.mobility = rule.mobilityRules; r += `<br>${slave.slaveName}'s usage of mobility aids has been set to ${rule.mobilityRules}.`; } @@ -2684,79 +2684,70 @@ globalThis.DefaultRules = (function() { */ function ProcessSmartPiercings(slave, rule) { if (slave.clitPiercing === 3) { - let _used = 0; if (rule.clitSetting !== undefined && rule.clitSetting !== null && rule.clitSetting !== "random") { if (slave.clitSetting !== rule.clitSetting && slave.fetishStrength !== 100) { slave.clitSetting = rule.clitSetting; - _used = 1; r += `<br>${slave.slaveName}'s smart piercing has been set to ${slave.clitSetting}.`; + return; } else if (slave.fetishStrength < 100) { - _used = 1; + return; } } else if (rule.clitSetting === "random") { slave.clitSetting = either("vanilla", "oral", "anal", "boobs", "submissive", "dom", "humiliation", "pregnancy", "masochist", "sadist"); - _used = 1; r += `<br>${slave.slaveName}'s smart piercing has been set to ${slave.clitSetting}.`; + return; } - if (_used === 0) { - if (rule.clitSettingEnergy !== undefined && (rule.clitSettingEnergy !== null)) { - if (slave.energy < rule.clitSettingEnergy) { - if (slave.clitSetting !== "all") { - r += `<br>${slave.slaveName}'s smart piercing has been set to enhance libido.`; - } - slave.clitSetting = "all"; - _used = 1; - } else if (slave.energy >= rule.clitSettingEnergy + 10) { - if (slave.clitSetting !== "none") { - r += `<br>${slave.slaveName}'s smart piercing has been set to suppress libido.`; - } - slave.clitSetting = "none"; - _used = 1; + if (rule.clitSettingEnergy !== undefined && (rule.clitSettingEnergy !== null)) { + if (slave.energy < rule.clitSettingEnergy) { + if (slave.clitSetting !== "all") { + r += `<br>${slave.slaveName}'s smart piercing has been set to enhance libido.`; } - } - } - if (_used === 0) { - if (rule.clitSettingXY !== undefined && (rule.clitSettingXY !== null)) { - if (slave.attrXY < rule.clitSettingXY) { - if (slave.clitSetting !== "men") { - r += `<br>${slave.slaveName}'s smart piercing has been set to encourage attraction to men.`; - } - slave.clitSetting = "men"; - _used = 1; - } else if (slave.attrXY >= rule.clitSettingXY + 10) { - if (slave.clitSetting !== "anti-men") { - r += `<br>${slave.slaveName}'s smart piercing has been set to discourage attraction to men.`; - } - slave.clitSetting = "anti-men"; - _used = 1; + slave.clitSetting = "all"; + return; + } else if (slave.energy >= rule.clitSettingEnergy + 10) { + if (slave.clitSetting !== "none") { + r += `<br>${slave.slaveName}'s smart piercing has been set to suppress libido.`; } + slave.clitSetting = "none"; + return; } } - if (_used === 0) { - if (rule.clitSettingXX !== undefined && (rule.clitSettingXX !== null)) { - if (slave.attrXX < rule.clitSettingXX) { - if (slave.clitSetting !== "women") { - r += `<br>${slave.slaveName}'s smart piercing has been set to encourage attraction to women.`; - } - slave.clitSetting = "women"; - _used = 1; - } else if (slave.attrXX >= rule.clitSettingXX + 10) { - if (slave.clitSetting !== "anti-women") { - r += `<br>${slave.slaveName}'s smart piercing has been set to discourage attraction to women.`; - } - slave.clitSetting = "anti-women"; - _used = 1; + if (rule.clitSettingXY !== undefined && (rule.clitSettingXY !== null)) { + if (slave.attrXY < rule.clitSettingXY) { + if (slave.clitSetting !== "men") { + r += `<br>${slave.slaveName}'s smart piercing has been set to encourage attraction to men.`; } + slave.clitSetting = "men"; + return; + } else if (slave.attrXY >= rule.clitSettingXY + 10) { + if (slave.clitSetting !== "anti-men") { + r += `<br>${slave.slaveName}'s smart piercing has been set to discourage attraction to men.`; + } + slave.clitSetting = "anti-men"; + return; } } - if (_used === 0) { - if (rule.clitSetting !== undefined && rule.clitSetting !== null && slave.clitSetting !== rule.clitSetting) { - slave.clitSetting = rule.clitSetting; - _used = 1; - r += `<br>${slave.slaveName}'s smart piercing has been set to ${slave.clitSetting}.`; + if (rule.clitSettingXX !== undefined && (rule.clitSettingXX !== null)) { + if (slave.attrXX < rule.clitSettingXX) { + if (slave.clitSetting !== "women") { + r += `<br>${slave.slaveName}'s smart piercing has been set to encourage attraction to women.`; + } + slave.clitSetting = "women"; + return; + } else if (slave.attrXX >= rule.clitSettingXX + 10) { + if (slave.clitSetting !== "anti-women") { + r += `<br>${slave.slaveName}'s smart piercing has been set to discourage attraction to women.`; + } + slave.clitSetting = "anti-women"; + return; } } } + if (rule.clitSetting !== undefined && rule.clitSetting !== null && slave.clitSetting !== rule.clitSetting) { + slave.clitSetting = rule.clitSetting; + r += `<br>${slave.slaveName}'s smart piercing has been set to ${slave.clitSetting}.`; + return; + } } /** diff --git a/src/js/assignJS.js b/src/js/assignJS.js index 06659766ee50be76fcc2a64e1e32ecee043b8d5b..32f86468427940c57319fef62d2105a0a617cb55 100644 --- a/src/js/assignJS.js +++ b/src/js/assignJS.js @@ -431,13 +431,7 @@ globalThis.assignJob = function(slave, job) { if (!assignmentVisible(slave) && Array.isArray(V.personalAttention)) { if (V.personalAttention.deleteWith(s => s.ID === slave.ID).length > 0) { if (V.personalAttention.length === 0) { - if (V.PC.career === "escort" || V.PC.career === "prostitute" || V.PC.career === "child prostitute") { - V.personalAttention = "whoring"; - } else if (V.PC.career === "servant" || V.PC.career === "handmaiden" || V.PC.career === "child servant") { - V.personalAttention = "upkeep"; - } else { - V.personalAttention = "business"; - } + resetPersonalAttention(); r += `${slave.slaveName} no longer has your personal attention; you plan to focus on ${V.personalAttention}.`; } else { r += `${slave.slaveName} no longer has your personal attention.`; @@ -641,14 +635,7 @@ globalThis.removeJob = function(slave, assignment, saveRecord = false) { } } if (V.personalAttention === "HG" && attentionCheck === 1) { - if (V.PC.career === "escort" || V.PC.career === "prostitute" || V.PC.career === "child prostitute") { - V.personalAttention = "whoring"; - } else if (V.PC.career === "servant" || V.PC.career === "handmaiden" || V.PC.career === "child servant") { - V.personalAttention = "upkeep"; - } else { - V.personalAttention = "business"; - } - + resetPersonalAttention(); r += `You no longer have a slave assigned to be your Head Girl, so you turn your personal attention to focus on ${V.personalAttention}.`; } V.HGTimeInGrade = 0; diff --git a/src/js/extendedFamilyModeJS.js b/src/js/extendedFamilyModeJS.js index 023ece75ce16de74b4f327cce55d75dceba8da1b..55955af1b9fbea45e2df5188563e6f9b67210464 100644 --- a/src/js/extendedFamilyModeJS.js +++ b/src/js/extendedFamilyModeJS.js @@ -46,10 +46,8 @@ globalThis.isParentP = function(daughter, parent) { globalThis.isGrandmotherP = function(granddaughter, grandmother) { let father; let mother; - if (((mother = getSlave(granddaughter.mother)) && (mother.mother === grandmother.ID)) || ((father = getSlave(granddaughter.father)) && (father.mother === grandmother.ID))) { - return true; - } - return false; + return ((mother = getSlave(granddaughter.mother)) && (mother.mother === grandmother.ID)) + || ((father = getSlave(granddaughter.father)) && (father.mother === grandmother.ID)); }; /** Returns true if grandfather is the grandfather of granddaughter @@ -60,10 +58,8 @@ globalThis.isGrandmotherP = function(granddaughter, grandmother) { globalThis.isGrandfatherP = function(granddaughter, grandfather) { let father; let mother; - if (((mother = getSlave(granddaughter.mother)) && (mother.father === grandfather.ID)) || ((father = getSlave(granddaughter.father)) && (father.father === grandfather.ID))) { - return true; - } - return false; + return ((mother = getSlave(granddaughter.mother)) && (mother.father === grandfather.ID)) + || ((father = getSlave(granddaughter.father)) && (father.father === grandfather.ID)); }; /** Returns true if grandparent is the either the grandmother or grandfather of granddaughter @@ -81,10 +77,7 @@ globalThis.isGrandparentP = function(granddaughter, grandparent) { * @returns {boolean} */ globalThis.sameDad = function(slave1, slave2) { - if ((slave1.father === slave2.father) && (specificDad(slave1))) { - return true; - } - return false; + return (slave1.father === slave2.father) && (specificDad(slave1)); }; /** Returns true if slave1 and slave2 share the same mother @@ -93,10 +86,7 @@ globalThis.sameDad = function(slave1, slave2) { * @returns {boolean} */ globalThis.sameMom = function(slave1, slave2) { - if ((slave1.mother === slave2.mother) && (specificMom(slave1))) { - return true; - } - return false; + return (slave1.mother === slave2.mother) && (specificMom(slave1)); }; /** Returns true if slave1 and slave2 have at least one common parent diff --git a/src/js/findSlave.js b/src/js/findSlave.js index 3ce15a0cc314b84ecaf8d06336a6eaed17d238c6..44796f307e084795873bc16d3f85a8998524ba47 100644 --- a/src/js/findSlave.js +++ b/src/js/findSlave.js @@ -82,6 +82,8 @@ App.FindSlave.searchByExpression = function(query) { if (query) { const resultTitle = App.UI.DOM.appendNewElement("p", frag, "Query results from expression: "); App.UI.DOM.appendNewElement("code", resultTitle, query); + /** @type {function(App.Entity.SlaveState):boolean} */ + // @ts-ignore const pred = new Function("slave", "return (" + query + ");"); const ids = runWithReadonlyProxy(() => { return this._slaveIDs(pred); }); this._appendResultList(ids, frag); diff --git a/src/js/removeSlave.js b/src/js/removeSlave.js index 071678f08b83cd3c62426418ef31fd84ade8b573..d879b6ff8f1f4aaa8b2d749018ef83ab235440d7 100644 --- a/src/js/removeSlave.js +++ b/src/js/removeSlave.js @@ -129,13 +129,7 @@ globalThis.removeSlave = function(slave) { if (Array.isArray(V.personalAttention)) { V.personalAttention.deleteWith(s => s.ID === AS_ID); if (V.personalAttention.length === 0) { - if (V.PC.career === "escort" || V.PC.career === "prostitute" || V.PC.career === "child prostitute") { - V.personalAttention = "whoring"; - } else if (V.PC.career === "servant" || V.PC.career === "handmaiden" || V.PC.career === "child servant") { - V.personalAttention = "upkeep"; - } else { - V.personalAttention = "business"; - } + resetPersonalAttention(); } } diff --git a/src/js/utilsPC.js b/src/js/utilsPC.js new file mode 100644 index 0000000000000000000000000000000000000000..4d1e516a74ca22e7874425dcb7377854d5b33f5d --- /dev/null +++ b/src/js/utilsPC.js @@ -0,0 +1,9 @@ +globalThis.resetPersonalAttention = function() { + if (V.PC.career === "escort" || V.PC.career === "prostitute" || V.PC.career === "child prostitute") { + V.personalAttention = "whoring"; + } else if (V.PC.career === "servant" || V.PC.career === "handmaiden" || V.PC.career === "child servant") { + V.personalAttention = "upkeep"; + } else { + V.personalAttention = "business"; + } +}; diff --git a/src/uncategorized/costsBudget.tw b/src/uncategorized/costsBudget.tw index 82e4afb5dc5db37e0e50351ff733230ee0ffe2dc..44e3f27614f7b9d73c396fa2784e239c69e0b96c 100644 --- a/src/uncategorized/costsBudget.tw +++ b/src/uncategorized/costsBudget.tw @@ -78,7 +78,7 @@ <span class="detail">Your weekly costs are as follows:</span> <<set _options = new App.UI.OptionsGroup()>> <<run _options.addOption("", "costsBudget", $showAllEntries) -.addValue("Normal", 0).on().addValue("Show Empty Entries", 1).neutral()>> +.addValue("Normal", 0).on().addValue("Show Empty Entries", 1)>> <<includeDOM _options.render()>> /* Table of Totals */ diff --git a/src/uncategorized/repBudget.tw b/src/uncategorized/repBudget.tw index ef2534a8043ff33a9117619cbfd16a12dd9815c7..6d6a831f74a45914326724b031d4d67277a9fd62 100644 --- a/src/uncategorized/repBudget.tw +++ b/src/uncategorized/repBudget.tw @@ -19,7 +19,7 @@ //Your weekly reputation changes are as follows:// <<set _options = new App.UI.OptionsGroup()>> <<run _options.addOption("", "repBudget", $showAllEntries) -.addValue("Normal", 0).on().addValue("Show Empty Entries", 1).neutral()>> +.addValue("Normal", 0).on().addValue("Show Empty Entries", 1)>> <<includeDOM _options.render()>> /* Table of Totals */