diff --git a/src/uncategorized/wardrobe.tw b/src/facilities/wardrobe/wardrobe.tw similarity index 99% rename from src/uncategorized/wardrobe.tw rename to src/facilities/wardrobe/wardrobe.tw index e39959f20831a9514f53e500877ff674d616f0ee..bf59ef8da5c7d3bf8ba2e5d379eb867966426470 100644 --- a/src/uncategorized/wardrobe.tw +++ b/src/facilities/wardrobe/wardrobe.tw @@ -10,6 +10,8 @@ <h1>Slave Wardrobe</h1> +<<includeDOM App.UI.WardrobeShopping("FS")>> + <p class="scene-intro"> The room containing all the clothes and accessories you have available to dress your slaves in, as well as the supplies and tools your tailor needs to resize them to better fit your slaves. Several mirrors are set up for a slave to try on outfits should they be allowed to dress themselves. The selection includes <<set _ownItAll = ( diff --git a/src/facilities/wardrobe/wardrobeShopping.css b/src/facilities/wardrobe/wardrobeShopping.css new file mode 100644 index 0000000000000000000000000000000000000000..5dbc9333b3afdc4ccb228b6215bfa027868d330a --- /dev/null +++ b/src/facilities/wardrobe/wardrobeShopping.css @@ -0,0 +1,5 @@ +.wardrobe-shopping-cell { + display: inline-block; + width: "450px"; + border: 1px solid white; +} \ No newline at end of file diff --git a/src/facilities/wardrobe/wardrobeShopping.js b/src/facilities/wardrobe/wardrobeShopping.js new file mode 100644 index 0000000000000000000000000000000000000000..1a2b73300b363ce35f57efc4b778a35d20f45a91 --- /dev/null +++ b/src/facilities/wardrobe/wardrobeShopping.js @@ -0,0 +1,67 @@ + +/** + * + * @param {*} category FS, FSrevivalist, or "other" + */ + +App.UI.WardrobeShopping = function(category) { + const data = App.Data.WardrobeShopping[category]; + const model = (V.seeDicks === 100) ? GenerateNewSlave("XY") : GenerateNewSlave("XX"); + + const el = document.createElement("p"); + el.id = `id${category}`; + Object.keys(data).forEach((clothing) => el.append(createCell(clothing))); + return el; + + /** + * + * @param {string} clothing + */ + function createCell(clothing) { + const el = document.createElement("div"); + el.classList.add("wardrobe-shopping-cell"); + /** @type {wardrobeItem} */ + const clothingObj = App.Data.WardrobeShopping[category][clothing]; + const cost = Math.trunc(clothingObj.cost * V.upgradeMultiplierTrade); + + if (V.seeImages === 1) { + // Get a randomly chosen piece of clothing from the set to display: + model.clothes = clothingObj.contains[Math.floor(Math.random() * clothingObj.contains.length)]; + App.UI.DOM.appendNewElement("div", el, App.Art.SlaveArtElement(model, 1, 0), ["imageRef", "tinyImg"]); + } + if (!V.boughtItem.clothing[clothing]) { + if (cost > V.cash) { + App.UI.DOM.appendNewElement( + "div", + el, + App.UI.DOM.link( + `Order ${clothingObj.title}`, + () => { + cashX(forceNeg(cost), "capEx"); + V.boughtItem.clothing[clothing] = 1; + refresh(); + } + ) + ); + 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}`] + ) + ); + App.UI.DOM.appendNewElement("div", el, `Costs ¤${cost}`, ["red", "detail"]); + } + } else { + el.append(clothingObj.owned); + } + + return el; + } + function refresh() { + jQuery(`#id${category}`).empty().append(App.UI.WardrobeShopping(category)); + } +}; diff --git a/src/facilities/wardrobe/wardrobeShoppingData.js b/src/facilities/wardrobe/wardrobeShoppingData.js new file mode 100644 index 0000000000000000000000000000000000000000..ed84b6e134b0c1d355918734fd5fd8bbb4ccf464 --- /dev/null +++ b/src/facilities/wardrobe/wardrobeShoppingData.js @@ -0,0 +1,28 @@ + +App.Data.WardrobeShopping = { + /** + * @typedef {object} wardrobeItem + * @property {string} title + * @property {Number} cost + * @property {string[]} contains + * @property {string} owned + */ + + /** + * @type {Object.<string, wardrobeItem>} String will be the property checked to see if the item is owned. So for "bunny", it will check V.boughtItem.clothing["bunny"]. + */ + FS: { + "bunny": { + title: "a shipment of bunny suits", + cost: 7500, + contains: ["a bunny outfit"], + owned: "You are well stocked with classic bunny suits and bowties.", + } + }, + FSrevivalist: { + + }, + other: { + + } +} \ No newline at end of file