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

fix cash check and disabled link display

parent 7851617c
No related branches found
No related tags found
No related merge requests found
App.UI.WardrobeShopping = function() {
const el = document.createElement("p");
el.id = "wardrobe-shopping";
App.UI.DOM.appendNewElement("H1", el, `Slave Wardrobe`);
......@@ -65,6 +66,7 @@ App.UI.WardrobeShopping = function() {
/** @type {wardrobeItem} */
const clothingObj = App.Data.WardrobeShopping[category][clothing];
const cost = Math.trunc(clothingObj.cost * V.upgradeMultiplierTrade);
let div;
if (V.seeImages === 1) {
// Get a randomly chosen piece of clothing from the set to display:
......@@ -72,7 +74,7 @@ App.UI.WardrobeShopping = function() {
App.UI.DOM.appendNewElement("div", el, App.Art.SlaveArtElement(model, 1, 0), ["imageRef", "smlImg"]);
}
if (!V.boughtItem.clothing[clothing]) {
if (cost > V.cash) {
if (cost < V.cash) {
App.UI.DOM.appendNewElement(
"div",
el,
......@@ -87,14 +89,12 @@ App.UI.WardrobeShopping = function() {
);
App.UI.DOM.appendNewElement("div", el, `Costs ¤${cost}`, "detail");
} else {
App.UI.DOM.appendNewElement(
"div",
el,
App.UI.DOM.disabledLink(
`Order ${clothingObj.title}`,
[`Cannot afford ¤${cost}`]
)
div = App.UI.DOM.disabledLink(
`Order ${clothingObj.title}`,
[`Cannot afford ¤${cost}`]
);
div.style.display = "inline"; // Fixes disabledLink
el.append(div);
App.UI.DOM.appendNewElement("div", el, `Costs ¤${cost}`, ["red", "detail"]);
}
} else {
......@@ -104,7 +104,7 @@ App.UI.WardrobeShopping = function() {
return el;
}
function refresh() {
jQuery(`#id${category}`).empty().append(App.UI.WardrobeShopping(category));
jQuery(`#wardrobe-shopping`).empty().append(App.UI.WardrobeShopping());
}
};
}
\ No newline at end of file
}
};
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