From 0afdef7b15a2b72054baad64f82834b38d2607f3 Mon Sep 17 00:00:00 2001
From: lowercasedonkey <lowercasedonkey@gmail.com>
Date: Wed, 22 Apr 2020 18:42:07 -0400
Subject: [PATCH] group drugs by category

---
 src/interaction/slaveInteract.js | 289 ++++++++++++++++++++-----------
 1 file changed, 188 insertions(+), 101 deletions(-)

diff --git a/src/interaction/slaveInteract.js b/src/interaction/slaveInteract.js
index d8a3f70062e..c6212a471e3 100644
--- a/src/interaction/slaveInteract.js
+++ b/src/interaction/slaveInteract.js
@@ -306,211 +306,221 @@ App.UI.SlaveInteract.drugs = function(slave) {
 		He,
 		His
 	} = getPronouns(slave);
-	const drugOptions = [];
 	const drugLevelOptions = [];
+	const lips = [];
+	const breasts = [];
+	const nipples = [];
+	const butt = [];
+	const dick = [];
+	const balls = [];
+	const fertility = [];
+	const hormones = [];
+	const psych = [];
+	const misc = [];
 
 	if (slave.drugs !== "no drugs") {
 		drugLevelOptions.push({text: `None`, updateSlave: {drugs: `no drugs`}});
 	}
 	if (slave.indentureRestrictions < 2) {
-		if (
-			slave.drugs === "intensive breast injections" ||
-			slave.drugs === "intensive butt injections" ||
-			slave.drugs === "intensive penis enhancement" ||
-			slave.drugs === "intensive testicle enhancement"
-		) {
-			switch (slave.drugs) {
-				case "intensive breast injections":
-					drugLevelOptions.push({text: `Moderate`, updateSlave: {drugs: `breast injections`}});
-					break;
-				case "intensive butt injections":
-					drugLevelOptions.push({text: `Moderate`, updateSlave: {drugs: `butt injections`}});
-					break;
-				case "intensive penis enhancement":
-					drugLevelOptions.push({text: `Moderate`, updateSlave: {drugs: `penis enhancement`}});
-					break;
-				case "intensive testicle enhancement":
-					drugLevelOptions.push({text: `Moderate`, updateSlave: {drugs: `testicle enhancement`}});
-					break;
-			}
-		} else if (slave.drugs === "breast injections" || slave.drugs === "butt injections" || slave.drugs === "penis enhancement" || slave.drugs === "testicle enhancement") {
-			drugLevelOptions.push({text: `Intensify`, updateSlave: {drugs: "intensive " + slave.drugs}});
-		}
+
+		// Psych
 		if (slave.intelligence > -100 && slave.indentureRestrictions < 1) {
-			drugOptions.push({text: `Psychosuppressants`, updateSlave: {drugs: `psychosuppressants`}});
+			psych.push({text: `Psychosuppressants`, updateSlave: {drugs: `psychosuppressants`}});
 		} else if (slave.intelligence > -100) {
-			drugOptions.push({text: `Psychosuppressants`, disabled: `Cannot suppress indentured slave`});
+			psych.push({text: `Psychosuppressants`, disabled: `Cannot suppress indentured slave`});
 		} else if (slave.indentureRestrictions < 1) {
-			drugOptions.push({text: `Psychosuppressants`, disabled: `Too stupid to suppress`});
+			psych.push({text: `Psychosuppressants`, disabled: `Too stupid to suppress`});
 		} else {
-			drugOptions.push({text: `Psychosuppressants`, disabled: `Too stupid and indentured to suppress`});
+			psych.push({text: `Psychosuppressants`, disabled: `Too stupid and indentured to suppress`});
 		}
 		if (V.arcologies[0].FSSlaveProfessionalismResearch === 1) {
 			if (canImproveIntelligence(slave)) {
-				drugOptions.push({text: `Psychostimulants`, updateSlave: {drugs: `psychostimulants`}});
+				psych.push({text: `Psychostimulants`, updateSlave: {drugs: `psychostimulants`}});
 			} else {
-				drugOptions.push({text: `Psychostimulants`, disabled: `Cannot improve intelligence`});
+				psych.push({text: `Psychostimulants`, disabled: `Cannot improve intelligence`});
 			}
 		}
+
+		// Breasts
 		if (slave.boobs < 48000) {
-			drugOptions.push({text: `Breasts`, updateSlave: {drugs: `breast injections`}});
+			breasts.push({text: `Breasts`, updateSlave: {drugs: `breast injections`}});
 		} else {
-			drugOptions.push({text: `Breasts`, disabled: `Boobs are too large`});
+			breasts.push({text: `Breasts`, disabled: `Boobs are too large`});
 		}
 		if (V.arcologies[0].FSAssetExpansionistResearch === 1) {
 			if (slave.boobs < 25000) {
-				drugOptions.push({text: `Hyper-Breasts`, updateSlave: {drugs: `hyper breast injections`}});
+				breasts.push({text: `Hyper-Breasts`, updateSlave: {drugs: `hyper breast injections`}});
+			} else {
+				breasts.push({text: `Hyper Breasts`, disabled: `Boobs are too large`});
+			}
+		}
+		if (V.arcologies[0].FSSlimnessEnthusiastResearch === 1) {
+			if ((slave.boobs - slave.boobsImplant - slave.boobsMilk) > 100) {
+				breasts.push({text: `Breast reducers`, updateSlave: {drugs: `breast redistributors`}});
 			} else {
-				drugOptions.push({text: `Hyper Breasts`, disabled: `Boobs are too large`});
+				breasts.push({text: `Breast reducers`, disabled: `Boobs are too small`});
 			}
 		}
+
+		// Nipples
 		if(V.dispensary) {
 			if ((["inverted", "partially inverted", "cute", "tiny", "puffy"].includes(slave.nipples))) {
-				drugOptions.push({text: `Nipple enhancers`, updateSlave: {drugs: `nipple enhancers`}});
+				nipples.push({text: `Nipple enhancers`, updateSlave: {drugs: `nipple enhancers`}});
 			} else if(slave.nipples === "huge") {
-				drugOptions.push({text: `Nipple enhancers`, disabled: `Nipples are already huge`});
+				nipples.push({text: `Nipple enhancers`, disabled: `Nipples are already huge`});
 			} else {
-				drugOptions.push({text: `Nipple enhancers`, disabled: `Has no effect on ${slave.nipples} nipples`});
+				nipples.push({text: `Nipple enhancers`, disabled: `Has no effect on ${slave.nipples} nipples`});
 			}
 		}
 		if (V.arcologies[0].FSSlimnessEnthusiastResearch === 1) {
-			if ((slave.boobs - slave.boobsImplant - slave.boobsMilk) > 100) {
-				drugOptions.push({text: `Breast reducers`, updateSlave: {drugs: `breast redistributors`}});
-			} else {
-				drugOptions.push({text: `Breast reducers`, disabled: `Boobs are too small`});
-			}
 			if (slave.nipples === "huge" || slave.nipples === "puffy" || slave.nipples === "cute") {
-				drugOptions.push({text: `Nipple reducers`, updateSlave: {drugs: `nipple atrophiers`}});
+				nipples.push({text: `Nipple reducers`, updateSlave: {drugs: `nipple atrophiers`}});
 			} else {
-				drugOptions.push({text: `Nipple reducers`, disabled: `Nipples are ${slave.nipples}`});
+				nipples.push({text: `Nipple reducers`, disabled: `Nipples are ${slave.nipples}`});
 			}
 		}
+
+		// Butt
 		if (slave.butt < 9) {
-			drugOptions.push({text: `Buttocks`, updateSlave: {drugs: `butt injections`}});
+			butt.push({text: `Buttocks`, updateSlave: {drugs: `butt injections`}});
 		} else {
-			drugOptions.push({text: `Buttocks`, disabled: `Butt is too large`});
+			butt.push({text: `Buttocks`, disabled: `Butt is too large`});
 		}
 		if (V.arcologies[0].FSAssetExpansionistResearch === 1) {
 			if (slave.butt < 20) {
-				drugOptions.push({text: `Hyper-Buttocks`, updateSlave: {drugs: `hyper butt injections`}});
+				butt.push({text: `Hyper-Buttocks`, updateSlave: {drugs: `hyper butt injections`}});
 			} else {
-				drugOptions.push({text: `Hyper Buttocks`, disabled: `Butt is too large`});
+				butt.push({text: `Hyper Buttocks`, disabled: `Butt is too large`});
 			}
 		}
 		if (V.arcologies[0].FSSlimnessEnthusiastResearch === 1) {
 			if (slave.butt - slave.buttImplant > 0) {
-				drugOptions.push({text: `Butt reducers`, updateSlave: {drugs: `butt redistributors`}});
+				butt.push({text: `Butt reducers`, updateSlave: {drugs: `butt redistributors`}});
 			} else {
-				drugOptions.push({text: `Butt reducers`, disabled: `Butt is too small`});
+				butt.push({text: `Butt reducers`, disabled: `Butt is too small`});
 			}
 		}
+
+		// Lips
 		if (slave.lips <= 95 || (slave.lips <= 85 && V.seeExtreme !== 1)) {
-			drugOptions.push({text: `Lips`, updateSlave: {drugs: `lip injections`}});
+			lips.push({text: `Lips`, updateSlave: {drugs: `lip injections`}});
 		} else {
-			drugOptions.push({text: `Lips`, disabled: `Lips are too large`});
+			lips.push({text: `Lips`, disabled: `Lips are too large`});
 		}
 		if (V.arcologies[0].FSSlimnessEnthusiastResearch === 1) {
 			if (slave.lips - slave.lipsImplant > 0) {
-				drugOptions.push({text: `Lip reducers`, updateSlave: {drugs: `lip atrophiers`}});
-			} else {
-				drugOptions.push({text: `Lip reducers`, disabled: `Lips are too small`});
-			}
-		}
-		if (V.growthStim === 1) {
-			if (canImproveHeight(slave)) {
-				drugOptions.push({text: `Growth Stimulants`, updateSlave: {drugs: `growth stimulants`}});
+				lips.push({text: `Lip reducers`, updateSlave: {drugs: `lip atrophiers`}});
 			} else {
-				drugOptions.push({text: `Growth Stimulants`, disabled: `Cannot increase height further`});
+				lips.push({text: `Lip reducers`, disabled: `Lips are too small`});
 			}
 		}
-		drugOptions.push({text: `Fertility`, updateSlave: {drugs: `fertility drugs`}});
+
+		// Fertility
+		fertility.push({text: `Fertility`, updateSlave: {drugs: `fertility drugs`}});
 		if (V.seeHyperPreg === 1 && slave.indentureRestrictions < 1 && V.superFertilityDrugs === 1 && (slave.breedingMark !== 1 || V.propOutcome === 0 || V.eugenicsFullControl === 1 || V.arcologies[0].FSRestart === "unset")) {
-			drugOptions.push({text: `Fertility+`, updateSlave: {drugs: `super fertility drugs`}});
+			fertility.push({text: `Fertility+`, updateSlave: {drugs: `super fertility drugs`}});
 		}
+
+		// Dick/clit
 		if (slave.dick > 0) {
 			if (slave.dick < 10) {
-				drugOptions.push({text: `Penis enhancement`, updateSlave: {drugs: `penis enhancement`}});
+				dick.push({text: `Penis enhancement`, updateSlave: {drugs: `penis enhancement`}});
 			} else {
-				drugOptions.push({text: `Penis enhancement`, disabled: `Dick is too large`});
+				dick.push({text: `Penis enhancement`, disabled: `Dick is too large`});
 			}
 		} else {
 			if (slave.clit < 5) {
-				drugOptions.push({text: `Clitoris enhancement`, updateSlave: {drugs: `penis enhancement`}});
+				dick.push({text: `Clitoris enhancement`, updateSlave: {drugs: `penis enhancement`}});
 			} else {
-				drugOptions.push({text: `Clitoris enhancement`, disabled: `Clit is too large`});
+				dick.push({text: `Clitoris enhancement`, disabled: `Clit is too large`});
 			}
 		}
 		if (V.arcologies[0].FSAssetExpansionistResearch === 1) {
 			if (slave.dick > 0) {
 				if (slave.dick < 31) {
-					drugOptions.push({text: `Hyper penis enhancement`, updateSlave: {drugs: `hyper penis enhancement`}});
+					dick.push({text: `Hyper penis enhancement`, updateSlave: {drugs: `hyper penis enhancement`}});
 				} else {
-					drugOptions.push({text: `Hyper penis enhancement`, disabled: `Dick is too large`});
+					dick.push({text: `Hyper penis enhancement`, disabled: `Dick is too large`});
 				}
 			} else {
 				if (slave.clit < 5) {
-					drugOptions.push({text: `Hyper clitoris enhancement`, updateSlave: {drugs: `penis enhancement`}});
+					dick.push({text: `Hyper clitoris enhancement`, updateSlave: {drugs: `penis enhancement`}});
 				} else {
-					drugOptions.push({text: `Hyper clitoris enhancement`, disabled: `Clit is too large`});
+					dick.push({text: `Hyper clitoris enhancement`, disabled: `Clit is too large`});
 				}
 			}
 		}
 		if (V.arcologies[0].FSSlimnessEnthusiastResearch === 1) {
 			if (slave.dick > 1) {
-				drugOptions.push({text: `Penis reducers`, updateSlave: {drugs: `penis atrophiers`}});
+				dick.push({text: `Penis reducers`, updateSlave: {drugs: `penis atrophiers`}});
 			} else if (slave.dick === 1) {
-				drugOptions.push({text: `Penis reducers`, disabled: `Dick is already at minimum size`});
+				dick.push({text: `Penis reducers`, disabled: `Dick is already at minimum size`});
+			}
+			if (slave.clit > 0) {
+				dick.push({text: `Clitoris reducers`, updateSlave: {drugs: `clitoris atrophiers`}});
 			}
 		}
 		if (slave.dick > 0 && slave.dick < 11 && !canAchieveErection(slave) && slave.chastityPenis !== 1) {
-			drugOptions.push({text: `Erectile dysfunction circumvention`, updateSlave: {drugs: `priapism agents`}});
+			dick.push({text: `Erectile dysfunction circumvention`, updateSlave: {drugs: `priapism agents`}});
 		}
+
+		// Balls
 		if (slave.balls > 0) {
-			drugOptions.push({text: `Testicle enhancement`, updateSlave: {drugs: `testicle enhancement`}});
+			balls.push({text: `Testicle enhancement`, updateSlave: {drugs: `testicle enhancement`}});
 			if (V.arcologies[0].FSAssetExpansionistResearch === 1) {
-				drugOptions.push({text: `Hyper testicle enhancement`, updateSlave: {drugs: `hyper testicle enhancement`}});
+				balls.push({text: `Hyper testicle enhancement`, updateSlave: {drugs: `hyper testicle enhancement`}});
 			}
 		}
 		if (V.arcologies[0].FSSlimnessEnthusiastResearch === 1) {
 			if (slave.balls > 1) {
-				drugOptions.push({text: `Testicle reducers`, updateSlave: {drugs: `testicle atrophiers`}});
+				balls.push({text: `Testicle reducers`, updateSlave: {drugs: `testicle atrophiers`}});
 			} else if (slave.balls === 1) {
-				drugOptions.push({text: `Testicle reducers`, disabled: `Balls are already at minimum size`});
+				balls.push({text: `Testicle reducers`, disabled: `Balls are already at minimum size`});
 			}
-			if (slave.clit > 0) {
-				drugOptions.push({text: `Clitoris reducers`, updateSlave: {drugs: `clitoris atrophiers`}});
+		}
+
+		// Hormones
+		if (V.precociousPuberty === 1 && V.pubertyHormones === 1 && (slave.breedingMark !== 1 || V.propOutcome === 0 || V.eugenicsFullControl === 1 || V.arcologies[0].FSRestart === "unset")) {
+			if ((slave.ovaries === 1 || slave.mpreg === 1) && slave.pubertyXX === 0) {
+				hormones.push({text: `Female hormone injections`, updateSlave: {drugs: `female hormone injections`}});
+			}
+			if (slave.balls > 0 && slave.pubertyXY === 0) {
+				hormones.push({text: `Male hormone injections`, updateSlave: {drugs: `male hormone injections`}});
+			}
+		}
+		hormones.push({text: `Hormone enhancers`, updateSlave: {drugs: `hormone enhancers`}});
+		hormones.push({text: `Hormone blockers`, updateSlave: {drugs: `hormone blockers`}});
+
+		// Misc
+		if (V.growthStim === 1) {
+			if (canImproveHeight(slave)) {
+				misc.push({text: `Growth Stimulants`, updateSlave: {drugs: `growth stimulants`}});
+			} else {
+				misc.push({text: `Growth Stimulants`, disabled: `Cannot increase height further`});
 			}
+		}
+		if (V.arcologies[0].FSSlimnessEnthusiastResearch === 1) {
 			if (slave.labia > 0) {
-				drugOptions.push({text: `Labia reducers`, updateSlave: {drugs: `labia atrophiers`}});
+				misc.push({text: `Labia reducers`, updateSlave: {drugs: `labia atrophiers`}});
 			}
 		}
 		if (V.arcologies[0].FSYouthPreferentialistResearch === 1) {
 			if (slave.visualAge > 18) {
-				drugOptions.push({text: `Anti-aging cream`, updateSlave: {drugs: `anti-aging cream`}});
+				misc.push({text: `Anti-aging cream`, updateSlave: {drugs: `anti-aging cream`}});
 			} else {
-				drugOptions.push({text: `Anti-aging cream`, disabled: `Slave already looks young enough`});
+				misc.push({text: `Anti-aging cream`, disabled: `Slave already looks young enough`});
 			}
 		}
-		drugOptions.push({text: `Steroids`, updateSlave: {drugs: `steroids`}});
+		misc.push({text: `Steroids`, updateSlave: {drugs: `steroids`}});
 		if (V.arcologies[0].FSSlimnessEnthusiastResearch === 1) {
 			if (slave.weight > -95) {
-				drugOptions.push({text: `Weight loss pills`, updateSlave: {drugs: `appetite suppressors`}});
+				misc.push({text: `Weight loss pills`, updateSlave: {drugs: `appetite suppressors`}});
 			} else {
-				drugOptions.push({text: `Weight loss pills`, disabled: `Slave is already at low weight`});
-			}
-		}
-		if (V.precociousPuberty === 1 && V.pubertyHormones === 1 && (slave.breedingMark !== 1 || V.propOutcome === 0 || V.eugenicsFullControl === 1 || V.arcologies[0].FSRestart === "unset")) {
-			if ((slave.ovaries === 1 || slave.mpreg === 1) && slave.pubertyXX === 0) {
-				drugOptions.push({text: `Female hormone injections`, updateSlave: {drugs: `female hormone injections`}});
-			}
-			if (slave.balls > 0 && slave.pubertyXY === 0) {
-				drugOptions.push({text: `Male hormone injections`, updateSlave: {drugs: `male hormone injections`}});
+				misc.push({text: `Weight loss pills`, disabled: `Slave is already at low weight`});
 			}
 		}
-		drugOptions.push({text: `Hormone enhancers`, updateSlave: {drugs: `hormone enhancers`}});
-		drugOptions.push({text: `Hormone blockers`, updateSlave: {drugs: `hormone blockers`}});
 		if (slave.boobs > 250 && slave.boobShape !== "saggy" && V.purchasedSagBGone === 1) {
-			drugOptions.push({text: `Sag-B-Gone breast lifting cream`, updateSlave: {drugs: `sag-B-gone`}});
+			misc.push({text: `Sag-B-Gone breast lifting cream`, updateSlave: {drugs: `sag-B-gone`}});
 		}
 	}
 
@@ -523,10 +533,87 @@ App.UI.SlaveInteract.drugs = function(slave) {
 	title.appendChild(App.UI.SlaveInteract.generateRows(drugLevelOptions, slave));
 	el.append(title);
 
-	let drugLinks = document.createElement('div');
-	drugLinks.appendChild(App.UI.SlaveInteract.generateRows(drugOptions, slave));
-	drugLinks.className = "choices";
-	el.append(drugLinks);
+	let links;
+	if (lips.length) {
+		links = document.createElement('div');
+		links.append(`Lips: `);
+		links.appendChild(App.UI.SlaveInteract.generateRows(lips, slave));
+		links.className = "choices";
+		el.append(links);
+	}
+
+	if (breasts.length) {
+		links = document.createElement('div');
+		links.append(`Breasts: `);
+		links.appendChild(App.UI.SlaveInteract.generateRows(breasts, slave));
+		links.className = "choices";
+		el.append(links);
+	}
+
+	if (nipples.length) {
+		links = document.createElement('div');
+		links.append(`Nipples: `);
+		links.appendChild(App.UI.SlaveInteract.generateRows(nipples, slave));
+		links.className = "choices";
+		el.append(links);
+	}
+
+	if (butt.length) {
+		links = document.createElement('div');
+		links.append(`Butt: `);
+		links.appendChild(App.UI.SlaveInteract.generateRows(butt, slave));
+		links.className = "choices";
+		el.append(links);
+	}
+
+	if (dick.length) {
+		links = document.createElement('div');
+		links.append(`dick: `);
+		links.appendChild(App.UI.SlaveInteract.generateRows(dick, slave));
+		links.className = "choices";
+		el.append(links);
+	}
+
+	if (balls.length) {
+		links = document.createElement('div');
+		links.append(`Balls: `);
+		links.appendChild(App.UI.SlaveInteract.generateRows(balls, slave));
+		links.className = "choices";
+		el.append(links);
+	}
+
+	if (fertility.length) {
+		links = document.createElement('div');
+		links.append(`Fertility: `);
+		links.appendChild(App.UI.SlaveInteract.generateRows(fertility, slave));
+		links.className = "choices";
+		el.append(links);
+	}
+
+	if (hormones.length) {
+		links = document.createElement('div');
+		links.append(`Hormones: `);
+		links.appendChild(App.UI.SlaveInteract.generateRows(hormones, slave));
+		links.className = "choices";
+		el.append(links);
+	}
+
+	if (psych.length) {
+		links = document.createElement('div');
+		links.append(`Psych: `);
+		links.appendChild(App.UI.SlaveInteract.generateRows(psych, slave));
+		links.className = "choices";
+		el.append(links);
+	}
+
+	if (misc.length) {
+		links = document.createElement('div');
+		links.append(`Misc: `);
+		links.appendChild(App.UI.SlaveInteract.generateRows(misc, slave));
+		links.className = "choices";
+		el.append(links);
+	}
+
 
 	return jQuery('#drugs').empty().append(el);
 };
-- 
GitLab