diff --git a/src/interaction/siRules.js b/src/interaction/siRules.js index 091da886cfb4e3a33bf6fceaab59b47f3e915f3b..005332973c60ac1a2207d84e88b5746cecb52682 100644 --- a/src/interaction/siRules.js +++ b/src/interaction/siRules.js @@ -291,42 +291,82 @@ App.UI.SlaveInteract.rules = function(slave) { let title = document.createElement('div'); title.textContent = `Non-assignment orgasm rules: `; el.append(title); + // + 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 + }, + ]; - 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); + 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 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"; + function makeLinks(orgasmObj) { + const linkArray = []; + makeALink(1); + makeALink(0); + + return App.UI.DOM.generateLinksStrip(linkArray); + + function makeALink(value) { + const allow = orgasmObj.master ? `Grant` : `Allow`; + const forbid = orgasmObj.master ? `Deny` : `Forbid`; + const title = value ? allow : forbid; + if (slave.rules.release[orgasmObj.value] === value) { + linkArray.push( + App.UI.DOM.disabledLink( + title, + ["Currently selected"] + ) + ); + } else { + linkArray.push( + App.UI.DOM.link( + title, + () => { + slave.rules.release[orgasmObj.value] = value; + refresh(); + } + ) + ); + } } - selected.textContent = `${text}. `; - return selected; } - - return el; } function smartSettings(slave) {