diff --git a/src/descriptions/officeDescription.js b/src/descriptions/officeDescription.js index 7e8b4089ac0d39f63964a7468ef8acc235c01eb0..4ecac53c275b09bf69800c17cb5e04b75ea9c2ce 100644 --- a/src/descriptions/officeDescription.js +++ b/src/descriptions/officeDescription.js @@ -14,6 +14,9 @@ App.Desc.officeDescription = function(lastElement) { return f; + /** + * @returns {string} + */ function paragraph1() { const r = []; r.push(`You are at your desk in your penthouse office. It has a glass top interface from which you can rule over ${V.arcologies[0].name}; ${V.assistant.name}'s avatar is visible in one corner.`); @@ -222,6 +225,9 @@ App.Desc.officeDescription = function(lastElement) { return r.join(" "); } + /** + * @returns {string} + */ function paragraph2() { const r = []; @@ -431,6 +437,9 @@ App.Desc.officeDescription = function(lastElement) { return r.join(" "); } + /** + * @returns {string} + */ function paragraph3() { const r = []; @@ -452,4 +461,90 @@ App.Desc.officeDescription = function(lastElement) { return r.join(" "); } + + /** + * @returns {string} + */ + function printTrinkets() { + if (V.trinkets.length === 0) { + return ""; + } + + const trinkets = weightedArray2HashMap(V.trinkets); + let trinketString = []; + let plurals = false; + + for (const trinketDesc in trinkets) { + if (trinkets[trinketDesc] === 1) { + trinketString.push(trinketDesc); + } else if (trinkets[trinketDesc] > 1) { + trinketString.push(trinketPluralReplacer(trinketDesc)); + plurals = true; + } + } + + // depending on length of trinketString, add necessary conjunctions + if (trinketString.length === 1) { + if (plurals === false) { + trinketString = `a single item: ${trinketString[0]}`; + } else { + trinketString = trinketString[0]; + } + } else if (trinketString.length === 2 && plurals === false) { + trinketString = `a couple of items: ${trinketString[0]}, and ${trinketString[1]}`; + } else { + trinketString[trinketString.length - 1] = `and ${trinketString[trinketString.length - 1]}`; + trinketString = trinketString.join(", "); + } + return `There's a display case behind your desk, with ${trinketString}.`; + } + + function trinketPluralReplacer(desc) { + let r; + switch (desc) { + /* not supported + best in show ribbons + napkins + App.SlaveAssignment.porn trinkets + wedding photos + */ + // should never have plurals + case "a collection of diplomas from expensive schools": + case "a framed low denomination piece of paper money from your native country": + case "a battered old assault rifle": + case "a framed picture of a slave with her sale price scrawled across the bottom": + case "an artist's impression of an early arcology design": + case "a framed copy of the first news story featuring yourself": + case "a miniature model of your first arcology": + case "a copy of the first porno you starred in": + case "a framed picture of your late Master": + case "your favorite handgun, whose sight has instilled fear in many": + case "a news clipping of your first successful live hack": + case "a damaged plate carrier bearing Daughters of Liberty insignia": + case "a Daughters of Liberty flag that once hung in their forward command post within your arcology": + case "a Daughters of Liberty brassard": + case "a shot-torn flag of the failed nation whose militants attacked the Free City": + return desc; + // manual replacement + case "a thank-you note from a MILF tourist whom you made feel welcome in the arcology": + return "several thank-you notes from MILF tourists whom you made feel welcome in the arcology"; + // replacement by groups + default: + r = desc; + if (desc.endsWith("citizen")) { // will not reduce spam from different future societies + r = r.replace("message", "messages"); + r = r.replace("from a", "from"); + r = r.replace("a ", "several "); + r = r.replace("citizen", "citizens"); + r = r.replace("number", "numbers"); + r = r.replace("test", "tests"); + } else if (desc.endsWith("acquaintance")) { + r = r.replace("note", "notes"); + r = r.replace("from a", "from"); + r = r.replace("a ", "several "); + r = r.replace("owner", "owners"); + } + return r; + } + } }; diff --git a/src/js/storyJS.js b/src/js/storyJS.js index 25cab312c4d852543b53db801848003cf59626eb..cc771ba9a0fc20fe25c9c486999f69b6c16665b5 100644 --- a/src/js/storyJS.js +++ b/src/js/storyJS.js @@ -593,89 +593,6 @@ globalThis.generatePlayerPronouns = function(PC) { } }; -globalThis.printTrinkets = function() { // TODO: move these out of global scope - function trinketPluralReplacer(desc) { - let r; - switch (desc) { - /* not supported - best in show ribbons - napkins - App.SlaveAssignment.porn trinkets - wedding photos - */ - // should never have plurals - case "a collection of diplomas from expensive schools": - case "a framed low denomination piece of paper money from your native country": - case "a battered old assault rifle": - case "a framed picture of a slave with her sale price scrawled across the bottom": - case "an artist's impression of an early arcology design": - case "a framed copy of the first news story featuring yourself": - case "a miniature model of your first arcology": - case "a copy of the first porno you starred in": - case "a framed picture of your late Master": - case "your favorite handgun, whose sight has instilled fear in many": - case "a news clipping of your first successful live hack": - case "a damaged plate carrier bearing Daughters of Liberty insignia": - case "a Daughters of Liberty flag that once hung in their forward command post within your arcology": - case "a Daughters of Liberty brassard": - case "a shot-torn flag of the failed nation whose militants attacked the Free City": - return desc; - // manual replacement - case "a thank-you note from a MILF tourist whom you made feel welcome in the arcology": - return "several thank-you notes from MILF tourists whom you made feel welcome in the arcology"; - // replacement by groups - default: - r = desc; - if (desc.endsWith("citizen")) { // will not reduce spam from different future societies - r = r.replace("message", "messages"); - r = r.replace("from a", "from"); - r = r.replace("a ", "several "); - r = r.replace("citizen", "citizens"); - r = r.replace("number", "numbers"); - r = r.replace("test", "tests"); - } else if (desc.endsWith("acquaintance")) { - r = r.replace("note", "notes"); - r = r.replace("from a", "from"); - r = r.replace("a ", "several "); - r = r.replace("owner", "owners"); - } - return r; - } - } - - if (V.trinkets.length === 0) { - return ""; - } - - const trinkets = weightedArray2HashMap(V.trinkets); - let trinketString = []; - let plurals = false; - - for (const trinketDesc in trinkets) { - if (trinkets[trinketDesc] === 1) { - trinketString.push(trinketDesc); - } else if (trinkets[trinketDesc] > 1) { - trinketString.push(trinketPluralReplacer(trinketDesc)); - plurals = true; - } - } - - // depending on length of trinketString, add necessary conjunctions - if (trinketString.length === 1) { - if (plurals === false) { - trinketString = `a single item: ${trinketString[0]}`; - } else { - trinketString = trinketString[0]; - } - } else if (trinketString.length === 2 && plurals === false) { - trinketString = `a couple of items: ${trinketString[0]}, and ${trinketString[1]}`; - } else { - trinketString[trinketString.length - 1] = `and ${trinketString[trinketString.length - 1]}`; - trinketString = trinketString.join(", "); - } - return `There's a display case behind your desk, with ${trinketString}.`; -}; - /** * @param {number} nmbr1 * @param {number} nmbr2