diff --git a/src/js/colorinput.js b/src/js/colorinput.js index b27365c2e6461c5ad165f26dd88d465f6bee69bc..b97711b59ca92104febaa67be13e31c62d3f4ebc 100644 --- a/src/js/colorinput.js +++ b/src/js/colorinput.js @@ -4,9 +4,9 @@ Macro.add("colorinput", { let e = []; return this.args.length < 1 && e.push("variable name"), this.args.length < 2 && e.push("default value"), this.error("no " + e.join(" or ") + " specified"); } - if ("string" !== typeof this.args[0]) return this.error("variable name argument is not a string"); + if ("string" !== typeof this.args[0]) { return this.error("variable name argument is not a string"); } let varName = this.args[0].trim(); - if ("$" !== varName[0] && "_" !== varName[0]) return this.error('variable name "' + this.args[0] + '" is missing its sigil ($ or _)'); + if ("$" !== varName[0] && "_" !== varName[0]) { return this.error('variable name "' + this.args[0] + '" is missing its sigil ($ or _)'); } Config.debug && this.debugView.modes({ block: true }); diff --git a/src/js/datatypeCleanupJS.js b/src/js/datatypeCleanupJS.js index 9a03dc6c2725bab9f5cc2d37be6d7b5155fda0e5..12429b79a725562ab0683ae64576ec8ededb4686 100644 --- a/src/js/datatypeCleanupJS.js +++ b/src/js/datatypeCleanupJS.js @@ -37,13 +37,13 @@ App.Entity.Utils.SlaveDataSchemeCleanup = (function() { } } if (slave.hasOwnProperty("pornFameType")) { - slave.porn.fameType = slave["pornFameType"]; - delete slave["pornFameType"]; + slave.porn.fameType = slave.pornFameType; + delete slave.pornFameType; } if (slave.hasOwnProperty("pornFocus")) { - slave.porn.focus = slave["pornFocus"]; - delete slave["pornFocus"]; + slave.porn.focus = slave.pornFocus; + delete slave.pornFocus; } } } @@ -54,18 +54,18 @@ App.Entity.Utils.SlaveDataSchemeCleanup = (function() { function migrateSkills(slave) { if (!slave.hasOwnProperty("skill")) { slave.skill = new App.Entity.SlaveSkillsState(); - slave.skill.anal = slave["analSkill"]; - slave.skill.combat = slave["combatSkill"]; - slave.skill.entertainment = slave["entertainSkill"]; - slave.skill.oral = slave["oralSkill"]; - slave.skill.vaginal = slave["vaginalSkill"]; - slave.skill.whoring = slave["whoreSkill"]; - delete slave["analSkill"]; - delete slave["combatSkill"]; - delete slave["entertainSkill"]; - delete slave["oralSkill"]; - delete slave["vaginalSkill"]; - delete slave["whoreSkill"]; + slave.skill.anal = slave.analSkill; + slave.skill.combat = slave.combatSkill; + slave.skill.entertainment = slave.entertainSkill; + slave.skill.oral = slave.oralSkill; + slave.skill.vaginal = slave.vaginalSkill; + slave.skill.whoring = slave.whoreSkill; + delete slave.analSkill; + delete slave.combatSkill; + delete slave.entertainSkill; + delete slave.oralSkill; + delete slave.vaginalSkill; + delete slave.whoreSkill; const nameMap = { "HG": "headGirl", @@ -205,8 +205,7 @@ window.SlaveDatatypeCleanup = (function SlaveDatatypeCleanup() { */ function SlaveDatatypeCleanup(slave, isIncubatorSlave) { V = State.variables; - if (isIncubatorSlave !== true) - slaveAgeDatatypeCleanup(slave); + if (isIncubatorSlave !== true) { slaveAgeDatatypeCleanup(slave); } slavePhysicalDatatypeCleanup(slave); slaveFaceDatatypeCleanup(slave); slaveHairDatatypeCleanup(slave); diff --git a/src/js/economyJS.js b/src/js/economyJS.js index ce667235c7ff3bb19fb6db825c75a5926135dff9..0c92b469acd7ad1f7ef1e18f0094dce7e0524106 100644 --- a/src/js/economyJS.js +++ b/src/js/economyJS.js @@ -260,7 +260,7 @@ window.calculateCosts = (function() { } else { soldierMod = 2; } - const militiaUnits = V.militiaUnits.length, slaveUnits = V.slaveUnits.length, mercUnits = V.mercUnits.length; //predefined for optimization + const militiaUnits = V.militiaUnits.length, slaveUnits = V.slaveUnits.length, mercUnits = V.mercUnits.length; // predefined for optimization if (V.militiaUnits !== null) { for (let i = 0; i < militiaUnits; i++) { if (V.militiaUnits[i] !== null) { @@ -505,7 +505,7 @@ window.calculateCosts = (function() { return costs; } - //the cost of keeping a slave under restrictive rules + // the cost of keeping a slave under restrictive rules function getSlaveMinorCosts(slave) { let costs = 0; const rulesCost = State.variables.rulesCost; @@ -1464,7 +1464,7 @@ window.cashX = function(cost, what, who) { who.lastWeeksCashIncome += cost; who.lifetimeCashIncome += cost; } - } else if (cost < 0) { //EXPENSES + } else if (cost < 0) { // EXPENSES // record the action if (typeof V.lastWeeksCashExpenses[what] !== 'undefined') { V.lastWeeksCashExpenses[what] += cost; @@ -1514,7 +1514,7 @@ window.repX = function(rep, what, who) { } else { V.lastWeeksRepErrors += `Unknown place "${what}" gained you ${rep}<br>`; } - } else if (rep < 0) { //EXPENSES + } else if (rep < 0) { // EXPENSES // record the action if (typeof V.lastWeeksRepExpenses[what] !== 'undefined') { V.lastWeeksRepExpenses[what] += rep; diff --git a/src/js/futureSocietyJS.js b/src/js/futureSocietyJS.js index 48a68b277ba50a9049b0e3a709f171b73041cb59..be354d3d0265b83f80b57592e9c80b1353fd633e 100644 --- a/src/js/futureSocietyJS.js +++ b/src/js/futureSocietyJS.js @@ -38,19 +38,17 @@ window.FutureSocieties = (function() { function removeFS(FS) { const V = State.variables; const arcology = V.arcologies[0]; - const FSDecoration = `${FS }Decoration`; - const FSSMR = `${FS }SMR`; - let FSLaw = `${FS }Law`; + const FSDecoration = `${FS}Decoration`; + const FSSMR = `${FS}SMR`; + let FSLaw = `${FS}Law`; if (arcology[FS] === undefined) { // eslint-disable-next-line no-console console.log(`ERROR: bad FS reference, $arcologies[0].${FS} not defined`); return; } - if (FS === "FSSupremacist" || FS === "FSSubjugationist") - FSLaw += "ME"; - if (FS !== "FSNull") - arcology[FSDecoration] = 20; + if (FS === "FSSupremacist" || FS === "FSSubjugationist") { FSLaw += "ME"; } + if (FS !== "FSNull") { arcology[FSDecoration] = 20; } arcology[FS] = "unset"; switch (FS) { case "FSPaternalist": @@ -129,14 +127,7 @@ window.FutureSocieties = (function() { } if (V.arcologies[0].FSNull > 0) { // possibly recalculate for multiculturalism activeFS--; - if (V.FSCreditCount === 4) - activeFS += V.arcologies[0].FSNull / 25; - else if (V.FSCreditCount === 6) - activeFS += V.arcologies[0].FSNull / 17; - else if (V.FSCreditCount === 7) - activeFS += V.arcologies[0].FSNull / 15; - else - activeFS += V.arcologies[0].FSNull / 20; + if (V.FSCreditCount === 4) { activeFS += V.arcologies[0].FSNull / 25; } else if (V.FSCreditCount === 6) { activeFS += V.arcologies[0].FSNull / 17; } else if (V.FSCreditCount === 7) { activeFS += V.arcologies[0].FSNull / 15; } else { activeFS += V.arcologies[0].FSNull / 20; } } V.FSCredits = Math.max(Math.trunc(V.FSGotRepCredits - activeFS), 0); } diff --git a/src/js/generateGenetics.js b/src/js/generateGenetics.js index 3dd348dcba655cca05aed98a5ddda0755b22d28c..99aa7fb4652a86b8c124fa5c5395b05e26c92159 100644 --- a/src/js/generateGenetics.js +++ b/src/js/generateGenetics.js @@ -306,8 +306,8 @@ window.generateGenetics = (function() { let prop = ""; for (prop in skinToMelanin) { - if (!skinToMelanin.hasOwnProperty(prop)) continue; - if (skinIndex >= skinToMelanin[prop]) return prop; + if (!skinToMelanin.hasOwnProperty(prop)) { continue; } + if (skinIndex >= skinToMelanin[prop]) { return prop; } } return prop; // skinIndex can be zero - now false? } @@ -560,7 +560,7 @@ window.generateGenetics = (function() { } else { fetish = jsEither(["none", "none", "none", "none", "none", mother.fetish, mother.fetish]); } - if (fetish === "mindbroken") {fetish = "none";} + if (fetish === "mindbroken") { fetish = "none"; } return fetish; } @@ -872,7 +872,7 @@ window.generateGenetics = (function() { } else if (mother.geneticQuirks.uFace === 2) { quirks.uFace = 1; } - + // gigantism if (father !== 0) { if (mother.geneticQuirks.gigantism === 2 && father.geneticQuirks.gigantism === 2) { @@ -1616,11 +1616,11 @@ window.generateChild = function(mother, ova, destination) { child.birthWeek = 0; child.energy = 0; child.anus = 0; - if (child.vagina > 0) {child.vagina = 0;} - if (child.fetish !== "none") {child.fetishStrength = 20;} - if (child.dick > 0) {child.foreskin = 1; child.balls = 1; child.scrotum = 1;} - if (genes.faceShape !== undefined) {child.faceShape = genes.faceShape;} - if (mother.addict > 0) {child.addict = Math.trunc(mother.addict / 2);} + if (child.vagina > 0) { child.vagina = 0; } + if (child.fetish !== "none") { child.fetishStrength = 20; } + if (child.dick > 0) { child.foreskin = 1; child.balls = 1; child.scrotum = 1; } + if (genes.faceShape !== undefined) { child.faceShape = genes.faceShape; } + if (mother.addict > 0) { child.addict = Math.trunc(mother.addict / 2); } child.career = "a slave since birth"; child.birthName = child.slaveName; child.birthSurname = child.slaveSurname; diff --git a/src/js/hTagMacroJS.js b/src/js/hTagMacroJS.js index cda739f03305721de4ba74bc221624561ab5c990..9bcfdfd69a41e25626a817e0a79c6b23827e1397 100644 --- a/src/js/hTagMacroJS.js +++ b/src/js/hTagMacroJS.js @@ -20,23 +20,20 @@ Macro.add('htag', { let attributes; function munge(val, key) { - return `${key }="${ val }"`; + return `${key}="${val}"`; } - if (1 > this.args.length) - return this.error('invalid syntax, format: <<htag [id [ tag ] | attributes [ tag ] >>'); - if (1 < this.args.length) - htag = String(this.args[1]).trim(); - if ("object" === typeof this.args[0]) - attributes = $.map(this.args[0], munge).join(" "); - else - attributes = `id="${ String(this.args[0]).trim() }"`; + if (1 > this.args.length) { return this.error('invalid syntax, format: <<htag [id [ tag ] | attributes [ tag ] >>'); } + if (1 < this.args.length) { htag = String(this.args[1]).trim(); } + if ("object" === typeof this.args[0]) { attributes = $.map(this.args[0], munge).join(" "); } else { attributes = `id="${String(this.args[0]).trim()}"`; } if (Config.debug) - this.debugView.modes({ + { +this.debugView.modes({ block: true - }); + }); +} - jQuery(`<${ htag } ${ attributes } />`) + jQuery(`<${htag} ${attributes} />`) .wiki(payload) .appendTo(this.output); } diff --git a/src/js/heroCreator.js b/src/js/heroCreator.js index 1539fecb5f492203adaaca8f0e0bfd473ee99032..1200dc10bd31b2393952563c997c3e0f336eb2fa 100644 --- a/src/js/heroCreator.js +++ b/src/js/heroCreator.js @@ -11,9 +11,9 @@ App.Utils.getHeroSlave = function(heroSlave, baseHeroSlave) { function deepAssign(target, source) { if (isObject(target) && isObject(source)) { for (const key in source) { - if (!source.hasOwnProperty(key)) continue; + if (!source.hasOwnProperty(key)) { continue; } if (isObject(source[key])) { - if (!target.hasOwnProperty(key)) target[key] = {}; + if (!target.hasOwnProperty(key)) { target[key] = {}; } deepAssign(target[key], source[key]); } else { Object.assign(target, { diff --git a/src/js/physicalDevelopment.js b/src/js/physicalDevelopment.js index 3a9764d4ff11dc052dc39dc46cec09c5a59cfe7d..5c5d8d2367e7105fed7b2f74dd7a99302ef206cd 100644 --- a/src/js/physicalDevelopment.js +++ b/src/js/physicalDevelopment.js @@ -2463,7 +2463,9 @@ window.physicalDevelopment = (function physicalDevelopment() { dickMod = (slave.geneticQuirks.wellHung === 2 ? 2 : 1); if (slave.hormoneBalance >= 200) { + // } else if (slave.hormoneBalance >= 100) { + // } else if (slave.hormoneBalance <= -200) { if (slave.physicalAge === 8) { if (slave.dick < 6) { @@ -2739,7 +2741,9 @@ window.physicalDevelopment = (function physicalDevelopment() { */ function increaseBalls(slave) { if (slave.hormoneBalance >= 200) { + // } else if (slave.hormoneBalance >= 100) { + // } else if (slave.hormoneBalance <= -200) { if (slave.physicalAge === 8) { if (slave.balls < 6) { diff --git a/src/js/rbuttonJS.js b/src/js/rbuttonJS.js index b7e820536b6b9de6ba9a098c88ff8c2b79fe11b1..2f2df1d7ca5b21c6f159e1b82f9d82935ec337f0 100644 --- a/src/js/rbuttonJS.js +++ b/src/js/rbuttonJS.js @@ -12,8 +12,8 @@ Macro.add('rbutton', { handler() { if (this.args.length < 2) { const errors = []; - if (this.args.length < 1) {errors.push('variable name');} - if (this.args.length < 2) {errors.push('checked value');} + if (this.args.length < 1) { errors.push('variable name'); } + if (this.args.length < 2) { errors.push('checked value'); } return this.error(`no ${errors.join(' or ')} specified`); } diff --git a/src/js/spanMacroJS.js b/src/js/spanMacroJS.js index f6404eccf51bbc3d273974151f476460f386405d..61760b318d2d82c24865279255ce48018f846033 100644 --- a/src/js/spanMacroJS.js +++ b/src/js/spanMacroJS.js @@ -25,7 +25,7 @@ Macro.add('span', { Config.debug && this.debugView.modes({block: true}); - jQuery(`<span id='${ String(result) }' />`) + jQuery(`<span id='${String(result)}' />`) .wiki(payload) .appendTo(this.output); } diff --git a/src/js/textbox2.js b/src/js/textbox2.js index a434e8015b787503c360c42c83df75f41f85eba2..cebb01edecd516ec0c1e319a9e5a37ffac76051f 100644 --- a/src/js/textbox2.js +++ b/src/js/textbox2.js @@ -2,11 +2,11 @@ Macro.add("textbox2", { handler: function() { if (this.args.length < 2) { const e = []; - return this.args.length < 1 && e.push("variable name"), this.args.length < 2 && e.push("default value"), this.error(`no ${ e.join(" or ") } specified`); + return this.args.length < 1 && e.push("variable name"), this.args.length < 2 && e.push("default value"), this.error(`no ${e.join(" or ")} specified`); } - if ("string" !== typeof this.args[0]) return this.error("variable name argument is not a string"); + if ("string" !== typeof this.args[0]) { return this.error("variable name argument is not a string"); } const t = this.args[0].trim(); - if ("$" !== t[0] && "_" !== t[0]) return this.error(`variable name "${ this.args[0] }" is missing its sigil ($ or _)`); + if ("$" !== t[0] && "_" !== t[0]) { return this.error(`variable name "${this.args[0]}" is missing its sigil ($ or _)`); } Config.debug && this.debugView.modes({ block: true }); @@ -46,7 +46,7 @@ Macro.add("textbox2", { } Engine.play(passage); if (currentPassage === passage) { - Scripting.evalJavaScript(`window.scrollTo(0, ${ currentScrollPosition });`); + Scripting.evalJavaScript(`window.scrollTo(0, ${currentScrollPosition});`); } } } @@ -63,11 +63,11 @@ Macro.add("textbox2", { } jQuery(inputElement).attr({ - id: `${this.name }-${ r}`, - name: `${this.name }-${ r}`, + id: `${this.name}-${r}`, + name: `${this.name}-${r}`, // type: isNumber ? "number" : "text", /* TODO - hide spinner if we do this */ tabindex: 0 - }).addClass(`macro-${ this.name}`) + }).addClass(`macro-${this.name}`) .on("change", function() { State.setVar(t, valueToNumberIfSame(this.value)); }).on("blur", function() { @@ -79,7 +79,7 @@ Macro.add("textbox2", { }) .on("keypress", function(e) { 13 === e.which && (e.preventDefault(), State.setVar(t, valueToNumberIfSame(this.value)), gotoPassage()); - }).appendTo(this.output), State.setVar(t, a), inputElement.value = a, autofocus && (inputElement.setAttribute("autofocus", "autofocus"), postdisplay[`#autofocus:${ inputElement.id}`] = function(e) { + }).appendTo(this.output), State.setVar(t, a), inputElement.value = a, autofocus && (inputElement.setAttribute("autofocus", "autofocus"), postdisplay[`#autofocus:${inputElement.id}`] = function(e) { delete postdisplay[e], setTimeout(function() { return inputElement.focus(); }, Engine.minDomActionDelay); diff --git a/src/js/textboxJS.js b/src/js/textboxJS.js index 52adb138876e93d22bae1b08bc7cba80e03c86c2..573fac9a376304f75ca63366eaed93e6af5e080a 100644 --- a/src/js/textboxJS.js +++ b/src/js/textboxJS.js @@ -1,25 +1,25 @@ /* Nicked off greyelf, works for replace textboxes */ window.setReplaceTextboxMaxLength = function(storyVarName, maxLength) { - const textboxId = `#textbox-${ Util.slugify(storyVarName)}`; + const textboxId = `#textbox-${Util.slugify(storyVarName)}`; $(textboxId) .attr("maxlength", maxLength) .css({ "min-width": "initial", - "width": `${maxLength }em`, + "width": `${maxLength}em`, "padding": "3px 2px" }); }; /* Nicked off TheMadExile, works for non-replace textboxes */ window.setTextboxMaxLength = function(storyVarName, maxLength) { - const textboxId = `#textbox-${ Util.slugify(storyVarName)}`; - postdisplay[`${textboxId }-maxlength`] = function(taskName) { + const textboxId = `#textbox-${Util.slugify(storyVarName)}`; + postdisplay[`${textboxId}-maxlength`] = function(taskName) { delete postdisplay[taskName]; $(textboxId) .attr("maxlength", maxLength) .css({ "min-width": "initial", - "width": `${maxLength }em`, + "width": `${maxLength}em`, "padding": "3px 2px" }); };