diff --git a/src/endWeek/saStayConfined.js b/src/endWeek/saStayConfined.js index 7b60f4536c80a36f1132a3557171399e87405e69..4a1453a591b9686a6f583f12c26a14d328b23632 100644 --- a/src/endWeek/saStayConfined.js +++ b/src/endWeek/saStayConfined.js @@ -99,14 +99,33 @@ window.saStayConfined = function saStayConfined(slave) { } else { t += ` ${He} is now willing to <span class="devotion accept">do as ${he}'s told,</span>`; } - t += ` so <span class="noteworthy">${his} assignment has defaulted to rest.</span>`; + + t += ` <span class="noteworthy">`; if (slave.assignment === "be confined in the cellblock") { State.temporary.brokenSlaves++; State.temporary.DL--; State.temporary.dI--; } - removeJob(slave, slave.assignment); - } + if (V.assignmentRecords[slave.ID]) { + let oldJob = V.assignmentRecords[slave.ID]; + assignJobSafely(slave, oldJob); + if (slave.choosesOwnAssignment === 1) { + t += ` and ${he} is resting before choosing another task.`; + } else if (slave.assignment === "rest") { + if (oldJob !== "rest") { + t += ` and since ${he} was unable to return to ${his} old task to ${oldJob}, ${his} assignment has defaulted to rest.`; + } else { + t += ` so ${he} has returned to rest.`; + } + } else { + t += ` so ${he} goes back to ${oldJob}.`; + } + } else { + t += ` so ${his} assignment has defaulted to rest.`; + removeJob(slave, slave.assignment); + } + t += `</span>`; + } return t; }; diff --git a/src/endWeek/saTakeClasses.js b/src/endWeek/saTakeClasses.js index 08ee9f45019a39fabfe92ce95ef0f3d89c317afc..e18ffc65c03be80af31eb7d3ec9b7348df266495 100644 --- a/src/endWeek/saTakeClasses.js +++ b/src/endWeek/saTakeClasses.js @@ -412,8 +412,26 @@ window.saTakeClasses = (function saServeThePublic() { if ((slave.skill.entertainment > 30) || (V.schoolroomUpgradeSkills === 0 && slave.skill.entertainment > 10)) { if ((slave.skill.anal > 30) || (V.schoolroomUpgradeSkills === 0 && slave.skill.anal > 10)) { if ((slave.skill.vaginal > 30) || (V.schoolroomUpgradeSkills === 0 && slave.skill.vaginal > 10) || (slave.vagina < 0)) { - r += ` ${He} can learn little from further classes, so <span class="noteworthy">${his} assignment has defaulted to rest.</span>`; - removeJob(slave, "take classes"); + r += ` <span class="noteworthy">`; + if (V.assignmentRecords[slave.ID]) { + let oldJob = V.assignmentRecords[slave.ID]; + assignJobSafely(slave, oldJob); + if (slave.choosesOwnAssignment === 1) { + t += ` and ${he} is resting before choosing another task.`; + } else if (slave.assignment === "rest") { + if (oldJob !== "rest") { + r += ` and since ${he} was unable to return to ${his} old task to ${oldJob}, ${his} assignment has defaulted to rest.`; + } else { + r += ` so ${he} has returned to rest.`; + } + } else { + r += ` so ${he} goes back to ${oldJob}.`; + } + } else { + r += ` so ${his} assignment has defaulted to rest.`; + removeJob(slave, slave.assignment); + } + r += `</span>`; } } } diff --git a/src/gui/css/mainStyleSheet.css b/src/gui/css/mainStyleSheet.css index 2c20405dee171c3676da7590fceb662832d89f77..77595075c001e7ebf299ffd23d0ff0040780e246 100644 --- a/src/gui/css/mainStyleSheet.css +++ b/src/gui/css/mainStyleSheet.css @@ -326,3 +326,10 @@ div.double-indent { .story-label { text-decoration: underline; } + +/* Note: Do not do a linebreak after span in HTML, because it will underline the automatic space it inserts: "Matilda_is a cow" */ +.slave-name { + color: pink; + font-weight: bold; + text-decoration: underline; +} \ No newline at end of file diff --git a/src/init/storyInit.tw b/src/init/storyInit.tw index c872cf579b8ebb1b5d33b9725e87e1676e355372..a57b06613734f65bdc1a1302948a5d288a066277 100644 --- a/src/init/storyInit.tw +++ b/src/init/storyInit.tw @@ -336,6 +336,7 @@ You should have received a copy of the GNU General Public License along with thi <<set $useSlaveSummaryOverviewTab = 0>> <<set $useSlaveListInPageJSNavigation = 0>> <<set $killChoice = -1>> + <<set $assignmentRecords = {}>> /* master suite reporting and alternate descriptions */ <<set $verboseDescriptions = 0>> diff --git a/src/js/assignJS.js b/src/js/assignJS.js index a3d9938e675fa8d65850a55d267614d27df146c5..7caead6c7c1343aef7236df1ff8ccf54a49b5304 100644 --- a/src/js/assignJS.js +++ b/src/js/assignJS.js @@ -2,6 +2,7 @@ window.assignJob = function assignJob(slave, job) { "use strict"; let r = ""; + let oldJob = slave.assignment; if (job === "Pit" || job === "Coursing Association") { return r; } @@ -16,6 +17,24 @@ window.assignJob = function assignJob(slave, job) { V[propName] = slave; }; + /* Tracking for the following cases: */ + if (V.assignmentRecords[slave.ID] !== "choose her own job") { // if choosesOwnAssignment was set before removeJob (which wipes it out), it's saved in assignmentRecords. We don't want to overwrite that here, as we want to be able to get it back. + switch (job.toLowerCase()) { + case "be confined in the cellblock": + case "cellblock": + case "get treatment in the clinic": + case "clinic": + case "learn in the schoolroom": + case "schoolroom": + case "rest in the spa": + case "spa": + if (oldJob !== "rest") { + V.assignmentRecords[slave.ID] = oldJob; // these jobs are temporary, so we save what the slave will return to if it is meaningful. + } + break; + } + } + /* use .toLowerCase() to get rid of a few dupe conditions. */ switch (job.toLowerCase()) { case "be confined in the arcade": @@ -385,6 +404,17 @@ window.assignJob = function assignJob(slave, job) { return r; }; +window.assignJobSafely = function assignJobSafely(slave, assignmentStr){ + if (V.assignmentRecords[slave.ID] === "choose her own job") { + assignJob(slave, "rest"); + slave.choosesOwnAssignment = 1; + } else if (!App.Utils.jobForAssignment(assignmentStr).canEmploy(slave).length) { // If nothing complains about job requirements not being met + assignJob(slave, assignmentStr); + } else { + assignJob(slave, "rest"); + } +}; + window.removeJob = function removeJob(slave, assignment) { "use strict"; let r = ""; @@ -396,6 +426,10 @@ window.removeJob = function removeJob(slave, assignment) { return r; } + if (V.assignmentRecords[slave.ID]) { + delete V.assignmentRecords[slave.ID]; + } + const idx = V.slaveIndices[slave.ID]; if (assignment === "Pit") { @@ -583,6 +617,10 @@ window.removeJob = function removeJob(slave, assignment) { slave.rules.living = "normal"; } + if (slave.choosesOwnAssignment > 0) { + V.assignmentRecords[slave.ID] = "choose her own job"; + } + slave.choosesOwnAssignment = 0; slave.sentence = 0; } @@ -900,8 +938,11 @@ App.Utils.jobForAssignment = function() { if (map.size === 0) { fillMap(); } - return map.get(assignment); + const res = map.get(assignment); + if (!res) { + throw Error(`Can't find job object for assignment '${assignment}'`); + } + return res; } - return getJob; }(); diff --git a/src/js/removeActiveSlave.js b/src/js/removeActiveSlave.js index e5ce66906de23fbd59c4ede720ea20765618796d..1d34fc8386a3e90b0a268d4a4afa3212ee80fa94 100644 --- a/src/js/removeActiveSlave.js +++ b/src/js/removeActiveSlave.js @@ -229,6 +229,10 @@ window.removeActiveSlave = function removeActiveSlave() { V.missingParentID--; } + if (V.assignmentRecords[AS_ID]) { + delete V.assignmentRecords[AS_ID]; + } + removeSlave(INDEX); LENGTH--; V.activeSlave = 0; diff --git a/src/uncategorized/BackwardsCompatibility.tw b/src/uncategorized/BackwardsCompatibility.tw index bb4142d9c589b891551ca7ddba053cbebe93ccbb..9491ea05451cb9454e056bdf09babd02678f5634 100644 --- a/src/uncategorized/BackwardsCompatibility.tw +++ b/src/uncategorized/BackwardsCompatibility.tw @@ -3150,7 +3150,9 @@ Setting missing slave variables: <<run App.Entity.Utils.SlaveDataSchemeCleanup($traitor)>> <<run SlaveDatatypeCleanup($traitor)>> <</if>> - +<<if ndef $assignmentRecords>> + <<set $assignmentRecords = {}>> +<</if>> Done<br> diff --git a/src/uncategorized/clinicReport.tw b/src/uncategorized/clinicReport.tw index f99fb156a410142e6a711dd3fdea6e9121f848e4..0f051540f9fc5be93292bdd80d75b8fce0faceb4 100644 --- a/src/uncategorized/clinicReport.tw +++ b/src/uncategorized/clinicReport.tw @@ -299,8 +299,29 @@ <<elseif ($Nurse != 0) && ($slaves[$i].pregAdaptation*1000 < $slaves[$i].bellyPreg || $slaves[$i].preg > $slaves[$i].pregData.normalBirth/1.33)>> <<elseif ($Nurse != 0) && ($clinicInflateBelly > 0) && ($slaves[$i].bellyImplant >= 0) && ($slaves[$i].bellyImplant <= ($arcologies[0].FSTransformationFetishistResearch ? 800000 : 130000))>> <<else>> - <br><br>''__@@.pink;$slaves[$i].slaveName@@__'' has been cured<<if ($Nurse != 0) && ($clinicUpgradeFilters == 1)>> and purified<</if>>, so @@.yellow;$his assignment has defaulted to rest.@@ - <<= removeJob($slaves[$i], "get treatment in the clinic")>> + <p> + <span class="slave-name">$slaves[$i].slaveName</span> has been cured<<if ($Nurse != 0) && ($clinicUpgradeFilters == 1)>> and purified<</if>>, + <span class="noteworthy"> + <<if $assignmentRecords[$slaves[$i].ID]>> + <<set _oldJob = $assignmentRecords[$slaves[$i].ID]>> + <<= assignJobSafely($slaves[$i], _oldJob)>> + <<if $slaves[$i].choosesOwnAssignment === 1>> + and $he is resting before choosing another task. + <<elseif $slaves[$i].assignment === "rest">> + <<if _oldJob != "rest">> + and since $he was unable to return to $his old task to <<print _oldJob>>, $his assignment has defaulted to rest. + <<else>> + so $he has returned to rest. + <</if>> + <<else>> + so $he goes back to <<print $slaves[$i].assignment>>. + <</if>> + <<else>> + so $his assignment has defaulted to rest. + <<= removeJob($slaves[$i], "get treatment in the clinic")>> + <</if>> + </span> + </p> <<set _restedSlaves++, _dI--, _DL-->> <<continue>> <</if>> diff --git a/src/uncategorized/saChoosesOwnJob.tw b/src/uncategorized/saChoosesOwnJob.tw index f69d8ea9cf35d4aa69a19df2ea11f3c24fac4784..849db7560e048932466aca30a3e96dff243501a9 100644 --- a/src/uncategorized/saChoosesOwnJob.tw +++ b/src/uncategorized/saChoosesOwnJob.tw @@ -2,6 +2,8 @@ <<set _clinicL = $CliniciIDs.length, _schoolL = $SchlRiIDs.length, _servQL = $ServQiIDs.length, _nurseryL = $NurseryiIDs.length, _brothelL = $BrothiIDs.length, _clubL = $ClubiIDs.length, _masterSL = $MastSiIDs.length, _spaL = $SpaiIDs.length, _dairyL = $DairyiIDs.length>> +<<setLocalPronouns $slaves[$i]>> + <<if ($slaves[$i].choosesOwnAssignment == 0) || ($slaves[$i].fuckdoll > 0) || ($slaves[$i].fetish == "mindbroken")>> /* nothing to do */ diff --git a/src/uncategorized/schoolroomReport.tw b/src/uncategorized/schoolroomReport.tw index b939302ffebde08527c2dc09a1394c83e7e6a1f9..252b5d1c427087443b638988a6bda9304da3519e 100644 --- a/src/uncategorized/schoolroomReport.tw +++ b/src/uncategorized/schoolroomReport.tw @@ -162,7 +162,11 @@ <</if>> /% Education done? Has to be here before we run the SA's or there will be double entries for slave %/ <<if $slaves[$i].fetish == "mindbroken">> - <<= removeJob($slaves[$i], "learn in the schoolroom")>> + <<if $assignmentRecords[$slaves[$i].ID]>> + <<= assignJobSafely($slaves[$i], $assignmentRecords[$slaves[$i].ID])>> + <<else>> + <<= removeJob($slaves[$i], "learn in the schoolroom")>> + <</if>> <<set _restedSlaves++, _dI--, _DL-->> <<continue>> <<else>> @@ -173,8 +177,29 @@ <<if ($slaves[$i].skill.entertainment > 30) || (($schoolroomUpgradeSkills == 0) && ($slaves[$i].skill.entertainment > 10))>> <<if ($slaves[$i].skill.anal > 30) || (($schoolroomUpgradeSkills == 0) && ($slaves[$i].skill.anal > 10))>> <<if ($slaves[$i].skill.vaginal > 30) || (($schoolroomUpgradeSkills == 0) && ($slaves[$i].skill.vaginal > 10)) || ($slaves[$i].vagina < 0)>> - <br><br>''__@@.pink;$slaves[$i].slaveName@@__'' can learn little from further classes, so @@.yellow;_his2 assignment has defaulted to rest.@@ - <<= removeJob($slaves[$i], "learn in the schoolroom")>> + <p> + <span class="slave-name">$slaves[$i].slaveName</span> can learn little from further classes, + <span class="noteworthy"> + <<if $assignmentRecords[$slaves[$i].ID]>> + <<set _oldJob = $assignmentRecords[$slaves[$i].ID]>> + <<= assignJobSafely($slaves[$i], _oldJob)>> + <<if $slaves[$i].choosesOwnAssignment === 1>> + and $he is resting before choosing another task. + <<elseif $slaves[$i].assignment === "rest">> + <<if _oldJob != "rest">> + and since $he was unable to return to $his old task to <<print _oldJob>>, $his assignment has defaulted to rest. + <<else>> + so $he has returned to rest. + <</if>> + <<else>> + so $he goes back to <<print $slaves[$i].assignment>>. + <</if>> + <<else>> + so _his2 assignment has defaulted to rest. + <<= removeJob($slaves[$i], "learn in the schoolroom")>> + <</if>> + </span> + </p> <<set _restedSlaves++, _dI--, _DL-->> <<continue>> <</if>> diff --git a/src/uncategorized/slaveInteract.tw b/src/uncategorized/slaveInteract.tw index 076fc739f09927e53467dac6c3d95a51bb77f2a9..46253cc557bc1b8db6fbdbeab9ffc4da6a207e79 100644 --- a/src/uncategorized/slaveInteract.tw +++ b/src/uncategorized/slaveInteract.tw @@ -506,7 +506,17 @@ /* CAN BE REASSIGNED */ - Assignment: <strong><span id="assign">$activeSlave.assignment<<if $activeSlave.sentence>> ($activeSlave.sentence weeks)<</if>></span>.</strong> + Assignment: + <span id="assign" font-weight="bold"> + <<if $activeSlave.sentence>> + $activeSlave.assignment ($activeSlave.sentence weeks). + <<else>> + $activeSlave.assignment. + <</if>> + </span> + <<if $assignmentRecords[$activeSlave.ID] && $assignmentRecords[$activeSlave.ID] != $activeSlave.assignment>> + Previously: <<print $assignmentRecords[$activeSlave.ID]>> + <</if>> <span id="assignmentLinks"><<= App.UI.SlaveInteract.assignmentBlock("assignmentLinks")>></span> <<set _numFacilities = $brothel+$club+$dairy+$farmyard+$servantsQuarters+$masterSuite+$spa+$nursery+$clinic+$schoolroom+$cellblock+$arcade+$HGSuite>> diff --git a/src/uncategorized/spaReport.tw b/src/uncategorized/spaReport.tw index 28d77963b349707c5dd73595fbd817e9e96133cf..40326adbf1d99702c29b91fa16b674eb377f3e2c 100644 --- a/src/uncategorized/spaReport.tw +++ b/src/uncategorized/spaReport.tw @@ -288,8 +288,29 @@ <<set $slaves[$i].rules.living = "luxurious">> <</switch>> <<if ($slaves[$i].health.condition >= 50) && ($slaves[$i].health.tired < 20) && ($slaves[$i].trust > 60) && ($slaves[$i].devotion > 60) && ($slaves[$i].fetish != "mindbroken") && ($slaves[$i].sexualFlaw == "none") && ($slaves[$i].behavioralFlaw == "none")>> - <br><br>''__@@.pink;$slaves[$i].slaveName@@__'' is feeling well enough to leave $spaName, so @@.yellow;$his assignment has defaulted to rest.@@ - <<= removeJob($slaves[$i], "rest in the spa")>> + <p> + <span class="slave-name">$slaves[$i].slaveName</span> is feeling well enough to leave $spaName, + <span class="noteworthy"> + <<if $assignmentRecords[$slaves[$i].ID]>> + <<set _oldJob = $assignmentRecords[$slaves[$i].ID]>> + <<= assignJobSafely($slaves[$i], _oldJob)>> + <<if $slaves[$i].choosesOwnAssignment === 1>> + and $he is resting before choosing another task. + <<elseif $slaves[$i].assignment === "rest">> + <<if _oldJob != "rest">> + and since $he was unable to return to $his old task to <<print _oldJob>>, $his assignment has defaulted to rest. + <<else>> + so $he has returned to rest. + <</if>> + <<else>> + so $he goes back to <<print $slaves[$i].assignment>>. + <</if>> + <<else>> + so $his assignment has defaulted to rest. + <<= removeJob($slaves[$i], "rest in the spa")>> + <</if>> + </span> + </p> <<set _restedSlaves++, _DL--, _dI-->> <<continue>> <</if>>