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

fixes

parent 6c6e6ed5
No related branches found
No related tags found
1 merge request!8026Custom slave to js
...@@ -3,8 +3,8 @@ App.Markets["Custom Slave"] = function() { ...@@ -3,8 +3,8 @@ App.Markets["Custom Slave"] = function() {
const el = document.createElement("p"); const el = document.createElement("p");
const slave = V.customSlave; const slave = V.customSlave;
el.append(intro()); el.append(intro());
//el.append(age()); el.append(age());
//el.append(health()); el.append(health());
el.append(muscles()); el.append(muscles());
return el; return el;
...@@ -76,15 +76,19 @@ App.Markets["Custom Slave"] = function() { ...@@ -76,15 +76,19 @@ App.Markets["Custom Slave"] = function() {
function health() { function health() {
const el = document.createElement("div"); const el = document.createElement("div");
const id = "health-text"; const id = "health-text";
const choices = { const choices = new Map([
0: "Healthy", [0, "Healthy"],
1: "Extremely healthy" [1, "Extremely healthy"]
}; ]);
createDescription(el, description, id); createDescription(el, description, id);
el.append(choicesMaker("health", choices, id, description)); el.append(choicesMaker("health", choices, id, description));
function description() { function description() {
return choices[slave.health]; for (const [value, text] of choices) {
if (slave.health === Number(value)) {
return `${text}.`;
}
}
} }
return el; return el;
...@@ -108,6 +112,7 @@ App.Markets["Custom Slave"] = function() { ...@@ -108,6 +112,7 @@ App.Markets["Custom Slave"] = function() {
el.append(choicesMaker("muscles", choices, id, description)); el.append(choicesMaker("muscles", choices, id, description));
function description() { function description() {
// Obnoxiously, the old check is reversed, so I'm working around it by reporting the previous value to the one that hits.
let savedText = "frail"; let savedText = "frail";
for (const [value, text] of choices) { for (const [value, text] of choices) {
if (slave.muscles < Number(value)) { if (slave.muscles < Number(value)) {
...@@ -138,7 +143,7 @@ App.Markets["Custom Slave"] = function() { ...@@ -138,7 +143,7 @@ App.Markets["Custom Slave"] = function() {
/** /**
* *
* @param {String} slaveParam * @param {String} slaveParam
* @param {Object} choices * @param {Map} choices
* @param {string} id * @param {string} id
* @param {Function} description * @param {Function} description
*/ */
......
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