diff --git a/src/facilities/ads.js b/src/facilities/ads.js index ef7f9ab9439348afb28539edde02a9cdb15a1d0b..3418bd545d3fa7032aad53d6e656e8607cdce7b3 100644 --- a/src/facilities/ads.js +++ b/src/facilities/ads.js @@ -248,11 +248,9 @@ App.Ads.AdManager = class { * * @param {string} building * @param {boolean} [preview] - * @returns {string} + * @returns {DocumentFragment} */ App.Ads.report = function(building, preview = false) { - let r = ``; - /** @type {App.Entity.Facilities.Facility} */ const facility = App.Entity.facilities[building]; const DL = facility.employeesIDs().size; @@ -275,70 +273,53 @@ App.Ads.report = function(building, preview = false) { spending: V[building + "AdsSpending"] }; - return report(building, preview); + return report(); - function report(building, preview) { + function report() { + const frag = new DocumentFragment(); if (preview) { - r += `<p><h3>Asset size</h3>`; - r += stacked(building, preview); - r += links(building, "stacked"); - r += `</p>`; + App.UI.DOM.appendNewElement("h3", frag, "Asset size"); + frag.append(stacked()); + frag.append(links("stacked")); - r += `<p><h3>Asset origin</h3>`; - r += implanted(building, preview); - r += links(building, "implanted"); - r += `</p>`; + App.UI.DOM.appendNewElement("h3", frag, "Asset origin"); + frag.append(implanted()); + frag.append(links("implanted")); - r += `<p><h3>Body mods</h3>`; - r += modded(building, preview); - r += links(building, "modded"); - r += `</p>`; + App.UI.DOM.appendNewElement("h3", frag, "Body mods"); + frag.append(modded()); + frag.append(links("modded")); if (V.seePreg !== 0) { - r += `<p><h3>Pregnancy</h3>`; - r += preg(building, preview); - r += links(building, "preg"); - r += `</p>`; + App.UI.DOM.appendNewElement("h3", frag, "Pregnancy"); + frag.append(preg()); + frag.append(links("preg")); } - r += `<p><h3>Age</h3>`; - r += age(building, preview); - r += links(building, "age"); - r += `</p>`; + App.UI.DOM.appendNewElement("h3", frag, "Age"); + frag.append(age()); + frag.append(links("age")); if (V.seeDicks !== 0) { - r += `<p><h3>Genitalia</h3>`; - r += XX(building, preview); - r += links(building, "XX"); - r += `</p>`; + App.UI.DOM.appendNewElement("h3", frag, "Genitalia"); + frag.append(XX()); + frag.append(links("age")); } - - r += `<p>`; - r += final(building, preview); - r += `</p>`; + App.UI.DOM.appendNewElement("p", frag, final()); } else { - r += `<p>`; - r += intro(building, preview); - r += `</p><p>`; - r += stacked(building, preview); - r += `</p><p>`; - r += preg(building, preview); - r += `</p><p>`; - r += modded(building, preview); - r += `</p><p>`; - r += implanted(building, preview); - r += `</p><p>`; - r += XX(building, preview); - r += `</p><p>`; - r += age(building, preview); - r += `</p><p>`; - r += final(building, preview); - r += `</p>`; + App.UI.DOM.appendNewElement("p", frag, intro()); + App.UI.DOM.appendNewElement("p", frag, stacked()); + App.UI.DOM.appendNewElement("p", frag, preg()); + App.UI.DOM.appendNewElement("p", frag, modded()); + App.UI.DOM.appendNewElement("p", frag, implanted()); + App.UI.DOM.appendNewElement("p", frag, XX()); + App.UI.DOM.appendNewElement("p", frag, age()); + App.UI.DOM.appendNewElement("p", frag, final()); } - return r; + return frag; } - function intro(building, preview) { + function intro() { let t = ``; if (adCampaign.spending !== 0) { if (building === "brothel") { @@ -368,7 +349,7 @@ App.Ads.report = function(building, preview = false) { } } - function stacked(building, preview) { + function stacked() { let t = ``; const pref = App.Ads.Categories.assetSize.classifyLocalPreference(); let girls = adMgr.slavesMajority(App.Ads.Categories.assetSize); @@ -428,7 +409,7 @@ App.Ads.report = function(building, preview = false) { t += `trim `; } t += `girls matched most customers' preferences and the girls in the ${building} matched its advertisements. `; - t += reputation(building, 1, preview); + t += reputation(1); } else if ((adCampaign.stacked === pref) && (girls !== adCampaign.stacked)) { t += `Its advertising for `; if (adCampaign.stacked === 1) { @@ -437,7 +418,7 @@ App.Ads.report = function(building, preview = false) { t += `trim `; } t += `girls matched most customers preferences, but most of the girls in the ${building} were not as advertised. `; - t += reputation(building, -1, preview); + t += reputation(-1); } else if ((girls === pref) && (girls !== adCampaign.stacked)) { t += `The `; if (girls === 1) { @@ -452,7 +433,7 @@ App.Ads.report = function(building, preview = false) { t += `slim `; } t += `girls, `; - t += reputation(building, 0, preview); + t += reputation(0); } else if (girls !== pref) { t += `Some customers were put off since the `; if (girls === 1) { @@ -467,7 +448,7 @@ App.Ads.report = function(building, preview = false) { t += `slim `; } t += `girls. `; - t += reputation(building, -1, preview); + t += reputation(-1); } } else { if (girls === pref) { @@ -484,7 +465,7 @@ App.Ads.report = function(building, preview = false) { t += `slim `; } t += `girls. `; - t += reputation(building, 1, preview); + t += reputation(1); } else { t += `Some customers were put off since the `; if (girls === 1) { @@ -499,13 +480,13 @@ App.Ads.report = function(building, preview = false) { t += `slim `; } t += `girls. `; - t += reputation(building, -1, preview); + t += reputation(-1); } } return t; } - function preg(building, preview) { + function preg() { let t = ``; const pref = App.Ads.Categories.preg.classifyLocalPreference(); let girls = adMgr.slavesMajority(App.Ads.Categories.preg); @@ -565,7 +546,7 @@ App.Ads.report = function(building, preview = false) { t += `flat-bellied `; } t += `girls matched most customers' preferences and the girls in the ${building} matched its advertisements. `; - t += reputation(building, 1, preview); + t += reputation(1); } else if ((adCampaign.preg === pref) && (girls !== adCampaign.preg)) { t += `Its advertising for `; if (adCampaign.preg === 1) { @@ -574,7 +555,7 @@ App.Ads.report = function(building, preview = false) { t += `flat-bellied `; } t += `girls matched most customers' preferences, but the girls in the ${building} did not. `; - t += reputation(building, -1, preview); + t += reputation(-1); } else if ((girls === pref) && (girls !== adCampaign.preg)) { t += `The `; if (girls === 1) { @@ -589,7 +570,7 @@ App.Ads.report = function(building, preview = false) { t += `flat-bellied `; } t += `girls, `; - t += reputation(building, 0, preview); + t += reputation(0); } else if (girls !== pref) { t += `Some customers were put off since the `; if (girls === 1) { @@ -604,7 +585,7 @@ App.Ads.report = function(building, preview = false) { t += `flat-bellied `; } t += `girls. `; - t += reputation(building, -1, preview); + t += reputation(-1); } } else { if (girls === pref) { @@ -621,7 +602,7 @@ App.Ads.report = function(building, preview = false) { t += ` flat-bellied `; } t += `girls. `; - t += reputation(building, 1, preview); + t += reputation(1); } else { t += `Some customers were put off since the `; if (girls === 1) { @@ -636,14 +617,14 @@ App.Ads.report = function(building, preview = false) { t += `flat-bellied `; } t += `girls. `; - t += reputation(building, -1, preview); + t += reputation(-1); } } } return t; } - function modded(building, preview) { + function modded() { let t = ``; const pref = App.Ads.Categories.mods.classifyLocalPreference(); let girls = adMgr.slavesMajority(App.Ads.Categories.mods); @@ -703,7 +684,7 @@ App.Ads.report = function(building, preview = false) { t += `natural bodied `; } t += `girls matched most customers' preferences and the girls in the ${building} matched its advertisements. `; - t += reputation(building, 1, preview); + t += reputation(1); } else if ((adCampaign.modded === pref) && (girls !== adCampaign.modded)) { t += `Its advertising for `; if (adCampaign.modded === 1) { @@ -712,7 +693,7 @@ App.Ads.report = function(building, preview = false) { t += `natural bodied `; } t += `girls matched most customers preferences, but the girls in the ${building} did not. `; - t += reputation(building, -1, preview); + t += reputation(-1); } else if ((girls === pref) && (girls !== adCampaign.modded)) { t += `The `; if (girls === 1) { @@ -727,7 +708,7 @@ App.Ads.report = function(building, preview = false) { t += `natural bodied `; } t += `girls, `; - t += reputation(building, 0, preview); + t += reputation(0); } else if (girls !== pref) { t += `Some customers were put off since the `; if (girls === 1) { @@ -742,7 +723,7 @@ App.Ads.report = function(building, preview = false) { t += `natural bodied `; } t += `girls. `; - t += reputation(building, -1, preview); + t += reputation(-1); } } else { if (girls === pref) { @@ -759,7 +740,7 @@ App.Ads.report = function(building, preview = false) { t += `natural unmodded `; } t += `girls. `; - t += reputation(building, 1, preview); + t += reputation(1); } else { t += `Some customers were put off since the `; if (girls === 1) { @@ -774,13 +755,13 @@ App.Ads.report = function(building, preview = false) { t += `natural bodied `; } t += `girls. `; - t += reputation(building, -1, preview); + t += reputation(-1); } } return t; } - function implanted(building, preview) { + function implanted() { let t = ``; const pref = App.Ads.Categories.assetOrigin.classifyLocalPreference(); let girls = adMgr.slavesMajority(App.Ads.Categories.assetOrigin); @@ -840,7 +821,7 @@ App.Ads.report = function(building, preview = false) { t += `naturally pure `; } t += `girls matched most customers' preferences and the girls in the ${building} matched its advertisements. `; - t += reputation(building, 1, preview); + t += reputation(1); } else if ((adCampaign.implanted === pref) && (girls !== adCampaign.implanted)) { t += `Its advertising for `; if (adCampaign.implanted === 1) { @@ -849,7 +830,7 @@ App.Ads.report = function(building, preview = false) { t += `naturally pure `; } t += `girls matched most customers preferences, but the girls in the ${building} did not. `; - t += reputation(building, -1, preview); + t += reputation(-1); } else if ((girls === pref) && (girls !== adCampaign.implanted)) { t += `The `; if (girls === 1) { @@ -864,7 +845,7 @@ App.Ads.report = function(building, preview = false) { t += `naturally pure `; } t += `girls, `; - t += reputation(building, 0, preview); + t += reputation(0); } else if (girls !== pref) { t += `Some customers were put off since the `; if (girls === 1) { @@ -879,7 +860,7 @@ App.Ads.report = function(building, preview = false) { t += `naturally pure `; } t += `girls. `; - t += reputation(building, -1, preview); + t += reputation(-1); } } else { if (girls === pref) { @@ -896,7 +877,7 @@ App.Ads.report = function(building, preview = false) { t += `natural unmodded `; } t += `girls. `; - t += reputation(building, 1, preview); + t += reputation(1); } else { t += `Some customers were put off since the `; if (girls === 1) { @@ -911,13 +892,13 @@ App.Ads.report = function(building, preview = false) { t += `naturally pure `; } t += `girls. `; - t += reputation(building, -1, preview); + t += reputation(-1); } } return t; } - function XX(building, preview) { + function XX() { let t = ``; const pref = App.Ads.Categories.genitalia.classifyLocalPreference(); let girls = adMgr.slavesMajority(App.Ads.Categories.genitalia); @@ -983,7 +964,7 @@ App.Ads.report = function(building, preview = false) { t += `with dicks `; } t += `matches most customers' preferences as advertised. `; - t += reputation(building, 1, preview); + t += reputation(1); } else if ((adCampaign.XX === pref) && (girls !== adCampaign.XX)) { t += `Its advertising for girls `; if (adCampaign.XX === 1) { @@ -992,7 +973,7 @@ App.Ads.report = function(building, preview = false) { t += `with dicks `; } t += `matched most customers preferences, but the girls in the ${building} are not as advertised. `; - t += reputation(building, -1, preview); + t += reputation(-1); } else if ((girls === pref) && (girls !== adCampaign.XX)) { t += `The girls `; if (girls === 1) { @@ -1007,7 +988,7 @@ App.Ads.report = function(building, preview = false) { t += ` with dicks`; } t += `, `; - t += reputation(building, 0, preview); + t += reputation(0); } else if (girls !== pref) { t += `Some customers were put off since the girls `; if (girls === 1) { @@ -1022,7 +1003,7 @@ App.Ads.report = function(building, preview = false) { t += ` with dicks`; } t += `. `; - t += reputation(building, -1, preview); + t += reputation(-1); } } else { if (girls === pref) { @@ -1033,7 +1014,7 @@ App.Ads.report = function(building, preview = false) { t += `with male genitalia `; } t += `. `; - t += reputation(building, 1, preview); + t += reputation(1); } else { t += `Some customers were put off since the girls `; if (girls === 1) { @@ -1048,14 +1029,14 @@ App.Ads.report = function(building, preview = false) { t += `with dicks`; } t += `. `; - t += reputation(building, -1, preview); + t += reputation(-1); } } } return t; } - function age(building, preview) { + function age() { let t = ``; const pref = App.Ads.Categories.age.classifyLocalPreference(); let girls = adMgr.slavesMajority(App.Ads.Categories.age); @@ -1119,30 +1100,30 @@ App.Ads.report = function(building, preview = false) { if ((adCampaign.age === pref) && (girls === adCampaign.age)) { payBonus(); t += `Its advertising matches most customers' age preferences and the girls in the ${building} match the ages as advertised. `; - t += reputation(building, 1, preview); + t += reputation(1); } else if ((adCampaign.age === pref) && (girls !== adCampaign.age)) { t += `Its advertising matched most customers age preferences, but the girls in the ${building} are not as advertised. `; - t += reputation(building, -1, preview); + t += reputation(-1); } else if ((girls === pref) && (girls !== adCampaign.age)) { t += `The ages of girls in the ${building} did not match the ages as advertised, but since the girls in the ${building} matched most customers age preferences, `; - t += reputation(building, 0, preview); + t += reputation(0); } else if (girls !== pref) { t += `Some customers were put off since the ages of girls there did not match their preferences. `; - t += reputation(building, -1, preview); + t += reputation(-1); } } else { if (girls === pref) { t += `The girls in the ${building} match most customers' age preferences. `; - t += reputation(building, 1, preview); + t += reputation(1); } else { t += `Some customers were put off since the ages of girls there did not match their preferences. `; - t += reputation(building, -1, preview); + t += reputation(-1); } } return t; } - function final(building, preview) { + function final() { let t = ``; if (adMgr.overallVarietyBonus()) { if (!preview) { @@ -1169,7 +1150,7 @@ App.Ads.report = function(building, preview = false) { return t; } - function reputation(building, change, preview) { + function reputation(change) { const minBonus = 50; const maxBonus = 150; if (change > 0) { @@ -1195,7 +1176,7 @@ App.Ads.report = function(building, preview = false) { } } - function links(building, category) { + function links(category) { let r = ``; let passage = (capFirstChar(building) + " Advertisement"); diff --git a/src/uncategorized/brothelAdvertisement.tw b/src/uncategorized/brothelAdvertisement.tw index 1b4c8d8ce3e0fc65311de1d24f3cac18bd5623df..1e7ac07fbf06659f3add118ffc195ff683d4ae60 100644 --- a/src/uncategorized/brothelAdvertisement.tw +++ b/src/uncategorized/brothelAdvertisement.tw @@ -161,5 +161,5 @@ </div> <p> - <<= App.Ads.report("brothel", true)>> + <<includeDOM App.Ads.report("brothel", true)>> </p> diff --git a/src/uncategorized/clubAdvertisement.tw b/src/uncategorized/clubAdvertisement.tw index dd0cac4c160b1eed4da5d5e5de52e3f42f10a85f..cb85188466022d2c8a40d3f4d93388786f05f330 100644 --- a/src/uncategorized/clubAdvertisement.tw +++ b/src/uncategorized/clubAdvertisement.tw @@ -158,5 +158,5 @@ </div> <p> - <<= App.Ads.report("club", true)>> + <<includeDOM App.Ads.report("club", true)>> </p>