diff --git a/src/facilities/arcade/arcadeFramework.js b/src/facilities/arcade/arcadeFramework.js index c04c4d16cf9c3fecc39495df7bf813d3e89da5ad..b94e395071fbb96590c57a4ba89cdcbf7b770428 100644 --- a/src/facilities/arcade/arcadeFramework.js +++ b/src/facilities/arcade/arcadeFramework.js @@ -6,7 +6,12 @@ App.Data.Facilities.arcade = { position: "whore", assignment: "be confined in the arcade", publicSexUse: true, - fuckdollAccepted: true + fuckdollAccepted: true, + description: { + rulesAssistant: { + assigned:()=> `be confined in ${V.arcadeName}` + } + } }, }, defaultJob: "assignee", diff --git a/src/facilities/brothel/brothelFramework.js b/src/facilities/brothel/brothelFramework.js index 3548a8ac937eb165792707da425ab9bcb46084d6..302fb310d4d98b38881d9531cfd1744cc5770a2a 100644 --- a/src/facilities/brothel/brothelFramework.js +++ b/src/facilities/brothel/brothelFramework.js @@ -6,7 +6,12 @@ App.Data.Facilities.brothel = { position: "whore", assignment: "work in the brothel", publicSexUse: true, - fuckdollAccepted: false + fuckdollAccepted: false, + description: { + rulesAssistant: { + assigned:()=> `work in ${V.brothelName}` + } + } }, }, defaultJob: "assignee", diff --git a/src/facilities/cellblock/cellblockFramework.js b/src/facilities/cellblock/cellblockFramework.js index 1c40d3d83589a9e816ebc38150ddede29468f6ed..1917eda3b416f3036ff040b2128d9808614815f2 100644 --- a/src/facilities/cellblock/cellblockFramework.js +++ b/src/facilities/cellblock/cellblockFramework.js @@ -6,7 +6,12 @@ App.Data.Facilities.cellblock = { position: "confinee", assignment: "be confined in the cellblock", publicSexUse: false, - fuckdollAccepted: false + fuckdollAccepted: false, + description: { + rulesAssistant: { + assigned:()=> `be confined in ${V.cellblockName}` + } + } }, }, defaultJob: "assignee", diff --git a/src/facilities/clinic/clinicFramework.js b/src/facilities/clinic/clinicFramework.js index e5c1c8356612330cc503e777bb78e38207db0f73..f8b15403f97d616347f2c5e5adf5c34200ae8157 100644 --- a/src/facilities/clinic/clinicFramework.js +++ b/src/facilities/clinic/clinicFramework.js @@ -6,7 +6,12 @@ App.Data.Facilities.clinic = { position: "patient", assignment: "get treatment in the clinic", publicSexUse: false, - fuckdollAccepted: false + fuckdollAccepted: false, + description: { + rulesAssistant: { + assigned:()=> `get treatment in ${V.clinicName}` + } + } } }, defaultJob: "patient", diff --git a/src/facilities/club/clubFramework.js b/src/facilities/club/clubFramework.js index 9fc92ff7c07e70b686062d40191e117bef4fd4e6..05294e8594169725c35eba0b72336de8282ba841 100644 --- a/src/facilities/club/clubFramework.js +++ b/src/facilities/club/clubFramework.js @@ -6,7 +6,12 @@ App.Data.Facilities.club = { position: "Slut", assignment: "serve in the club", publicSexUse: true, - fuckdollAccepted: false + fuckdollAccepted: false, + description: { + rulesAssistant: { + assigned:()=> `serve in ${V.clubName}` + } + } }, }, defaultJob: "slut", diff --git a/src/facilities/dairy/dairyFramework.js b/src/facilities/dairy/dairyFramework.js index d8c4f8ebb874b7d1cb8b7a8142da72e1820f8c6f..58834f8fed270c32fdd59c79d84d4d71a77375ed 100644 --- a/src/facilities/dairy/dairyFramework.js +++ b/src/facilities/dairy/dairyFramework.js @@ -6,7 +6,12 @@ App.Data.Facilities.dairy = { position: "cow", assignment: "work in the dairy", publicSexUse: false, - fuckdollAccepted: false + fuckdollAccepted: false, + description: { + rulesAssistant: { + assigned:()=> `be milked in ${V.dairyName}` + } + } } }, defaultJob: "cow", diff --git a/src/facilities/farmyard/farmyardFramework.js b/src/facilities/farmyard/farmyardFramework.js index 29a2256ebd13bcc0ddf505d8e84c07c5b3a5193e..b9172753f9f2852a433b9a7bf190b9cb89307519 100644 --- a/src/facilities/farmyard/farmyardFramework.js +++ b/src/facilities/farmyard/farmyardFramework.js @@ -6,7 +6,12 @@ App.Data.Facilities.farmyard = { position: "farmhand", assignment: "work as a farmhand", publicSexUse: false, - fuckdollAccepted: false + fuckdollAccepted: false, + description: { + rulesAssistant: { + assigned:()=> `work in ${V.farmyardName}` + } + } } }, defaultJob: "farmhand", diff --git a/src/facilities/headGirlSuite/headGirlSuiteFramework.js b/src/facilities/headGirlSuite/headGirlSuiteFramework.js index c4676de022367146af348b785679637bd5c483ca..8c1e9c8f59d172a0ef2082ac9946e2a374844b40 100644 --- a/src/facilities/headGirlSuite/headGirlSuiteFramework.js +++ b/src/facilities/headGirlSuite/headGirlSuiteFramework.js @@ -6,7 +6,12 @@ App.Data.Facilities.headGirlSuite = { position: "Head Girl's toy", assignment: "live with your Head Girl", publicSexUse: true, - fuckdollAccepted: false + fuckdollAccepted: false, + description: { + rulesAssistant: { + assigned:()=> `live in your Head Girl's private suite` + } + } } }, defaultJob: "HGToy", diff --git a/src/facilities/masterSuite/masterSuiteFramework.js b/src/facilities/masterSuite/masterSuiteFramework.js index 473f51a600067d8d82d7f2394c2ead406b433238..e5cd58740ec35d8e6ae7f5206aa2489d8a65e630 100644 --- a/src/facilities/masterSuite/masterSuiteFramework.js +++ b/src/facilities/masterSuite/masterSuiteFramework.js @@ -6,7 +6,12 @@ App.Data.Facilities.masterSuite = { position: "fucktoy", assignment: "serve in the master suite", publicSexUse: false, - fuckdollAccepted: false + fuckdollAccepted: false, + description: { + rulesAssistant: { + assigned:()=> `${V.masterSuiteName}` + } + } } }, defaultJob: "fucktoy", diff --git a/src/facilities/nursery/nurseryFramework.js b/src/facilities/nursery/nurseryFramework.js index 208c47892a5135007783196f53cc80a7cc15ccf9..8993e3c346ed2b52a6a7683863d7770e2b6f256c 100644 --- a/src/facilities/nursery/nurseryFramework.js +++ b/src/facilities/nursery/nurseryFramework.js @@ -6,7 +6,12 @@ App.Data.Facilities.nursery = { position: "nanny", assignment: "work as a nanny", publicSexUse: false, - fuckdollAccepted: false + fuckdollAccepted: false, + description: { + rulesAssistant: { + assigned:()=> `work in ${V.nurseryName}` + } + } } }, defaultJob: "nanny", diff --git a/src/facilities/penthouse/penthouseFramework.js b/src/facilities/penthouse/penthouseFramework.js index d9a8bfb4da60437bd57412a1efaa1772a0aa0f4f..bb1f457b815845d0e855ce1b28b202747d7c3908 100644 --- a/src/facilities/penthouse/penthouseFramework.js +++ b/src/facilities/penthouse/penthouseFramework.js @@ -13,7 +13,13 @@ App.Data.Facilities.penthouse = { position: "Choose own", assignment: "choose her own job", publicSexUse: false, - fuckdollAccepted: false + fuckdollAccepted: false, + description: { + rulesAssistant: { + assigned:({pronouns:{his}})=>`select ${his} own assignments`, + assignedType: "allowed" + } + } }, fucktoy: { position: "Fucktoy", diff --git a/src/facilities/schoolroom/schoolroomFramework.js b/src/facilities/schoolroom/schoolroomFramework.js index 70e50d1ffea874f796f9d61a7cb9f16f8bd6788a..34b893c1ab3ec4e4c15751e87ac7d6da0f2883c0 100644 --- a/src/facilities/schoolroom/schoolroomFramework.js +++ b/src/facilities/schoolroom/schoolroomFramework.js @@ -6,7 +6,12 @@ App.Data.Facilities.schoolroom = { position: "", assignment: "learn in the schoolroom", publicSexUse: false, - fuckdollAccepted: false + fuckdollAccepted: false, + description: { + rulesAssistant: { + assigned:()=> `study in ${V.schoolroomName}` + } + } } }, defaultJob: "student", diff --git a/src/facilities/servantsQuarters/servantsQuartersFramework.js b/src/facilities/servantsQuarters/servantsQuartersFramework.js index ce4603f64781a44666da5d33e0964f984f53d340..d68c49c657bbba9d58f23fb85a75f5e308126a69 100644 --- a/src/facilities/servantsQuarters/servantsQuartersFramework.js +++ b/src/facilities/servantsQuarters/servantsQuartersFramework.js @@ -6,7 +6,12 @@ App.Data.Facilities.servantsQuarters = { position: "servant", assignment: "work as a servant", publicSexUse: false, - fuckdollAccepted: false + fuckdollAccepted: false, + description: { + rulesAssistant: { + assigned:()=> `work in ${V.servantsQuartersName}` + } + } } }, defaultJob: "servant", diff --git a/src/facilities/spa/spaFramework.js b/src/facilities/spa/spaFramework.js index 08b5ee443c15342178f834ef732699c4642b25a0..68006d7800821a143ec87af0d3795c74b43458cd 100644 --- a/src/facilities/spa/spaFramework.js +++ b/src/facilities/spa/spaFramework.js @@ -7,6 +7,11 @@ App.Data.Facilities.spa = { assignment: "rest in the spa", publicSexUse: false, fuckdollAccepted: false, + description: { + rulesAssistant: { + assigned:()=> `rest in ${V.spaName}` + } + } } }, defaultJob: "assignee", diff --git a/src/js/DefaultRules.js b/src/js/DefaultRules.js index 97ed261888899f6b508d3c321441619e9b4b6a0a..f4ed47570a9be9fd38ef7068d8080bd4ba1f51b9 100644 --- a/src/js/DefaultRules.js +++ b/src/js/DefaultRules.js @@ -3,10 +3,31 @@ window.DefaultRules = (function() { "use strict"; + const assignedTypes = { + "auto": {success:"has been automatically assigned", unable: "could not be assigned"}, + "allowed": {success:"is allowed", unable: "could not be allowed"}, + }; + const getAssignmentDescription = function({rule, slave, assignmentResult, append=null}) { + const job = App.Utils.jobForAssignment(rule.setAssignment).desc; + let work = job.assignment; + let descriptionType = "auto"; + const assignmentInfo = (job.description || {}).rulesAssistant; + if(assignmentInfo != null) { + if(assignmentInfo.assigned != null) { + work = assignmentInfo.assigned({slave, pronouns, rule}); + } + if(assignmentInfo.assignedType != null) { + descriptionType = assignmentInfo.assignedType; + } + } + const assignedTypeInfo = assignedTypes[descriptionType]; + if(assignedTypeInfo == null) { throw Error(`Unknown description type ${JSON.stringify(descriptionType)} in ${JSON.stringify(rule.setAssignment)}`); } + const hasBeenAssigned = assignedTypeInfo[assignmentResult]; + return `<br>${slave.slaveName} ${hasBeenAssigned} to ${work}${append || ''}.`; + }; + let r; - let he; - let him; - let his; + let pronouns, he, him, his; /** * @param {App.Entity.SlaveState} slave @@ -15,7 +36,7 @@ window.DefaultRules = (function() { function DefaultRules(slave) { if (slave.useRulesAssistant === 0) { return r; } // exempted r = ""; - ({he, him, his} = getPronouns(slave)); + ({he, him, his} = pronouns = getPronouns(slave)); const slaveReadOnly = createReadonlyProxy(slave); const {rule, ruleIds} = runWithReadonlyProxy(()=>ProcessSlaveRules(slaveReadOnly)); slave.currentRules = ruleIds; @@ -36,7 +57,7 @@ window.DefaultRules = (function() { ProcessArmAccessory(slave, rule); ProcessLegAccessory(slave, rule); } - ProcessPit(slave,rule); + ProcessPit(slave, rule); ProcessBellyImplant(slave, rule); if (isFertile(slave) || slave.pregWeek < 0) { ProcessContraceptives(slave, rule); @@ -111,20 +132,29 @@ window.DefaultRules = (function() { r += `<span class="red">raWidgets missing case for assignment 'V.{rule.setAssignment}'</span>.`; return rule; } + const removeAssignment = ()=> { + if (job.facility !== App.Entity.facilities.penthouse) { + RAFacilityRemove(slave, rule); // before deleting rule.setAssignment + } + delete rule.setAssignment; + }; switch (rule.setAssignment) { case "rest": case "please you": // slaves always qualify for this assignment break; default: - if (job.checkRequirements(slave).length === 0 && job.facility.hasFreeSpace) { - break; - } else { - if (job.facility !== App.Entity.facilities.penthouse) { - RAFacilityRemove(slave, rule); // before deleting rule.setAssignment - } - delete rule.setAssignment; + if (job.checkRequirements(slave).length !== 0) { + // no message to prevent spam + removeAssignment(); + } else if (!job.facility.hasFreeSpace) { + r += getAssignmentDescription({ + rule, slave, assignmentResult:"unable", + append:" because it was full" + }); + removeAssignment(); } + break; } return rule; } @@ -137,53 +167,7 @@ window.DefaultRules = (function() { // place slave on assignment defined by the rule if ((rule.setAssignment !== undefined && rule.setAssignment !== null)) { if (((rule.setAssignment === "choose her own job" && !slave.choosesOwnAssignment) || rule.setAssignment !== slave.assignment)) { - switch (rule.setAssignment) { - case "live with your Head Girl": - r += `<br>${slave.slaveName} has been automatically assigned to live in your Head Girl's private suite.`; - break; - case "be confined in the arcade": - r += `<br>${slave.slaveName} has been automatically assigned to be confined in ${V.arcadeName}.`; - break; - case "serve in the master suite": - r += `<br>${slave.slaveName} has been automatically assigned to ${V.masterSuiteName}.`; - break; - case "get treatment in the clinic": - r += `<br>${slave.slaveName} has been automatically assigned to get treatment in ${V.clinicName}.`; - break; - case "rest in the spa": - r += `<br>${slave.slaveName} has been automatically assigned to rest in ${V.spaName}.`; - break; - case "work as a nanny": - r += `<br>${slave.slaveName} has been automatically assigned to work in ${V.nurseryName}.`; - break; - case "work in the brothel": - r += `<br>${slave.slaveName} has been automatically assigned to work in ${V.brothelName}.`; - break; - case "serve in the club": - r += `<br>${slave.slaveName} has been automatically assigned to serve in ${V.clubName}.`; - break; - case "work in the dairy": - r += `<br>${slave.slaveName} has been automatically assigned to be milked in ${V.dairyName}.`; - break; - case "work as a farmhand": - r += `<br>${slave.slaveName} has been automatically assigned to work in ${V.farmyardName}.`; - break; - case "work as a servant": - r += `<br>${slave.slaveName} has been automatically assigned to work in ${V.servantsQuartersName}.`; - break; - case "learn in the schoolroom": - r += `<br>${slave.slaveName} has been automatically assigned to study in ${V.schoolroomName}.`; - break; - case "be confined in the cellblock": - r += `<br>${slave.slaveName} has been automatically assigned to be confined in ${V.cellblockName}.`; - break; - case "choose her own job": - r += `<br>${slave.slaveName} is now allowed to select ${his} own assignments.`; - break; - default: - r += `<br>${slave.slaveName} has been automatically assigned to ${rule.setAssignment}.`; - break; - } + r += getAssignmentDescription({rule, slave, assignmentResult:"success"}); assignJob(slave, rule.setAssignment); } } @@ -1509,7 +1493,7 @@ window.DefaultRules = (function() { * @param {App.RA.RuleSetters} rule */ - function ProcessPit(slave,rule){ + function ProcessPit(slave, rule){ if (rule.pitRules !== undefined && rule.pitRules !== null){ if (V.pit > 0){ if (rule.pitRules === 0){