Skip to content
Snippets Groups Projects
Commit 5ca7a9a7 authored by lowercasedonkey's avatar lowercasedonkey
Browse files

polish

parent d5dece46
No related branches found
No related tags found
1 merge request!8098Bulk slave to js
App.Markets.bulkSlaveIntro = function(slaveArray) { App.Markets.bulkSlaveIntro = function() {
const el = new DocumentFragment(); const el = new DocumentFragment();
const r = []; const r = [];
let _seed; let seed;
let p;
if (!V.market.introType || V.market.newSlaves.length === 0) { if (!V.market.introType || V.market.newSlaves.length === 0) {
V.market.introType = ""; V.market.introType = "";
} }
...@@ -11,41 +12,37 @@ App.Markets.bulkSlaveIntro = function(slaveArray) { ...@@ -11,41 +12,37 @@ App.Markets.bulkSlaveIntro = function(slaveArray) {
switch (V.market.introType) { switch (V.market.introType) {
case "": case "":
/* No message to give */ /* No message to give */
break;
case "multi": case "multi":
if (V.market.newSlaves.length > 1) { if (V.market.newSlaves.length > 1) {
r.push(`Your selection of ${V.market.newSlaves.length} slaves arrives from `); r.push(`Your selection of ${V.market.newSlaves.length} slaves arrives from ${App.Markets.marketName(V.market.slaveMarket, V.market.numArcology)}.`);
App.Markets.marketName(V.market.slaveMarket, V.market.numArcology)
r.push(`.`);
} else { } else {
r.push(`Your new slave from `); r.push(`Your new slave from ${App.Markets.marketName(V.market.slaveMarket, V.market.numArcology)} has arrived.`);
App.Markets.marketName(V.market.slaveMarket, V.market.numArcology)
r.push(` has arrived.`);
} }
break;
case "bulk": case "bulk":
r.push(`Your delivery of ${V.market.newSlaves.length} slaves arrives from ${App.Markets.marketName(V.market.slaveMarket, V.market.numArcology)}.`); r.push(`Your delivery of ${V.market.newSlaves.length} slaves arrives from ${App.Markets.marketName(V.market.slaveMarket, V.market.numArcology)}.`);
if (V.market.newSlaves.length !== V.market.numSlaves) { if (V.market.newSlaves.length !== V.market.numSlaves) {
r.push(`You were going to order ${V.market.numSlaves}, but V.assistant.name lowered it on financial grounds.`); r.push(`You were going to order ${V.market.numSlaves}, but ${V.assistant.name} lowered it on financial grounds.`);
} }
_seed = Math.ceil(V.slavesSeen - V.slaveMarketLimit); seed = Math.ceil(V.slavesSeen - V.slaveMarketLimit);
if (_seed > V.market.newSlaves.length) { if (seed > V.market.newSlaves.length) {
r.push(`You have cast such a wide net for slaves this week that all are more expensive than normal.`); r.push(`You have cast such a wide net for slaves this week that all are more expensive than normal.`);
} else if (_seed > 0) { } else if (seed > 0) {
r.push(`You have cast such a wide net for slaves this week that some (_seed) are more expensive than normal.`); r.push(`You have cast such a wide net for slaves this week that some (${seed}) are more expensive than normal.`);
} }
if (V.market.slaveMarket === "TFS") { if (V.market.slaveMarket === "TFS") {
/* Put line about The Futanari Sisters discount & pricing */ /* Put line about The Futanari Sisters discount & pricing */
} else if (V.discount === 475) { } else if (V.discount === 475) {
r.push(`Your bulk delivery came with a <span class="yellowgreen">5%</span> discount.`); r.push(`Your bulk delivery came with a <span class="yellowgreen">5%</span> discount.`);
} else { } else {
r.push(`With all your discounts factored in you got a <span class="yellowgreen">${(500 - V.discount) / 5}%</span> discount`); r.push(`With all your discounts factored in you got a <span class="yellowgreen">${(500 - V.discount) / 5}%</span> discount;`);
} }
r.push(`You spent <span class="yellowgreen">${cashFormat(V.spent)}</span> on your new slaves.<br><br>`); r.push(`You spent <span class="yellowgreen">${cashFormat(V.spent)}</span> on your new slaves.`);
break;
case "inStock": case "inStock":
r.push(`You clear out `); r.push(`You clear out ${App.Markets.marketName(V.market.slaveMarket, V.market.numArcology)} of its stock of ${V.market.newSlaves.length} slaves.`);
App.Markets.marketName(V.market.slaveMarket, V.market.numArcology)
r.push(` of its stock of ${V.market.newSlaves.length} slaves.`);
if (V.market.slaveMarket === "TFS") { if (V.market.slaveMarket === "TFS") {
/* Put line about The Futanari Sisters discount & pricing */ /* Put line about The Futanari Sisters discount & pricing */
} else if (V.discount === 475) { } else if (V.discount === 475) {
...@@ -53,16 +50,17 @@ App.Markets.bulkSlaveIntro = function(slaveArray) { ...@@ -53,16 +50,17 @@ App.Markets.bulkSlaveIntro = function(slaveArray) {
} else { } else {
r.push(`With all your discounts factored in you got a <span class="yellowgreen">${(500 - V.discount) / 5}%</span> discount`); r.push(`With all your discounts factored in you got a <span class="yellowgreen">${(500 - V.discount) / 5}%</span> discount`);
} }
r.push(`You spent <span class="yellowgreen">${cashFormat(V.spent)}</span> on your new slaves.<br><br>`); r.push(`You spent <span class="yellowgreen">${cashFormat(V.spent)}</span> on your new slaves.`);
break;
case "liquidator": case "liquidator":
r.push(`Your new pair of slaves look frightened and uncertain, but seem encouraged by each other's presence.`); r.push(`Your new pair of slaves look frightened and uncertain, but seem encouraged by each other's presence.`);
break;
case "egyptian": case "egyptian":
r.push(`They arrive hand-in-hand and don't let go of each other until the end of the enslavement process, and even after they break their grip and undress at your instruction, their eyes never stray far from each other. With a closer look at them, their blood relation is as obvious as their infatuation with one another. No wonder they couldn't keep it a secret.`); r.push(`They arrive hand-in-hand and don't let go of each other until the end of the enslavement process, and even after they break their grip and undress at your instruction, their eyes never stray far from each other. With a closer look at them, their blood relation is as obvious as their infatuation with one another. No wonder they couldn't keep it a secret.`);
break;
case "event": case "event":
r.push(`This is placeholder event info.`); r.push(`This is placeholder event info.`);
break;
} }
App.Events.addParagraph(el, r); App.Events.addParagraph(el, r);
/* remove the below line to make the intro blurb show up for every slave, not just the first */ /* remove the below line to make the intro blurb show up for every slave, not just the first */
...@@ -76,21 +74,18 @@ App.Markets.bulkSlaveIntro = function(slaveArray) { ...@@ -76,21 +74,18 @@ App.Markets.bulkSlaveIntro = function(slaveArray) {
SugarCube.Engine.play(V.returnTo); SugarCube.Engine.play(V.returnTo);
} else { } else {
if (V.market.newSlaves.length > 1) { if (V.market.newSlaves.length > 1) {
App.UI.DOM.appendNewElement("div", el, `Showing new slave ${V.market.newSlaveIndex + 1} of ${V.market.newSlaves.length}:`) App.UI.DOM.appendNewElement("div", el, `Showing new slave ${V.market.newSlaveIndex + 1} of ${V.market.newSlaves.length}:`);
} }
//<br><br>
/* Set slave to the desired newSlave so that existing code can be used */ /* Set slave to the desired newSlave so that existing code can be used */
const _slave = V.market.newSlaves[V.market.newSlaveIndex]; const _slave = V.market.newSlaves[V.market.newSlaveIndex];
/* Due to possible gingering, the Long Slave Description must be displayed before the New Slave Intro */ /* Due to possible gingering, the Long Slave Description must be displayed before the New Slave Intro */
/* policies were applied earlier, if needed */ /* policies were applied earlier, if needed */
el.append(App.Desc.longSlave(_slave, { market: "generic" })); el.append(App.Desc.longSlave(_slave, {market: "generic"}));
//<br>
/* Use existing New Slave Intro */ /* Use existing New Slave Intro */
el.append(App.UI.newSlaveIntro(_slave))/* calls removeGingering() if needed */ el.append(App.UI.newSlaveIntro(_slave));/* calls removeGingering() if needed */
/* Override nextButton setting from New Slave Intro */ /* Override nextButton setting from New Slave Intro */
V.nextButton = "Continue"; V.nextButton = "Continue";
...@@ -98,14 +93,30 @@ App.Markets.bulkSlaveIntro = function(slaveArray) { ...@@ -98,14 +93,30 @@ App.Markets.bulkSlaveIntro = function(slaveArray) {
App.Utils.updateUserButton(); App.Utils.updateUserButton();
/* Add an option = goto the next slave below the New Slave Intro section */ /* Add an option = goto the next slave below the New Slave Intro section */
//<br><br>
p = document.createElement("p");
if (V.market.newSlaveIndex < (V.market.newSlaves.length - 1)) { if (V.market.newSlaveIndex < (V.market.newSlaves.length - 1)) {
[[Next Slave | Bulk Slave Intro]] p.append(
App.UI.DOM.passageLink(
`Next Slave`,
`Bulk Slave Intro`
)
);
} else { } else {
[[Finish introducing slaves | Bulk Slave Intro][V.market.newSlavesDone = 1]] p.append(
App.UI.DOM.link(
`Finish introducing slaves`,
() => {
V.market.newSlavesDone = 1;
},
[],
`Bulk Slave Intro`
)
);
} }
el.append(p);
}/* Closes no new Slaves check */ } /* Closes no new Slaves check */
V.market.newSlaveIndex++; V.market.newSlaveIndex++;
return el;
}; };
:: Bulk Slave Intro [nobr] :: Bulk Slave Intro [nobr]
<<if ndef $market.introType || $market.newSlaves.length == 0>> <<includeDOM App.Markets.bulkSlaveIntro()>>
<<set $market.introType = "">>
<</if>>
<<if isNaN($market.newSlaveIndex)>>
<<set $market.newSlaveIndex = 0>>
<</if>>
<<switch $market.introType>>
<<case "">>
/* No message to give */
<<case "multi">>
<<if $market.newSlaves.length > 1>>
Your selection of $market.newSlaves.length slaves arrives from <<= App.Markets.marketName($market.slaveMarket, $market.numArcology)>>.
<<else>>
Your new slave from <<= App.Markets.marketName($market.slaveMarket, $market.numArcology)>> has arrived.
<</if>>
<<case "bulk">>
Your delivery of $market.newSlaves.length slaves arrives from <<= App.Markets.marketName($market.slaveMarket, $market.numArcology)>>.
<<if $market.newSlaves.length != $market.numSlaves>>
You were going to order $market.numSlaves, but $assistant.name lowered it on financial grounds.
<</if>>
<<set _seed = Math.ceil($slavesSeen - $slaveMarketLimit)>>
<<if _seed > $market.newSlaves.length>>
You have cast such a wide net for slaves this week that all are more expensive than normal.
<<elseif _seed > 0>>
You have cast such a wide net for slaves this week that some (_seed) are more expensive than normal.
<</if>>
<<if $market.slaveMarket == "TFS">>
/* Put line about The Futanari Sisters discount & pricing */
<<elseif $discount == 475>>
Your bulk delivery came with a @@.yellowgreen;5%@@ discount.
<<else>>
With all your discounts factored in you got a @@.yellowgreen;<<print (500-$discount)/5>>%@@ discount;
<</if>>
You spent @@.yellowgreen;<<print cashFormat($spent)>>@@ on your new slaves.<br><br>
<<case "inStock">>
You clear out <<= App.Markets.marketName($market.slaveMarket, $market.numArcology)>> of its stock of $market.newSlaves.length slaves.
<<if $market.slaveMarket == "TFS">>
/* Put line about The Futanari Sisters discount & pricing */
<<elseif $discount == 475>>
Your bulk delivery came with a @@.yellowgreen;5%@@ discount.
<<else>>
With all your discounts factored in you got a @@.yellowgreen;<<print (500-$discount)/5>>%@@ discount;
<</if>>
You spent @@.yellowgreen;<<print cashFormat($spent)>>@@ on your new slaves.<br><br>
<<case "liquidator">>
<p>Your new pair of slaves look frightened and uncertain, but seem encouraged by each other's presence.</p>
<<case "egyptian">>
<p>They arrive hand-in-hand and don't let go of each other until the end of the enslavement process, and even after they break their grip and undress at your instruction, their eyes never stray far from each other. With a closer look at them, their blood relation is as obvious as their infatuation with one another. No wonder they couldn't keep it a secret.</p>
<<case "event">>
This is placeholder event info.
<</switch>>
/* remove the below line to make the intro blurb show up for every slave, not just the first */
<<set $market.introType = "">>
<<if ($market.newSlaveIndex >= $market.newSlaves.length) || ($market.newSlavesDone == 1)>>
/* Variable Clean-up */
<<set $market.newSlaves = []>>
<<set $market.newSlavesDone = 0>>
<<set $market.introType = "">>
<<goto $returnTo>>
<<else>>
<<if $market.newSlaves.length > 1>>
Showing new slave <<print $market.newSlaveIndex+1>> of <<print $market.newSlaves.length>>:
<</if>>
<br><br>
/* Set slave to the desired newSlave so that existing code can be used */
<<set _slave = $market.newSlaves[$market.newSlaveIndex]>>
/* Due to possible gingering, the Long Slave Description must be displayed before the New Slave Intro */
/* policies were applied earlier, if needed */
<<includeDOM App.Desc.longSlave(_slave, {market: "generic"})>>
<br>
/* Use existing New Slave Intro */
<<includeDOM App.UI.newSlaveIntro(_slave)>> /* calls removeGingering() if needed */
/* Override nextButton setting from New Slave Intro */
<<set $nextButton = "Continue">>
<<set $nextLink = "Bulk Slave Intro">>
/* Add an option = goto the next slave below the New Slave Intro section */
<br><br>
<<if $market.newSlaveIndex < ($market.newSlaves.length - 1)>>
[[Next Slave|Bulk Slave Intro]]
<<else>>
[[Finish introducing slaves|Bulk Slave Intro][$market.newSlavesDone = 1]]
<</if>>
<</if>> /* Closes no new Slaves check */
<<set $market.newSlaveIndex++>>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment