From 3a3343ef25de5bd0b3ac938b0a78e7d4e257c259 Mon Sep 17 00:00:00 2001
From: lowercasedonkey <lowercasedonkey@gmail.com>
Date: Sat, 10 Oct 2020 15:46:40 -0400
Subject: [PATCH] custom

---
 .../specificMarkets/customSlaveMarket.js      | 50 +++++++++++++++++--
 1 file changed, 47 insertions(+), 3 deletions(-)

diff --git a/src/markets/specificMarkets/customSlaveMarket.js b/src/markets/specificMarkets/customSlaveMarket.js
index f47c4afde96..b6f37404f71 100644
--- a/src/markets/specificMarkets/customSlaveMarket.js
+++ b/src/markets/specificMarkets/customSlaveMarket.js
@@ -12,7 +12,7 @@ App.Markets["Custom Slave"] = function() {
 	el.append(weight());
 	el.append(face());
 	el.append(race());
-	// Skin tone
+	el.append(skin());
 	el.append(boobs());
 	el.append(butt());
 	el.append(sex());
@@ -319,7 +319,7 @@ App.Markets["Custom Slave"] = function() {
 			select.append(option);
 		}
 		select.onchange = () => {
-			slave.nationality = select.options[select.selectedIndex].value;
+			slave.race = select.options[select.selectedIndex].value;
 			jQuery("#race-text").empty().append(description());
 		};
 		el.append(select);
@@ -335,7 +335,51 @@ App.Markets["Custom Slave"] = function() {
 		return el;
 	}
 
-	//TODO: function skinTone
+	function skin() {
+		const el = document.createElement("div");
+		const slaveProperty = "skin";
+		const choices = new Map;
+		for (const skin of App.Data.misc.naturalSkins) {
+			choices.set(skin, capFirstChar(skin));
+		}
+
+		createDescription(el, description, slaveProperty);
+
+		// Choices
+		el.append(
+			App.UI.DOM.makeTextBox(
+				slave.skin,
+				(v) => {
+					slave.skin = v;
+					jQuery("#skin-text").empty().append(description());
+				}
+			)
+		);
+
+		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.skin = select.options[select.selectedIndex].value;
+			jQuery("#skin-text").empty().append(description());
+		};
+		el.append(select);
+
+		function description() {
+			if (slave.race) {
+				return `${capFirstChar(slave.skin)}. `;
+			} else {
+				return "Ethnicity is unimportant. ";
+			}
+		}
+
+		return el;
+	}
+
 
 	function boobs() {
 		const el = document.createElement("div");
-- 
GitLab