From 62c2d55e7427de311a8e44ce389b69c6348e676b Mon Sep 17 00:00:00 2001 From: Svornost <11434-svornost@users.noreply.gitgud.io> Date: Mon, 29 Jun 2020 13:20:49 -0700 Subject: [PATCH] Allow event resultHandlers to return a single object instead of an array to make it a bit easier to manage, and change existing events which now do unnecessary array-wrapping. --- src/events/RECI/butthole.js | 4 ++-- src/events/RESS/moistPussy.js | 2 +- src/events/RESS/muscles.js | 2 +- src/events/RESS/retchingCum.js | 6 +++--- src/events/RESS/waistlineWoes.js | 2 +- src/events/eventUtils.js | 11 ++++++++--- 6 files changed, 16 insertions(+), 11 deletions(-) diff --git a/src/events/RECI/butthole.js b/src/events/RECI/butthole.js index 515c3a21161..0b9bc576b51 100644 --- a/src/events/RECI/butthole.js +++ b/src/events/RECI/butthole.js @@ -518,7 +518,7 @@ App.Events.RECIButthole = class RECIButthole extends App.Events.BaseEvent { eventSlave.devotion += 2; partnerSlave.devotion += 2; - return [container]; + return container; } function talk() { @@ -688,7 +688,7 @@ App.Events.RECIButthole = class RECIButthole extends App.Events.BaseEvent { eventSlave.trust += 4; App.Events.addParagraph(container, t); - return [container]; + return container; } function assFuck() { diff --git a/src/events/RESS/moistPussy.js b/src/events/RESS/moistPussy.js index bdc38648f48..296f40ee3b3 100644 --- a/src/events/RESS/moistPussy.js +++ b/src/events/RESS/moistPussy.js @@ -159,7 +159,7 @@ App.Events.RESSMoistPussy = class RESSMoistPussy extends App.Events.BaseEvent { eventSlave.devotion += 5; App.Events.addParagraph(container, t); - return [container]; + return container; } function pound() { diff --git a/src/events/RESS/muscles.js b/src/events/RESS/muscles.js index a109c897f3f..5e0a0ea033f 100644 --- a/src/events/RESS/muscles.js +++ b/src/events/RESS/muscles.js @@ -184,7 +184,7 @@ App.Events.RESSMuscles = class RESSMuscles extends App.Events.BaseEvent { } function compliment() { - return [`${He} finishes posing with an impressive display of ${his} obliques. ${He} walks powerfully to the shower, ${his} ripped buttocks delineating each step. The shower is glass-walled. As ${he} washes, several of your other slaves are waking up and starting their days. They can't help but stare as ${eventSlave.slaveName} soaps ${himself}. ${eventSlave.slaveName} enjoys the attention.`]; + return `${He} finishes posing with an impressive display of ${his} obliques. ${He} walks powerfully to the shower, ${his} ripped buttocks delineating each step. The shower is glass-walled. As ${he} washes, several of your other slaves are waking up and starting their days. They can't help but stare as ${eventSlave.slaveName} soaps ${himself}. ${eventSlave.slaveName} enjoys the attention.`; } } }; diff --git a/src/events/RESS/retchingCum.js b/src/events/RESS/retchingCum.js index b91252c2016..05c48157f20 100644 --- a/src/events/RESS/retchingCum.js +++ b/src/events/RESS/retchingCum.js @@ -78,20 +78,20 @@ App.Events.RESSRetchingCum = class RESSRetchingCum extends App.Events.BaseEvent eventSlave.devotion -= 5; eventSlave.trust += 5; eventSlave.dietCum = 0; - return [`You see how ${eventSlave.slaveName} is suffering and you decide to reconsider ${his} dietary prescription. You instruct ${V.assistant.name} to change ${eventSlave.slaveName}'s diet to exclude cum for now. Slaves who can't eat are unhealthy, and unhealthy slaves are unprofitable slaves. ${He} is now <span class="mediumorchid">more confident that ${he} can resist you and get ${his} way,</span> ${he} also <span class="mediumaquamarine">trusts you a little more</span> to look after ${his} well being.`]; + return `You see how ${eventSlave.slaveName} is suffering and you decide to reconsider ${his} dietary prescription. You instruct ${V.assistant.name} to change ${eventSlave.slaveName}'s diet to exclude cum for now. Slaves who can't eat are unhealthy, and unhealthy slaves are unprofitable slaves. ${He} is now <span class="mediumorchid">more confident that ${he} can resist you and get ${his} way,</span> ${he} also <span class="mediumaquamarine">trusts you a little more</span> to look after ${his} well being.`; } function heavy() { eventSlave.devotion -= 3; eventSlave.trust -= 3; eventSlave.dietCum = 2; - return [`You instruct ${V.assistant.name} to double down on ${eventSlave.slaveName}'s cum diet. Ungrateful little sluts who retch up their expensive food sometimes need tough love. Making ${his} cum-food thicker and more concentrated might help ${him} to learn that no matter how bad things seem, you can always make them worse. Initially ${his} new heavy cum diet makes no difference in ${his} ability to keep it down, but you tell ${him} to give it some time. Eventually ${he} will learn to appreciate cum as the primary ingredient in everything ${he} ingests. All of your future cumsluts do, sooner or later. ${His} pathetic tears reveal how <span class="gold">helpless ${he} feels,</span> but they don't hide the <span class="mediumorchid">streak of rebelliousness</span> that remains burning inside ${him}.`]; + return `You instruct ${V.assistant.name} to double down on ${eventSlave.slaveName}'s cum diet. Ungrateful little sluts who retch up their expensive food sometimes need tough love. Making ${his} cum-food thicker and more concentrated might help ${him} to learn that no matter how bad things seem, you can always make them worse. Initially ${his} new heavy cum diet makes no difference in ${his} ability to keep it down, but you tell ${him} to give it some time. Eventually ${he} will learn to appreciate cum as the primary ingredient in everything ${he} ingests. All of your future cumsluts do, sooner or later. ${His} pathetic tears reveal how <span class="gold">helpless ${he} feels,</span> but they don't hide the <span class="mediumorchid">streak of rebelliousness</span> that remains burning inside ${him}.`; } function reduce() { eventSlave.devotion += 2; eventSlave.trust += 2; eventSlave.dietCum = 1; - return [`${eventSlave.slaveName} is on a very heavy cum diet, and it's possible you're forcing ${him} to take too much, too soon. You decide to give ${him} a break and instruct ${V.assistant.name} to reduce, but not eliminate the amount of cum in ${his} diet. Although it doesn't immediately make ${him} hate cum any less, <span class="hotpink">${he} appreciates your willingness</span> to make things a little less unpleasant for ${him}. <span class="mediumaquamarine">${He} is a little less afraid of you too,</span> although not as much as if you'd taken ${him} off ${his} cum diet altogether.`]; + return `${eventSlave.slaveName} is on a very heavy cum diet, and it's possible you're forcing ${him} to take too much, too soon. You decide to give ${him} a break and instruct ${V.assistant.name} to reduce, but not eliminate the amount of cum in ${his} diet. Although it doesn't immediately make ${him} hate cum any less, <span class="hotpink">${he} appreciates your willingness</span> to make things a little less unpleasant for ${him}. <span class="mediumaquamarine">${He} is a little less afraid of you too,</span> although not as much as if you'd taken ${him} off ${his} cum diet altogether.`; } function double() { diff --git a/src/events/RESS/waistlineWoes.js b/src/events/RESS/waistlineWoes.js index b6fc1244d05..2dfa25fe0a3 100644 --- a/src/events/RESS/waistlineWoes.js +++ b/src/events/RESS/waistlineWoes.js @@ -402,7 +402,7 @@ App.Events.RESSWaistlineWoes = class RESSWaistlineWoes extends App.Events.BaseEv eventSlave.weight -= 5; App.Events.addParagraph(frag, t); - return [frag]; + return frag; } function shoo() { diff --git a/src/events/eventUtils.js b/src/events/eventUtils.js index cbc83be5fb5..141c1e108f7 100644 --- a/src/events/eventUtils.js +++ b/src/events/eventUtils.js @@ -143,9 +143,9 @@ App.Events.addParagraph = function(node, sentences) { node.appendChild(para); }; -/** result handler callback - process the result and return an array of mixed strings and DOM nodes +/** result handler callback - process the result and return an array of mixed strings and DOM nodes, or a single string or DOM node * @callback resultHandler - * @returns {Array<string|HTMLElement|DocumentFragment>} + * @returns {Array<string|HTMLElement|DocumentFragment>|string|HTMLElement|DocumentFragment} */ /** a response to an event, and its result */ App.Events.Result = class { @@ -165,7 +165,12 @@ App.Events.Result = class { */ handle(resultSpanID) { let frag = document.createDocumentFragment(); - $(frag).append(...App.Events.spaceSentences(this.handler())); + let contents = this.handler(); + if (Array.isArray(contents)) { + $(frag).append(...App.Events.spaceSentences(contents)); + } else { + $(frag).append(contents); + } App.UI.DOM.replace(`#${resultSpanID}`, frag); } -- GitLab