diff --git a/devTools/types/FC.d.ts b/devTools/types/FC.d.ts index a3f2b2ca6f01b8d043e483d51c90bd646a488da2..e0cc8bc9e1e8f1e99630884d68b02bca1711ea73 100644 --- a/devTools/types/FC.d.ts +++ b/devTools/types/FC.d.ts @@ -150,7 +150,9 @@ declare global { buttplug: string; vaginalAttachment: string; buttplugAttachment: string; - eyeColor: string; + iris: string; + pupil: string; + sclera: string; makeup: number; nails: number; hColor: string; diff --git a/src/js/DefaultRules.js b/src/js/DefaultRules.js index 0f0b40753be28fae39ce4cf33abf7cb7e8d79b26..6ed0c94711f12e7c7b0f8c8e7e4f72713432aeda 100644 --- a/src/js/DefaultRules.js +++ b/src/js/DefaultRules.js @@ -2151,11 +2151,49 @@ globalThis.DefaultRules = (function() { * @param {App.RA.RuleSetters} rule */ function ProcessStyle(slave, rule) { - if (rule.eyeColor !== undefined && (rule.eyeColor !== null)) { - if (getLeftEyeColor(slave) !== rule.eyeColor || getRightEyeColor(slave) !== rule.eyeColor) { - setEyeColor(slave, rule.eyeColor); + if ( + (rule.iris !== undefined && rule.iris !== null) || + (rule.pupil !== undefined && rule.pupil !== null) || + (rule.sclera !== undefined && rule.sclera !== null) + ) { + console.log("has rule", rule); + if ( + getLeftEyeColor(slave) !== rule.iris || getRightEyeColor(slave) !== rule.iris || + getLeftEyePupil(slave) !== rule.pupil || getRightEyePupil(slave) !== rule.pupil || + getLeftEyeSclera(slave) !== rule.sclera || getRightEyeSclera(slave) !== rule.sclera + ) { + console.log("iris: ", rule.iris); + let iris = rule.iris || getLeftEyeColor(slave); + let pupil = rule.pupil || getLeftEyePupil(slave); + let sclera = rule.sclera || getLeftEyeSclera(slave); + setEyeColorFull(slave, iris, pupil, sclera, "left"); + + iris = rule.iris || getRightEyeColor(slave); + pupil = rule.pupil || getRightEyePupil(slave); + sclera = rule.sclera || getRightEyeSclera(slave); + setEyeColorFull(slave, iris, pupil, sclera, "right"); + cashX(forceNeg(V.modCost), "slaveMod", slave); - r += `<br>${slave.slaveName} has been given ${rule.eyeColor} contact lenses.`; + const lensDesc = []; + if (rule.iris) { + if (hasBothEyes(slave)) { + lensDesc.push(`${rule.iris} irises`); + } else { + lensDesc.push(`a ${rule.iris} iris`); + } + } + if (rule.pupil) { + if (hasBothEyes(slave)) { + lensDesc.push(`${rule.pupil} pupils`); + } else { + lensDesc.push(`a ${rule.pupil} pupil`); + } + } + if (rule.sclera) { + lensDesc.push(`${rule.sclera} sclera`); + } + const lens = lensDesc.slice(0, lensDesc.length - 1).join(', ') + ", and " + lensDesc.slice(-1); + r += `<br>${slave.slaveName} has been given ${hasBothEyes(slave)?`contact lenses`:`a contact lens`} with ${lens}.`; } } diff --git a/src/js/rulesAssistantOptions.js b/src/js/rulesAssistantOptions.js index 730da4dc67bf0ed0fd240423a4b3c908d20d4cbc..ba790d7963f68aadf02cdee16e153ad4e22e3a10 100644 --- a/src/js/rulesAssistantOptions.js +++ b/src/js/rulesAssistantOptions.js @@ -1687,7 +1687,9 @@ globalThis.rulesAssistantOptions = (function() { constructor(tabButtons) { super("cosmetic", "Cosmetic", tabButtons); this.appendChild(new EyewearList()); - this.appendChild(new LensesList()); + this.appendChild(new IrisColorList()); + this.appendChild(new PupilShapeList()); + this.appendChild(new ScleraColorList()); this.appendChild(new EarwearList()); this.appendChild(new MakeupList()); this.appendChild(new NailsList()); @@ -2876,108 +2878,28 @@ globalThis.rulesAssistantOptions = (function() { this.onchange = (value) => current_rule.set.eyewear = value; } } - - class LensesList extends List { + class IrisColorList extends List { constructor() { - super("Eye coloring"); - this.colorlist = new LensesColorList(this); - this.shapelist = new LensesShapeList(this); - this.colorlist.onchange = () => this.setValue(undefined); - this.shapelist.onchange = () => this.setValue(undefined); - this.setValue(current_rule.set.eyeColor); - this.onchange = (value) => current_rule.set.eyeColor = value; - } - - _appendContentTo(container) { - super._appendContentTo(container); - this.colorlist._appendContentTo(container); - this.shapelist._appendContentTo(container); - } - - combine() { - const lst = []; - if (this.colorlist.getData() !== null) { lst.push(this.colorlist.getData()); } - if (this.shapelist.getData() !== null) { lst.push(this.shapelist.getData()); } - return (lst.length === 0) ? null : lst.join(" "); - } - - setValue(val) { - if (val === undefined) { - val = this.combine(); - } else { - if (val === noDefaultSetting.value || val === null) { - this.colorlist.setValue(val); - this.shapelist.setValue(val); - } else { - let list = val.split(' '); - if(list.length === 2) { - this.colorlist.setValue(list[0]); - this.shapelist.setValue(list[1]); - } else if(list.length === 1) { - this.colorlist.trySetValue(list[0]); - this.shapelist.trySetValue(list[0]); - } - } - } - super.setValue(val); - current_rule.set.eyeColor = val; - } - } - - class LensesColorList extends List { - constructor(parent) { - const items = - [ - "blue", - "black", - "brown", - "green", - "turquoise", - "sky-blue", - "hazel", - "pale-grey", - "white", - "pink", - "yellow", - "orange", - "amber", - "red" - ]; - super("Color", items); - this.labelElement_.className = "ra-sub-label"; - this.parent = parent; + const items = App.Medicine.Modification.eyeColor.map(color => color.value); + super("Iris", items); + this.setValue(current_rule.set.iris); + this.onchange = (value) => current_rule.set.iris = value; } - - createValueElement() { - return null; - } - } - - class LensesShapeList extends List { - constructor(parent) { - const items = - [ - "catlike", - "serpent-like", - "goat-like", - "devilish", - "demonic", - "hypnotic", - "heart-shaped", - "star-shaped", - "wide-eyed", - "almond-shaped", - "bright", - "teary", - "vacant" - ]; - super("Shape", items); - this.labelElement_.className = "ra-sub-label"; - this.parent = parent; + } + class PupilShapeList extends List { + constructor() { + const items = ["none"].concat(App.Medicine.Modification.eyeShape.map(shape => shape.value)); + super("Pupil", items); + this.setValue(current_rule.set.pupil); + this.onchange = (value) => current_rule.set.pupil = value; } - - createValueElement() { - return null; + } + class ScleraColorList extends List { + constructor() { + const items = ["none"].concat(App.Medicine.Modification.eyeColor.map(color => color.value)); + super("Sclera", items); + this.setValue(current_rule.set.sclera); + this.onchange = (value) => current_rule.set.sclera = value; } } diff --git a/src/js/statsChecker/eyeChecker.js b/src/js/statsChecker/eyeChecker.js index 85b49c03ab04f3ee036fb69ad8b2ace5755c8848..c7e812acc2774098494792a807b222225a7d04a9 100644 --- a/src/js/statsChecker/eyeChecker.js +++ b/src/js/statsChecker/eyeChecker.js @@ -223,6 +223,30 @@ globalThis.getRightEyePupil = function(slave) { } }; +/** + * @param {App.Entity.SlaveState} slave + * @returns {string} + */ +globalThis.getLeftEyeSclera = function(slave) { + if (hasLeftEye(slave)) { + return slave.eye.left.sclera; + } else { + return "empty"; + } +}; + +/** + * @param {App.Entity.SlaveState} slave + * @returns {string} + */ +globalThis.getRightEyeSclera = function(slave) { + if (hasLeftEye(slave)) { + return slave.eye.right.sclera; + } else { + return "empty"; + } +}; + /** * @param {App.Entity.SlaveState} slave * @returns {boolean}