diff --git a/src/js/slaveListing.js b/src/js/slaveListing.js index f94b41f25ed02a54ba65ca9f8a89fed3c5174c93..f700147b1aa4c0beaa218f5a5ba5b1411a9c3b9f 100644 --- a/src/js/slaveListing.js +++ b/src/js/slaveListing.js @@ -716,15 +716,14 @@ App.UI.SlaveList.listNGPSlaves = function() { App.UI.tabbar.tabButtonDOM('remove', "Remove from import") ); - const NGPassignment = Job.IMPORTED; let imported = []; let nonImported = []; for (const slave of V.slaves) { /* handle the legacy assignment string */ if (slave.assignment === "be imported") { - slave.assignment = NGPassignment; + slave.assignment = Job.IMPORTED; } - if (slave.assignment === NGPassignment) { + if (slave.assignment === Job.IMPORTED) { imported.push(slave.ID); } else { nonImported.push(slave.ID); @@ -735,7 +734,7 @@ App.UI.SlaveList.listNGPSlaves = function() { 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, () => removeJob(s, NGPassignment)) + (s) => App.UI.DOM.passageLink('Remove from import list', thisPassage, () => removeJob(s, Job.IMPORTED)) ))); } else { frag.append(App.UI.tabbar.makeTabDOM("remove", App.UI.DOM.makeElement('em', "No slaves will go with you to the new game"))); @@ -745,7 +744,7 @@ App.UI.SlaveList.listNGPSlaves = function() { 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, () => assignJob(s, NGPassignment)) + (s) => App.UI.DOM.passageLink('Add to import list', thisPassage, () => assignJob(s, Job.IMPORTED)) ))); } else { frag.append(App.UI.tabbar.makeTabDOM("assign", App.UI.DOM.makeElement('strong', `Slave import limit reached`))); diff --git a/src/js/underperformingSlaves.js b/src/js/underperformingSlaves.js index 635485ae599efe70e776453f810d82a2565be4f6..04f1444bb0278fddb639b02ac3d012eb352ce9dc 100644 --- a/src/js/underperformingSlaves.js +++ b/src/js/underperformingSlaves.js @@ -1,5 +1,14 @@ App.Underperformers = {}; +/** Select only slaves which are not reasonably expected to produce any income (brand new slaves, servants, fucktoys, etc) + * @param {App.Entity.SlaveState} slave + * @returns {boolean} + */ +App.Underperformers.expectIncome = function(slave) { + const productionJobs = [Job.ARCADE, Job.MILKED, Job.WHORE, Job.GLORYHOLE, Job.BROTHEL, Job.DAIRY]; + return productionJobs.includes(slave.assignment) && ((slave.weekAcquired + 1) < V.week) && _.isFinite(slave.lastWeeksCashIncome); +}; + 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"); @@ -11,11 +20,7 @@ App.Underperformers.highSale = function() { 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 - ) + filter: App.Underperformers.expectIncome } ), [], @@ -38,11 +43,7 @@ App.Underperformers.expensive = function() { 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 - ) + filter: App.Underperformers.expectIncome } ), [],