From 5e29f61ccdfda00372e9122c37f743ff6afa158c Mon Sep 17 00:00:00 2001 From: Pregmodder <pregmodder@gmail.com> Date: Sat, 25 Aug 2018 00:59:29 -0400 Subject: [PATCH] new JS usage and tweaks --- devNotes/twine JS.txt | 15 +++++ src/js/utilJS.tw | 15 +++++ src/utility/descriptionWidgetsFlesh.tw | 86 ++++++++++++-------------- 3 files changed, 70 insertions(+), 46 deletions(-) diff --git a/devNotes/twine JS.txt b/devNotes/twine JS.txt index fdaf38e1fa2..84a16f33e8c 100644 --- a/devNotes/twine JS.txt +++ b/devNotes/twine JS.txt @@ -3656,6 +3656,21 @@ window.ValidateFacilityDecoration = function ValidateFacilityDecoration(decorati } }; +function ordinalSuffix(i) { + var j = i % 10, + k = i % 100; + if (j == 1 && k != 11) { + return i + "st"; + } + if (j == 2 && k != 12) { + return i + "nd"; + } + if (j == 3 && k != 13) { + return i + "rd"; + } + return i + "th"; +} + /*:: Span Macro JS [script]*/ /* diff --git a/src/js/utilJS.tw b/src/js/utilJS.tw index 7a13bfbb6fe..48897ebd068 100644 --- a/src/js/utilJS.tw +++ b/src/js/utilJS.tw @@ -779,3 +779,18 @@ window.ValidateFacilityDecoration = function ValidateFacilityDecoration(decorati break; } }; + +function ordinalSuffix(i) { + var j = i % 10, + k = i % 100; + if (j == 1 && k != 11) { + return i + "st"; + } + if (j == 2 && k != 12) { + return i + "nd"; + } + if (j == 3 && k != 13) { + return i + "rd"; + } + return i + "th"; +} \ No newline at end of file diff --git a/src/utility/descriptionWidgetsFlesh.tw b/src/utility/descriptionWidgetsFlesh.tw index 8909320e9fa..e4587647ca1 100644 --- a/src/utility/descriptionWidgetsFlesh.tw +++ b/src/utility/descriptionWidgetsFlesh.tw @@ -4208,16 +4208,16 @@ $He's got a <</if>> <<if ($seeRace == 1)>> - <<if $activeSlave.race == "white">> + <<if $activeSlave.origRace == "white">> pink pussylips. - <<elseif $activeSlave.race == "asian">> - dark $activeSlave.race pussylips. - <<elseif $activeSlave.race == "middle eastern">> - dark $activeSlave.race pussylips. - <<elseif $activeSlave.race == "latina">> - dark $activeSlave.race pussylips. - <<elseif $activeSlave.race == "black">> - dark $activeSlave.race pussylips. + <<elseif $activeSlave.origRace == "asian">> + dark $activeSlave.origRace pussylips. + <<elseif $activeSlave.origRace == "middle eastern">> + dark $activeSlave.origRace pussylips. + <<elseif $activeSlave.origRace == "latina">> + dark $activeSlave.origRace pussylips. + <<elseif $activeSlave.origRace == "black">> + dark $activeSlave.origRace pussylips. <<else>> $activeSlave.skin pussylips. <</if>> @@ -13885,7 +13885,7 @@ $He has <<elseif $activeSlave.preg == $activeSlave.pregWeek/4>> $he could shockingly pass for a girl only a quarter as far along. <<else>> - $he shockingly only looks like a girl on $his $activeSlave.preg week of pregnancy. + $he shockingly only looks like a girl on $his ordinalSuffix($activeSlave.preg) week of pregnancy. <</if>> <<elseif $activeSlave.preg+20 <= $activeSlave.pregWeek>> <<if $activeSlave.preg == $activeSlave.pregWeek/2>> @@ -13893,7 +13893,7 @@ $He has <<elseif $activeSlave.preg == $activeSlave.pregWeek/4>> $he could surprisingly pass for a girl only a quarter as far along. <<else>> - $he surprisingly only looks like a girl on $his $activeSlave.preg week of pregnancy. + $he surprisingly only looks like a girl on $his ordinalSuffix($activeSlave.preg) week of pregnancy. <</if>> <<elseif $activeSlave.preg+10 <= $activeSlave.pregWeek>> <<if $activeSlave.preg == $activeSlave.pregWeek/2>> @@ -13901,7 +13901,7 @@ $He has <<elseif $activeSlave.preg == $activeSlave.pregWeek/4>> $he could pass for a girl only a quarter as far along. <<else>> - $he only looks like a woman on $his $activeSlave.preg week of pregnancy. + $he only looks like a woman on $his ordinalSuffix($activeSlave.preg) week of pregnancy. <</if>> <<else>> $his pregnancy is smaller than anticipated. @@ -13916,7 +13916,7 @@ $He has <<elseif $activeSlave.preg == $activeSlave.pregWeek*4>> $he could shockingly pass for a girl nearly four times as far along. <<else>> - $he shockingly looks like a girl on $his $activeSlave.preg week of pregnancy. + $he shockingly looks like a girl on $his ordinalSuffix($activeSlave.preg) week of pregnancy. <</if>> <<elseif $activeSlave.preg >= $activeSlave.pregWeek+10>> Despite being pregnant for only $activeSlave.pregWeek weeks, @@ -13925,7 +13925,7 @@ $He has <<elseif $activeSlave.preg == $activeSlave.pregWeek*4>> $he could surprisingly pass for a girl nearly four times as far along. <<else>> - $he surprisingly looks like a girl on $his $activeSlave.preg week of pregnancy. + $he surprisingly looks like a girl on $his ordinalSuffix($activeSlave.preg) week of pregnancy. <</if>> <<elseif $activeSlave.preg >= $activeSlave.pregWeek+5>> Despite being pregnant for only $activeSlave.pregWeek weeks, @@ -13934,7 +13934,7 @@ $He has <<elseif $activeSlave.preg == $activeSlave.pregWeek*4>> $he could pass for a girl nearly four times as far along. <<else>> - $he looks like a woman on $his $activeSlave.preg week of pregnancy. + $he looks like a woman on $his ordinalSuffix($activeSlave.preg) week of pregnancy. <</if>> <<else>> Despite being pregnant for only $activeSlave.pregWeek weeks, $his pregnancy is larger than anticipated. @@ -14141,42 +14141,36 @@ $He has $He's originally @@.tan;<<print $activeSlave.nationality>>@@; ethnically, $he's <</if>> @@.tan;<<print $activeSlave.race>>@@, and $his skin is <<print $activeSlave.skin>><<if $activeSlave.markings == "freckles">> and lightly freckled<<if (($activeSlave.skin == "pale") || ($activeSlave.skin == "fair")) && ($activeSlave.hColor != "red")>>, an attractive combination<</if>><<elseif $activeSlave.markings == "heavily freckled">> and heavily freckled<<if (($activeSlave.skin == "pale") || ($activeSlave.skin == "fair")) && ($activeSlave.hColor != "red")>>, an attractive combination<</if>><</if>>. -<<elseif ($seeRace == 1)>> - Ethnically, $he's @@.tan;<<print $activeSlave.race>>@@, and $his skin is <<print $activeSlave.skin>><<if $activeSlave.markings == "freckles">> and lightly freckled<<if (($activeSlave.skin == "pale") || ($activeSlave.skin == "fair")) && ($activeSlave.hColor != "red")>>, an attractive combination<</if>><<elseif $activeSlave.markings == "heavily freckled">> and heavily freckled<<if (($activeSlave.skin == "pale") || ($activeSlave.skin == "fair")) && ($activeSlave.hColor != "red")>>, an attractive combination<</if>><</if>>. -<<else>> - $His skin is <<print $activeSlave.skin>><<if $activeSlave.markings == "freckles">> and lightly freckled<<if (($activeSlave.skin == "pale") || ($activeSlave.skin == "fair")) && ($activeSlave.hColor != "red")>>, an attractive combination<</if>><<elseif $activeSlave.markings == "heavily freckled">> and heavily freckled<<if (($activeSlave.skin == "pale") || ($activeSlave.skin == "fair")) && ($activeSlave.hColor != "red")>>, an attractive combination<</if>><</if>>. -<</if>> - -<<if $saleDescription == 1>> - <<if ($seeRace == 1)>> - <<if $activeSlave.race != $activeSlave.origRace>> - <<if $PC.slaving >= 50>> - Thanks to your experience in buying and selling slaves, you can easily tell that $he has recieved plastic surgery to appear <<print $activeSlave.race>>; $his original race is currently unknown to you. - <<elseif $PC.medicine >= 50>> - Thanks to your medical experience, you can easily tell that $he has recieved plastic surgery to appear <<print $activeSlave.race>>; $his original race is currently unknown to you. - <<elseif $PC.medicine >= 30 || $PC.slaving >= 30>> - Something about some of $his more obviously <<print $activeSlave.race>> features strikes you as odd. - <</if>> + <<if $activeSlave.race != $activeSlave.origRace && $saleDescription != 1>> + $He has recieved plastic surgery to appear <<print $activeSlave.race>>; $he is originally <<print $activeSlave.origRace>>. + <<elseif $activeSlave.race != $activeSlave.origRace && $saleDescription == 1>> + <<if $PC.medicine >= 100>> + Thanks to your medical experience, you can easily tell that $he was oringinally <<print $activeSlave.origRace>>, but surgically modified. + <<elseif $PC.medicine >= 50>> + Oddly enough, $he appears to have a number of $activeSlave.origRace features. + <<elseif $PC.slaving >= 50>> + Thanks to your experience in buying and selling slaves, you can easily tell that $he is not naturally <<print $activeSlave.race>>. + <<elseif random(0,100) < $PC.medicine>> + $His features seem slightly off. <</if>> <</if>> - <<if $activeSlave.skin != $activeSlave.origSkin>> - <<if $PC.slaving >= 75>> - Thanks to your experience in buying and selling slaves, you can easily tell that $his skin has been treated to appear <<print $activeSlave.skin>>; $his original skin tone is currently unknown to you. - <<elseif $PC.medicine >= 75>> - Thanks to your medical experience, you can easily tell that $his skin has been treated to appear <<print $activeSlave.skin>>; $his original skin tone is currently unknown to you. - <<elseif $PC.medicine >= 55 || $PC.slaving >= 55>> - Something about the coloring of $his <<print $activeSlave.skin>> skin strikes you as odd. +<<elseif ($seeRace == 1)>> + Ethnically, $he's @@.tan;<<print $activeSlave.race>>@@, and $his skin is <<print $activeSlave.skin>><<if $activeSlave.markings == "freckles">> and lightly freckled<<if (($activeSlave.skin == "pale") || ($activeSlave.skin == "fair")) && ($activeSlave.hColor != "red")>>, an attractive combination<</if>><<elseif $activeSlave.markings == "heavily freckled">> and heavily freckled<<if (($activeSlave.skin == "pale") || ($activeSlave.skin == "fair")) && ($activeSlave.hColor != "red")>>, an attractive combination<</if>><</if>>. + <<if $activeSlave.race != $activeSlave.origRace && $saleDescription != 1>> + $He has recieved plastic surgery to appear <<print $activeSlave.race>>; $he is originally <<print $activeSlave.origRace>>. + <<elseif $activeSlave.race != $activeSlave.origRace && $saleDescription == 1>> + <<if $PC.medicine >= 100>> + Thanks to your medical experience, you can easily tell that $he was oringinally <<print $activeSlave.origRace>>, but surgically modified. + <<elseif $PC.medicine >= 50>> + Oddly enough, $he appears to have a number of $activeSlave.origRace features. + <<elseif $PC.slaving >= 50>> + Thanks to your experience in buying and selling slaves, you can easily tell that $he is not naturally <<print $activeSlave.race>>. + <<elseif random(0,100) < $PC.medicine>> + $His features seem slightly off. <</if>> <</if>> <<else>> - <<if ($seeRace == 1)>> - <<if $activeSlave.race != $activeSlave.origRace>> - $He has recieved plastic surgery to appear <<print $activeSlave.race>>; $he is originally <<print $activeSlave.origRace>>. - <</if>> - <</if>> - <<if $activeSlave.skin != $activeSlave.origSkin>> - $His skin has been treated to appear <<print $activeSlave.skin>>; $his skin is originally <<print $activeSlave.origSkin>> in color. - <</if>> + $His skin is <<print $activeSlave.skin>><<if $activeSlave.markings == "freckles">> and lightly freckled<<if (($activeSlave.skin == "pale") || ($activeSlave.skin == "fair")) && ($activeSlave.hColor != "red")>>, an attractive combination<</if>><<elseif $activeSlave.markings == "heavily freckled">> and heavily freckled<<if (($activeSlave.skin == "pale") || ($activeSlave.skin == "fair")) && ($activeSlave.hColor != "red")>>, an attractive combination<</if>><</if>>. <</if>> <</widget>> -- GitLab