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/js/003-data/slaveMods.js b/js/003-data/slaveMods.js index 263a49514426f765d07a80dcd7e795da3cc4f8c5..3ee72458b193cdde7735a74b07fa68ec78cb6aeb 100644 --- a/js/003-data/slaveMods.js +++ b/js/003-data/slaveMods.js @@ -4,11 +4,11 @@ * @property {function(void):boolean} [requirements] Function to determine if a brand symbol can be used. */ /** - * @typedef {object<string, BrandStyle[]>} BrandStyleList + * @typedef {Object.<string, BrandStyle[]>} BrandStyleList * How the brand is saved in the variable. */ -/** @type {object<string, BrandStyleList>} */ +/** @type {Object.<string, BrandStyleList>} */ App.Medicine.Modification.Brands = { personal: { "your personal symbol": {displayName: "Your slaving emblem"}, @@ -398,3 +398,37 @@ App.Medicine.Modification.hairStyles = { }, ] }; + +App.Medicine.Modification.eyeColor = [ + {value: "amber"}, + {value: "black"}, + {value: "blue"}, + {value: "brown"}, + {value: "green"}, + {value: "hazel"}, + {value: "orange"}, + {value: "pale-grey"}, + {value: "pink"}, + {value: "red"}, + {value: "sky-blue"}, + {value: "turquoise"}, + {value: "white"}, + {value: "yellow"} +]; + +App.Medicine.Modification.eyeShape = [ + {value: "circular"}, + {value: "almond-shaped"}, + {value: "bright"}, + {value: "catlike"}, + {value: "demonic"}, + {value: "devilish"}, + {value: "goat-like"}, + {value: "heart-shaped"}, + {value: "hypnotic"}, + {value: "serpent-like"}, + {value: "star-shaped"}, + {value: "teary"}, + {value: "vacant"}, + {value: "wide-eyed"} +]; diff --git a/src/data/backwardsCompatibility/datatypeCleanup.js b/src/data/backwardsCompatibility/datatypeCleanup.js index ae955a09e5b932325677c73ddc16879855aad1ce..c4b24719321b31f773c66233712b4ef6e3058ea6 100644 --- a/src/data/backwardsCompatibility/datatypeCleanup.js +++ b/src/data/backwardsCompatibility/datatypeCleanup.js @@ -2090,6 +2090,7 @@ App.Entity.Utils.RARuleDatatypeCleanup = function() { set.collar = null; break; } + delete set.eyeColor; } }(); diff --git a/src/js/DefaultRules.js b/src/js/DefaultRules.js index 0f0b40753be28fae39ce4cf33abf7cb7e8d79b26..f9d395f1a9016ab796512d45e5205ac7597abcfd 100644 --- a/src/js/DefaultRules.js +++ b/src/js/DefaultRules.js @@ -2151,11 +2151,47 @@ 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) + ) { + 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 + ) { + 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/rulesAssistant.js b/src/js/rulesAssistant.js index 8bb727015c2d16c86a35811ad59512f606fa0df8..04ffbf3cd6bd089b2d8d35f75cf218219a708a59 100644 --- a/src/js/rulesAssistant.js +++ b/src/js/rulesAssistant.js @@ -210,7 +210,9 @@ App.RA.newRule = function() { buttplug: null, buttplugAttachment: null, vaginalAttachment: null, - eyeColor: null, + iris: null, + sclera: null, + pupil: null, makeup: null, nails: null, hColor: null, 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/salon.js b/src/js/salon.js index 5d01883a4e758db166979acace82af6748fd0744..e1a2e9a9ad72285b4a33ca698ad5c43fedb1ac34 100644 --- a/src/js/salon.js +++ b/src/js/salon.js @@ -29,12 +29,9 @@ App.Medicine.Modification.eyeSelector = function(entity, player = false) { function assembleLinks() { const sides = ["left", "right", "both"]; - const irisColors = ["amber", "black", "blue", "brown", "green", "hazel", "orange", "pale-grey", "pink", "red", - "sky-blue", "turquoise", "white", "yellow"]; - const pupilShapes = ["none", "circular", "almond-shaped", "bright", "catlike", "demonic", "devilish", - "goat-like", "heart-shaped", "hypnotic", "serpent-like", "star-shaped", "teary", "vacant", "wide-eyed"]; - const scleraColors = ["none", "white", "amber", "black", "blue", "brown", "green", "hazel", "orange", - "pale-grey", "pink", "red", "sky-blue", "turquoise", "yellow"]; + const irisColors = App.Medicine.Modification.eyeColor.map(color => color.value); + const pupilShapes = ["none"].concat(App.Medicine.Modification.eyeShape.map(shape => shape.value)); + const scleraColors = ["none"].concat(App.Medicine.Modification.eyeColor.map(color => color.value)); const div = document.createDocumentFragment(); div.append( assembleList("Side: ", sides, value => selectedSide = value, selectedIris), 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}