diff --git a/src/facilities/nursery/widgets/infants/infantSummary.js b/src/facilities/nursery/widgets/infants/infantSummary.js index 95ef77777eca0b29d82c609dc60b308654af824d..56768d5cb8a6c6ba3d2388015db3f541bfc76d41 100644 --- a/src/facilities/nursery/widgets/infants/infantSummary.js +++ b/src/facilities/nursery/widgets/infants/infantSummary.js @@ -4,116 +4,229 @@ * @returns {string} */ App.Facilities.Nursery.InfantSummary = function(child) { - "use strict"; const - weeksOwned = V.week - child.weekAcquired; + weeksOwned = V.week - child.weekAcquired, + pronouns = getPronouns(child), + abbreviate = V.UI.slaveSummary.abbreviation; let r = ``; - function InfantSummaryUncached(child) { - /** @type {App.UI.SlaveSummary.AbbreviationState} */ - const abbreviate = V.UI.slaveSummary.abbreviation; - if (abbreviate.health === 1) { - // shortHealth(child); - } else if (abbreviate.health === 2) { - // longHealth(child); + function InfantSummaryUncached() { + // r += health(); + r += description(); + r += race(); + r += nationality(); + r += skin(); + r += age(); + r += face(); + + r += `</span><br>`; + + if (V.seeImages !== 1 || V.seeSummaryImages !== 1 || V.imageChoice === 1) { + r += " "; + } + + r += intelligence(); + if (child.prestige > 0) { + r += prestige(); } - if (abbreviate.nationality + abbreviate.genitalia + abbreviate.physicals + abbreviate.skills + abbreviate.mental !== 0) { + if (child.pornPrestige > 0) { + r += pornPrestige(); + } + r += behavioralFlaw(); + r += sexualFlaw(); + + if ((child.relationship !== 0) || (abbreviate.clothes === 2) || (abbreviate.rulesets === 2)) { + r += `<br> `; + if (V.seeImages !== 1 || V.seeSummaryImages !== 1 || V.imageChoice === 1) { + r += ` `; + } + } + + r += extendedFamily(); + r += rival(); + + r += ` `; + + if (abbreviate.origins === 2 && child.origin !== 0) { + r += origins(); + } + + return r; + } + + + // function health() { + // if (abbreviate.health === 1) { + // return shortHealth(child); + // } else if (abbreviate.health === 2) { + // return longHealth(child); + // } + // } + + function description() { + let desc; + + if (abbreviate.nationality + + abbreviate.genitalia + + abbreviate.physicals + + abbreviate.skills + + abbreviate.mental !== 0) { r += `<br> `; if (V.seeImages !== 1 || V.seeSummaryImages !== 1 || V.imageChoice === 1) { r += " "; } } + if (child.actualAge > 0) { if (child.actualAge > 1) { - V.desc = `toddler`; + desc = `toddler`; } else { - V.desc = `baby`; + desc = `baby`; } } else { if (weeksOwned <= 1) { - V.desc = `newborn`; + desc = `newborn`; } else { - V.desc = `baby`; + desc = `baby`; } } - const firstLetter = V.desc.substring(0, 1).toUpperCase(); - V.desc = firstLetter + V.desc.substring(1); - r += `<strong><span class="coral">${V.desc}${abbreviate.physicals === 2? '.' : ''}</span></strong> `; + + const firstLetter = desc.substring(0, 1).toUpperCase(); + + desc = firstLetter + desc.substring(1); + r += `<strong><span class="coral">${desc}${abbreviate.physicals === 2 ? '.' : ''}</span></strong> `; + + return r; + } + + function race() { + let r = ``; + if (V.seeRace) { r += `<span class="tan">`; + if (abbreviate.race === 1) { - shortRace(child); + r += shortRace(child); } else if (abbreviate.race === 2) { - longRace(child); + r += longRace(child); } r += `</span> `; } + + return r; + } + + function nationality() { if (abbreviate.nationality === 1) { - shortNationality(child); + return shortNationality(child); } else if (abbreviate.nationality === 2) { - longNationality(child); + return longNationality(child); } + } + + function skin() { if (abbreviate.physicals === 1) { - shortSkin(child); + return shortSkin(child); } else { - r += `<span class="pink">${child.skin.charAt(0).toUpperCase() + child.skin.slice(1)} skin.</span> `; + return `<span class="pink">${child.skin.charAt(0).toUpperCase() + child.skin.slice(1)} skin.</span> `; } + } + + function age() { if (abbreviate.physicals === 1) { - shortAge(child); - shortFace(child); - r += `</span> `; + return shortAge(child); } else if (abbreviate.physicals === 2) { - longAge(child); - longFace(child); - r += `</span> `; + return longAge(child); } - r += `<br>`; - if (V.seeImages !== 1 || V.seeSummaryImages !== 1 || V.imageChoice === 1) { - r += " "; + } + + function face() { + if (abbreviate.physicals === 1) { + return shortFace(child); + } else if (abbreviate.physicals === 2) { + return longFace(child); } + } + + function intelligence() { if (abbreviate.skills === 1) { - shortIntelligence(child); - shortPrestige(child); - shortPornPrestige(child); + return shortIntelligence(child); } else if (abbreviate.skills === 2) { - longIntelligence(child); - longPrestige(child); - longPornPrestige(child); + return longIntelligence(child); } + } + + function prestige() { + if (abbreviate.skills === 1) { + return shortPrestige(child); + } else if (abbreviate.skills === 2) { + return longPrestige(child); + } + } + + function pornPrestige() { + if (abbreviate.skills === 1) { + return shortPornPrestige(child); + } else if (abbreviate.skills === 2) { + return longPornPrestige(child); + } + } + + function behavioralFlaw() { if (abbreviate.mental === 1) { - shortBehaviorFlaw(child); - shortSexFlaw(child); + return shortBehaviorFlaw(child); } else if (abbreviate.mental === 2) { - longBehaviorFlaw(child); - longSexFlaw(child); + return longBehaviorFlaw(child); } - if ((child.relationship !== 0) || (abbreviate.clothes === 2) || (abbreviate.rulesets === 2)) { - r += `<br> `; - if (V.seeImages !== 1 || V.seeSummaryImages !== 1 || V.imageChoice === 1) { - r += ` `; - } + } + + function sexualFlaw() { + if (abbreviate.mental === 1) { + return shortSexFlaw(child); + } else if (abbreviate.mental === 2) { + return longSexFlaw(child); } + } + + function extendedFamily() { if (abbreviate.mental === 1) { + let r = ``; + r += `<span class="lightgreen">`; shortExtendedFamily(child); r += `</span> `; - shortRival(child); + + return r; } else if (abbreviate.mental === 2) { - longExtendedFamily(child); - longRival(child); + return longExtendedFamily(child); } - r += ` `; - if (abbreviate.origins === 2 && child.origin !== 0) { - origins(child); + } + + function rival() { + if (abbreviate.mental === 1) { + return shortRival(child); + } else if (abbreviate.mental === 2) { + return longRival(child); } + } + + function origins() { + let r = `<br> `; + + if (V.seeImages !== 1 || V.seeSummaryImages !== 1 || V.imageChoice === 1) { + r += ` `; + } + r += `<span class="gray">${child.origin}</span> `; + return r; } + + + // /** TODO: add health to infants - // * @param {App.Entity.InfantState} child - // */ // function shortHealth(child) { // if (child.health.condition < -20) { // r += `<strong><span class="red">H ${V.summaryStats ? `[${child.health.condition}]` : ''}</span></strong> `; @@ -125,9 +238,6 @@ App.Facilities.Nursery.InfantSummary = function(child) { // r += " "; // } - // /** - // * @param {App.Entity.InfantState} child - // */ // function longHealth(child) { // if (child.health.condition < -90) { // r += `<span class="red">On the edge of death ${V.summaryStats ? `[${child.health.condition}]` : ''}.</span> `; @@ -147,10 +257,9 @@ App.Facilities.Nursery.InfantSummary = function(child) { // r += " "; // } - /** - * @param {App.Entity.InfantState} child - */ function shortRace(child) { + let r = ``; + switch (child.race) { case "white": r += `C`; @@ -192,12 +301,13 @@ App.Facilities.Nursery.InfantSummary = function(child) { r += `${child.race.charAt(0).toUpperCase() + child.race.charAt(1) + child.race.charAt(2)}`; break; } + + return r; } - /** - * @param {App.Entity.InfantState} child - */ function longRace(child) { + let r = ``; + switch (child.race) { case "white": r += `Caucasian. `; @@ -239,13 +349,13 @@ App.Facilities.Nursery.InfantSummary = function(child) { r += `${child.race.charAt(0).toUpperCase() + child.race.slice(1)}. `; break; } + + return r; } - /** - * @param {App.Entity.InfantState} child - */ function shortNationality(child) { - r += `<span class="tan">`; + let r = `<span class="tan">`; + switch (child.nationality) { case "Afghan": r += `Afg`; @@ -915,14 +1025,15 @@ App.Facilities.Nursery.InfantSummary = function(child) { r += `${child.nationality.charAt(0) + child.nationality.charAt(1) + child.nationality.charAt(2)}`; break; } + r += `</span> `; + + return r; } - /** - * @param {App.Entity.InfantState} child - */ function longNationality(child) { - r += `<span class="tan">`; + let r = `<span class="tan">`; + switch (child.nationality) { case "a Cook Islander": r += `Cook Islander. `; @@ -953,14 +1064,14 @@ App.Facilities.Nursery.InfantSummary = function(child) { r += `${child.nationality}. `; break; } + r += `</span> `; + + return r; } - /** - * @param {App.Entity.InfantState} child - */ function shortSkin(child) { - r += `<span class="pink">`; + let r = `<span class="pink">`; switch (child.skin) { case "pure white": r += `P. Whi`; @@ -1017,13 +1128,13 @@ App.Facilities.Nursery.InfantSummary = function(child) { break; } r += `</span> `; + + return r; } - /** - * @param {App.Entity.InfantState} child - */ function shortAge(child) { - r += `<span class="pink">`; + let r = `<span class="pink">`; + if (V.showAgeDetail === 1) { if (child.actualAge > 0) { r += `${capFirstChar(num(child.actualAge))}yrs. `; @@ -1039,12 +1150,13 @@ App.Facilities.Nursery.InfantSummary = function(child) { } } } + + return r; } - /** - * @param {App.Entity.InfantState} child - */ function shortFace(child) { + let r = ``; + if (child.face < -95) { r += `<span class="red">Face---${V.summaryStats ? `[${child.face}]` : ''}</span> `; } else if (child.face < -40) { @@ -1060,13 +1172,13 @@ App.Facilities.Nursery.InfantSummary = function(child) { } else { r += `<span class="pink">Face+++${V.summaryStats ? `[${child.face}]` : ''}</span> `; } + + return r; } - /** - * @param {App.Entity.InfantState} child - */ function longAge(child) { - r += `<span class="pink">`; + let r = `<span class="pink">`; + if (V.showAgeDetail) { if (child.actualAge > 0) { r += `${capFirstChar(num(child.actualAge))}-year-old `; @@ -1087,13 +1199,13 @@ App.Facilities.Nursery.InfantSummary = function(child) { } } } + + return r; } - /** - * @param {App.Entity.InfantState} child - */ function longFace(child) { - r += `Likely to have `; + let r = `Likely to have `; + if (child.face < -95) { r += `a <span class="red">very ugly${V.summaryStats ? `[${child.face}]`: ''}</span>`; } else if (child.face < -40) { @@ -1110,16 +1222,19 @@ App.Facilities.Nursery.InfantSummary = function(child) { r += `a <span class="pink">very beautiful${V.summaryStats ? `[${child.face}]`: ''}</span>`; } r += `, ${child.faceShape} face. `; + + return r; } - /** - * @param {App.Entity.InfantState} child - */ function shortIntelligence(child) { - let intelligence = child.intelligence; + let + intelligence = child.intelligence, + r = ``; + if (child.hasOwnProperty("intelligenceImplant")) { intelligence += child.intelligenceImplant; } + if (child.fetish === "mindbroken") { return; } else if (child.hasOwnProperty("intelligenceImplant") && child.intelligenceImplant >= 30) { @@ -1173,50 +1288,49 @@ App.Facilities.Nursery.InfantSummary = function(child) { r += `<span class="orangered">I---${V.summaryStats ? `[${intelligence}]` : ''}</span> `; } } + + return r; } - /** - * @param {App.Entity.InfantState} child - */ function shortPrestige(child) { - if (child.prestige > 0) { - r += `<span class="green">`; - if (child.prestige > 2) { - r += `Prest++`; - } else if (child.prestige === 2) { - r += `Prest+`; - } else if (child.prestige === 1) { - r += `Prest`; - } - r += `</span> `; + let r = `<span class="green">`; + + if (child.prestige > 2) { + r += `Prest++`; + } else if (child.prestige === 2) { + r += `Prest+`; + } else if (child.prestige === 1) { + r += `Prest`; } + r += `</span> `; + + return r; } - /** - * @param {App.Entity.InfantState} child - */ function shortPornPrestige(child) { - if (child.pornPrestige > 0) { - r += `<span class="green">`; - if (child.pornPrestige > 2) { - r += `PPrest++`; - } else if (child.pornPrestige === 2) { - r += `PPrest+`; - } else if (child.pornPrestige === 1) { - r += `PPrest`; - } - r += `</span> `; + let r = `<span class="green">`; + + if (child.pornPrestige > 2) { + r += `PPrest++`; + } else if (child.pornPrestige === 2) { + r += `PPrest+`; + } else if (child.pornPrestige === 1) { + r += `PPrest`; } + r += `</span> `; + + return r; } - /** - * @param {App.Entity.InfantState} child - */ function longIntelligence(child) { - let intelligence = child.intelligence; + let + intelligence = child.intelligence, + r = ``; + if (child.hasOwnProperty("intelligenceImplant")) { intelligence += child.intelligenceImplant; } + if (child.intelligence > 95) { r += `<span class="deepskyblue">Likely to be brilliant${V.summaryStats ? `[${intelligence}]` : ''}.</span> `; } else if (intelligence > 50) { @@ -1232,47 +1346,43 @@ App.Facilities.Nursery.InfantSummary = function(child) { } else { r += `<span class="orangered">Likely to be moronic${V.summaryStats ? `[${intelligence}]` : ''}.</span> `; } + + return r; } - /** - * @param {App.Entity.InfantState} child - */ function longPrestige(child) { - if (child.prestige > 0) { - r += `<span class="green">`; - if (child.prestige > 2) { - r += `Extremely prestigious. `; - } else if (child.prestige === 2) { - r += `Very prestigious. `; - } else if (child.prestige === 1) { - r += `Prestigious. `; - } - r += `</span> `; + let r = `<span class="green">`; + + if (child.prestige > 2) { + r += `Extremely prestigious. `; + } else if (child.prestige === 2) { + r += `Very prestigious. `; + } else if (child.prestige === 1) { + r += `Prestigious. `; } + r += `</span> `; + + return r; } - /** - * @param {App.Entity.InfantState} child - */ function longPornPrestige(child) { - if (child.pornPrestige > 0) { - r += `<span class="green">`; - if (child.pornPrestige > 2) { - r += `Porn star. `; - } else if (child.pornPrestige === 2) { - r += `Porn slut. `; - } else if (child.pornPrestige === 1) { - r += `Porn amateur. `; - } - r += `</span> `; + let r = `<span class="green">`; + + if (child.pornPrestige > 2) { + r += `Porn star. `; + } else if (child.pornPrestige === 2) { + r += `Porn slut. `; + } else if (child.pornPrestige === 1) { + r += `Porn amateur. `; } + r += `</span> `; + + return r; } - /** - * @param {App.Entity.InfantState} child - */ function shortBehaviorFlaw(child) { - r += `<span class="red">`; + let r = `<span class="red">`; + switch (child.behavioralFlaw) { case "arrogant": r += `Arrog`; @@ -1306,12 +1416,13 @@ App.Facilities.Nursery.InfantSummary = function(child) { break; } r += `</span> `; + + return r; } - /** - * @param {App.Entity.InfantState} child - */ function shortSexFlaw(child) { + let r = ``; + switch (child.sexualFlaw) { case "hates oral": r += `<span class="red">Oral-</span> `; @@ -1371,13 +1482,13 @@ App.Facilities.Nursery.InfantSummary = function(child) { child.sexualFlaw = "none"; break; } + + return r; } - /** - * @param {App.Entity.InfantState} child - */ function longBehaviorFlaw(child) { - r += `<span class="red">`; + let r = `<span class="red">`; + switch (child.behavioralFlaw) { case "arrogant": r += `Arrogant. `; @@ -1411,12 +1522,13 @@ App.Facilities.Nursery.InfantSummary = function(child) { break; } r += `</span> `; + + return r; } - /** - * @param {App.Entity.InfantState} child - */ function longSexFlaw(child) { + let r = ``; + switch (child.sexualFlaw) { case "hates oral": r += `<span class="red">Hates oral.</span> `; @@ -1476,13 +1588,15 @@ App.Facilities.Nursery.InfantSummary = function(child) { child.sexualFlaw = "none"; break; } + + return r; } - /** - * @param {App.Entity.InfantState} child - */ function shortExtendedFamily(child) { - let handled = 0; + let + handled = 0, + r = ``; + if (child.mother > 0) { const _ssj = V.slaves.findIndex(function(s) { return s.ID === child.mother; @@ -1506,6 +1620,7 @@ App.Facilities.Nursery.InfantSummary = function(child) { } else if (child.mother in V.missingTable && V.showMissingSlavesSD && V.showMissingSlaves) { r += `${V.missingTable[child.mother].fullName}'s daughter `; } + if (child.father > 0 && child.father !== child.mother) { const _ssj = V.slaves.findIndex(function(s) { return s.ID === child.father; @@ -1529,6 +1644,7 @@ App.Facilities.Nursery.InfantSummary = function(child) { } else if (child.father in V.missingTable && child.father !== child.mother && V.showMissingSlavesSD && V.showMissingSlaves) { r += `${V.missingTable[child.father].fullName}'s daughter`; } + if (child.daughters === 1) { let _ssj = V.slaves.findIndex(function(s) { return s.mother === child.ID; @@ -1557,6 +1673,7 @@ App.Facilities.Nursery.InfantSummary = function(child) { } else if (child.daughters > 1) { r += `multiple daughters `; } + if (child.sisters === 1) { const _ssj = V.slaves.findIndex(function(s) { return areSisters(s, child) > 0; @@ -1573,6 +1690,7 @@ App.Facilities.Nursery.InfantSummary = function(child) { } else if (child.sisters > 1) { r += `multiple sisters `; } + if (child.relationship > 0 && handled !== 1) { const _ssj = V.slaves.findIndex(function(s) { return s.ID === child.relationshipTarget; @@ -1589,12 +1707,13 @@ App.Facilities.Nursery.InfantSummary = function(child) { } else if (child.relationship === -1) { r += `E Slut`; } + + return r; } - /** - * @param {App.Entity.InfantState} child - */ function shortRival(child) { + let r = ``; + if (child.rivalry !== 0) { r += ` `; const _ssj = V.slaves.findIndex(function(s) { @@ -1612,13 +1731,15 @@ App.Facilities.Nursery.InfantSummary = function(child) { r += `</span> `; } } + + return r; } - /** - * @param {App.Entity.InfantState} child - */ function longExtendedFamily(child) { - let handled = 0; + let + handled = 0, + r = ``; + if (child.mother > 0) { const _ssj = V.slaves.findIndex(function(s) { return s.ID === child.mother; @@ -1644,6 +1765,7 @@ App.Facilities.Nursery.InfantSummary = function(child) { } else if (child.mother in V.missingTable && V.showMissingSlavesSD && V.showMissingSlaves) { r += `${V.missingTable[child.mother].fullName}'s <span class="lightgreen">daughter.</span> `; } + if (child.father > 0 && child.father !== child.mother) { const _ssj = V.slaves.findIndex(function(s) { return s.ID === child.father; @@ -1668,6 +1790,7 @@ App.Facilities.Nursery.InfantSummary = function(child) { } else if (child.father in V.missingTable && child.father !== child.mother && V.showMissingSlavesSD && V.showMissingSlaves) { r += `${V.missingTable[child.father].fullName}'s <span class="lightgreen">daughter.</span> `; } + if (child.daughters === 1) { let _ssj = V.slaves.findIndex(function(s) { return s.mother === child.ID; @@ -1702,6 +1825,7 @@ App.Facilities.Nursery.InfantSummary = function(child) { r += `<span class="lightgreen">Has several daughters.</span> `; } } + if (child.sisters === 1) { const _ssj = V.slaves.findIndex(function(s) { return areSisters(s, child) > 0; @@ -1724,6 +1848,7 @@ App.Facilities.Nursery.InfantSummary = function(child) { r += `<span class="lightgreen">Has several sisters.</span> `; } } + if (child.relationship > 0 && handled !== 1) { const _ssj = V.slaves.findIndex(function(s) { return s.ID === child.relationshipTarget; @@ -1740,17 +1865,19 @@ App.Facilities.Nursery.InfantSummary = function(child) { } else if (child.relationship === -1) { r += `<span class="lightgreen">Emotional slut.</span> `; } + + return r; } - /** - * @param {App.Entity.InfantState} child - */ function longRival(child) { + let r = ``; + if (child.rivalry !== 0) { r += ` `; const _ssj = V.slaves.findIndex(function(s) { return s.ID === child.rivalryTarget; }); + if (_ssj !== -1) { if (child.rivalry <= 1) { r += `<span class="lightsalmon">Dislikes</span> ${SlaveFullName(V.slaves[_ssj])}. `; @@ -1762,17 +1889,8 @@ App.Facilities.Nursery.InfantSummary = function(child) { } r += " "; } - } - /** - * @param {App.Entity.InfantState} child - */ - function origins(child) { - r += `<br> `; - if (V.seeImages !== 1 || V.seeSummaryImages !== 1 || V.imageChoice === 1) { - r += ` `; - } - r += `<span class="gray">${child.origin}</span> `; + return r; } return InfantSummaryUncached(child); diff --git a/src/facilities/nursery/widgets/utils/nurseryUtils.js b/src/facilities/nursery/widgets/utils/nurseryUtils.js index 81ac40ec0438400595e98c46b4d32b068a6e503d..00aa06fd24fd1ec2f7637519d385daadaaa4436c 100644 --- a/src/facilities/nursery/widgets/utils/nurseryUtils.js +++ b/src/facilities/nursery/widgets/utils/nurseryUtils.js @@ -18,7 +18,7 @@ App.Facilities.Nursery.childList = function () { weeksLeft = (V.targetAgeNursery * 52) - weeksOwned, he = getPronouns(child).he, him = getPronouns(child).him, - He = getPronouns(child).Him; + He = getPronouns(child).He; if (child.actualAge < 3) { r += App.UI.passageLink(`${SlaveFullName(child)}`, "Infant Interact", `$activeChild = $cribs[${i}]`);