diff --git a/css/rulesAssistant/conditionEditor.css b/css/rulesAssistant/conditionEditor.css index 3ab3b7cfc3b11ec8b829111b326d7dfa61541346..24fde98844dc251f13b2469c887873812ea6bb6d 100644 --- a/css/rulesAssistant/conditionEditor.css +++ b/css/rulesAssistant/conditionEditor.css @@ -19,6 +19,10 @@ color: var(--link-hover-color); } +.rule-builder textarea { + min-width: 20em; +} + .rule-part-browser { } diff --git a/js/rulesAssistant/conditionEditor.js b/js/rulesAssistant/conditionEditor.js index 580105e2bd20c1e4fe761662c93f3f543b2c28e8..ff693da9b9b8400a3825b6d97a8d9c7d2a863448 100644 --- a/js/rulesAssistant/conditionEditor.js +++ b/js/rulesAssistant/conditionEditor.js @@ -36,6 +36,9 @@ App.RA.Activation.Editor = (function() { * @param {(rule:FC.RA.PostFixRule)=>void} callback */ function saveEditor(callback) { + if (currentRule == null) { + return; + } const error = currentRule.validate([]) === "error"; if (!error) { callback(serializeRule(currentRule)); @@ -533,12 +536,12 @@ App.RA.Activation.Editor = (function() { * @type {Map<RulePairComparators, string>} */ const rulePairComparators = new Map([ - ["eq", "=="], - ["neq", "!="], + ["eq", "="], + ["neq", "≠"], ["lt", "<"], ["gt", ">"], - ["lte", "<="], - ["gte", ">="], + ["lte", "⩽"], + ["gte", "⩾"], ["sub", "-"], ["div", "/"], ["substr", "Contains"], @@ -1010,10 +1013,14 @@ App.RA.Activation.Editor = (function() { refreshEditor(); }; div.append(button); - div.append(makeTextBoxDragSafe(App.UI.DOM.makeTextBox(this.check.slice(1), (v) => { - this.check = this._expectedType.first() + v; + const textArea = document.createElement("textarea"); + textArea.append(this.check.slice(1)); + textArea.onchange = ev => { + // @ts-ignore + this.check = this._expectedType.first() + ev.target.value; refreshEditor(); - }), this)); + }; + div.append(makeTextBoxDragSafe(textArea, this)); this._markValidationError(div); return div; } @@ -1036,7 +1043,7 @@ App.RA.Activation.Editor = (function() { } /** - * @param {HTMLInputElement} textBox + * @param {HTMLInputElement|HTMLTextAreaElement} textBox * @param {RulePart} rulePart * @returns {HTMLSpanElement} */ diff --git a/src/data/backwardsCompatibility/datatypeCleanup.js b/src/data/backwardsCompatibility/datatypeCleanup.js index b6d9489e6973cd518550456ab26c3aba242d0d59..d11529d346d7f71ab9cb13bea70c124dc04fdd1a 100644 --- a/src/data/backwardsCompatibility/datatypeCleanup.js +++ b/src/data/backwardsCompatibility/datatypeCleanup.js @@ -2148,16 +2148,16 @@ App.Entity.Utils.RARuleDatatypeCleanup = function() { if (typeof cond.function === "boolean") { cond.activation = [cond.function, 1, "and"]; } else if (cond.function === "custom") { - cond.activation = ["?bc=>" + cond.data + "(c.slave)", 1, "and"]; + cond.activation = ["?bc=>(" + cond.data + ")(c.slave)", 1, "and"]; } else if (cond.function === "belongs") { switch (cond.data.attribute) { case "amp": cond.activation = cond.data.value[0] === 1 - ? ["visamputee", 1, "and"] - : ["visamputee", "not", 1, "and"]; + ? ["isamputee", 1, "and"] + : ["isamputee", "not", 1, "and"]; break; case "genes": - cond.activation = ["vgenes", cond.data.value[0], "eqstr", 1, "and"]; + cond.activation = ["genes", "!" + cond.data.value[0], "eqstr", 1, "and"]; break; case "fetish": cond.activation = []; @@ -2165,7 +2165,7 @@ App.Entity.Utils.RARuleDatatypeCleanup = function() { let count = 0; for (const fetish of cond.data.value) { count++; - cond.activation.push("vfetish", "!" + fetish, "eqstr"); + cond.activation.push("fetish", "!" + fetish, "eqstr"); } cond.activation.push(count, "or", 1, "and"); } @@ -2219,28 +2219,27 @@ App.Entity.Utils.RARuleDatatypeCleanup = function() { } function convertBetween() { - //switch (cond.data.attribute) { const values = { - "devotion": "vdevotion", - "trust": "vtrust", - "health.condition": "vhealth", - "health.tired": "vfatigue", - "energy": "venergy", - "height": "vheight", - "weight": "vweight", - "actualAge": "vage", - "physicalAge": "vphysicalAge", - "visualAge": "vvisualAge", - "muscles": "vmuscles", - "pregType": "vpregType", - "bellyImplant": "vbellyImplant", - "belly": "vbelly", - "intelligenceImplant": "vintelligenceImplant", - "intelligence": "vintelligence", - "accent": "vaccent", - "waist": "vwaist", - "chem": "vchem", - "lactation": "vlactation", + "devotion": "devotion", + "trust": "trust", + "health.condition": "health", + "health.tired": "fatigue", + "energy": "energy", + "height": "height", + "weight": "weight", + "actualAge": "age", + "physicalAge": "physicalAge", + "visualAge": "visualAge", + "muscles": "muscles", + "pregType": "pregType", + "bellyImplant": "bellyImplant", + "belly": "belly", + "intelligenceImplant": "intelligenceImplant", + "intelligence": "intelligence", + "accent": "accent", + "waist": "waist", + "chem": "chem", + "lactation": "lactation", }; if (values.hasOwnProperty(cond.data.attribute)) { return addBetween(values[cond.data.attribute]); @@ -2263,44 +2262,44 @@ App.Entity.Utils.RARuleDatatypeCleanup = function() { function assigmentToKey(assignment) { const jobs = { - [Job.REST]: "vrest", - [Job.CHOICE]: "vchoice", - [Job.FUCKTOY]: "vfucktoy", - [Job.CLASSES]: "vclasses", - [Job.HOUSE]: "vhouse", - [Job.WHORE]: "vwhore", - [Job.PUBLIC]: "vpublic", - [Job.SUBORDINATE]: "vsubordinate", - [Job.MILKED]: "vmilked", - [Job.GLORYHOLE]: "vgloryhole", - [Job.CONFINEMENT]: "vconfinement", - [Job.BODYGUARD]: "vbodyguard", - [Job.RECRUITER]: "vrecruiter", - [Job.HEADGIRL]: "vheadgirl", - [Job.ARCADE]: "varcade", - [Job.MADAM]: "vmadam", - [Job.BROTHEL]: "vbrothel", - [Job.WARDEN]: "vwarden", - [Job.CELLBLOCK]: "vcellblock", - [Job.DJ]: "vdj", - [Job.CLUB]: "vclub", - [Job.NURSE]: "vnurse", - [Job.CLINIC]: "vclinic", - [Job.MILKMAID]: "vmilkmaid", - [Job.DAIRY]: "vdairy", - [Job.FARMER]: "vfarmer", - [Job.FARMYARD]: "vfarmyard", - [Job.HEADGIRLSUITE]: "vheadgirlsuite", - [Job.CONCUBINE]: "vconcubine", - [Job.MASTERSUITE]: "vmastersuite", - [Job.MATRON]: "vmatron", - [Job.NURSERY]: "vnursery", - [Job.TEACHER]: "vteacher", - [Job.SCHOOL]: "vschool", - [Job.STEWARD]: "vsteward", - [Job.QUARTER]: "vquarter", - [Job.ATTENDANT]: "vattendant", - [Job.SPA]: "vspa" + [Job.REST]: "rest", + [Job.CHOICE]: "choice", + [Job.FUCKTOY]: "fucktoy", + [Job.CLASSES]: "classes", + [Job.HOUSE]: "house", + [Job.WHORE]: "whore", + [Job.PUBLIC]: "public", + [Job.SUBORDINATE]: "subordinate", + [Job.MILKED]: "milked", + [Job.GLORYHOLE]: "gloryhole", + [Job.CONFINEMENT]: "confinement", + [Job.BODYGUARD]: "bodyguard", + [Job.RECRUITER]: "recruiter", + [Job.HEADGIRL]: "headgirl", + [Job.ARCADE]: "arcade", + [Job.MADAM]: "madam", + [Job.BROTHEL]: "brothel", + [Job.WARDEN]: "warden", + [Job.CELLBLOCK]: "cellblock", + [Job.DJ]: "dj", + [Job.CLUB]: "club", + [Job.NURSE]: "nurse", + [Job.CLINIC]: "clinic", + [Job.MILKMAID]: "milkmaid", + [Job.DAIRY]: "dairy", + [Job.FARMER]: "farmer", + [Job.FARMYARD]: "farmyard", + [Job.HEADGIRLSUITE]: "headgirlsuite", + [Job.CONCUBINE]: "concubine", + [Job.MASTERSUITE]: "mastersuite", + [Job.MATRON]: "matron", + [Job.NURSERY]: "nursery", + [Job.TEACHER]: "teacher", + [Job.SCHOOL]: "school", + [Job.STEWARD]: "steward", + [Job.QUARTER]: "quarter", + [Job.ATTENDANT]: "attendant", + [Job.SPA]: "spa" }; return jobs[assignment]; } diff --git a/src/gui/Encyclopedia/encyclopediaRAActivationEditor.js b/src/gui/Encyclopedia/encyclopediaRAActivationEditor.js index 173ac2d0ad92829ad947d6eadb7d313e0236074a..77ebed727a42af50801b69d0b202bec62c635fe2 100644 --- a/src/gui/Encyclopedia/encyclopediaRAActivationEditor.js +++ b/src/gui/Encyclopedia/encyclopediaRAActivationEditor.js @@ -60,9 +60,9 @@ App.Encyclopedia.addArticle("RA Condition Editor", function() { transformerRow(el, "Multiply all", "Multiplies all input values", "Number"); transformerRow(el, "Maximum", "Gives the largest input value", "Number"); transformerRow(el, "Minimum", "Gives the smallest input value", "Number"); - transformerRow(el, "==, !=", "Compares the input values based on the comparator in " + + transformerRow(el, "=, ≠", "Compares the input values based on the comparator in " + "the middle. Both sides need to have the same data type.", "Boolean, Number, String"); - transformerRow(el, "<, >, <=, >=", "Compares the input values based on the comparator in " + + transformerRow(el, "<, ⩽, >, ⩾", "Compares the input values based on the comparator in " + "the middle. Both sides need to have the same data type.", "Boolean, Number"); transformerRow(el, "-", "Subtracts the second value from the first value", "Number"); transformerRow(el, "/", "Divides the second value by the first value", "Number");