From 6d40089cd5f3b8a4bdf83062af5c835d167e08d6 Mon Sep 17 00:00:00 2001
From: lowercasedonkey <lowercasedonkey@gmail.com>
Date: Sat, 10 Oct 2020 15:31:51 -0400
Subject: [PATCH] start race

---
 .../specificMarkets/customSlaveMarket.js      | 77 +++++++++++++++++--
 1 file changed, 71 insertions(+), 6 deletions(-)

diff --git a/src/markets/specificMarkets/customSlaveMarket.js b/src/markets/specificMarkets/customSlaveMarket.js
index e1d98751247..684b4ce6f5b 100644
--- a/src/markets/specificMarkets/customSlaveMarket.js
+++ b/src/markets/specificMarkets/customSlaveMarket.js
@@ -11,7 +11,7 @@ App.Markets["Custom Slave"] = function() {
 	el.append(height());
 	el.append(weight());
 	el.append(face());
-	// Ethnicity
+	el.append(race());
 	// Skin tone
 	el.append(boobs());
 	el.append(butt());
@@ -28,8 +28,8 @@ App.Markets["Custom Slave"] = function() {
 	el.append(skillCombat());
 	el.append(intelligence());
 	el.append(intelligenceImplant());
-	// eyes
-	// hears
+	el.append(eyes());
+	el.append(hears());
 	el.append(smells());
 	el.append(tastes());
 	el.append(limbs());
@@ -288,7 +288,43 @@ App.Markets["Custom Slave"] = function() {
 		return el;
 	}
 
-	//TODO: function ethnicity
+	function race() {
+		const el = document.createElement("div");
+		const slaveProperty = "race";
+		const choices = new Map([
+			["ethnicity is unimportant", "Ethnicity is unimportant"],
+		]);
+		for (const race of App.Data.misc.filterRaces) {
+			choices.set(race.toLowerCase(), race);
+		}
+
+		createDescription(el, description, slaveProperty);
+
+		// Choices
+		const select = document.createElement("select");
+		for (const [value, text] of choices) {
+			const option = document.createElement("option");
+			option.text = text;
+			option.value = value;
+			select.append(option);
+		}
+		select.onchange = () => {
+			slave.nationality = select.options[select.selectedIndex].value;
+			jQuery("#race-text").empty().append(description());
+		};
+		el.append(select);
+
+		function description() {
+			for (const [value, text] of choices) {
+				if (slave.nationality === value) {
+					return `${text}. `;
+				}
+			}
+			return "Ethnicity is unimportant. "
+		}
+
+		return el;
+	}
 
 	//TODO: function skinTone
 
@@ -689,7 +725,37 @@ App.Markets["Custom Slave"] = function() {
 		descText.append(description());
 		el.append(descText);
 
-		el.append(choicesMaker(slaveProperty, choices, description));
+		const linkArray = [];
+		if (V.seeExtreme) {
+			linkArray.push(
+				App.UI.DOM.link(
+					"Blind",
+					() => {
+						eyeSurgery(slave, "both", "blind");
+						jQuery(`#${descText.id}-text`).empty().append(description());
+					}
+				)
+			);
+		}
+		linkArray.push(
+			App.UI.DOM.link(
+				"Nearsighted",
+				() => {
+					eyeSurgery(slave, "both", "blur");
+					jQuery(`#${descText.id}-text`).empty().append(description());
+				}
+			)
+		);
+		linkArray.push(
+			App.UI.DOM.link(
+				"Normal Vision",
+				() => {
+					eyeSurgery(slave, "both", "fix");
+					jQuery(`#${descText.id}-text`).empty().append(description());
+				}
+			)
+		);
+		el.append(App.UI.DOM.generateLinksStrip(linkArray));
 
 		function description() {
 			const vision = getBestVision(slave);
@@ -704,7 +770,6 @@ App.Markets["Custom Slave"] = function() {
 		return el;
 	}
 
-
 	function hears() {
 		const el = document.createElement("div");
 		const slaveProperty = "hears";
-- 
GitLab