diff --git a/src/endWeek/servantsQuartersReport.js b/src/endWeek/servantsQuartersReport.js index f17e25d68f296bac8cf2608ec4466ba58712d52e..8cbdc81ae4c02f7acef7c8d093d3907213d21188 100644 --- a/src/endWeek/servantsQuartersReport.js +++ b/src/endWeek/servantsQuartersReport.js @@ -183,28 +183,6 @@ App.EndWeek.servantsQuartersReport = function() { return r.join(' '); } - /** Generate (and return, if not silent) the "standard" part of the slave report - * @param {App.Entity.SlaveState} slave - * @param {boolean} silent - * @returns {HTMLElement|null} - */ - function standardSlaveReport(slave, silent) { - const clothes = App.SlaveAssignment.choosesOwnClothes(slave); - tired(slave); - const rules = App.UI.DOM.renderPassage("SA rules"); - const diet = App.UI.DOM.renderPassage("SA diet"); - const ltEffects = App.UI.DOM.renderPassage("SA long term effects"); - const drugs = App.SlaveAssignment.drugs(slave); - const relationships = App.UI.DOM.renderPassage("SA relationships"); - const rivalries = App.UI.DOM.renderPassage("SA rivalries"); - const devotion = App.UI.DOM.renderPassage("SA devotion"); - if (!silent) { - const content = App.UI.DOM.makeElement("div", '', "indent"); - $(content).append(clothes, rules, diet, ltEffects, drugs, relationships, rivalries, document.createElement('br'), devotion); - return content; - } - } - const stewardessEffects = App.UI.DOM.appendNewElement("p", frag, '', "indent"); $(stewardessEffects).append(stewardessText()); @@ -233,9 +211,9 @@ App.EndWeek.servantsQuartersReport = function() { App.UI.DOM.appendNewElement("div", stewardessEntry, App.Art.SlaveArtElement(slave, 0, 0), ["imageRef", "tinyImg"]); } $(stewardessEntry).append(`<span class='slave-name'>${SlaveFullName(slave)}</span> is serving as your Stewardess.`); - $(stewardessEntry).append(standardSlaveReport(slave, false)); + $(stewardessEntry).append(App.SlaveAssignment.standardSlaveReport(slave, false)); } else { - standardSlaveReport(slave, true); + App.SlaveAssignment.standardSlaveReport(slave, true); } } @@ -323,7 +301,7 @@ App.EndWeek.servantsQuartersReport = function() { SQMilk += V.milk; SQMilkSale += V.milkSale; } - $(slaveEntry).append(standardSlaveReport(slave, false)); + $(slaveEntry).append(App.SlaveAssignment.standardSlaveReport(slave, false)); } else { // discard return values silently App.SlaveAssignment.servant(slave, stewardessBonus); @@ -332,7 +310,7 @@ App.EndWeek.servantsQuartersReport = function() { SQMilk += V.milk; SQMilkSale += V.milkSale; } - standardSlaveReport(slave, true); + App.SlaveAssignment.standardSlaveReport(slave, true); } } diff --git a/src/endWeek/standardSlaveReport.js b/src/endWeek/standardSlaveReport.js new file mode 100644 index 0000000000000000000000000000000000000000..7e669a80033415724c8b4042da1fad0d3fcad487 --- /dev/null +++ b/src/endWeek/standardSlaveReport.js @@ -0,0 +1,28 @@ +/** + * Generates (and returns if not silent) a standard slave report + * @param {App.Entity.SlaveState} slave + * @param {boolean} silent + * @returns {HTMLElement|null} + */ + App.SlaveAssignment.standardSlaveReport = function(slave, silent=false) { + const + clothes = App.SlaveAssignment.choosesOwnClothes(slave); + tired(slave); + + const + rules = App.UI.DOM.renderPassage("SA rules"), + diet = App.UI.DOM.renderPassage("SA diet"), + ltEffects = App.UI.DOM.renderPassage("SA long term effects"), + drugs = App.SlaveAssignment.drugs(slave), + relationships = App.UI.DOM.renderPassage("SA relationships"), + rivalries = App.UI.DOM.renderPassage("SA rivalries"), + devotion = App.UI.DOM.renderPassage("SA devotion"); + + if (!silent) { + const content = App.UI.DOM.makeElement("div", '', "indent"); + + $(content).append(clothes, rules, diet, ltEffects, drugs, relationships, rivalries, document.createElement('br'), devotion); + + return content; + } + } diff --git a/src/facilities/nursery/widgets/reports/nurseryReport.js b/src/facilities/nursery/widgets/reports/nurseryReport.js index 8721c47382f70c336d153ccd18b3ed3d90c447c5..bf6eaddf9380117027bd0d29b1b276bb749a006f 100644 --- a/src/facilities/nursery/widgets/reports/nurseryReport.js +++ b/src/facilities/nursery/widgets/reports/nurseryReport.js @@ -113,35 +113,6 @@ App.Facilities.Nursery.nurseryReport = function nurseryReport() { } } - /** - * Generates (and returns if not silent) a standard slave report - * @param {App.Entity.SlaveState} slave - * @param {boolean} silent - * @returns {HTMLElement|null} - */ - function standardSlaveReport(slave, silent) { - const - clothes = App.SlaveAssignment.choosesOwnClothes(slave); - tired(slave); - - const - rules = App.UI.DOM.renderPassage("SA rules"), - diet = App.UI.DOM.renderPassage("SA diet"), - ltEffects = App.UI.DOM.renderPassage("SA long term effects"), - drugs = App.SlaveAssignment.drugs(slave), - relationships = App.UI.DOM.renderPassage("SA relationships"), - rivalries = App.UI.DOM.renderPassage("SA rivalries"), - devotion = App.UI.DOM.renderPassage("SA devotion"); - - if (!silent) { - const content = App.UI.DOM.makeElement("div", '', "indent"); - - $(content).append(clothes, rules, diet, ltEffects, drugs, relationships, rivalries, document.createElement('br'), devotion); - - return content; - } - } - const matronEffects = App.UI.DOM.appendNewElement("p", frag, '', "indent"); @@ -182,9 +153,9 @@ App.Facilities.Nursery.nurseryReport = function nurseryReport() { } $(matronEntry).append(`<span class="slave-name">${SlaveFullName(slave)}</span> is serving as your Matron.`); - $(matronEntry).append(standardSlaveReport(slave, false)); + $(matronEntry).append(App.SlaveAssignment.standardSlaveReport(slave, false)); } else { - standardSlaveReport(slave, true); + App.SlaveAssignment.standardSlaveReport(slave, true); } } @@ -258,10 +229,10 @@ App.Facilities.Nursery.nurseryReport = function nurseryReport() { $(nannyContent).append(`${He} ${App.SlaveAssignment.nanny(slave, matronBonus)}`); - $(slaveEntry).append(standardSlaveReport(slave, false)); + $(slaveEntry).append(App.SlaveAssignment.standardSlaveReport(slave, false)); } else { // silently discard return values App.SlaveAssignment.nanny(slave, matronBonus); - standardSlaveReport(slave, true); + App.SlaveAssignment.standardSlaveReport(slave, true); } }