From c8508607e7cb9fcb16696854ee546832c1a84f1d Mon Sep 17 00:00:00 2001 From: Pregmodder <pregmodder@gmail.com> Date: Sat, 18 May 2019 02:05:25 -0700 Subject: [PATCH] Revert "Merge branch 'dcoded-dev' into 'pregmod-master'" This reverts merge request !4538 --- .eslintrc.json | 2 +- src/art/vector/VectorArtJS.js | 4 +- src/interaction/main/mainLinks.js | 2 +- src/js/DefaultRules.js | 4 +- src/js/assayJS.js | 2 +- src/js/assignJS.js | 94 +++++++++++++++---------------- src/js/familyTreeJS.js | 30 ++++------ src/js/hTagMacroJS.js | 5 +- src/js/pregJS.js | 3 +- src/js/quickListJS.js | 30 +++++----- src/js/removeActiveSlave.js | 6 +- src/js/rulesAssistant.js | 6 +- src/js/sexActsJS.js | 3 +- src/js/slaveCostJS.js | 73 ++++++++++-------------- src/js/slaveGenerationJS.js | 4 +- src/js/slaveListing.js | 16 +++--- src/js/slaveStatsChecker.js | 60 ++++++++++---------- src/js/storyJS.js | 60 ++++++++++---------- src/js/textInput.js | 4 +- src/js/utilJS.js | 8 +-- 20 files changed, 200 insertions(+), 216 deletions(-) diff --git a/.eslintrc.json b/.eslintrc.json index dec9b166a68..c50f403a869 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -36,7 +36,7 @@ "eqeqeq": "warn", "no-fallthrough": "error", "space-before-function-paren": ["warn", { - "anonymous": "never", + "anonymous": "always", "named": "never", "asyncArrow": "always" }], diff --git a/src/art/vector/VectorArtJS.js b/src/art/vector/VectorArtJS.js index 3da76328829..5295d7e1072 100644 --- a/src/art/vector/VectorArtJS.js +++ b/src/art/vector/VectorArtJS.js @@ -1,4 +1,4 @@ -window.VectorArt = (function() { +window.VectorArt = (function () { "use strict"; let V, T, slave; let r; @@ -2679,7 +2679,7 @@ window.VectorArt = (function() { return VectorArt; })(); -window.LegacyVectorArt = function(slave, artSize) { +window.LegacyVectorArt = function (slave, artSize) { const filePath = "'resources/vector"; const skinFilePath = `${filePath}/body/white`; const wearingLatex = slave.clothes === "a Fuckdoll suit" || slave.clothes === "restrictive latex" || slave.clothes === "a latex catsuit"; diff --git a/src/interaction/main/mainLinks.js b/src/interaction/main/mainLinks.js index 44b7f3aa8b2..80a9153ca67 100644 --- a/src/interaction/main/mainLinks.js +++ b/src/interaction/main/mainLinks.js @@ -1,5 +1,5 @@ /* OPEN MAIN */ -App.UI.View.MainLinks = function() { +App.UI.View.MainLinks = function () { "use strict"; const V = State.variables; const PA = Array.isArray(V.personalAttention) ? V.personalAttention.map(x => getSlave(x.ID)) : []; diff --git a/src/js/DefaultRules.js b/src/js/DefaultRules.js index 90ed3d4ce5e..c94323529c1 100644 --- a/src/js/DefaultRules.js +++ b/src/js/DefaultRules.js @@ -1,6 +1,6 @@ // this code applies RA rules onto slaves -window.DefaultRules = (function() { +window.DefaultRules = (function () { "use strict"; let V; let r; @@ -1353,7 +1353,7 @@ window.DefaultRules = (function() { } } if (_priorities.length > 1) { - _priorities = _priorities.sort(function(a, b) { + _priorities = _priorities.sort(function (a, b) { if (a.weight > b.weight) { return -1; } diff --git a/src/js/assayJS.js b/src/js/assayJS.js index b0812a49b6e..85d9c11a4b1 100644 --- a/src/js/assayJS.js +++ b/src/js/assayJS.js @@ -389,7 +389,7 @@ App.Utils.Pronouns = class { * @param {App.Entity.SlaveState} slave * @returns {App.Utils.Pronouns} */ -window.getPronouns = function(slave) { +window.getPronouns = function (slave) { return new App.Utils.Pronouns(slave); }; diff --git a/src/js/assignJS.js b/src/js/assignJS.js index 266fe5fab04..90124832f88 100644 --- a/src/js/assignJS.js +++ b/src/js/assignJS.js @@ -4,7 +4,8 @@ window.assignJob = function assignJob(slave, job) { const V = State.variables; let r = ""; - if (job === "Pit" || job === "Coursing Association") { return r; } + if (job === "Pit" || job === "Coursing Association") + return r; removeJob(slave, slave.assignment); const idx = V.slaveIndices[slave.ID]; @@ -169,11 +170,10 @@ window.assignJob = function assignJob(slave, job) { slave.assignmentVisible = 0; V.masterSuiteSlaves++; V.MastSiIDs.push(slave.ID); - if (V.masterSuiteUpgradeLuxury > 0) { + if (V.masterSuiteUpgradeLuxury > 0) slave.livingRules = "luxurious"; - } else { + else slave.livingRules = "spare"; - } break; case "learn in the schoolroom": @@ -258,11 +258,10 @@ window.assignJob = function assignJob(slave, job) { case "be your concubine": slave.assignment = job; slave.assignmentVisible = 0; /* non-visible leadership roles */ - if (V.masterSuiteUpgradeLuxury > 0) { + if (V.masterSuiteUpgradeLuxury > 0) slave.livingRules = "luxurious"; - } else { + else slave.livingRules = "normal"; - } break; case "be your head girl": @@ -277,7 +276,8 @@ window.assignJob = function assignJob(slave, job) { if (V.dojo > 1) { slave.livingRules = "luxurious"; } - if (V.pitBG === 1 && V.fighterIDs.includes(slave.ID)) { V.fighterIDs.delete(slave.ID); } + if (V.pitBG === 1 && V.fighterIDs.includes(slave.ID)) + V.fighterIDs.delete(slave.ID); break; case "be your agent": @@ -303,25 +303,24 @@ window.assignJob = function assignJob(slave, job) { } if (slave.assignmentVisible === 0 && Array.isArray(V.personalAttention)) { - const awi = V.personalAttention.findIndex(function(s) { return s.ID === slave.ID; }); + const awi = V.personalAttention.findIndex(function(s) {return s.ID === slave.ID;}); if (awi !== -1) { V.personalAttention.deleteAt(awi); if (V.personalAttention.length === 0) { - if (V.PC.career === "escort") { + if (V.PC.career === "escort") V.personalAttention = "whoring"; - } else if (V.PC.career === "servant") { + else if (V.PC.career === "servant") V.personalAttention = "upkeep"; - } else { + else V.personalAttention = "business"; - } r += `${slave.slaveName} no longer has your personal attention; you plan to focus on ${V.personalAttention}.`; - } else { + } else r += `${slave.slaveName} no longer has your personal attention.`; - } } } V.JobIDArray = resetJobIDArray(); - if (idx >= 0) { V.slaves[idx] = slave; } + if (idx >= 0) + V.slaves[idx] = slave; return r; }; @@ -333,40 +332,43 @@ window.removeJob = function removeJob(slave, assignment) { const idx = V.slaveIndices[slave.ID]; - if (assignment === "Pit") { + if (assignment === "Pit") V.fighterIDs.delete(slave.ID); - } else if (assignment === "Coursing Association") { + + else if (assignment === "Coursing Association") V.Lurcher = 0; - } else { - if (V.HeadGirl !== 0 && slave.ID === V.HeadGirl.ID) { + + else { + if (V.HeadGirl !== 0 && slave.ID === V.HeadGirl.ID) V.HeadGirl = 0; - } else if (V.Recruiter !== 0 && slave.ID === V.Recruiter.ID) { + else if (V.Recruiter !== 0 && slave.ID === V.Recruiter.ID) V.Recruiter = 0; - } else if (V.Bodyguard !== 0 && slave.ID === V.Bodyguard.ID) { + else if (V.Bodyguard !== 0 && slave.ID === V.Bodyguard.ID) V.Bodyguard = 0; - } else if (V.Madam !== 0 && slave.ID === V.Madam.ID) { + else if (V.Madam !== 0 && slave.ID === V.Madam.ID) V.Madam = 0; - } else if (V.DJ !== 0 && slave.ID === V.DJ.ID) { + else if (V.DJ !== 0 && slave.ID === V.DJ.ID) V.DJ = 0; - } else if (V.Milkmaid !== 0 && slave.ID === V.Milkmaid.ID) { + else if (V.Milkmaid !== 0 && slave.ID === V.Milkmaid.ID) V.Milkmaid = 0; - } else if (V.Farmer !== 0 && slave.ID === V.Farmer.ID) { + else if (V.Farmer !== 0 && slave.ID === V.Farmer.ID) V.Farmer = 0; - } else if (V.Schoolteacher !== 0 && slave.ID === V.Schoolteacher.ID) { + else if (V.Schoolteacher !== 0 && slave.ID === V.Schoolteacher.ID) V.Schoolteacher = 0; - } else if (V.Attendant !== 0 && slave.ID === V.Attendant.ID) { + else if (V.Attendant !== 0 && slave.ID === V.Attendant.ID) V.Attendant = 0; - } else if (V.Matron !== 0 && slave.ID === V.Matron.ID) { + else if (V.Matron !== 0 && slave.ID === V.Matron.ID) V.Matron = 0; - } else if (V.Nurse !== 0 && slave.ID === V.Nurse.ID) { + else if (V.Nurse !== 0 && slave.ID === V.Nurse.ID) V.Nurse = 0; - } else if (V.Stewardess !== 0 && slave.ID === V.Stewardess.ID) { + else if (V.Stewardess !== 0 && slave.ID === V.Stewardess.ID) V.Stewardess = 0; - } else if (V.Wardeness !== 0 && slave.ID === V.Wardeness.ID) { + else if (V.Wardeness !== 0 && slave.ID === V.Wardeness.ID) V.Wardeness = 0; - } else if (V.Concubine !== 0 && slave.ID === V.Concubine.ID) { + else if (V.Concubine !== 0 && slave.ID === V.Concubine.ID) V.Concubine = 0; - } else if (V.Collectrix !== 0 && slave.ID === V.Collectrix.ID) { V.Collectrix = 0; } + else if (V.Collectrix !== 0 && slave.ID === V.Collectrix.ID) + V.Collectrix = 0; /* use .toLowerCase() to get rid of a few dupe conditions. */ switch (assignment.toLowerCase()) { @@ -473,13 +475,13 @@ window.removeJob = function removeJob(slave, assignment) { case "be your head girl": slave.assignment = "rest"; if (V.HGSuiteEquality === 0 && V.personalAttention === "HG") { - if (V.PC.career === "escort") { + if (V.PC.career === "escort") V.personalAttention = "whoring"; - } else if (V.PC.career === "servant") { + else if (V.PC.career === "servant") V.personalAttention = "upkeep"; - } else { + else V.personalAttention = "business"; - } + r += `You no longer have a slave assigned to be your Head Girl, so you turn your personal attention to focus on ${V.personalAttention}.`; } break; @@ -490,11 +492,12 @@ window.removeJob = function removeJob(slave, assignment) { const _leaderIndex = V.leaders.findIndex(function(x) { return x.ID === slave.ID; }); - if (_leaderIndex !== -1) { V.leaders.deleteAt(_leaderIndex); } + if (_leaderIndex !== -1) + V.leaders.deleteAt(_leaderIndex); if (slave.relationshipTarget > 0) { /* following code assumes there can be at most one companion */ - const _lover = V.slaves.findIndex(function(s) { return haveRelationshipP(s, slave) && s.assignment === "live with your agent"; }); + const _lover = V.slaves.findIndex(function(s) {return haveRelationshipP(s, slave) && s.assignment === "live with your agent";}); if (_lover !== -1) { V.slaves[_lover].assignment = "rest"; V.slaves[_lover].assignmentVisible = 1; @@ -507,18 +510,16 @@ window.removeJob = function removeJob(slave, assignment) { break; } - if (slave.livingRules === "luxurious" && slave.assignmentVisible !== 1) { + if (slave.livingRules === "luxurious" && slave.assignmentVisible !== 1) slave.livingRules = "normal"; - } slave.assignmentVisible = 1; slave.choosesOwnAssignment = 0; slave.sentence = 0; } V.JobIDArray = resetJobIDArray(); - if (idx >= 0) { + if (idx >= 0) V.slaves[idx] = slave; - } return r; }; @@ -540,9 +541,8 @@ window.resetJobIDArray = function resetJobIDArray() { }; slaves.forEach(function(slave) { - if (JobIDArray.hasOwnProperty(slave.assignment)) { + if (JobIDArray.hasOwnProperty(slave.assignment)) JobIDArray[slave.assignment].push(slave.ID); - } }); return JobIDArray; @@ -602,7 +602,7 @@ App.UI.jobLinks = function() { const slave = App.Utils.slaveByIndex(index); for (const f of facilitiesOrder) { - if (!f.established) { continue; } + if (!f.established) continue; const rejects = f.canHostSlave(slave); if (rejects.length === 0) { transfers.push(f.transferLink(index, undefined, passage())); diff --git a/src/js/familyTreeJS.js b/src/js/familyTreeJS.js index 8f11d0b8908..e6cc775d6bb 100644 --- a/src/js/familyTreeJS.js +++ b/src/js/familyTreeJS.js @@ -195,7 +195,7 @@ window.renderFamilyTree = function(slaves, filterID) { .links(data.links); function dragstarted(d) { - if (!d3.event.active) { simulation.alphaTarget(0.3).restart(); } + if (!d3.event.active) simulation.alphaTarget(0.3).restart(); d.fx = d.x; d.fy = d.y; } @@ -206,7 +206,7 @@ window.renderFamilyTree = function(slaves, filterID) { } function dragended(d) { - if (!d3.event.active) { simulation.alphaTarget(0); } + if (!d3.event.active) simulation.alphaTarget(0); d.fx = null; d.fy = null; } @@ -536,7 +536,8 @@ window.updateFamilyTree = function(activeSlave = lastActiveSlave, slaves = lastS let numTreeNodes = 0; let graphElement = document.getElementById("graph"); - if (!graphElement) { return; } + if (!graphElement) + return; graphElement.innerHTML = ""; /* The way this code works is that we start with the activeSlave then we call @@ -562,9 +563,8 @@ window.updateFamilyTree = function(activeSlave = lastActiveSlave, slaves = lastS return activeSlave; } for (let i = 0; i < slaves.length; ++i) { - if (slaves[i].ID === id) { + if (slaves[i].ID === id) return slaves[i]; - } } return { "slaveName": "-", @@ -582,9 +582,8 @@ window.updateFamilyTree = function(activeSlave = lastActiveSlave, slaves = lastS } recursionProtectSlaveId[slave.ID] = true; - if (typeof slave.father === "undefined" || typeof slave.mother === "undefined") { + if (typeof slave.father === "undefined" || typeof slave.mother === "undefined") return slaveInfo_(slave, activeSlaveId); - } if (slave.father === -1 || slave.mother === -1) { return slaveInfo(getSlave(-1), activeSlaveId, recursionProtectSlaveId); @@ -617,9 +616,8 @@ window.updateFamilyTree = function(activeSlave = lastActiveSlave, slaves = lastS let spouseToChild = {}; function maybeAddSpouseToChild(child) { - if (child.ID === slave.ID) { + if (child.ID === slave.ID) return; - } if (child.father === slave.ID) { if (!spouseToChild[child.mother]) { spouseToChild[child.mother] = []; @@ -633,16 +631,14 @@ window.updateFamilyTree = function(activeSlave = lastActiveSlave, slaves = lastS } } - if (activeSlave.ID !== PC.ID) + if (activeSlave.ID !== PC.ID) maybeAddSpouseToChild(activeSlave); - } maybeAddSpouseToChild(getSlave(-1)); for (let i = 0; i < slaves.length; ++i) { let child = slaves[i]; - if (child.ID !== activeSlave.ID) { + if (child.ID !== activeSlave.ID) maybeAddSpouseToChild(child); - } } for (let key in spouseToChild) { @@ -657,7 +653,7 @@ window.updateFamilyTree = function(activeSlave = lastActiveSlave, slaves = lastS } let marriage = { "spouse": {"name": spouseName, "class": spouse.genes}, - "children": children.map(function(x) {return slaveInfo_(x, activeSlaveId, slavesAdded, depth + 1);}), + "children": children.map(function(x) { return slaveInfo_(x, activeSlaveId, slavesAdded, depth + 1); }), }; data.marriages.push(marriage); } @@ -665,18 +661,16 @@ window.updateFamilyTree = function(activeSlave = lastActiveSlave, slaves = lastS return data; } - if (activeSlave === PC || activeSlave === null) { + if (activeSlave === PC || activeSlave === null) activeSlave = getSlave(-1); - } const treeData = [slaveInfo(activeSlave, activeSlave.ID)]; console.log("Family tree is", treeData, 'and has:', numTreeNodes); let parentWidth = document.getElementById('editFamily').offsetWidth; console.log(parentWidth, document.getElementById('passages').offsetWidth); - if (!parentWidth) { + if (!parentWidth) parentWidth = document.body.offsetWidth - 483; - } console.log(parentWidth, Math.min(200 + 40 * numTreeNodes, parentWidth - 200) + 200); diff --git a/src/js/hTagMacroJS.js b/src/js/hTagMacroJS.js index a39182d7c32..eae7530a3a8 100644 --- a/src/js/hTagMacroJS.js +++ b/src/js/hTagMacroJS.js @@ -31,8 +31,9 @@ Macro.add('htag', { } else { attributes = `id="${String(this.args[0]).trim()}"`; } - if (Config.debug) { - this.debugView.modes({ + if (Config.debug) + { +this.debugView.modes({ block: true }); } diff --git a/src/js/pregJS.js b/src/js/pregJS.js index 7642540d9b2..853e4d66669 100644 --- a/src/js/pregJS.js +++ b/src/js/pregJS.js @@ -507,9 +507,8 @@ window.findFather = function(fatherID) { window.adjustFatherProperty = function(actor, property, newValue) { let father = findFather(actor.ID); - if (father) { + if (father) father[property] = newValue; - } }; /* OLD diff --git a/src/js/quickListJS.js b/src/js/quickListJS.js index 27fe34eed16..8ac22f3e4c8 100644 --- a/src/js/quickListJS.js +++ b/src/js/quickListJS.js @@ -1,4 +1,4 @@ -window.sortDomObjects = function(objects, attrName, reverse = 0) { +window.sortDomObjects = function (objects, attrName, reverse = 0) { reverse = (reverse) ? -1 : 1; function sortingByAttr(a, b) { @@ -15,22 +15,22 @@ window.sortDomObjects = function(objects, attrName, reverse = 0) { return objects.toArray().sort(sortingByAttr); }; -window.sortButtonsByDevotion = function() { +window.sortButtonsByDevotion = function () { let $sortedButtons = $('#qlWrapper button').remove(); $sortedButtons = sortDomObjects($sortedButtons, 'data-devotion'); $($sortedButtons).appendTo($('#qlWrapper')); quickListBuildLinks(); }; -window.sortButtonsByTrust = function() { +window.sortButtonsByTrust = function () { let $sortedButtons = $('#qlWrapper button').remove(); $sortedButtons = sortDomObjects($sortedButtons, 'data-trust'); $($sortedButtons).appendTo($('#qlWrapper')); quickListBuildLinks(); }; -window.quickListBuildLinks = function() { - $("[data-scroll-to]").click(function() { +window.quickListBuildLinks = function () { + $("[data-scroll-to]").click(function () { let $this = $(this), $toElement = $this.attr('data-scroll-to'); // note the * 1 enforces $offset to be an integer, without @@ -44,31 +44,31 @@ window.quickListBuildLinks = function() { }); }; -window.sortIncubatorPossiblesByName = function() { +window.sortIncubatorPossiblesByName = function () { let $sortedIncubatorPossibles = $('#qlIncubator div.possible').detach(); $sortedIncubatorPossibles = sortDomObjects($sortedIncubatorPossibles, 'data-name'); $($sortedIncubatorPossibles).appendTo($('#qlIncubator')); }; -window.sortIncubatorPossiblesByPregnancyWeek = function() { +window.sortIncubatorPossiblesByPregnancyWeek = function () { let $sortedIncubatorPossibles = $('#qlIncubator div.possible').detach(); $sortedIncubatorPossibles = sortDomObjects($sortedIncubatorPossibles, 'data-preg-week'); $($sortedIncubatorPossibles).appendTo($('#qlIncubator')); }; -window.sortIncubatorPossiblesByPregnancyCount = function() { +window.sortIncubatorPossiblesByPregnancyCount = function () { let $sortedIncubatorPossibles = $('#qlIncubator div.possible').detach(); $sortedIncubatorPossibles = sortDomObjects($sortedIncubatorPossibles, 'data-preg-count'); $($sortedIncubatorPossibles).appendTo($('#qlIncubator')); }; -window.sortIncubatorPossiblesByReservedSpots = function() { +window.sortIncubatorPossiblesByReservedSpots = function () { let $sortedIncubatorPossibles = $('#qlIncubator div.possible').detach(); $sortedIncubatorPossibles = sortDomObjects($sortedIncubatorPossibles, 'data-reserved-spots'); $($sortedIncubatorPossibles).appendTo($('#qlIncubator')); }; -window.sortIncubatorPossiblesByPreviousSort = function() { +window.sortIncubatorPossiblesByPreviousSort = function () { let sort = State.variables.sortIncubatorList; if ('unsorted' !== sort) { if ('Name' === sort) { @@ -83,31 +83,31 @@ window.sortIncubatorPossiblesByPreviousSort = function() { } }; -window.sortNurseryPossiblesByName = function() { +window.sortNurseryPossiblesByName = function () { let $sortedNurseryPossibles = $('#qlNursery div.possible').detach(); $sortedNurseryPossibles = sortDomObjects($sortedNurseryPossibles, 'data-name'); $($sortedNurseryPossibles).appendTo($('#qlNursery')); }; -window.sortNurseryPossiblesByPregnancyWeek = function() { +window.sortNurseryPossiblesByPregnancyWeek = function () { let $sortedNurseryPossibles = $('#qlNursery div.possible').detach(); $sortedNurseryPossibles = sortDomObjects($sortedNurseryPossibles, 'data-preg-week'); $($sortedNurseryPossibles).appendTo($('#qlNursery')); }; -window.sortNurseryPossiblesByPregnancyCount = function() { +window.sortNurseryPossiblesByPregnancyCount = function () { let $sortedNurseryPossibles = $('#qlNursery div.possible').detach(); $sortedNurseryPossibles = sortDomObjects($sortedNurseryPossibles, 'data-preg-count'); $($sortedNurseryPossibles).appendTo($('#qlNursery')); }; -window.sortNurseryPossiblesByReservedSpots = function() { +window.sortNurseryPossiblesByReservedSpots = function () { let $sortedNurseryPossibles = $('#qlNursery div.possible').detach(); $sortedNurseryPossibles = sortDomObjects($sortedNurseryPossibles, 'data-reserved-spots'); $($sortedNurseryPossibles).appendTo($('#qlNursery')); }; -window.sortNurseryPossiblesByPreviousSort = function() { +window.sortNurseryPossiblesByPreviousSort = function () { let sort = State.variables.sortNurseryList; if ('unsorted' !== sort) { if ('Name' === sort) { diff --git a/src/js/removeActiveSlave.js b/src/js/removeActiveSlave.js index c93d9435f7e..d07be0a9658 100644 --- a/src/js/removeActiveSlave.js +++ b/src/js/removeActiveSlave.js @@ -125,7 +125,7 @@ window.removeActiveSlave = function removeActiveSlave() { } if (Array.isArray(V.personalAttention)) { - const _rasi = V.personalAttention.findIndex(function(s) { return s.ID === AS_ID; }); + const _rasi = V.personalAttention.findIndex(function (s) { return s.ID === AS_ID; }); if (_rasi !== -1) { V.personalAttention.deleteAt(_rasi); if (V.personalAttention.length === 0) { @@ -195,7 +195,7 @@ window.removeActiveSlave = function removeActiveSlave() { } } - const _geneIndex = V.genePool.findIndex(function(s) { return s.ID === AS_ID; }); + const _geneIndex = V.genePool.findIndex(function (s) { return s.ID === AS_ID; }); if (_geneIndex !== -1) { let keep = false; if (V.traitor !== 0) { @@ -335,7 +335,7 @@ window.removeNonNGPSlave = function removeNonNGPSlave(removedSlave) { } }); - const _geneIndex = V.genePool.findIndex(function(s) { return s.ID === ID; }); + const _geneIndex = V.genePool.findIndex(function (s) { return s.ID === ID; }); if (_geneIndex !== -1) { let keep = false; if (isImpregnatedBy(V.PC, removedSlave)) { diff --git a/src/js/rulesAssistant.js b/src/js/rulesAssistant.js index 58dc828578e..399d95b4a9f 100644 --- a/src/js/rulesAssistant.js +++ b/src/js/rulesAssistant.js @@ -72,7 +72,7 @@ window.mergeRules = function mergeRules(rules) { const applies = (combinedRule[key] === undefined || (key === "autoBrand" && rule[key]) || (key !== "autoBrand" && rule[key] !== "no default setting")); - if (!applies) { return; } + if (!applies) return; combinedRule[key] = rule[key]; }); }); @@ -97,7 +97,7 @@ window.ruleApplied = function(slave, rule) { window.RAFacilityRemove = function RAFacilityRemove(slave, rule) { const V = State.variables; let r = ""; - if (!rule.facilityRemove) { return r; } + if (!rule.facilityRemove) return r; switch (rule.setAssignment) { case "be confined in the arcade": if (slave.assignment === rule.setAssignment) { @@ -223,7 +223,7 @@ window.ruleAppliesP = function ruleAppliesP(cond, slave) { } // assignment / facility / special slaves / specific slaves check let assignment = slave.assignment; - if (assignment === "be your Concubine") { assignment = "serve in the master suite"; } + if (assignment === "be your Concubine") assignment = "serve in the master suite"; if (cond.specialSlaves !== -1) { // not "Include", which means "doesn't matter" flag = flag && (cond.specialSlaves == isLeaderP(slave)); // eslint-disable-line eqeqeq diff --git a/src/js/sexActsJS.js b/src/js/sexActsJS.js index a04a0817d64..231f899b902 100644 --- a/src/js/sexActsJS.js +++ b/src/js/sexActsJS.js @@ -1,4 +1,4 @@ -window.VCheck = (function() { +window.VCheck = (function () { "use strict"; let he; let him; @@ -315,6 +315,7 @@ window.VCheck = (function() { } return r; } + })(); /** diff --git a/src/js/slaveCostJS.js b/src/js/slaveCostJS.js index b00b6062ec7..a4a571ffe93 100644 --- a/src/js/slaveCostJS.js +++ b/src/js/slaveCostJS.js @@ -1488,7 +1488,7 @@ window.FResult = (function() { } const uses = V.oralUseWeight + V.vaginalUseWeight + V.analUseWeight; - if (uses <= 0) { return; } + if (uses <= 0) return; result += (6 + slave.tonguePiercing) * (V.oralUseWeight / uses) * (slave.skill.oral / 30); if (slave.sexualFlaw === "cum addict") { @@ -1527,11 +1527,11 @@ window.FResult = (function() { V.slaves.forEach(islave => { if (isParentP(slave, islave) && sameAssignmentP(slave, islave)) { result += 1; - if (incestBonus) { result += 1; } + if (incestBonus) result += 1; } if (areSisters(slave, islave) > 0 && sameAssignmentP(slave, islave)) { result += 1; - if (incestBonus) { result += 1; } + if (incestBonus) result += 1; } }); } @@ -1543,7 +1543,7 @@ window.FResult = (function() { const fre = getSlave(slave.relationTarget); if (fre !== undefined && sameAssignmentP(slave, fre)) { result += 2; - if (incestBonus) { result += 2; } + if (incestBonus) result += 2; } } @@ -1554,7 +1554,7 @@ window.FResult = (function() { const fre = V.slaves.findIndex(s => { return haveRelationshipP(slave, s) && sameAssignmentP(slave, s); }); - if (fre !== -1) { result += 1; } + if (fre !== -1) result += 1; } /** @@ -1562,7 +1562,7 @@ window.FResult = (function() { */ function calcWorksWithRival(slave) { const en = getSlave(slave.rivalryTarget); - if (en !== undefined && sameAssignmentP(slave, en)) { result -= 1; } + if (en !== undefined && sameAssignmentP(slave, en)) result -= 1; } /** @@ -1588,7 +1588,8 @@ window.FResult = (function() { */ function calcPreg(slave) { if (V.arcologies[0].FSRepopulationFocus > 20) { - if (slave.belly >= 1500) { result += 2; } else { result -= 2; } + if (slave.belly >= 1500) result += 2; + else result -= 2; } else if (V.arcologies[0].FSRepopulationFocusPregPolicy === 1) { if (slave.bellyPreg >= 1500) { result += 1; @@ -1623,8 +1624,8 @@ window.FResult = (function() { * @param {App.Entity.SlaveState} slave */ function calcSexAttributes(slave) { - if (slave.clitPiercing > 2) { result += 1; } - if (slave.tail === "sex") { result += 1; } + if (slave.clitPiercing > 2) result += 1; + if (slave.tail === "sex") result += 1; if (slave.fetishKnown === 1 && slave.fetishStrength > 60 && slave.fetish !== "none") { result += slave.fetishStrength / 5; } @@ -1632,22 +1633,16 @@ window.FResult = (function() { if (slave.attrKnown === 1) { result += Math.trunc(slave.attrXX / 20); result += Math.trunc(slave.attrXY / 20); - if (slave.energy > 95) { - result += 3; - } else if (slave.energy > 80) { - result += 2; - } else if (slave.energy > 60) { - result += 1; - } else if (slave.energy <= 20) { - result -= 2; - } else if (slave.energy <= 40) { - result -= 1; - } - } - if (slave.sexualFlaw !== "none") { result -= 2; } - if (slave.sexualQuirk !== "none") { result += 2; } - if (slave.behavioralFlaw !== "none") { result -= 2; } - if (slave.behavioralQuirk !== "none") { result += 2; } + if (slave.energy > 95) result += 3; + else if (slave.energy > 80) result += 2; + else if (slave.energy > 60) result += 1; + else if (slave.energy <= 20) result -= 2; + else if (slave.energy <= 40) result -= 1; + } + if (slave.sexualFlaw !== "none") result -= 2; + if (slave.sexualQuirk !== "none") result += 2; + if (slave.behavioralFlaw !== "none") result -= 2; + if (slave.behavioralQuirk !== "none") result += 2; } /** @@ -1665,9 +1660,8 @@ window.FResult = (function() { * @param {App.Entity.SlaveState} slave */ function calcSight(slave) { - if (!canSee(slave)) { - result -= 3; - } else if (slave.eyes <= -1) { + if (!canSee(slave)) result -= 3; + else if (slave.eyes <= -1) { if (slave.eyewear !== "corrective glasses" && slave.eyewear !== "corrective contacts") { result -= 1; } @@ -1682,7 +1676,8 @@ window.FResult = (function() { * @param {App.Entity.SlaveState} slave */ function calcHearing(slave) { - if (!canHear(slave)) { result -= 2; } else if (slave.hears <= -1) { + if (!canHear(slave)) result -= 2; + else if (slave.hears <= -1) { if (slave.earwear !== "hearing aids") { result -= 1; } @@ -1695,7 +1690,7 @@ window.FResult = (function() { * @param {App.Entity.SlaveState} slave */ function calcEgyptianBonus(slave) { - if (V.racialVarieties === undefined) { V.racialVarieties = []; } + if (V.racialVarieties === undefined) V.racialVarieties = []; if (!V.racialVarieties.includes(slave.race)) { V.racialVarieties.push(slave.race); } @@ -1733,8 +1728,8 @@ window.FResult = (function() { } else if (!V.familyTesting && slave.relation !== 0) { calcWorksWithRelativesVanilla(slave); } - if (slave.relationship > 0) { calcWorksWithRelationship(slave); } - if (slave.rivalry !== 0) { calcWorksWithRival(slave); } + if (slave.relationship > 0) calcWorksWithRelationship(slave); + if (slave.rivalry !== 0) calcWorksWithRival(slave); calcHInjectionsDiet(slave); calcPreg(slave); calcRace(slave); @@ -1758,18 +1753,12 @@ window.FResult = (function() { function calcAge(slave) { if ((V.arcologies[0].FSRepopulationFocus !== "unset" || V.arcologies[0].FSGenderFundamentalist !== "unset") && slave.physicalAge === V.minimumSlaveAge && slave.physicalAge === V.fertilityAge && canGetPregnant(slave)) { result += 1; - if (slave.birthWeek === 0) { - result += result; - } else if (slave.birthWeek < 4) { - result += 0.2 * result; - } + if (slave.birthWeek === 0) result += result; + else if (slave.birthWeek < 4) result += 0.2 * result; } else if (slave.physicalAge === V.minimumSlaveAge) { result += 1; - if (slave.birthWeek === 0) { - result += 0.5 * result; - } else if (slave.birthWeek < 4) { - result += 0.1 * result; - } + if (slave.birthWeek === 0) result += 0.5 * result; + else if (slave.birthWeek < 4) result += 0.1 * result; } else if (slave.physicalAge === V.fertilityAge && canGetPregnant(slave) && (V.arcologies[0].FSRepopulationFocus !== "unset" || V.arcologies[0].FSGenderFundamentalist !== "unset")) { result += 1; if (slave.birthWeek === 0) { diff --git a/src/js/slaveGenerationJS.js b/src/js/slaveGenerationJS.js index 653092227d1..5bb707929cb 100644 --- a/src/js/slaveGenerationJS.js +++ b/src/js/slaveGenerationJS.js @@ -1532,7 +1532,7 @@ window.generatePronouns = function generatePronouns(slave) { /** * @param {App.Entity.SlaveState} slave */ -window.generatePuberty = function(slave) { +window.generatePuberty = function (slave) { if ((slave.ovaries === 1 || slave.mpreg === 1) && slave.physicalAge >= slave.pubertyAgeXX) { slave.pubertyXX = 1; } else { @@ -1548,7 +1548,7 @@ window.generatePuberty = function(slave) { /** * @param {App.Entity.SlaveState} slave */ -window.ageImplantAdjustment = function(slave) { +window.ageImplantAdjustment = function (slave) { if (slave.visualAge > 80) { slave.visualAge -= 40; } else if (slave.visualAge >= 70) { diff --git a/src/js/slaveListing.js b/src/js/slaveListing.js index cf1af0e4258..5ded9cc39e2 100644 --- a/src/js/slaveListing.js +++ b/src/js/slaveListing.js @@ -362,7 +362,7 @@ App.UI.selectSlaveForPersonalAttention = function(id) { * @param {string} passage The passage to link to * @returns {string} */ -App.UI.SlaveList.sortingLinks = function(passage) { +App.UI.SlaveList.sortingLinks = function (passage) { const V = State.variables; let r = ' Sort by: '; r += ["devotion", "name", "assignment", "seniority", "actualAge", "visualAge", "physicalAge"] @@ -385,7 +385,7 @@ App.UI.SlaveList.sortingLinks = function(passage) { * @param {{assign: string, remove: string, transfer: (string| undefined)}} [tabCaptions] * @returns {string} */ -App.UI.SlaveList.listSJFacilitySlaves = function(facility, facilityPassage, showTransfersTab = false, tabCaptions = undefined) { +App.UI.SlaveList.listSJFacilitySlaves = function (facility, facilityPassage, showTransfersTab = false, tabCaptions = undefined) { const V = State.variables; facilityPassage = facilityPassage || passage(); tabCaptions = tabCaptions || { @@ -463,7 +463,7 @@ App.UI.SlaveList.listSJFacilitySlaves = function(facility, facilityPassage, show /** * @returns {string} */ -App.UI.SlaveList.listNGPSlaves = function() { +App.UI.SlaveList.listNGPSlaves = function () { const V = State.variables; const thisPassage = 'New Game Plus'; let r = this.sortingLinks(thisPassage) + '<br>'; @@ -507,7 +507,7 @@ App.UI.SlaveList.listNGPSlaves = function() { * @param {string} [selectionPassage] passage name for manager selection. "${Manager} Select" if omitted * @returns {string} */ -App.UI.SlaveList.displayManager = function(facility, selectionPassage) { +App.UI.SlaveList.displayManager = function (facility, selectionPassage) { const managerCapName = capFirstChar(facility.desc.manager.position); selectionPassage = selectionPassage || `${managerCapName} Select`; const manager = facility.manager.currentEmployee; @@ -526,11 +526,11 @@ App.UI.SlaveList.displayManager = function(facility, selectionPassage) { * @param {boolean} [showTransfersPage] * @returns {string} */ -App.UI.SlaveList.stdFacilityPage = function(facility, showTransfersPage) { +App.UI.SlaveList.stdFacilityPage = function (facility, showTransfersPage) { return this.displayManager(facility) + '<br><br>' + this.listSJFacilitySlaves(facility, passage(), showTransfersPage); }; -App.UI.SlaveList.penthousePage = function() { +App.UI.SlaveList.penthousePage = function () { const V = State.variables; const ph = App.Entity.facilities.penthouse; const listElementId = 'summarylist'; // for the untabbed mode only @@ -783,7 +783,7 @@ App.UI.SlaveList.penthousePage = function() { * @returns {boolean} */ -App.UI.SlaveList.slaveSelectionList = function() { +App.UI.SlaveList.slaveSelectionList = function () { const selectionElementId = "slaveSelectionList"; return selection; @@ -915,7 +915,7 @@ App.UI.SlaveList.slaveSelectionList = function() { * @param {string} [passage] one of the *Workaround passages. Will be composed from the position name if omitted * @returns {string} */ -App.UI.SlaveList.facilityManagerSelection = function(facility, passage) { +App.UI.SlaveList.facilityManagerSelection = function (facility, passage) { passage = passage || capFirstChar(facility.manager.desc.position) + " Workaround"; return this.slaveSelectionList(slave => facility.manager.canEmploy(slave), (slave, index) => App.UI.passageLink(SlaveFullName(slave), passage, `$i = ${index}`), diff --git a/src/js/slaveStatsChecker.js b/src/js/slaveStatsChecker.js index 1c0b9811c47..905d4f8bd54 100644 --- a/src/js/slaveStatsChecker.js +++ b/src/js/slaveStatsChecker.js @@ -1,4 +1,4 @@ -window.SlaveStatsChecker = (function() { +window.SlaveStatsChecker = (function () { return { checkForLisp: hasLisp, isModded: isModded, @@ -177,7 +177,7 @@ window.SlaveStatsChecker = (function() { * @param {App.Entity.SlaveState} slave * @returns {boolean} */ -window.isSlim = function(slave) { +window.isSlim = function (slave) { let slim = false; const ArcologyZero = State.variables.arcologies[0]; @@ -209,7 +209,7 @@ window.isSlim = function(slave) { * @param {App.Entity.SlaveState} slave * @returns {number} */ -window.slimPass = function(slave) { +window.slimPass = function (slave) { let slimPass = 0; const ArcologyZero = State.variables.arcologies[0]; @@ -238,7 +238,7 @@ window.slimPass = function(slave) { * @param {App.Entity.SlaveState} slave * @returns {boolean} */ -window.isStacked = function(slave) { +window.isStacked = function (slave) { return (slave.butt > 4) && (slave.boobs > 800); }; @@ -246,7 +246,7 @@ window.isStacked = function(slave) { * @param {App.Entity.SlaveState} slave * @returns {boolean} */ -window.isXY = function(slave) { +window.isXY = function (slave) { return (slave.dick > 0); }; @@ -254,7 +254,7 @@ window.isXY = function(slave) { * @param {App.Entity.SlaveState} slave * @returns {boolean} */ -window.isYoung = function(slave) { +window.isYoung = function (slave) { return (slave.visualAge < 30); }; @@ -262,7 +262,7 @@ window.isYoung = function(slave) { * @param {App.Entity.SlaveState} slave * @returns {boolean} */ -window.isPreg = function(slave) { +window.isPreg = function (slave) { return ((slave.bellyPreg >= 5000) || (slave.bellyImplant >= 5000)); }; @@ -270,7 +270,7 @@ window.isPreg = function(slave) { * @param {App.Entity.SlaveState} slave * @returns {boolean} */ -window.isNotPreg = function(slave) { +window.isNotPreg = function (slave) { return (!isPreg(slave) && (slave.belly < 100) && (slave.weight < 30) && !setup.fakeBellies.includes(slave.bellyAccessory)); }; @@ -278,7 +278,7 @@ window.isNotPreg = function(slave) { * @param {App.Entity.SlaveState} slave * @returns {boolean} */ -window.isPure = function(slave) { +window.isPure = function (slave) { return ((slave.boobsImplant === 0) && (slave.buttImplant === 0) && (slave.waist >= -95) && (slave.lipsImplant === 0) && (slave.faceImplant < 30) && (slave.bellyImplant === -1) && (Math.abs(slave.shouldersImplant) < 2) && (Math.abs(slave.hipsImplant) < 2)); }; @@ -286,7 +286,7 @@ window.isPure = function(slave) { * @param {App.Entity.SlaveState} slave * @returns {boolean} */ -window.isSurgicallyImproved = function(slave) { +window.isSurgicallyImproved = function (slave) { return ((slave.boobsImplant > 0) && (slave.buttImplant > 0) && (slave.waist < -10) && (slave.lipsImplant > 0)); }; @@ -294,7 +294,7 @@ window.isSurgicallyImproved = function(slave) { * @param {App.Entity.SlaveState} slave * @returns {boolean} */ -window.isFullyPotent = function(slave) { +window.isFullyPotent = function (slave) { if (!slave) { return null; } else if (slave.dick > 0 && slave.balls > 0 && slave.ballType !== "sterile" && slave.hormoneBalance < 100 && slave.drugs !== "hormone blockers") { @@ -307,7 +307,7 @@ window.isFullyPotent = function(slave) { * @param {App.Entity.SlaveState} slave * @returns {boolean} */ -window.canGetPregnant = function(slave) { +window.canGetPregnant = function (slave) { if (!slave) { return null; } else if (slave.preg === -1) { /* contraceptives check */ @@ -327,7 +327,7 @@ window.canGetPregnant = function(slave) { * @param {App.Entity.SlaveState} slave * @returns {boolean} */ -window.isFertile = function(slave) { +window.isFertile = function (slave) { if (!slave) { return null; } @@ -375,7 +375,7 @@ window.isFertile = function(slave) { * @param {App.Entity.SlaveState} slave * @returns {boolean} */ -window.canAchieveErection = function(slave) { +window.canAchieveErection = function (slave) { if (!slave) { return null; } else if (slave.dick <= 0) { @@ -400,7 +400,7 @@ window.canAchieveErection = function(slave) { * @param {App.Entity.SlaveState} slave * @returns {boolean} */ -window.canPenetrate = function(slave) { +window.canPenetrate = function (slave) { if (!slave) { return null; } else if (!canAchieveErection(slave)) { @@ -417,7 +417,7 @@ window.canPenetrate = function(slave) { * @param {App.Entity.SlaveState} slave * @returns {boolean} */ -window.canSee = function(slave) { +window.canSee = function (slave) { if (!slave) { return null; } @@ -428,7 +428,7 @@ window.canSee = function(slave) { * @param {App.Entity.SlaveState} slave * @returns {boolean} */ -window.canHear = function(slave) { +window.canHear = function (slave) { if (!slave) { return null; } @@ -439,7 +439,7 @@ window.canHear = function(slave) { * @param {App.Entity.SlaveState} slave * @returns {boolean} */ -window.canSmell = function(slave) { +window.canSmell = function (slave) { if (!slave) { return null; } @@ -450,7 +450,7 @@ window.canSmell = function(slave) { * @param {App.Entity.SlaveState} slave * @returns {boolean} */ -window.canTaste = function(slave) { +window.canTaste = function (slave) { if (!slave) { return null; } @@ -461,7 +461,7 @@ window.canTaste = function(slave) { * @param {App.Entity.SlaveState} slave * @returns {boolean} */ -window.canWalk = function(slave) { +window.canWalk = function (slave) { if (!slave) { return null; } else if (slave.amp === 1) { @@ -494,7 +494,7 @@ window.canWalk = function(slave) { * @param {App.Entity.SlaveState} slave * @returns {boolean} */ -window.canTalk = function(slave) { +window.canTalk = function (slave) { if (!slave) { return null; } else if (slave.accent > 2) { @@ -519,7 +519,7 @@ window.canTalk = function(slave) { * @param {App.Entity.SlaveState} slave * @returns {boolean} */ -window.canDoAnal = function(slave) { +window.canDoAnal = function (slave) { if (!slave) { return null; } else if (slave.chastityAnus === 1) { @@ -532,7 +532,7 @@ window.canDoAnal = function(slave) { * @param {App.Entity.SlaveState} slave * @returns {boolean} */ -window.canDoVaginal = function(slave) { +window.canDoVaginal = function (slave) { if (!slave) { return null; } else if (slave.vagina < 0) { @@ -547,7 +547,7 @@ window.canDoVaginal = function(slave) { * @param {App.Entity.SlaveState} slave * @returns {boolean} */ -window.tooFatSlave = function(slave) { +window.tooFatSlave = function (slave) { if (!slave) { return null; } else if (slave.weight > 190 + (slave.muscles / 5) && slave.physicalAge >= 18) { @@ -566,7 +566,7 @@ window.tooFatSlave = function(slave) { * @param {App.Entity.SlaveState} slave * @returns {boolean} */ -window.tooBigBreasts = function(slave) { +window.tooBigBreasts = function (slave) { if (!slave) { return null; } else if (slave.boobs > 30000 + (slave.muscles * 100) && slave.physicalAge >= 18) { @@ -585,7 +585,7 @@ window.tooBigBreasts = function(slave) { * @param {App.Entity.SlaveState} slave * @returns {boolean} */ -window.tooBigBelly = function(slave) { +window.tooBigBelly = function (slave) { if (!slave) { return null; } else if (slave.belly >= 450000 + (slave.muscles * 2000) && slave.physicalAge >= 18) { @@ -604,7 +604,7 @@ window.tooBigBelly = function(slave) { * @param {App.Entity.SlaveState} slave * @returns {boolean} */ -window.tooBigBalls = function(slave) { +window.tooBigBalls = function (slave) { if (!slave) { return null; } else if (slave.balls >= 30 + (slave.muscles * .3) && slave.physicalAge <= 3) { @@ -621,7 +621,7 @@ window.tooBigBalls = function(slave) { * @param {App.Entity.SlaveState} slave * @returns {boolean} */ -window.tooBigDick = function(slave) { +window.tooBigDick = function (slave) { if (!slave) { return null; } else if (slave.dick >= 20 + (slave.muscles * .1) && slave.physicalAge <= 3 && slave.dick !== 0) { @@ -638,7 +638,7 @@ window.tooBigDick = function(slave) { * @param {App.Entity.SlaveState} slave * @returns {boolean} */ -window.tooBigButt = function(slave) { +window.tooBigButt = function (slave) { if (!slave) { return null; } else if (slave.butt > 10 && slave.physicalAge <= 3) { @@ -653,7 +653,7 @@ window.tooBigButt = function(slave) { * @param {App.Entity.SlaveState} slave * @returns {boolean} */ -window.isVegetable = function(slave) { +window.isVegetable = function (slave) { if (!slave) { return false; } diff --git a/src/js/storyJS.js b/src/js/storyJS.js index 18530af669e..a58bc99bbe5 100644 --- a/src/js/storyJS.js +++ b/src/js/storyJS.js @@ -8,7 +8,7 @@ * @param {number} maxValue * @returns {number} */ -window.variableAsNumber = function(x, defaultValue = 0, minValue, maxValue) { +window.variableAsNumber = function (x, defaultValue = 0, minValue, maxValue) { x = Number(x); if (isNaN(x)) { return defaultValue; @@ -26,7 +26,7 @@ window.variableAsNumber = function(x, defaultValue = 0, minValue, maxValue) { * @param {App.Entity.SlaveState} slave * @return {boolean} */ -window.isSexuallyPure = function(slave) { +window.isSexuallyPure = function (slave) { if (!slave) { return null; } @@ -34,7 +34,7 @@ window.isSexuallyPure = function(slave) { }; if (typeof interpolate === "undefined") { - const interpolate = function(x0, y0, x1, y1, x) { + const interpolate = function (x0, y0, x1, y1, x) { if (x <= x0) { return y0; } else if (x >= x1) { @@ -51,7 +51,7 @@ if (typeof interpolate === "undefined") { * @param {any} val * @returns {any[]} */ -window.removeFromArray = function(arr, val) { +window.removeFromArray = function (arr, val) { for (let i = 0; i < arr.length; i++) { if (val === arr[i]) { return arr.splice(i, 1); @@ -66,10 +66,10 @@ window.removeFromArray = function(arr, val) { * @param {any} thisArg * @returns {Array} */ -window.filterInPlace = function(arr, callback, thisArg) { +window.filterInPlace = function (arr, callback, thisArg) { let j = 0; - arr.forEach(function(e, i) { + arr.forEach(function (e, i) { if (callback.call(thisArg, e, i, arr)) { arr[j++] = e; } @@ -84,7 +84,7 @@ window.filterInPlace = function(arr, callback, thisArg) { * @param {App.Entity.SlaveState} slave2 * @returns {boolean} */ -window.canBreed = function(slave1, slave2) { +window.canBreed = function (slave1, slave2) { if (!slave1 || !slave2) { return null; } @@ -98,7 +98,7 @@ window.canBreed = function(slave1, slave2) { * @param {App.Entity.SlaveState} slave2 * @returns {boolean} */ -window.canImpreg = function(slave1, slave2) { +window.canImpreg = function (slave1, slave2) { if (!slave1 || !slave2) { return null; } else if (slave2.dick < 1) { @@ -144,7 +144,7 @@ window.canImpreg = function(slave1, slave2) { * @param {object} PC * @returns {boolean} */ -window.isPlayerFertile = function(PC) { +window.isPlayerFertile = function (PC) { if (!PC) { return null; } else if (PC.preg !== 0) { @@ -164,7 +164,7 @@ window.isPlayerFertile = function(PC) { * @param {App.Entity.SlaveState} slave * @returns {string|number} */ -window.relationTargetWord = function(slave) { +window.relationTargetWord = function (slave) { if (!slave) { return null; } else if (slave.relation === "daughter") { @@ -179,7 +179,7 @@ window.relationTargetWord = function(slave) { * @param {App.Entity.SlaveState} slave * @returns {number} */ -window.milkAmount = function(slave) { +window.milkAmount = function (slave) { let milk; let calcs; if (!slave) { @@ -229,7 +229,7 @@ window.milkAmount = function(slave) { * @param {App.Entity.SlaveState} slave * @returns {number} */ -window.cumAmount = function(slave) { +window.cumAmount = function (slave) { let cum = 0; let calcs = 0; if (!slave) { @@ -279,7 +279,7 @@ window.cumAmount = function(slave) { * @param {string} text * @returns {string} */ -window.lispReplace = function(text) { +window.lispReplace = function (text) { text = text.replace(/Sh/g, "Th"); text = text.replace(/SS/g, "Th"); text = text.replace(/Ss/g, "Th"); @@ -367,7 +367,7 @@ window.lispReplace = function(text) { * @param {Object} arcology * @returns {number} */ -window.repGainSacrifice = function(slave, arcology) { +window.repGainSacrifice = function (slave, arcology) { if (!slave || !arcology || arcology.FSAztecRevivalist === "unset" || arcology.FSAztecRevivalist <= 0) { return 0; } @@ -379,33 +379,33 @@ window.repGainSacrifice = function(slave, arcology) { * @param {App.Entity.SlaveState} slave * @returns {boolean} */ -window.bodyguardSuccessorEligible = function(slave) { +window.bodyguardSuccessorEligible = function (slave) { if (!slave) { return false; } return (slave.devotion > 50 && slave.muscles >= 0 && slave.weight < 100 && slave.boobs < 8000 && slave.butt < 10 && slave.belly < 5000 && slave.balls < 10 && slave.dick < 10 && slave.preg < 20 && slave.fuckdoll === 0 && slave.fetish !== "mindbroken" && canWalk(slave)); }; -window.ngUpdateGenePool = function(genePool) { +window.ngUpdateGenePool = function (genePool) { const transferredSlaveIds = (State.variables.slaves || []) - .filter(function(s) { + .filter(function (s) { return s.ID >= 1200000; }) - .map(function(s) { + .map(function (s) { return s.ID - 1200000; }); return (genePool || []) - .filter(function(s) { + .filter(function (s) { return transferredSlaveIds.indexOf(s.ID) >= 0; }) - .map(function(s) { + .map(function (s) { const result = jQuery.extend(true, {}, s); result.ID += 1200000; return result; }); }; -window.ngUpdateMissingTable = function(missingTable) { +window.ngUpdateMissingTable = function (missingTable) { const newTable = {}; (State.variables.slaves || []) @@ -423,7 +423,7 @@ window.ngUpdateMissingTable = function(missingTable) { * @param {any} obj * @returns {string} */ -window.toJson = function(obj) { +window.toJson = function (obj) { let jsontext = JSON.stringify(obj); jsontext = jsontext.replace(/^{/, ""); jsontext = jsontext.replace(/}$/, ""); @@ -434,7 +434,7 @@ window.toJson = function(obj) { * @param {App.Entity.SlaveState} slave * @returns {string} */ -window.nippleColor = function(slave) { +window.nippleColor = function (slave) { if (skinToneLevel(slave.skin) < 8) { if (slave.preg > slave.pregData.normalBirth / 4 || (slave.counter.birthsTotal > 0 && slave.lactation > 0)) { return "brown"; @@ -467,7 +467,7 @@ window.nippleColor = function(slave) { * @param {Object} PC * @returns {number} */ -window.overpowerCheck = function(slave, PC) { +window.overpowerCheck = function (slave, PC) { let strength; if (State.variables.arcologies[0].FSPhysicalIdealist !== "unset") { @@ -494,7 +494,7 @@ window.overpowerCheck = function(slave, PC) { * @param {App.Entity.SlaveState} slave * @returns {number[]} */ -window.impregnatedBy = function(slave) { +window.impregnatedBy = function (slave) { const IDArray = []; if (!Array.isArray(slave.womb)) { WombInit(slave); @@ -511,15 +511,15 @@ window.impregnatedBy = function(slave) { * @param {App.Entity.SlaveState} father * @returns {boolean} */ -window.isImpregnatedBy = function(mother, father) { +window.isImpregnatedBy = function (mother, father) { return impregnatedBy(mother).includes(father.ID); }; -window.jsAlert = function(obj) { +window.jsAlert = function (obj) { alert(obj); }; -window.jsConsoleInfo = function(obj) { +window.jsConsoleInfo = function (obj) { // eslint-disable-next-line no-console console.info(obj); }; @@ -599,7 +599,7 @@ window.SoftenSexualFlaw = function SoftenSexualFlaw(slave) { /** * @param {object} PC */ -window.generatePlayerPronouns = function(PC) { +window.generatePlayerPronouns = function (PC) { if (PC.title === 0) { PC.pronoun = "she"; PC.possessivePronoun = "hers"; @@ -617,7 +617,7 @@ window.generatePlayerPronouns = function(PC) { } }; -window.generateAssistantPronouns = function() { +window.generateAssistantPronouns = function () { const V = State.variables; if (V.assistant === 0) { V.assistantPronouns.pronoun = "it"; diff --git a/src/js/textInput.js b/src/js/textInput.js index 25c358be815..00bffdaac33 100644 --- a/src/js/textInput.js +++ b/src/js/textInput.js @@ -2,7 +2,7 @@ Macro.add("textinput", { // Signifies that the macro is a container macro. tags: null, - handler: function() { + handler: function () { if (this.args.length < 2) { const errors = []; if (this.args.length < 1) { @@ -38,7 +38,7 @@ Macro.add("textinput", { tabindex: 0 // for accessibility }) .addClass("macro-textarea") // "hijack" the .macro-textarea class - .on("input", function() { + .on("input", function () { Wikifier.setValue(varName, this.value); if (that.payload[0].contents !== "") { Wikifier.wikifyEval(that.payload[0].contents.trim()); diff --git a/src/js/utilJS.js b/src/js/utilJS.js index 90ec4cc6d03..d9f92887d1a 100644 --- a/src/js/utilJS.js +++ b/src/js/utilJS.js @@ -1830,7 +1830,7 @@ App.UI.tabbar = function() { function handlePreSelectedTab() { let selectedTab = State.variables.tabChoice[_tabChoiceVarName()]; if (!selectedTab) { selectedTab = "assign"; } - $(document).one(':passagedisplay', function() { + $(document).one(':passagedisplay', function () { let tabBtn = document.getElementById(`tab ${selectedTab}`); if (!tabBtn) { tabBtn = document.getElementsByClassName('tablinks').item(0); @@ -1893,7 +1893,7 @@ App.UI.passageLink = function(linkText, passage, setter, elementType = 'a') { * @param {string} selector * @param {string} newContent */ -App.UI.replace = function(selector, newContent) { +App.UI.replace = function (selector, newContent) { let ins = jQuery(document.createDocumentFragment()); ins.wiki(newContent); const target = $(selector); @@ -1918,7 +1918,7 @@ App.UI.replace = function(selector, newContent) { * @param {string} [tag='div'] * @returns {string} */ -App.UI.htag = function(text, attributes, tag = 'div') { +App.UI.htag = function (text, attributes, tag = 'div') { const payload = text.replace(/(^\n+|\n+$)/, ""); if ("object" === typeof attributes) { @@ -2532,6 +2532,6 @@ App.Utils.setActiveSlaveByIndex = function(index) { * @param {number} id slave ID * @returns {number} */ -App.Utils.slaveIndexForId = function(id) { +App.Utils.slaveIndexForId = function (id) { return State.variables.slaveIndices[id]; }; -- GitLab