diff --git a/src/js/slaveCostJS.js b/src/js/slaveCostJS.js index 83f460b7ed487f196f19e747861737b3bfd7b6d4..8eb7ea4d47cf2a28d48c5d32a6b6c2f77243b19d 100644 --- a/src/js/slaveCostJS.js +++ b/src/js/slaveCostJS.js @@ -2331,6 +2331,9 @@ globalThis.slaveCost = function(slave, isStartingSlave = false, followLaws = fal ])); let cheatFResultContents = App.UI.DOM.appendNewElement("div", el, costFrame()); + + App.UI.DOM.appendNewElement("div", el, "A slave's base value is modified by an additive multiplier. A slave worth ¤200 with two bonuses worth 0.1 each will be worth ¤220", "note"); + return el; /** Set up the frame that contains the info @@ -2341,12 +2344,22 @@ globalThis.slaveCost = function(slave, isStartingSlave = false, followLaws = fal el.classList.add("grid-2columns-auto"); let sortedBeautyMapKeys; - if ((criteria === "text" && direction === "descending") || (criteria === "value" && direction === "ascending")) { - sortedBeautyMapKeys = Array.from(beautyObj.map.keys()).sort((a, b) => (beautyObj.map.get(a) > beautyObj.map.get(b)) ? 1 : -1); - } else { - sortedBeautyMapKeys = Array.from(beautyObj.map.keys()).sort((a, b) => (beautyObj.map.get(a) < beautyObj.map.get(b)) ? 1 : -1); + if (criteria === "text") { + if (direction === "descending") { + sortedBeautyMapKeys = Array.from(beautyObj.map.keys()).sort((a, b) => (a > b) ? 1 : -1); + } else { + sortedBeautyMapKeys = Array.from(beautyObj.map.keys()).sort((a, b) => (a < b) ? 1 : -1); + } + } else if (criteria === "value") { + if (direction === "descending") { + sortedBeautyMapKeys = Array.from(beautyObj.map.keys()).sort((a, b) => (beautyObj.map.get(a) > beautyObj.map.get(b)) ? 1 : -1); + } else { + sortedBeautyMapKeys = Array.from(beautyObj.map.keys()).sort((a, b) => (beautyObj.map.get(a) < beautyObj.map.get(b)) ? 1 : -1); + } } + + for (const key of sortedBeautyMapKeys) { let value = beautyObj.map.get(key); value = (Math.floor(value * 10) / 10); @@ -2361,6 +2374,7 @@ globalThis.slaveCost = function(slave, isStartingSlave = false, followLaws = fal App.UI.DOM.appendNewElement("div", el, capFirstChar(key)); } + return el; } }