diff --git a/src/facilities/farmyard/farmyard.tw b/src/facilities/farmyard/farmyard.tw index d46216e5007adcd9e31a145c6e8514196c58be23..2e833adb8da53dc319fc1dd64485d6a2eb01f5f2 100644 --- a/src/facilities/farmyard/farmyard.tw +++ b/src/facilities/farmyard/farmyard.tw @@ -111,7 +111,7 @@ $farmyardNameCaps is an oasis of growth in the midst of the jungle of steel and Assigned here are $farmMenials slaves working to produce as much food as possible. <</if>> <<if $farmMenialsSpace > 0>> - You <<if $menials > 0>> own <<if $menials > 10>><<print commaNum($menials)>><<else>><<= numberToWords($menials)>><</if>><<else>>don't own any<</if>> free menial slaves. $farmyardNameCaps can house <<print $farmMenialsSpace>> menial slaves total, with <<print $farmMenialsSpace - $farmMenials>> free slots. + You <<if $menials > 0>> own <<print commaNum($menials)>><<else>>don't own any<</if>> free menial slaves. $farmyardNameCaps can house <<print $farmMenialsSpace>> menial slaves total, with <<print $farmMenialsSpace - $farmMenials>> free slots. <</if>> <br> diff --git a/src/init/storyInit.tw b/src/init/storyInit.tw index 3ed33fe7b2f07831c60a078402abd37f704dabdc..9070d39d7692339e4440d4359f75272a95b3241d 100644 --- a/src/init/storyInit.tw +++ b/src/init/storyInit.tw @@ -265,6 +265,8 @@ You should have received a copy of the GNU General Public License along with thi <<set $showHeightCMs = 1>> <<set $showDickCMs = 1>> <<set $showInches = 0>> + <<set $showNumbers = 2>> + <<set $showNumbersMax = 20>> <<set $showScores = 1>> <<set $showAssignToScenes = 1>> <<set $showEWD = 1>> diff --git a/src/js/utilJS.js b/src/js/utilJS.js index 32c4bf36ef084495868f7c9990baaa576253a8d0..c57e2e71a99eeaa7d95411c1a9692b8a3fd8d842 100644 --- a/src/js/utilJS.js +++ b/src/js/utilJS.js @@ -608,89 +608,108 @@ window.numberWithCommas = function(x) { return x.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ","); }; -window.numberToWords = function(x) { - if (x === 0) { - return "zero"; - } - - var ONE_TO_NINETEEN = [ - "one", "two", "three", "four", "five", - "six", "seven", "eight", "nine", "ten", - "eleven", "twelve", "thirteen", "fourteen", "fifteen", - "sixteen", "seventeen", "eighteen", "nineteen" - ]; +window.numberToWords = function (x) { + const V = State.variables; + let max = V.showNumbersMax; - var TENS = [ - "ten", "twenty", "thirty", "forty", "fifty", - "sixty", "seventy", "eighty", "ninety" - ]; + if (V.showNumbers !== 2) { + if (x === 0) { + return "zero"; + } - var SCALES = ["thousand", "million", "billion", "trillion"]; + var ONE_TO_NINETEEN = [ + "one", "two", "three", "four", "five", + "six", "seven", "eight", "nine", "ten", + "eleven", "twelve", "thirteen", "fourteen", "fifteen", + "sixteen", "seventeen", "eighteen", "nineteen" + ]; - // helper function for use with Array.filter - function isTruthy(item) { - return !!item; - } + var TENS = [ + "ten", "twenty", "thirty", "forty", "fifty", + "sixty", "seventy", "eighty", "ninety" + ]; - // convert a number into "chunks" of 0-999 - function chunk(number) { - var thousands = []; + var SCALES = ["thousand", "million", "billion", "trillion"]; - while (number > 0) { - thousands.push(number % 1000); - number = Math.floor(number / 1000); + // helper function for use with Array.filter + function isTruthy(item) { + return !!item; } - return thousands; - } + // convert a number into "chunks" of 0-999 + function chunk(number) { + var thousands = []; - // translate a number from 1-999 into English - function inEnglish(number) { - var thousands, hundreds, tens, ones, words = []; + while (number > 0) { + thousands.push(number % 1000); + number = Math.floor(number / 1000); + } - if (number < 20) { - return ONE_TO_NINETEEN[number - 1]; // may be undefined + return thousands; } - if (number < 100) { - ones = number % 10; - tens = number / 10 | 0; // equivalent to Math.floor(number / 10) + // translate a number from 1-999 into English + function inEnglish(number) { + var thousands, hundreds, tens, ones, words = []; - words.push(TENS[tens - 1]); - words.push(inEnglish(ones)); + if (number < 20) { + return ONE_TO_NINETEEN[number - 1]; // may be undefined + } - return words.filter(isTruthy).join("-"); - } + if (number < 100) { + ones = number % 10; + tens = number / 10 | 0; // equivalent to Math.floor(number / 10) - hundreds = number / 100 | 0; - words.push(inEnglish(hundreds)); - words.push("hundred"); - words.push(inEnglish(number % 100)); + words.push(TENS[tens - 1]); + words.push(inEnglish(ones)); - return words.filter(isTruthy).join(" "); - } + return words.filter(isTruthy).join("-"); + } + + hundreds = number / 100 | 0; + words.push(inEnglish(hundreds)); + words.push("hundred"); + words.push(inEnglish(number % 100)); - // append the word for a scale. Made for use with Array.map - function appendScale(chunk, exp) { - var scale; - if (!chunk) { - return null; + return words.filter(isTruthy).join(" "); } - scale = SCALES[exp - 1]; - return [chunk, scale].filter(isTruthy).join(" "); - } - var string = chunk(x) - .map(inEnglish) - .map(appendScale) - .filter(isTruthy) - .reverse() - .join(" "); + // append the word for a scale. Made for use with Array.map + function appendScale(chunk, exp) { + var scale; + if (!chunk) { + return null; + } + scale = SCALES[exp - 1]; + return [chunk, scale].filter(isTruthy).join(" "); + } - if (x > 0) { - return string; + var string = chunk(x) + .map(inEnglish) + .map(appendScale) + .filter(isTruthy) + .reverse() + .join(" "); + + if (V.showNumbers === 1) { + if (x <= max) { + if (x > 0) { + return string; + } else { + return "negative " + string; + } + } else { + return commaNum(x); + } + } else { + if (x > 0) { + return string; + } else { + return "negative " + string; + } + } } else { - return "negative " + string; + return commaNum(x); } }; diff --git a/src/uncategorized/BackwardsCompatibility.tw b/src/uncategorized/BackwardsCompatibility.tw index 85f4a6e18e07820afb4a2c242898278c4e0fb977..dc153cd52a0f4a08b18df00d6a27b573073ef9b0 100644 --- a/src/uncategorized/BackwardsCompatibility.tw +++ b/src/uncategorized/BackwardsCompatibility.tw @@ -1062,6 +1062,12 @@ <<if ndef $showInches>> <<set $showInches = 0>> <</if>> +<<if ndef $showNumbers>> + <<set $showNumbers = 2>> +<</if>> +<<if ndef $showNumbersMax>> + <<set $showNumbersMax = 20>> +<</if>> <<if ndef $prisonCircuit>> <<set $prisonCircuit = ["low tier criminals", "gangs and smugglers", "white collar", "military prison"]>> <<set $prisonCircuitIndex = random(0,$prisonCircuit.length-1)>> diff --git a/src/uncategorized/descriptionOptions.tw b/src/uncategorized/descriptionOptions.tw index a6c2bb15abb1686ac756c637907d8d9ff9f615e2..2c5ea2f7a7cdb08e21f72b46e554795b5f254dde 100644 --- a/src/uncategorized/descriptionOptions.tw +++ b/src/uncategorized/descriptionOptions.tw @@ -86,6 +86,18 @@ Height and length units are in <br> +Numbers <<if $showNumbers == 1>>@@.green;BELOW $showNumbersMax@@<</if>> are displayed as +<<if $showNumbers == 1>> + words.<br> + <<textbox "$showNumbersMax" $showNumbersMax>> //[[Words|Description Options][$showNumbers = 0]]// | //[[Integers|Description Options][$showNumbers = 2]]// +<<elseif $showNumbers == 2>> + @@.yellow;INTEGERS.@@ //[[Words|Description Options][$showNumbers = 0]]// | //[[Both|Description Options][$showNumbers = 1, $showNumbersMax = 20]]// +<<else>> + @@.yellow;WORDS.@@ //[[Integers|Description Options][$showNumbers = 2]]// | //[[Both|Description Options][$showNumbers = 1, $showNumbersMax = 20]]// +<</if>> + +<br> + Attractiveness and Sexual scores are <<if $showScores == 1>> @@.green;SHOWN.@@ //[[Hide|Description Options][$showScores = 0]]// diff --git a/src/uncategorized/reRecruit.tw b/src/uncategorized/reRecruit.tw index f477b0aacdf9fd9de3a1294d94f174db641f2f5e..cd646f3e39229816667909cbeaf479131ee22019 100644 --- a/src/uncategorized/reRecruit.tw +++ b/src/uncategorized/reRecruit.tw @@ -2011,7 +2011,7 @@ Your Head Girl sends you a discreet message that _he2 may have found a slave for you. $HeadGirl.slaveName duly ushers a girl into your office. $He looks very young, like a dissolute party girl. $He bites $his lip nervously when $he sees you, and looks to $HeadGirl.slaveName for guidance. $HeadGirl.slaveName nods at $him reassuringly, so $he explains $himself. <br><br> -"<<if $PC.title != 0>>Sir<<else>>Ma'am<</if>>, my name is $activeSlave.slaveName. I'm, um, bored, I guess. I go to clubs and get drunk and fuck guys and it's just kinda boring. I thought it would be different when I turned <<print $activeSlave.actualAge>>, but that was a couple months ago and, well, nothing's different. I saw $HeadGirl.slaveName and _he2 was just so graceful and beautiful and _he2 seemed so confident in what _he2 was doing and who _he2 was and I talked to _him2 and _he2 said _he2 was your Head Girl and... I want to be like _him2. Can I be your slave? I'd be good, I'm good at sucking dicks and stuff." $He seems to be a little naïve about sexual slavery, but there's no need to tell $him that. +"<<if $PC.title != 0>>Sir<<else>>Ma'am<</if>>, my name is $activeSlave.slaveName. I'm, um, bored, I guess. I go to clubs and get drunk and fuck guys and it's just kinda boring. I thought it would be different when I turned <<= numberToWords($activeSlave.actualAge)>>, but that was a couple months ago and, well, nothing's different. I saw $HeadGirl.slaveName and _he2 was just so graceful and beautiful and _he2 seemed so confident in what _he2 was doing and who _he2 was and I talked to _him2 and _he2 said _he2 was your Head Girl and... I want to be like _him2. Can I be your slave? I'd be good, I'm good at sucking dicks and stuff." $He seems to be a little naïve about sexual slavery, but there's no need to tell $him that. <<case "male recruit">> @@ -2019,7 +2019,7 @@ Your Head Girl sends you a discreet message that _he2 may have found a slave for Your Head Girl sends you a discreet message that _he2 may have found a slave for you. $HeadGirl.slaveName duly ushers an androgynous young person into your office. $He's dressed as a girl and acts like one. $He looks very young, like a dissolute party girl. $He bites $his lip nervously when $he sees you, and looks to $HeadGirl.slaveName for guidance. $HeadGirl.slaveName nods at $him reassuringly, so $he explains $himself. <br><br> -"<<if $PC.title != 0>>Sir<<else>>Ma'am<</if>>, my name is $activeSlave.slaveName. I'm, um, bored, I guess. I go to clubs and get drunk and fuck guys and it's just kinda boring. I thought it would be different when I turned <<print $activeSlave.actualAge>>, but that was a couple months ago and, well, nothing's different. I saw $HeadGirl.slaveName and _he2 was just so beautiful and has a dick like me and _he2 seemed so confident in what _he2 was doing and who _he2 was and I talked to _him2 and _he2 said _he2 was your Head Girl and... I want to be like _him2. Can I be your slave? I'd be good, I'm good at sucking dicks." $He seems to be a little naïve about sexual slavery, but there's no need to tell $him that. +"<<if $PC.title != 0>>Sir<<else>>Ma'am<</if>>, my name is $activeSlave.slaveName. I'm, um, bored, I guess. I go to clubs and get drunk and fuck guys and it's just kinda boring. I thought it would be different when I turned <<= numberToWords($activeSlave.actualAge)>>, but that was a couple months ago and, well, nothing's different. I saw $HeadGirl.slaveName and _he2 was just so beautiful and has a dick like me and _he2 seemed so confident in what _he2 was doing and who _he2 was and I talked to _him2 and _he2 said _he2 was your Head Girl and... I want to be like _him2. Can I be your slave? I'd be good, I'm good at sucking dicks." $He seems to be a little naïve about sexual slavery, but there's no need to tell $him that. <<case "whore recruit">> diff --git a/src/utility/descriptionWidgetsStyle.tw b/src/utility/descriptionWidgetsStyle.tw index 99e029ccdddfc533462b2d73cb3a1ede051d91c1..dfa27858dc9b5f6ab567d8eba4bddd3b55547c8c 100644 --- a/src/utility/descriptionWidgetsStyle.tw +++ b/src/utility/descriptionWidgetsStyle.tw @@ -3525,7 +3525,7 @@ $His <</if>> <<elseif _pregCollar == 2>> <<if $activeSlave.pregWeek < 0>> - "<<print $activeSlave.pregWeek*-1>> week<<if $activeSlave.pregWeek != -1>>s<</if>> until I can get preggers again!" + "<<= numberToWords($activeSlave.pregWeek*-1)>> week<<if $activeSlave.pregWeek != -1>>s<</if>> until I can get preggers again!" <<elseif $activeSlave.pregKnown == 1>> <<if $activeSlave.broodmother == 2>> <<if $activeSlave.preg > 37>>