diff --git a/src/interaction/siRules.js b/src/interaction/siRules.js index 091da886cfb4e3a33bf6fceaab59b47f3e915f3b..c43959518f861d610e2027f163a8c3bda240b39d 100644 --- a/src/interaction/siRules.js +++ b/src/interaction/siRules.js @@ -110,7 +110,6 @@ App.UI.SlaveInteract.rules = function(slave) { } else { penthouseCensus(); p.append("Living standard: "); - App.UI.DOM.appendNewElement("span", p, slave.rules.living, "bold"); } if (setup.facilityCareers.includes(slave.assignment)) { App.UI.DOM.appendNewElement("span", p, ` ${His} living conditions are managed by ${his} assignment.`, "note"); @@ -292,41 +291,77 @@ App.UI.SlaveInteract.rules = function(slave) { title.textContent = `Non-assignment orgasm rules: `; el.append(title); - makeLinks("Masturbation", "rules.release.masturbation", `Controls whether ${he} is allowed to pleasure ${himself}, should ${he} feel the need`); - makeLinks("Partner", "rules.release.partner", `Controls whether ${he} is allowed sexual contact with ${his} romantic partner, should you permit ${him} to have one`); - makeLinks("Facility Leader", "rules.release.facilityLeader", `Controls whether development facility leaders (Nurse, Attendant, etc) are allowed to satisfy ${his} sexual needs while ${he} is assigned to their facility; does not apply to production facilities`); - makeLinks("Family", "rules.release.family", `Controls whether ${he} is allowed sexual contact with close family members`); - makeLinks("Other slaves", "rules.release.slaves", `Controls whether ${he} is allowed sexual contact with your other slaves that do not fit any of the above categories`); - makeLinks("Master", "rules.release.master", `Controls whether you will fuck ${him} personally when ${he} needs it`, true); - - function makeLinks(text, setting, note, master = false) { - const options = - [{text: master ? `Grant` : `Allow`, updateSlave: {[setting]: 1}}, - {text: master ? `Deny` : `Forbid`, updateSlave: {[setting]: 0}}]; - - let links = document.createElement('div'); - links.append(`${text}: `); - links.append(status(_.get(slave, setting), master)); - links.appendChild(App.UI.SlaveInteract.generateRows(options, slave, "", false, refresh)); - App.UI.DOM.appendNewElement('span', links, ' ' + note, "note"); - links.className = "choices"; - el.append(links); - } + const choices = [ + { + title: "Masturbation", + value: "masturbation", + note: `Controls whether ${he} is allowed to pleasure ${himself}, should ${he} feel the need` + }, + { + title: "Partner", + value: "partner", + note: `Controls whether ${he} is allowed sexual contact with ${his} romantic partner, should you permit ${him} to have one` + }, + { + title: "Facility Leader", + value: "facilityLeader", + note: `Controls whether development facility leaders (Nurse, Attendant, etc) are allowed to satisfy ${his} sexual needs while ${he} is assigned to their facility; does not apply to production facilities` + }, + { + title: "Family", + value: "family", + note: `Controls whether ${he} is allowed sexual contact with close family members` + }, + { + title: "Other slaves", + value: "slaves", + note: `Controls whether ${he} is allowed sexual contact with your other slaves that do not fit any of the above categories` + }, + { + title: "Master", + value: "master", + note: `Controls whether you will fuck ${him} personally when ${he} needs it`, + master: true + }, + ]; - function status(setting, master) { - let selected = document.createElement('span'); - selected.style.fontWeight = "bold"; - let text; - if (master) { - text = setting ? "granted" : "denied"; - } else { - text = setting ? "allowed" : "denied"; - } - selected.textContent = `${text}. `; - return selected; + for (const orgasmObj of choices) { + const row = document.createElement("div"); + row.classList.add("choices"); + row.append(`${orgasmObj.title}: `); + row.append(makeLinks(orgasmObj)); + App.UI.DOM.appendNewElement("span", row, ` ${orgasmObj.note}`, "note"); + el.append(row); } return el; + + function makeLinks(orgasmObj) { + const linkArray = []; + makeALink(1); + makeALink(0); + + return App.UI.DOM.generateLinksStrip(linkArray); + + function makeALink(onOff) { + const allow = orgasmObj.master ? `Grant` : `Allow`; + const forbid = orgasmObj.master ? `Deny` : `Forbid`; + const title = onOff ? allow : forbid; + if (slave.rules.release[orgasmObj.value] === onOff) { + linkArray.push(App.UI.DOM.makeElement("span", title, "bold")); + } else { + linkArray.push( + App.UI.DOM.link( + title, + () => { + slave.rules.release[orgasmObj.value] = onOff; + refresh(); + } + ) + ); + } + } + } } function smartSettings(slave) {