diff --git a/src/interaction/siRecords.js b/src/interaction/siRecords.js index 4e1f0c92ca5641e12ccb73535626cfd9ff54b0c9..707849bcb38af95567bbeae0e1a96efb7e849552 100644 --- a/src/interaction/siRecords.js +++ b/src/interaction/siRecords.js @@ -188,27 +188,47 @@ App.UI.SlaveInteract.records = function(slave, refresh) { App.UI.DOM.appendNewElement("p", el, statistics()); function statistics() { + const div = document.createElement("div"); const text = []; const slaves = [...slave.partners].filter(i => i > 0); - const ownedSlaves = slaves - .filter(s => getSlave(s)) // make sure it isn't undefined - .map(s => SlaveFullName(getSlave(s))); // get the name + const ownedSlaves = slaves.filter(s => getSlave(s)); + const unownedSlaves = slaves.length - ownedSlaves.length; const other = []; - const link = App.UI.DOM.link(`${num(slaves.length)} ${slaves.length > 1 ? `different slaves` : `slave`}`, () => { - Dialog.append(`${slave.slaveName} has slept with `, toSentence(ownedSlaves), slaves.length - ownedSlaves.length > 0 ? `, as well as ${num(slaves.length - ownedSlaves.length)} slaves you don't currently own.` : `.`); - Dialog.open(); - }); + const ownedSlavesSpan = document.createElement("span"); - if (slaves.length > 0) { - text.push( - `${He}'s had sex with`, - link, - `so far.`, - ); - } else { - text.push(`${He} hasn't had sex with any of your slaves yet.`); + for (let i = 0; i < ownedSlaves.length; i++) { + const innerSpan = document.createElement("span"); + const slave = getSlave(ownedSlaves[i]); + + innerSpan.style.display = 'inline-block'; // hack to prevent span breaking line and giving unusable tooltip + innerSpan.style.marginRight = '4px'; + + if (ownedSlaves.length > 1) { + if (i === ownedSlaves.length - 1) { + innerSpan.append(` and `, App.UI.DOM.referenceSlaveWithPreview(slave, SlaveFullName(slave))); + + if (unownedSlaves > 0) { + innerSpan.append(`, as well as ${numberWithPlural(unownedSlaves, 'slave')} you don't currently own`); + } + + innerSpan.append(`.`); + } else { + innerSpan.append(App.UI.DOM.referenceSlaveWithPreview(slave, SlaveFullName(slave))); + + if (ownedSlaves.length > 2) { + innerSpan.append(`, `); + } + } + } else { + innerSpan.append( + App.UI.DOM.referenceSlaveWithPreview(slave, SlaveFullName(slave)), + `.`, + ); + } + + ownedSlavesSpan.append(innerSpan); } if (slave.partners.has(-1)) { @@ -233,13 +253,36 @@ App.UI.SlaveInteract.records = function(slave, refresh) { other.push(`members of the Futanari Sisters`); } + const link = App.UI.DOM.link(`${numberWithPluralOne(slaves.length, 'other slave')}`, () => { + const innerDiv = document.createElement("div"); + + innerDiv.append( + `${slave.slaveName} has slept with ${other.length > 0 ? `${toSentence(other)}, as well as `: ``}`, + ownedSlavesSpan + ); + + App.UI.DOM.replace(div, innerDiv); + }); + + if (slaves.length > 0) { + text.push( + `${He}'s had sex with`, + link, + `so far.`, + ); + } else if (other.length > 0) { + text.push(`${He} hasn't had sex with any of your slaves yet.`); + } else { + text.push(`${He} hasn't had sex with anyone yet.`); + } + if (other.length > 0) { text.push(`${He} has ${slaves.length > 0 ? `also` : ``} had sex with ${toSentence(other)}${slaves.length > 0 ? `` : `, though`}.`); } - App.Events.addNode(el, text); + App.Events.addNode(div, text); - return el; + return div; } r = []; diff --git a/src/player/managePersonalAffairs.js b/src/player/managePersonalAffairs.js index 6aad955ead2045320e70ca599f9b3bc66bec9030..1dfecc86216931726ca64bf489c9a2f641fc6e71 100644 --- a/src/player/managePersonalAffairs.js +++ b/src/player/managePersonalAffairs.js @@ -671,24 +671,46 @@ App.UI.managePersonalAffairs = function() { const text = []; const slaves = [...PC.partners].filter(i => i > 0); - const ownedSlaves = slaves - .filter(s => getSlave(s)) // make sure it isn't undefined - .map(s => SlaveFullName(getSlave(s))); // get the name + const ownedSlaves = slaves.filter(s => getSlave(s)); + const unownedSlaves = slaves.length - ownedSlaves.length; const other = []; - const link = App.UI.DOM.link(`${num(slaves.length)} ${slaves.length > 1 ? `different slaves` : `slave`}`, () => { - Dialog.append(`You have slept with `, toSentence(ownedSlaves), slaves.length - ownedSlaves.length > 0 ? `, as well as ${num(slaves.length - ownedSlaves.length)} slaves you don't currently own.` : `.`); - Dialog.open(); - }); + const ownedSlavesSpan = document.createElement("span"); - if (slaves.length > 0) { - text.push( - `You've had sex with`, - link, - `so far.`, - ); - } else { - text.push(`You haven't had sex with any slaves yet.`); + for (let i = 0; i < ownedSlaves.length; i++) { + const innerSpan = document.createElement("span"); + const slave = getSlave(ownedSlaves[i]); + + innerSpan.style.display = 'inline-block'; // hack to prevent span breaking line and giving unusable tooltip + innerSpan.style.marginRight = '4px'; + + if (ownedSlaves.length > 1) { + if (i === ownedSlaves.length - 1) { + innerSpan.append( + ` and `, + App.UI.DOM.referenceSlaveWithPreview(slave, SlaveFullName(slave)), + ); + + if (unownedSlaves > 0) { + innerSpan.append(`, as well as ${numberWithPlural(unownedSlaves, 'slave')} you don't currently own`); + } + + innerSpan.append(`.`); + } else { + innerSpan.append(App.UI.DOM.referenceSlaveWithPreview(slave, SlaveFullName(slave))); + + if (ownedSlaves.length > 2) { + innerSpan.append(`, `); + } + } + } else { + innerSpan.append( + App.UI.DOM.referenceSlaveWithPreview(slave, SlaveFullName(slave)), + `.`, + ); + } + + ownedSlavesSpan.append(innerSpan); } if (PC.partners.has(-2)) { @@ -710,6 +732,29 @@ App.UI.managePersonalAffairs = function() { other.push(`members of the Futanari Sisters`); } + const link = App.UI.DOM.link(`${num(slaves.length)} of your slaves`, () => { + const innerDiv = document.createElement("div"); + + innerDiv.append( + `You have slept with ${other.length > 0 ? `${toSentence(other)}, as well as `: ``}`, + ownedSlavesSpan + ); + + App.UI.DOM.replace(partnersDiv, innerDiv); + }); + + if (slaves.length > 0) { + text.push( + `You've had sex with`, + link, + `so far.`, + ); + } else if (other.length > 0) { + text.push(`You haven't had sex with any of your slaves yet.`); + } else { + text.push(`You haven't had sex with anyone yet.`); + } + if (other.length > 0) { text.push(`You have ${slaves.length > 0 ? `also` : ``} had sex with ${toSentence(other)}${slaves.length > 0 ? `` : `, though`}.`); }