diff --git a/src/Mods/DinnerParty/dinnerPartyPreparations.tw b/src/Mods/DinnerParty/dinnerPartyPreparations.tw index 777778de6c05068b7cf04155c168d347dea2d0a0..21d00fcdb1547c57eb1901b7fb4329c5080ad9df 100644 --- a/src/Mods/DinnerParty/dinnerPartyPreparations.tw +++ b/src/Mods/DinnerParty/dinnerPartyPreparations.tw @@ -29,7 +29,7 @@ Your assistant will take care of the invitations and all the arrangements; all y __Select Your Meat:__ <br><br> -<<= App.UI.SlaveList.slaveSelectionList( +<<includeDOM App.UI.SlaveList.slaveSelectionList( s => assignmentVisible(s) && s.fuckdoll === 0, App.UI.SlaveList.SlaveInteract.stdInteract, null, diff --git a/src/facilities/farmyard/farmerSelect.tw b/src/facilities/farmyard/farmerSelect.tw index 8ea9151878320174b1fb79caa18beaa0fa466853..2c66982b707aa3e92ba7e53540ddbfb5a36cd695 100644 --- a/src/facilities/farmyard/farmerSelect.tw +++ b/src/facilities/farmyard/farmerSelect.tw @@ -12,4 +12,4 @@ <br><br>''Appoint a Farmer from your obedient slaves:'' <br><br>[[None|Farmyard][removeJob($Farmer, "be the Farmer")]] <br><br> -<<print App.UI.SlaveList.facilityManagerSelection(App.Entity.facilities.farmyard, "Farmyard")>> +<<includeDOM App.UI.SlaveList.facilityManagerSelection(App.Entity.facilities.farmyard, "Farmyard")>> diff --git a/src/facilities/farmyard/farmyard.tw b/src/facilities/farmyard/farmyard.tw index b05f981da858a72dada11eb43bfb02d94d837f20..f86e94f17325ec1f3aa2b260f6012bea1daa9c6b 100644 --- a/src/facilities/farmyard/farmyard.tw +++ b/src/facilities/farmyard/farmyard.tw @@ -237,7 +237,7 @@ <br><hr><br> -<<print App.UI.SlaveList.stdFacilityPage(App.Entity.facilities.farmyard)>> +<<includeDOM App.UI.SlaveList.stdFacilityPage(App.Entity.facilities.farmyard)>> <br><br>Rename $farmyardName: <<textbox "$farmyardName" $farmyardName "Farmyard">> //Use a noun or similar short phrase// diff --git a/src/facilities/nursery/matronSelect.tw b/src/facilities/nursery/matronSelect.tw index 0b52309d0ff93d1b91e2d27dc1f76f066caefa6b..70531aff189aa069180438c3e283ddcd1e3a943a 100644 --- a/src/facilities/nursery/matronSelect.tw +++ b/src/facilities/nursery/matronSelect.tw @@ -12,4 +12,4 @@ <br><br>''Appoint a Matron from your devoted slaves:'' <br><br>[[None|Nursery][removeJob($Matron, "be the Matron")]] <br><br> -<<print App.UI.SlaveList.facilityManagerSelection(App.Entity.facilities.nursery, "Nursery")>> +<<includeDOM App.UI.SlaveList.facilityManagerSelection(App.Entity.facilities.nursery, "Nursery")>> diff --git a/src/facilities/nursery/nursery.tw b/src/facilities/nursery/nursery.tw index 86e754f2f8c30e6c56794f2fc1d3c93e2cbf5820..00445ff9cbd6b2ae6fd8118bbb858d55f3e10b88 100644 --- a/src/facilities/nursery/nursery.tw +++ b/src/facilities/nursery/nursery.tw @@ -151,7 +151,7 @@ </div> <p> - <<print App.UI.SlaveList.stdFacilityPage(App.Entity.facilities.nursery)>> + <<includeDOM App.UI.SlaveList.stdFacilityPage(App.Entity.facilities.nursery)>> </p> /* </div> diff --git a/src/gui/options/summaryOptions.tw b/src/gui/options/summaryOptions.tw index bb269e7d04b462c6a004bc93f6468a106ef0d059..9c079d55801ba4aedaed37a3247503a442dcf52e 100644 --- a/src/gui/options/summaryOptions.tw +++ b/src/gui/options/summaryOptions.tw @@ -43,11 +43,7 @@ <h2>Individual panels</h2> Sample summary: -<<= App.UI.SlaveList.render.listMarkup( - [$activeSlave.ID], - [], - App.UI.SlaveList.SlaveInteract.stdInteract -)>> +<<includeDOM App.UI.SlaveList.render([$activeSlave.ID], new Array(), App.UI.SlaveList.SlaveInteract.stdInteract)>> <<set _options = (new App.UI.OptionsGroup()).enableDoubleColumn()>> diff --git a/src/js/findSlave.js b/src/js/findSlave.js index 6587925d17b6a6508b246b1b342a3ca0b6c7e6d6..bd138ce9bdcad7685308e764fd152f2068582594 100644 --- a/src/js/findSlave.js +++ b/src/js/findSlave.js @@ -34,7 +34,7 @@ App.FindSlave._appendResultList = function(ids, frag) { if (ids.length === 0) { App.UI.DOM.appendNewElement("p", frag, "No matching slaves."); } else { - frag.appendChild(App.UI.SlaveList.render.listDOM(ids, [], App.UI.SlaveList.SlaveInteract.stdInteract)); + frag.appendChild(App.UI.SlaveList.render(ids, [], App.UI.SlaveList.SlaveInteract.stdInteract)); } }; diff --git a/src/js/slaveListing.js b/src/js/slaveListing.js index dec491595859e5549737ae4d1043c15a801caa7a..f94b41f25ed02a54ba65ca9f8a89fed3c5174c93 100644 --- a/src/js/slaveListing.js +++ b/src/js/slaveListing.js @@ -29,18 +29,10 @@ App.UI.SlaveList.render = function() { // potentially can be a problem if played long enough to reach Number.MAX_SAFE_INTEGER let listID = Number.MIN_SAFE_INTEGER; - /** @type {Object.<number, Node>}*/ - const readyResults = { - - }; - /** @type {App.Art.SlaveArtBatch?} */ let batchRenderer = null; - return { - listMarkup: listMarkup, - listDOM: listDOM - }; + return listDOM; /** * @param {number[]} IDs @@ -122,37 +114,6 @@ App.UI.SlaveList.render = function() { return res; } - /** - * @param {number[]} IDs - * @param {Array.<{id: number, rejects: string[]}>} rejectedSlaves - * @param {slaveToElement} interactionLink - * @param {slaveToElement} [postNote] - * @returns {string} - */ - function listMarkup(IDs, rejectedSlaves, interactionLink, postNote) { - const listIDStr = `slave-list-${listID}`; - readyResults[listID] = listDOM(IDs, rejectedSlaves, interactionLink, postNote); - - $(document).one(':passagedisplay', function() { - for (const e of document.querySelectorAll('[id^=slave-list]')) { - const id = e.getAttribute("data-listId"); - if (readyResults.hasOwnProperty(id)) { - if (e.childNodes.length > 0) { - e.innerHTML = ''; - } - e.appendChild(readyResults[id]); - delete readyResults[id]; - } - } - }); - - let resMarkup = `<div id="${listIDStr}" data-listId="${listID}"></div>`; - ++listID; - - return resMarkup; - } - - /** * @param {number} id * @param {slaveToElement} interactionLink @@ -615,31 +576,11 @@ App.UI.selectSlaveForPersonalAttention = function(id) { SugarCube.Engine.play("Personal Attention Select"); }; -/** - * Generates fragment with sorting options, that link to the given passage - * @param {string} passage The passage to link to - * @returns {string} - */ -App.UI.SlaveList.sortingLinks = function(passage) { - let r = ' Sort by: '; - let textify = (cc) => capFirstChar(cc.replace(/([A-Z])/g, " $1")); - r += ["devotion", "name", "assignment", "seniority", "actualAge", "visualAge", "physicalAge", "weeklyIncome"] - .map(so => V.sortSlavesBy !== so ? - App.UI.passageLink(textify(so), passage, `$sortSlavesBy = "${so}"`) : textify(so)) - .join(" | "); - - r += ' Sort: '; - r += ["descending", "ascending"].map(so => V.sortSlavesOrder !== so ? - App.UI.passageLink(capFirstChar(so), passage, `$sortSlavesOrder = "${so}"`) : capFirstChar(so)) - .join(" | "); - return r; -}; - /** * @param {string} passage - * @returns {*} + * @returns {HTMLElement} */ -App.UI.SlaveList.sortingLinksDOM = function(passage) { +App.UI.SlaveList.sortingLinks = function(passage) { const outerDiv = document.createElement("div"); outerDiv.classList.add("flex-container"); const textify = string => capFirstChar(string.replace(/([A-Z])/g, " $1")); @@ -666,7 +607,7 @@ App.UI.SlaveList.sortingLinksDOM = function(passage) { * @param {string} [facilityPassage] * @param {boolean} [showTransfersTab=false] * @param {{assign: string, remove: string, transfer: (string| undefined)}} [tabCaptions] - * @returns {string} + * @returns {DocumentFragment} */ App.UI.SlaveList.listSJFacilitySlaves = function(facility, facilityPassage, showTransfersTab = false, tabCaptions = undefined) { const job = facility.job(); @@ -677,30 +618,31 @@ App.UI.SlaveList.listSJFacilitySlaves = function(facility, facilityPassage, show remove: 'Remove a slave', transfer: 'Transfer from Facility' }; - let r = ''; + const frag = document.createDocumentFragment(); if (V.sortSlavesMain) { - r += this.sortingLinks(facilityPassage) + '<br>'; + frag.append(this.sortingLinks(facilityPassage)); } - r += '<div class="tabbar">' + - App.UI.tabbar.tabButton('assign', tabCaptions.assign) + - App.UI.tabbar.tabButton('remove', tabCaptions.remove) + - (showTransfersTab ? App.UI.tabbar.tabButton('transfer', tabCaptions.transfer) : '') + - '</div>'; + const tabbar = App.UI.DOM.appendNewElement("div", frag, '', "tabbar"); + tabbar.append( + App.UI.tabbar.tabButtonDOM('assign', tabCaptions.assign), + App.UI.tabbar.tabButtonDOM('remove', tabCaptions.remove), + (showTransfersTab ? App.UI.tabbar.tabButtonDOM('transfer', tabCaptions.transfer) : '') + ); const facilitySlaves = [...job.employeesIDs()]; if (facilitySlaves.length > 0) { SlaveSort.IDs(facilitySlaves); - r += App.UI.tabbar.makeTab("remove", App.UI.SlaveList.render.listMarkup(facilitySlaves, [], + frag.append(App.UI.tabbar.makeTabDOM("remove", App.UI.SlaveList.render(facilitySlaves, [], App.UI.SlaveList.SlaveInteract.stdInteract, (slave) => App.UI.DOM.link(`Retrieve ${getPronouns(slave).object} from ${facility.name}`, () => removeJob(slave, job.desc.assignment), [], facilityPassage) - )); + ))); } else { - r += App.UI.tabbar.makeTab("remove", `<em>${capFirstChar(facility.name)} is empty for the moment</em>`); + frag.append(App.UI.tabbar.makeTabDOM("remove", App.UI.DOM.makeElement("em", `${capFirstChar(facility.name)} is empty for the moment`))); } /** * @param {number[]} slaveIDs - * @returns {string} + * @returns {DocumentFragment} */ function assignableTabContent(slaveIDs) { SlaveSort.IDs(slaveIDs); @@ -714,7 +656,7 @@ App.UI.SlaveList.listSJFacilitySlaves = function(facility, facilityPassage, show passedSlaves.push(id); } }, []); - return App.UI.SlaveList.render.listMarkup(passedSlaves, rejectedSlaves, + return App.UI.SlaveList.render(passedSlaves, rejectedSlaves, App.UI.SlaveList.SlaveInteract.stdInteract, (slave) => App.UI.DOM.link(`Send ${getPronouns(slave).object} to ${facility.name}`, () => { assignmentTransition(slave, job.desc.assignment, facilityPassage); })); } @@ -722,9 +664,9 @@ App.UI.SlaveList.listSJFacilitySlaves = function(facility, facilityPassage, show const assignableSlaveIDs = job.desc.partTime ? V.slaves.map(slave => slave.ID) : // all slaves can work here [...App.Entity.facilities.penthouse.employeesIDs()]; // only slaves from the penthouse can be transferred here - r += App.UI.tabbar.makeTab("assign", assignableTabContent(assignableSlaveIDs)); + frag.append(App.UI.tabbar.makeTabDOM("assign", assignableTabContent(assignableSlaveIDs))); } else { - r += App.UI.tabbar.makeTab("assign", `<strong>${capFirstChar(facility.name)} is full and cannot hold any more slaves</strong>`); + frag.append(App.UI.tabbar.makeTabDOM("assign", App.UI.DOM.makeElement("strong", `${capFirstChar(facility.name)} is full and cannot hold any more slaves`))); } if (showTransfersTab) { @@ -736,14 +678,14 @@ App.UI.SlaveList.listSJFacilitySlaves = function(facility, facilityPassage, show } return acc; }, []); - r += App.UI.tabbar.makeTab("transfer", assignableTabContent(transferableIDs)); + frag.append(App.UI.tabbar.makeTabDOM("transfer", assignableTabContent(transferableIDs))); } else { - r += App.UI.tabbar.makeTab("transfer", `<strong>${capFirstChar(facility.name)} is full and cannot hold any more slaves</strong>`); + frag.append(App.UI.tabbar.makeTabDOM("transfer", App.UI.DOM.makeElement("strong", `${capFirstChar(facility.name)} is full and cannot hold any more slaves`))); } } App.UI.tabbar.handlePreSelectedTab(); - return r; + return frag; }; /** @@ -761,77 +703,76 @@ App.UI.SlaveList.makeNameDecorator = function(classNames) { }; /** - * @returns {string} + * @returns {DocumentFragment} */ App.UI.SlaveList.listNGPSlaves = function() { const thisPassage = 'New Game Plus'; - let r = this.sortingLinks(thisPassage) + '<br>'; - r += '<div class="tabbar">' + - App.UI.tabbar.tabButton('assign', 'Import a slave') + - App.UI.tabbar.tabButton('remove', 'Remove from import') + - '</div>'; + const frag = document.createDocumentFragment(); + frag.append(this.sortingLinks(thisPassage)); + const tabbar = App.UI.DOM.appendNewElement("div", frag, '', "tabbar"); + tabbar.append( + App.UI.tabbar.tabButtonDOM('assign', "Import a slave"), + App.UI.tabbar.tabButtonDOM('remove', "Remove from import") + ); const NGPassignment = Job.IMPORTED; - /** @type {App.Entity.SlaveState[]} */ - const slaves = V.slaves; - - /* handle the legacy assignment string */ - for (const slave of slaves) { + let imported = []; + let nonImported = []; + for (const slave of V.slaves) { + /* handle the legacy assignment string */ if (slave.assignment === "be imported") { - slave.assignment = Job.IMPORTED; + slave.assignment = NGPassignment; + } + if (slave.assignment === NGPassignment) { + imported.push(slave.ID); + } else { + nonImported.push(slave.ID); } } - if (V.slavesToImport > 0) { - const importedSlavesIDs = slaves.reduce((acc, s) => { - if (s.assignment === NGPassignment) { - acc.push(s.ID); - } - return acc; - }, []); - SlaveSort.IDs(importedSlavesIDs); - r += App.UI.tabbar.makeTab("remove", App.UI.SlaveList.render.listMarkup(importedSlavesIDs, [], + if (imported.length > 0) { + SlaveSort.IDs(imported); + frag.append(App.UI.tabbar.makeTabDOM("remove", App.UI.SlaveList.render(imported, [], App.UI.SlaveList.makeNameDecorator(["emphasizedSlave", "pink"]), - (s) => App.UI.DOM.passageLink('Remove from import list', thisPassage, - () => { V.slavesToImport -= 1; removeJob(s, NGPassignment); } - ))); + (s) => App.UI.DOM.passageLink('Remove from import list', thisPassage, () => removeJob(s, NGPassignment)) + ))); } else { - r += App.UI.tabbar.makeTab("remove", `<em>No slaves will go with you to the new game</em>`); + frag.append(App.UI.tabbar.makeTabDOM("remove", App.UI.DOM.makeElement('em', "No slaves will go with you to the new game"))); } - if (V.slavesToImport < V.slavesToImportMax) { - const slavesToImportIDs = slaves.reduce((acc, s) => { if (s.assignment !== NGPassignment) { acc.push(s.ID); } return acc; }, []); - SlaveSort.IDs(slavesToImportIDs); - r += App.UI.tabbar.makeTab("assign", App.UI.SlaveList.render.listMarkup(slavesToImportIDs, [], + if (imported.length < V.slavesToImportMax) { + SlaveSort.IDs(nonImported); + frag.append(App.UI.tabbar.makeTabDOM("assign", App.UI.SlaveList.render(nonImported, [], App.UI.SlaveList.makeNameDecorator(["emphasizedSlave", "pink"]), - (s) => App.UI.DOM.passageLink('Add to import list', thisPassage, - () => { V.slavesToImport += 1; assignJob(s, NGPassignment); } - ))); + (s) => App.UI.DOM.passageLink('Add to import list', thisPassage, () => assignJob(s, NGPassignment)) + ))); } else { - r += App.UI.tabbar.makeTab("assign", `<strong>Slave import limit reached</strong>`); + frag.append(App.UI.tabbar.makeTabDOM("assign", App.UI.DOM.makeElement('strong', `Slave import limit reached`))); } App.UI.tabbar.handlePreSelectedTab(); - return r; + return frag; }; /** * Renders facility manager summary or a note with a link to select one * @param {App.Entity.Facilities.Facility} facility * @param {string} [selectionPassage] passage name for manager selection. "${Manager} Select" if omitted - * @returns {string} + * @returns {DocumentFragment} */ App.UI.SlaveList.displayManager = function(facility, selectionPassage) { const managerCapName = capFirstChar(facility.desc.manager.position); selectionPassage = selectionPassage || `${managerCapName} Select`; const manager = facility.manager.currentEmployee; if (manager) { - return this.render.listMarkup([manager.ID], [], + return this.render([manager.ID], [], App.UI.SlaveList.SlaveInteract.stdInteract, () => App.UI.DOM.passageLink(`Change or remove ${managerCapName}`, selectionPassage)); } else { - return `You do not have a slave serving as a ${managerCapName}. ${App.UI.passageLink(`Appoint one`, selectionPassage, "")}`; + const frag = document.createDocumentFragment(); + frag.append(`You do not have a slave serving as a ${managerCapName}. `, App.UI.DOM.passageLink(`Appoint one`, selectionPassage)); + return frag; } }; @@ -839,10 +780,13 @@ App.UI.SlaveList.displayManager = function(facility, selectionPassage) { * Displays standard facility page with manager and list of workers * @param {App.Entity.Facilities.Facility} facility * @param {boolean} [showTransfersPage] - * @returns {string} + * @returns {DocumentFragment} */ App.UI.SlaveList.stdFacilityPage = function(facility, showTransfersPage) { - return this.displayManager(facility) + '<br><br>' + this.listSJFacilitySlaves(facility, passage(), showTransfersPage); + const frag = this.displayManager(facility); + frag.append(document.createElement('br')); // TODO: replace with margin on one of the divs? + frag.append(this.listSJFacilitySlaves(facility, passage(), showTransfersPage)); + return frag; }; App.UI.SlaveList.penthousePage = function() { @@ -865,7 +809,7 @@ App.UI.SlaveList.penthousePage = function() { const link = App.UI.DOM.makeElement("span", App.UI.DOM.passageLink("Manage Head Girl", "HG Select"), "major-link"); link.id = "manageHG"; slaveWrapper.append(link, " ", App.UI.DOM.makeElement("span", App.UI.Hotkeys.hotkeys("HG Select"), "hotkey")); - slaveWrapper.append(App.UI.SlaveList.render.listDOM([HG.ID], [], + slaveWrapper.append(App.UI.SlaveList.render([HG.ID], [], App.UI.SlaveList.SlaveInteract.penthouseInteract)); } else { if (V.slaves.length > 1) { @@ -908,7 +852,7 @@ App.UI.SlaveList.penthousePage = function() { const link = App.UI.DOM.makeElement("span", App.UI.DOM.passageLink("Manage Recruiter", "Recruiter Select"), "major-link"); link.id = "manageRecruiter"; slaveWrapper.append(link, " ", App.UI.DOM.makeElement("span", App.UI.Hotkeys.hotkeys("Recruiter Select"), "hotkey")); - slaveWrapper.append(App.UI.SlaveList.render.listDOM([RC.ID], [], + slaveWrapper.append(App.UI.SlaveList.render([RC.ID], [], App.UI.SlaveList.SlaveInteract.penthouseInteract)); } else { slaveWrapper.append("You have ", App.UI.DOM.makeElement("span", "not", "warning"), " selected a Recruiter. ", @@ -931,7 +875,7 @@ App.UI.SlaveList.penthousePage = function() { const link = App.UI.DOM.makeElement("span", App.UI.DOM.passageLink("Manage Bodyguard", "BG Select"), "major-link"); link.id = "manageBG"; slaveWrapper.append(link, " ", App.UI.DOM.makeElement("span", App.UI.Hotkeys.hotkeys("BG Select"), "hotkey")); - slaveWrapper.append(App.UI.SlaveList.render.listDOM([BG.ID], [], + slaveWrapper.append(App.UI.SlaveList.render([BG.ID], [], App.UI.SlaveList.SlaveInteract.penthouseInteract)); slaveWrapper.append(App.MainView.useGuard()); } else { @@ -962,7 +906,7 @@ App.UI.SlaveList.penthousePage = function() { SlaveSort.IDs(employeesIDs); return { n: employeesIDs.length, - dom: App.UI.SlaveList.render.listDOM(employeesIDs, [], App.UI.SlaveList.SlaveInteract.penthouseInteract, + dom: App.UI.SlaveList.render(employeesIDs, [], App.UI.SlaveList.SlaveInteract.penthouseInteract, V.fucktoyInteractionsPosition === 1 && job === "fucktoy" ? App.MainView.useFucktoy : null) }; } @@ -1051,7 +995,7 @@ App.UI.SlaveList.penthousePage = function() { } SlaveSort.IDs(penthouseSlavesIDs); return makeTabDesc('all', `All${V.useSlaveSummaryTabs > 0 ? ` (${penthouseSlavesIDs.length})` : ""}`, - App.UI.SlaveList.render.listDOM(penthouseSlavesIDs, [], App.UI.SlaveList.SlaveInteract.penthouseInteract)); + App.UI.SlaveList.render(penthouseSlavesIDs, [], App.UI.SlaveList.SlaveInteract.penthouseInteract)); } let fragment = document.createDocumentFragment(); @@ -1061,7 +1005,7 @@ App.UI.SlaveList.penthousePage = function() { } if (V.sortSlavesMain) { - fragment.append(App.UI.SlaveList.sortingLinksDOM("Main")); + fragment.append(App.UI.SlaveList.sortingLinks("Main")); } /** @type {tabDesc[]} */ @@ -1127,12 +1071,6 @@ App.UI.SlaveList.penthousePage = function() { return fragment; }; -/** - * @callback assignmentFilterGenerateCallback - * @param {string} value - * @returns {string} - */ - /** * @callback slaveFilterCallbackReasoned * @param {App.Entity.SlaveState} slave @@ -1148,49 +1086,53 @@ App.UI.SlaveList.penthousePage = function() { App.UI.SlaveList.slaveSelectionList = function() { const selectionElementId = "slaveSelectionList"; - return selection; - /** - * @typedef ListOptions * @property {slaveFilterCallbackReasoned|slaveFilterCallbackSimple} filter - * @property {slaveTestCallback} [expCheck] * @property {slaveToElement} interactionLink + * @property {slaveTestCallback} [expCheck] * @property {slaveToElement} [postNote] */ + let options = null; + + return selection; /** * @param {slaveFilterCallbackReasoned|slaveFilterCallbackSimple} filter * @param {slaveToElement} interactionLink - * @param {slaveTestCallback} [experianceChecker] + * @param {slaveTestCallback} [experienceChecker] * @param {slaveToElement} [postNote] - * @returns {string} + * @returns {HTMLElement} */ - function selection(filter, interactionLink, experianceChecker, postNote) { - if (experianceChecker === null) { experianceChecker = undefined; } - State.temporary.slaveSelection = { + function selection(filter, interactionLink, experienceChecker, postNote) { + if (experienceChecker === null) { experienceChecker = undefined; } + options = { filter: filter, - expCheck: experianceChecker, interactionLink: interactionLink, - postNote: postNote, - update: _updateList + expCheck: experienceChecker, + postNote: postNote }; $(document).one(':passagedisplay', () => { _updateList('all'); }); - return `<div>${_assignmentFilter(s => `<<run _slaveSelection.update('${s}')>>`, experianceChecker !== undefined)} <div id=${selectionElementId}></div></div>`; + + const div = document.createElement("div"); + div.append(_assignmentFilter(experienceChecker !== undefined)); + const selectionElement = App.UI.DOM.appendNewElement("div", div); + selectionElement.id = selectionElementId; + return div; } function _updateList(assignment) { const e = document.getElementById(selectionElementId); e.innerHTML = ''; - e.appendChild(_listSlaves(assignment, State.temporary.slaveSelection)); + e.appendChild(_listSlaves(assignment)); } + /** - * Displays assignment filter links, whose action are generated by the callback - * @param {assignmentFilterGenerateCallback} callback + * Displays assignment filter links * @param {boolean} includeExperienced - * @returns {string} + * @returns {HTMLElement} */ - function _assignmentFilter(callback, includeExperienced) { + function _assignmentFilter(includeExperienced) { let filters = { all: "All" }; @@ -1204,30 +1146,21 @@ App.UI.SlaveList.slaveSelectionList = function() { } } let links = []; - /* seems like SC2 does not process data-setter when data-passage is not set for (const f in filters) { - links.push(App.UI.passageLink(filters[f], passage, callback(f))); + links.push(App.UI.DOM.link(filters[f], () => _updateList(f))); } if (includeExperienced) { - links.push(`<span class="lime">${App.UI.passageLink('Experienced', passage, callback('experienced'))}</span>`); - }*/ - for (const f in filters) { - links.push(`<<link "${filters[f]}">>${callback(f)}<</link>>`); - } - if (includeExperienced) { - links.push(`<span class="lime"><<link "Experienced">>${callback('experienced')}<</link>></span>`); + links.push(App.UI.DOM.makeElement("span", App.UI.DOM.link('Experienced', () => _updateList('experienced')), "lime")); } - return links.join(' | '); + return App.UI.DOM.generateLinksStrip(links); } /** - * * @param {string} assignmentStr - * @param {ListOptions} options * @returns {DocumentFragment} */ - function _listSlaves(assignmentStr, options) { + function _listSlaves(assignmentStr) { const slaves = V.slaves; let unfilteredIDs = []; switch (assignmentStr) { @@ -1235,7 +1168,7 @@ App.UI.SlaveList.slaveSelectionList = function() { unfilteredIDs = slaves.map(s => s.ID); break; case 'experienced': - unfilteredIDs = slaves.reduce((acc, s, idx) => { + unfilteredIDs = slaves.reduce((acc, s) => { if (options.expCheck(s)) { acc.push(s.ID); } @@ -1273,14 +1206,14 @@ App.UI.SlaveList.slaveSelectionList = function() { s => options.postNote(s) : () => null; - return App.UI.SlaveList.render.listDOM(passingIDs, rejects, options.interactionLink, listPostNote); + return App.UI.SlaveList.render(passingIDs, rejects, options.interactionLink, listPostNote); } }(); /** * @param {App.Entity.Facilities.Facility} facility * @param {string} passage go here after the new facility manager is selected - * @returns {string} + * @returns {HTMLElement} */ App.UI.SlaveList.facilityManagerSelection = function(facility, passage) { return this.slaveSelectionList(slave => facility.manager.canEmploy(slave), diff --git a/src/js/underperformingSlaves.js b/src/js/underperformingSlaves.js new file mode 100644 index 0000000000000000000000000000000000000000..635485ae599efe70e776453f810d82a2565be4f6 --- /dev/null +++ b/src/js/underperformingSlaves.js @@ -0,0 +1,57 @@ +App.Underperformers = {}; + +App.Underperformers.highSale = function() { + const description = App.UI.DOM.makeElement("div", "Take the rough value of a slave and divide it by how much they made overall last week. This will tell you how many weeks it might take them to earn the same amount you'd get for selling them right now.", "note"); + + const frag = App.UI.SlaveList.render( + getBestSlavesIDs( + { + part:(slave) => { + const ratio = slaveCost(slave) / (slave.lastWeeksCashIncome - getSlaveCost(slave)); + return ratio > 0 ? ratio : 100000000 + ratio; + }, + count: 7, + filter:(slave) => ( + ["be confined in the arcade", "get milked", "whore", "work a glory hole", "work in the brothel", "work in the dairy"].includes(slave.assignment) + && ((slave.weekAcquired + 1) < V.week) + && slave.lastWeeksCashIncome + ) + } + ), + [], + App.UI.SlaveList.SlaveInteract.stdInteract, + (slave) => $(document.createDocumentFragment()).append( + `Worth ${cashFormatColor(slaveCost(slave))} / Nets ${cashFormatColor(slave.lastWeeksCashIncome - getSlaveCost(slave))} a week = ${(Math.trunc(slaveCost(slave) / (slave.lastWeeksCashIncome - getSlaveCost(slave)))) > 0 ? (Math.trunc(slaveCost(slave) / (slave.lastWeeksCashIncome - getSlaveCost(slave)))) : "infinite"} weeks` + ).get(0) + ); + + frag.prepend(description); + return frag; +}; + +App.Underperformers.expensive = function() { + const description = App.UI.DOM.makeElement("div", "This list looks for moochers by weighing their weekly income against the weekly cost of providing for them.", "note"); + + const frag = App.UI.SlaveList.render( + getBestSlavesIDs( + { + part:(slave) => (slave.lastWeeksCashIncome - getSlaveCost(slave)), + largest: false, + count: 7, + filter:(slave) => ( + ["be confined in the arcade", "get milked", "whore", "work a glory hole", "work in the brothel", "work in the dairy"].includes(slave.assignment) + && ((slave.weekAcquired + 1) < V.week) + && slave.lastWeeksCashIncome + ) + } + ), + [], + App.UI.SlaveList.SlaveInteract.stdInteract, + (slave) => $(document.createDocumentFragment()).append( + `${cashFormatColor(Math.trunc(slave.lastWeeksCashIncome - getSlaveCost(slave)))} net last week` + ).get(0) + ); + + frag.prepend(description); + return frag; +}; diff --git a/src/neighbor/neighborInteract.js b/src/neighbor/neighborInteract.js index 92701210edd08bb9c1c7aade7e828316aa197d71..3abdab94c9fa7e198a71f6b4f4cabd693b5572b8 100644 --- a/src/neighbor/neighborInteract.js +++ b/src/neighbor/neighborInteract.js @@ -181,7 +181,7 @@ App.Neighbor.Interact = (function() { linkText = `Recall them and reenslave your agent`; residentList.push(agentPartner.ID); } - container.append(App.UI.SlaveList.render.listDOM(residentList, [], App.UI.SlaveList.SlaveInteract.stdInteract)); + container.append(App.UI.SlaveList.render(residentList, [], App.UI.SlaveList.SlaveInteract.stdInteract)); container.append(App.UI.DOM.link(linkText, (f) => { removeJob(agent, "be your agent"); arcChanged(arcID); })); } container.append(" | "); diff --git a/src/npc/agent/agentSelect.tw b/src/npc/agent/agentSelect.tw index 147416474dbbb8ae100fc6168f18b47cb21a9610..e337c0d0ba671437a066fa34cdf110e684d62163 100644 --- a/src/npc/agent/agentSelect.tw +++ b/src/npc/agent/agentSelect.tw @@ -3,7 +3,7 @@ <<set $nextButton = "Back", $nextLink = "Neighbor Interact", $encyclopedia = "Agents">> ''Appoint an Agent from your devoted slaves:'' -<<= App.UI.SlaveList.slaveSelectionList( +<<includeDOM App.UI.SlaveList.slaveSelectionList( s => (s.fuckdoll === 0 && s.devotion > 20 && s.intelligence + s.intelligenceImplant > 15 && s.intelligenceImplant >= 15 && canWalk(s) && canSee(s) && canHear(s) && canTalk(s) && s.broodmother < 2 && (s.breedingMark !== 1 || V.propOutcome === 0 || V.eugenicsFullControl === 1 || V.arcologies[0].FSRestart === "unset")), (slave) => App.UI.DOM.passageLink(SlaveFullName(slave), 'Agent Workaround', () => { V.i = V.slaves.findIndex((s) => s.ID === slave.ID); }), diff --git a/src/npc/interaction/passage/matchmaking.tw b/src/npc/interaction/passage/matchmaking.tw index aa3ddabef18811f7f779d6810194757e6430ac9b..1bec089c484638da118a33a951883967a2f4808f 100644 --- a/src/npc/interaction/passage/matchmaking.tw +++ b/src/npc/interaction/passage/matchmaking.tw @@ -37,7 +37,7 @@ Their relationship would probably be somewhat artificial at first, and they'd ha <<if $seeImages == 1>><br style="clear:both"><</if>> <br><br>__Put $him with another worshipful <<if getSlave($activeSlave.ID).relationship == -2>>emotionally bonded slave<<else>>emotional slut<</if>>:__ -<<print App.UI.SlaveList.slaveSelectionList( +<<includeDOM App.UI.SlaveList.slaveSelectionList( s => s.devotion >= 100 && s.relationship === $activeSlave.relationship && s.ID !== $activeSlave.ID, App.UI.SlaveList.SlaveInteract.stdInteract, null, diff --git a/src/uncategorized/arcade.tw b/src/uncategorized/arcade.tw index 1bd7640f3700e1547563d00072f68739135e01c1..7d6d6beb78806115219db5436d434774e08ebaee 100644 --- a/src/uncategorized/arcade.tw +++ b/src/uncategorized/arcade.tw @@ -179,7 +179,7 @@ <<includeDOM App.Facilities.Arcade.Stats(true)>> <p> - <<print App.UI.SlaveList.listSJFacilitySlaves(App.Entity.facilities.arcade)>> + <<includeDOM App.UI.SlaveList.listSJFacilitySlaves(App.Entity.facilities.arcade)>> </p> <p> diff --git a/src/uncategorized/attendantSelect.tw b/src/uncategorized/attendantSelect.tw index 9145c5cb49f08cf0b87873ef76cf8558d8dc6ae2..f563ca18ad97374086798e02bcee9b96fc7b9285 100644 --- a/src/uncategorized/attendantSelect.tw +++ b/src/uncategorized/attendantSelect.tw @@ -11,4 +11,4 @@ <br><br>''Appoint an Attendant from your devoted slaves:'' <br><br>[[None|Spa][removeJob(_S.Attendant, Job.ATTENDANT)]] <br><br> -<<print App.UI.SlaveList.facilityManagerSelection(App.Entity.facilities.spa, "Spa")>> +<<includeDOM App.UI.SlaveList.facilityManagerSelection(App.Entity.facilities.spa, "Spa")>> diff --git a/src/uncategorized/bgSelect.tw b/src/uncategorized/bgSelect.tw index b888caa6e8fcf56c4fb3b593e5205cfcc857366b..9bf57513c0e30d888007db0f4db4c5e56c85e5e2 100644 --- a/src/uncategorized/bgSelect.tw +++ b/src/uncategorized/bgSelect.tw @@ -37,5 +37,5 @@ [[None|Main][removeJob($Bodyguard, "guard you")]] </div> <p> - <<print App.UI.SlaveList.facilityManagerSelection(App.Entity.facilities.armory, "Main")>> + <<includeDOM App.UI.SlaveList.facilityManagerSelection(App.Entity.facilities.armory, "Main")>> </p> diff --git a/src/uncategorized/brothel.tw b/src/uncategorized/brothel.tw index e638724aa409fa41cf65e14d39fa363c3b286b61..f9fa7e5d7990209a7686a32cc830721acc297f20 100644 --- a/src/uncategorized/brothel.tw +++ b/src/uncategorized/brothel.tw @@ -253,7 +253,7 @@ <<includeDOM App.Facilities.Brothel.Stats(true)>> <p> - <<print App.UI.SlaveList.stdFacilityPage(App.Entity.facilities.brothel)>> + <<includeDOM App.UI.SlaveList.stdFacilityPage(App.Entity.facilities.brothel)>> </p> <p> diff --git a/src/uncategorized/cellblock.tw b/src/uncategorized/cellblock.tw index 33ebb3147d77b2ba736307528d4eee5c9484afe4..90b64622ccfb757dd33e685d463525ea0b5883b7 100644 --- a/src/uncategorized/cellblock.tw +++ b/src/uncategorized/cellblock.tw @@ -138,7 +138,7 @@ </p> <p> - <<print App.UI.SlaveList.stdFacilityPage(App.Entity.facilities.cellblock)>> + <<includeDOM App.UI.SlaveList.stdFacilityPage(App.Entity.facilities.cellblock)>> </p> <p> diff --git a/src/uncategorized/clinic.tw b/src/uncategorized/clinic.tw index f29386e96abb096a1e10caf2931998cc460f2764..7e88681d257203e0e68d675d22ba91e9a5a1fc77 100644 --- a/src/uncategorized/clinic.tw +++ b/src/uncategorized/clinic.tw @@ -207,7 +207,7 @@ </div> <p> - <<print App.UI.SlaveList.stdFacilityPage(App.Entity.facilities.clinic, true)>> + <<includeDOM App.UI.SlaveList.stdFacilityPage(App.Entity.facilities.clinic, true)>> </p> <p> diff --git a/src/uncategorized/club.tw b/src/uncategorized/club.tw index 2595248737fa5521982e80daea7032a1845820b2..e9c220d61ec39581ef443641e1e3b20682073da3 100644 --- a/src/uncategorized/club.tw +++ b/src/uncategorized/club.tw @@ -285,7 +285,7 @@ <<includeDOM App.Facilities.Club.Stats(true)>> <p> - <<print App.UI.SlaveList.stdFacilityPage(App.Entity.facilities.club)>> + <<includeDOM App.UI.SlaveList.stdFacilityPage(App.Entity.facilities.club)>> </p> <p> diff --git a/src/uncategorized/concubineSelect.tw b/src/uncategorized/concubineSelect.tw index 9f153e7544385ea6b05ec7b253285604f9b0fd08..f41a0edbcfa9ca3c76b8dea9685dc4a4758e1f68 100644 --- a/src/uncategorized/concubineSelect.tw +++ b/src/uncategorized/concubineSelect.tw @@ -12,4 +12,4 @@ <br><br>''Appoint a Concubine from your devoted slaves:'' <br><br>[[None|Master Suite][removeJob($Concubine, "be your Concubine")]] <br><br> -<<print App.UI.SlaveList.facilityManagerSelection(App.Entity.facilities.masterSuite, "Master Suite")>> +<<includeDOM App.UI.SlaveList.facilityManagerSelection(App.Entity.facilities.masterSuite, "Master Suite")>> diff --git a/src/uncategorized/coursingAssociation.tw b/src/uncategorized/coursingAssociation.tw index a1d356c18ad9c96810ca230b75a0f323c046e479..1e6819683375a15a1b098aab61baca1d1ac5591a 100644 --- a/src/uncategorized/coursingAssociation.tw +++ b/src/uncategorized/coursingAssociation.tw @@ -16,13 +16,13 @@ The chasing slaves are known as lurchers, the term once used for the sighthounds <<if $LurcherID != 0>> <br><br>''Fire your Lurcher:'' - <<= App.UI.SlaveList.render.listMarkup([$LurcherID], [], + <<includeDOM App.UI.SlaveList.render([$LurcherID], new Array(), (slave) => App.UI.DOM.passageLink(SlaveFullName(slave), 'Coursing Association', () => removeJob(slave, Job.LURCHER)))>> <</if>> <br><br>''Select a slave to course as a Lurcher:'' <br><br> -<<= App.UI.SlaveList.slaveSelectionList( +<<includeDOM App.UI.SlaveList.slaveSelectionList( s => $LurcherID !== s.ID && canWalk(s) && canHold(s) && (canSee(s) || canHear(s)) && s.fuckdoll === 0 && isSlaveAvailable(s), (slave) => App.UI.DOM.link(SlaveFullName(slave), () => assignmentTransition(slave, Job.LURCHER, "Coursing Association")) )>> diff --git a/src/uncategorized/dairy.tw b/src/uncategorized/dairy.tw index 396eb8897115e729bace9738ada62020150cf479..8000aeccd8b2ac77311f935dd3c298f4c8526a3c 100644 --- a/src/uncategorized/dairy.tw +++ b/src/uncategorized/dairy.tw @@ -720,7 +720,7 @@ <p> <<set _facility = App.Entity.facilities.dairy>> <<if ($Milkmaid != 0)>> - <<print App.UI.SlaveList.displayManager(_facility)>> + <<includeDOM App.UI.SlaveList.displayManager(_facility)>> <<if canAchieveErection($Milkmaid) && $Milkmaid.pubertyXY == 1>> <<setLocalPronouns $Milkmaid>> <<if $milkmaidImpregnates == 1>> @@ -762,7 +762,7 @@ <p> - <<print App.UI.SlaveList.listSJFacilitySlaves(_facility)>> + <<includeDOM App.UI.SlaveList.listSJFacilitySlaves(_facility)>> </p> <p> diff --git a/src/uncategorized/djSelect.tw b/src/uncategorized/djSelect.tw index 721284c8b0bf9be71ef29ac835897be55e377d5c..7a962c67acb2dcb087239931f6a6fc6ff834293f 100644 --- a/src/uncategorized/djSelect.tw +++ b/src/uncategorized/djSelect.tw @@ -11,4 +11,4 @@ <br><br>''Appoint a DJ from your devoted slaves:'' <br><br>[[None|Club][removeJob(_S.DJ, "be the DJ")]] <br><br> -<<print App.UI.SlaveList.facilityManagerSelection(App.Entity.facilities.club, "Club")>> +<<includeDOM App.UI.SlaveList.facilityManagerSelection(App.Entity.facilities.club, "Club")>> diff --git a/src/uncategorized/headGirlSuite.tw b/src/uncategorized/headGirlSuite.tw index af33f0331020b0323f7509c9dcb70063ec36771d..3e1d5f0c8850c6fff477df0ad3761786bcd983df 100644 --- a/src/uncategorized/headGirlSuite.tw +++ b/src/uncategorized/headGirlSuite.tw @@ -58,7 +58,7 @@ </div> <</if>> <p> - <<print App.UI.SlaveList.listSJFacilitySlaves(App.Entity.facilities.headGirlSuite)>> + <<includeDOM App.UI.SlaveList.listSJFacilitySlaves(App.Entity.facilities.headGirlSuite)>> </p> <</if>> <p> diff --git a/src/uncategorized/hgSelect.tw b/src/uncategorized/hgSelect.tw index f729326e0e55e7b14bd8c46ce20f2db40176bba3..9b59519943036776a718a4ba2ca4f1ea753d87fc 100644 --- a/src/uncategorized/hgSelect.tw +++ b/src/uncategorized/hgSelect.tw @@ -91,4 +91,4 @@ _HGName <br><br>''Appoint a Head Girl from among your devoted slaves:'' <br><br>[[None|Main][removeJob($HeadGirl, "be your Head Girl")]] <br><br> -<<print App.UI.SlaveList.facilityManagerSelection(App.Entity.facilities.headGirlSuite, "Main")>> +<<includeDOM App.UI.SlaveList.facilityManagerSelection(App.Entity.facilities.headGirlSuite, "Main")>> diff --git a/src/uncategorized/madamSelect.tw b/src/uncategorized/madamSelect.tw index e72ea4a101805ba5b7f76eda8709d2ee7a88ad01..ef9dd5cba03b64805673f427aa54641c13ff5eeb 100644 --- a/src/uncategorized/madamSelect.tw +++ b/src/uncategorized/madamSelect.tw @@ -12,4 +12,4 @@ <br><br>''Appoint a Madam from your devoted slaves:'' <br><br>[[None|Brothel][removeJob($Madam, "be the Madam")]] <br><br> -<<print App.UI.SlaveList.facilityManagerSelection(App.Entity.facilities.brothel, "Brothel")>> +<<includeDOM App.UI.SlaveList.facilityManagerSelection(App.Entity.facilities.brothel, "Brothel")>> diff --git a/src/uncategorized/masterSuite.tw b/src/uncategorized/masterSuite.tw index efa64270a4d4f9649e1bc1f395ec8c4a96ec3496..c7d5fc3a683355a4f759a4444c850ecbc7e28472 100644 --- a/src/uncategorized/masterSuite.tw +++ b/src/uncategorized/masterSuite.tw @@ -360,7 +360,7 @@ $masterSuiteNameCaps is furnished <</if>> <br><br> -<<print App.UI.SlaveList.stdFacilityPage(App.Entity.facilities.masterSuite)>> +<<includeDOM App.UI.SlaveList.stdFacilityPage(App.Entity.facilities.masterSuite)>> <br><br>Rename $masterSuiteName: <<textbox "$masterSuiteName" $masterSuiteName "Master Suite">> //Use a noun or similar short phrase// diff --git a/src/uncategorized/milkmaidSelect.tw b/src/uncategorized/milkmaidSelect.tw index 1123fb3d52790e7d81708c6330d72b4e06133fe1..36069c2e9c08c7a57e0c1f7a05019ab010c5aca1 100644 --- a/src/uncategorized/milkmaidSelect.tw +++ b/src/uncategorized/milkmaidSelect.tw @@ -12,4 +12,4 @@ <br><br>''Appoint a Milkmaid from your obedient slaves:'' <br><br>[[None|Dairy][removeJob($Milkmaid, "be the Milkmaid")]] <br><br> -<<print App.UI.SlaveList.facilityManagerSelection(App.Entity.facilities.dairy, "Dairy")>> +<<includeDOM App.UI.SlaveList.facilityManagerSelection(App.Entity.facilities.dairy, "Dairy")>> diff --git a/src/uncategorized/newGamePlus.tw b/src/uncategorized/newGamePlus.tw index ed8e42b62e09064ac4ca23b74b50995e39b6a931..f582693fbfdbe64819a34ad5ddee809f29d225c5 100644 --- a/src/uncategorized/newGamePlus.tw +++ b/src/uncategorized/newGamePlus.tw @@ -1,10 +1,6 @@ :: New Game Plus [nobr] <<set $ui = "start">> <<unset $SlaveSummaryFiler>> -<<if ndef $slavesToImport>> - <<silently>><<include "Backwards Compatibility">><</silently>> -<</if>> -<<if ndef $slavesToImport>><<set $slavesToImport = 0>><</if>> <<if ndef $slavesToImportMax>><<set $slavesToImportMax = 5>><</if>> <<set _fee = 50000+($slavesToImportMax*10000)>> @@ -54,7 +50,7 @@ You <<if $cash >= _fee>>have<<else>>lack<</if>> the funds to bring more than $sl <<if $cheatMode == 1>> <<link "DEBUG: Add all slaves to import list" "New Game Plus">> <<for _ngi = 0; _ngi < $slaves.length; _ngi++>> <<= assignJob($slaves[_ngi], Job.IMPORTED)>> <</for>> <</link>> <br> <</if>> -Select up to $slavesToImportMax slaves to be imported into a new game and then click [[here.|init][$saveImported = 1,$oldCareer = "undefined",$slavesToImport = 0]] +Select up to $slavesToImportMax slaves to be imported into a new game and then click [[here.|init][$saveImported = 1,$oldCareer = "undefined"]] <br> -<<print App.UI.SlaveList.listNGPSlaves()>> +<<includeDOM App.UI.SlaveList.listNGPSlaves()>> diff --git a/src/uncategorized/nurseSelect.tw b/src/uncategorized/nurseSelect.tw index f6ad039bf404f48abf8e98ab2abf596dba3ad50c..84211a0e169b22a1ea03c3bf0e92c6006fdfad19 100644 --- a/src/uncategorized/nurseSelect.tw +++ b/src/uncategorized/nurseSelect.tw @@ -12,4 +12,4 @@ <br><br>[[None|Clinic][removeJob(_S.Nurse, "be the Nurse")]] <br><br> -<<print App.UI.SlaveList.facilityManagerSelection(App.Entity.facilities.clinic, "Clinic")>> +<<includeDOM App.UI.SlaveList.facilityManagerSelection(App.Entity.facilities.clinic, "Clinic")>> diff --git a/src/uncategorized/personalAttentionSelect.tw b/src/uncategorized/personalAttentionSelect.tw index 74c8f24c04d6af32566e9a6f75b94aa9946b215a..c4516490fe4d061924b6ad093dfdfda1e86914eb 100644 --- a/src/uncategorized/personalAttentionSelect.tw +++ b/src/uncategorized/personalAttentionSelect.tw @@ -359,7 +359,7 @@ <</if>> /* CLOSES NO SLAVE SELECTED */ <br><br>__Select a slave to train:__ <<if $PC.skill.slaving >= 100>>//Your @@.springgreen;slaving experience@@ allows you to divide your attention between more than one slave each week, with slightly reduced efficiency//<</if>> -<<= App.UI.SlaveList.slaveSelectionList( +<<includeDOM App.UI.SlaveList.slaveSelectionList( s => assignmentVisible(s) && s.fuckdoll === 0, s => App.UI.DOM.link(SlaveFullName(s), (id) => {App.UI.selectSlaveForPersonalAttention(id); }, s.ID) )>> diff --git a/src/uncategorized/pit.tw b/src/uncategorized/pit.tw index 8379add2ba0818f9351fa299b9d0a8a6e45a9e56..23b9f4956ec74aa5ce70650130574e48e9a6234b 100644 --- a/src/uncategorized/pit.tw +++ b/src/uncategorized/pit.tw @@ -331,7 +331,7 @@ $pitNameCaps is clean and ready, <</if>> <br><br> -<<print App.UI.SlaveList.listSJFacilitySlaves(App.Entity.facilities.pit, passage(), false, +<<includeDOM App.UI.SlaveList.listSJFacilitySlaves(App.Entity.facilities.pit, passage(), false, {assign: "Select a slave to fight", remove: "Cancel a slave's fight"})>> <br><br>Rename $pitName: <<textbox "$pitName" $pitName "Pit">> //Use a noun or similar short phrase// diff --git a/src/uncategorized/recruiterSelect.tw b/src/uncategorized/recruiterSelect.tw index 49ad10e6d6d3c9f3b5720de175404330b1533935..91f29f6dcdea9aa45c2aa043c1b0153449e0f675 100644 --- a/src/uncategorized/recruiterSelect.tw +++ b/src/uncategorized/recruiterSelect.tw @@ -65,4 +65,4 @@ <br><br>''Appoint a recruiter from among your devoted slaves:'' <br>[[None|Main][removeJob($Recruiter, "recruit girls")]] <br><br> -<<print App.UI.SlaveList.facilityManagerSelection(App.Entity.facilities.penthouse, "Main")>> +<<includeDOM App.UI.SlaveList.facilityManagerSelection(App.Entity.facilities.penthouse, "Main")>> diff --git a/src/uncategorized/schoolroom.tw b/src/uncategorized/schoolroom.tw index 57698e3065dce302a8342418f14361a2199b0866..4e0ea70ca30a3e9f2749ba841bf8ba57cf6a324c 100644 --- a/src/uncategorized/schoolroom.tw +++ b/src/uncategorized/schoolroom.tw @@ -179,7 +179,7 @@ </div> <p> - <<print App.UI.SlaveList.stdFacilityPage(App.Entity.facilities.schoolroom, true)>> + <<includeDOM App.UI.SlaveList.stdFacilityPage(App.Entity.facilities.schoolroom, true)>> </p> <p> diff --git a/src/uncategorized/schoolteacherSelect.tw b/src/uncategorized/schoolteacherSelect.tw index e7fa4148322b5e9f61491f256f1a425bf1eb9781..7572a3d974d9a863dcab5b573fc2886f6a5cb300 100644 --- a/src/uncategorized/schoolteacherSelect.tw +++ b/src/uncategorized/schoolteacherSelect.tw @@ -11,4 +11,4 @@ <br><br>''Appoint a Schoolteacher from your devoted slaves:'' <br><br>[[None|Schoolroom][removeJob(_S.Schoolteacher, "be the Schoolteacher")]] <br><br> -<<print App.UI.SlaveList.facilityManagerSelection(App.Entity.facilities.schoolroom, "Schoolroom")>> +<<includeDOM App.UI.SlaveList.facilityManagerSelection(App.Entity.facilities.schoolroom, "Schoolroom")>> diff --git a/src/uncategorized/servantsQuarters.tw b/src/uncategorized/servantsQuarters.tw index 1c1d71e93e47d0b973d75c721ddc7bccc60df860..ffd1cec37fd131f76556c31cf62aca76fcc13402 100644 --- a/src/uncategorized/servantsQuarters.tw +++ b/src/uncategorized/servantsQuarters.tw @@ -126,7 +126,7 @@ <<set _facility = App.Entity.facilities.servantsQuarters>> <<if _S.Stewardess>> <<setLocalPronouns _S.Stewardess>> - <<print App.UI.SlaveList.displayManager(_facility)>> + <<includeDOM App.UI.SlaveList.displayManager(_facility)>> <<if canAchieveErection(_S.Stewardess) && _S.Stewardess.pubertyXY == 1>> <<if $stewardessImpregnates == 1>> Keeping the maids pregnant is part of $his job. @@ -146,7 +146,7 @@ </p> <p> - <<print App.UI.SlaveList.listSJFacilitySlaves(_facility)>> + <<includeDOM App.UI.SlaveList.listSJFacilitySlaves(_facility)>> </p> <p> diff --git a/src/uncategorized/spa.tw b/src/uncategorized/spa.tw index 696db7c3bcdffeb274137dff9adb72d4a84a601c..a3ef59996152c693a576c88a34c8ff1fc63ca28d 100644 --- a/src/uncategorized/spa.tw +++ b/src/uncategorized/spa.tw @@ -148,7 +148,7 @@ </div> <p> - <<print App.UI.SlaveList.stdFacilityPage(App.Entity.facilities.spa, true)>> + <<includeDOM App.UI.SlaveList.stdFacilityPage(App.Entity.facilities.spa, true)>> </p> <p> diff --git a/src/uncategorized/stewardessSelect.tw b/src/uncategorized/stewardessSelect.tw index dfac601f9c962157abd5bff5c29e7e16b88b5f7a..a9dc36cfaa208ee59e6792dc62cb935d5337c05b 100644 --- a/src/uncategorized/stewardessSelect.tw +++ b/src/uncategorized/stewardessSelect.tw @@ -11,4 +11,4 @@ <br><br>''Appoint a Stewardess from your devoted slaves:'' <br><br>[[None|Servants' Quarters][removeJob(_S.Stewardess, Job.STEWARD)]] <br><br> -<<print App.UI.SlaveList.facilityManagerSelection(App.Entity.facilities.servantsQuarters, "Servants' Quarters")>> +<<includeDOM App.UI.SlaveList.facilityManagerSelection(App.Entity.facilities.servantsQuarters, "Servants' Quarters")>> diff --git a/src/uncategorized/subordinateTargeting.tw b/src/uncategorized/subordinateTargeting.tw index 8f357c015289900cdfc99f7a2fbcff653b40e205..7f9a8f115e9311fead3ccc60b7f63ff1158b773a 100644 --- a/src/uncategorized/subordinateTargeting.tw +++ b/src/uncategorized/subordinateTargeting.tw @@ -32,7 +32,7 @@ <</if>> <br><br>[[None|Subordinate Targeting][$activeSlave.subTarget = 0]] <br><br>__Select a slave for $him to submit to, sexually:__ - <<= App.UI.SlaveList.slaveSelectionList( + <<includeDOM App.UI.SlaveList.slaveSelectionList( s => s.devotion >= -20 && s.fuckdoll === 0 && State.variables.activeSlave.ID !== s.ID && (!isAmputee(State.variables.activeSlave) || !isAmputee(s)), (s) => App.UI.DOM.passageLink(SlaveFullName(s), 'Subordinate Targeting', () => { V.activeSlave.subTarget = s.ID; }), diff --git a/src/uncategorized/underperformingSlaves.tw b/src/uncategorized/underperformingSlaves.tw index 2b874d7244561fcf367584c74101a3c0be465769..5fc39bb79b88343d17662c48e4678fa42608a6a9 100644 --- a/src/uncategorized/underperformingSlaves.tw +++ b/src/uncategorized/underperformingSlaves.tw @@ -24,58 +24,15 @@ <button class="tablinks" onclick="App.UI.tabbar.openTab(event, 'highSale')" id="tab highSale">Worth much but earning little</button> <button class="tablinks" onclick="App.UI.tabbar.openTab(event, 'expensive')" id="tab expensive">Costing vs earning</button> </div> + <div id="highSale" class="tabcontent"> <div class="content"> - <div style="font-style:italic"> - Take the rough value of a slave and divide it by how much they made overall last week. This will tell you how many weeks it might take them to earn the same amount you'd get for selling them right now. - </div> - <<print App.UI.SlaveList.render.listMarkup( - getBestSlavesIDs( - { - part:(slave) => { - const ratio = slaveCost(slave) / (slave.lastWeeksCashIncome - getSlaveCost(slave)); - return ratio > 0 ? ratio : 100000000 + ratio; - }, - count: 7, - filter:(slave) => ( - ["be confined in the arcade", "get milked", "whore", "work a glory hole", "work in the brothel", "work in the dairy"].includes(slave.assignment) - && ((slave.weekAcquired + 1) < V.week) - && slave.lastWeeksCashIncome - ) - } - ), - [], - App.UI.SlaveList.SlaveInteract.stdInteract, - (slave) => $(document.createDocumentFragment()).append( - `Worth ${cashFormatColor(slaveCost(slave))} / Nets ${cashFormatColor(slave.lastWeeksCashIncome - getSlaveCost(slave))} a week = ${(Math.trunc(slaveCost(slave) / (slave.lastWeeksCashIncome - getSlaveCost(slave)))) > 0 ? (Math.trunc(slaveCost(slave) / (slave.lastWeeksCashIncome - getSlaveCost(slave)))) : "infinite"} weeks` - ).get(0) - )>> + <<includeDOM App.Underperformers.highSale()>> </div> </div> <div id="expensive" class="tabcontent"> <div class="content"> - <div style="font-style:italic"> - This list looks for moochers by weighing their weekly income against the weekly cost of providing for them. - </div> - <<print App.UI.SlaveList.render.listMarkup( - getBestSlavesIDs( - { - part:(slave) => (slave.lastWeeksCashIncome - getSlaveCost(slave)), - largest: false, - count: 7, - filter:(slave) => ( - ["be confined in the arcade", "get milked", "whore", "work a glory hole", "work in the brothel", "work in the dairy"].includes(slave.assignment) - && ((slave.weekAcquired + 1) < V.week) - && slave.lastWeeksCashIncome - ) - } - ), - [], - App.UI.SlaveList.SlaveInteract.stdInteract, - (slave) => $(document.createDocumentFragment()).append( - `${cashFormatColor(Math.trunc(slave.lastWeeksCashIncome - getSlaveCost(slave)))} net last week` - ).get(0) - )>> + <<includeDOM App.Underperformers.expensive()>> </div> </div> diff --git a/src/uncategorized/wardenessSelect.tw b/src/uncategorized/wardenessSelect.tw index d64de5bdce25ecff3aa384e8b93961e82288c7ba..6ae7bf5aed1652a53263bca874574444d24f3719 100644 --- a/src/uncategorized/wardenessSelect.tw +++ b/src/uncategorized/wardenessSelect.tw @@ -11,4 +11,4 @@ <br><br>''Appoint a Wardeness from your devoted slaves:'' <br><br>[[None|Cellblock][removeJob(_S.Wardeness, "be the Wardeness")]] <br><br> -<<print App.UI.SlaveList.facilityManagerSelection(App.Entity.facilities.cellblock, "Cellblock")>> +<<includeDOM App.UI.SlaveList.facilityManagerSelection(App.Entity.facilities.cellblock, "Cellblock")>>