diff --git a/src/markets/theMarket/buySlaves.js b/src/markets/theMarket/buySlaves.js new file mode 100644 index 0000000000000000000000000000000000000000..a6fa5190fc7f094e4d28a114afe6a1d8486e1bbb --- /dev/null +++ b/src/markets/theMarket/buySlaves.js @@ -0,0 +1,194 @@ +/** + * Displays the Market, where you can select individual slave markets to shop at. + * @returns {Node} + */ + +App.UI.buySlaves = function() { + const el = new DocumentFragment(); + const minCost = minimumSlaveCost(); + let linkArray; + + App.UI.DOM.appendNewElement("h2", el, "The Market"); + App.UI.DOM.appendNewElement("p", el, `There are many different organizations to purchase slaves from, but many of them are selective about their customers and will only sell to you if you are reputable. `, `note`); + + if (V.slaveCostFactor > 1.1) { + App.UI.DOM.appendNewElement("div", el, `There is a bull market for slaves; the price of slaves is very high. `, "yellow"); + } else if (V.slaveCostFactor > 1) { + App.UI.DOM.appendNewElement("div", el, `The slave market is bullish; the price of slaves is high. `, "yellow"); + } else if (V.slaveCostFactor < 0.9) { + App.UI.DOM.appendNewElement("div", el, `There is a bear market for slaves; the price of slaves is very low. `, "yellow"); + } else if (V.slaveCostFactor < 1) { + App.UI.DOM.appendNewElement("div", el, `The slave market is bearish; the price of slaves is low. `, "yellow"); + } else { + App.UI.DOM.appendNewElement("div", el, `The slave market is stable; the price of slaves is average. `); + } + + App.UI.DOM.appendNewElement("h2", el, "Sex Slave Purchase Options"); + + // Cheap + el.append(storeBlock(App.Data.Markets.low)); + + // Neighbors + App.UI.DOM.appendNewElement("h3", el, "Neighboring Arcologies"); + App.UI.DOM.appendNewElement("div", el, "The arcology's prosperity and culture will affect slaves who have lived there.", "note"); + App.UI.DOM.appendNewElement("div", el, neighborsBlock()); + + // Midrange + App.UI.DOM.appendNewElement("h3", el, "Midrange"); + el.append(storeBlock(App.Data.Markets.intermediate)); + + // Schools + if (V.rep > 6000) { + App.UI.DOM.appendNewElement("h3", el, "Slave Schools"); + App.UI.DOM.appendNewElement("div", el, "High prices; will be young and healthy.", "note"); + el.append(storeBlock(App.Data.Markets.schools)); + } else { + App.UI.DOM.appendNewElement("div", el, "You are not reputable enough to acquire fresh school slaves."); + } + + // High end + App.UI.DOM.appendNewElement("h3", el, "Special"); + el.append(storeBlock(App.Data.Markets.high)); + return el; + + function storeBlock(storeCategory) { + const el = new DocumentFragment(); + + for (const store of storeCategory) { + el.append(storeFront(store)); + } + + return el; + } + + function neighborsBlock() { + const el = new DocumentFragment(); + for (let _i = 0; _i < V.arcologies.length; _i++) { + if (V.arcologies[_i].direction !== 0) { + linkArray = []; + const linkUnit = document.createElement("span"); + linkUnit.append( + App.UI.DOM.link( + "Slaves from", + () => { + V.slaveMarket = "neighbor"; + V.numArcology = _i; + }, + [], + "Slave Markets" + ) + ); + App.UI.DOM.appendNewElement("span", linkUnit, ` ${V.arcologies[_i].name}`, "bold"); + linkArray.push(linkUnit); + if (V.cash > (minCost * 5)) { + linkArray.push( + App.UI.DOM.link( + "x5", + () => { + V.slaveMarket = "neighbor"; + V.introType = "bulk"; + V.numSlaves = 5; + V.numArcology = _i; + }, + [], + "Slave Markets" + ) + ); + } + if (V.cash > (minCost * 10)) { + linkArray.push( + App.UI.DOM.link( + "x10", + () => { + V.slaveMarket = "neighbor"; + V.introType = "bulk"; + V.numSlaves = 10; + V.numArcology = _i; + }, + [], + "Slave Markets" + ) + ); + } + App.UI.DOM.appendNewElement("div", el, App.UI.DOM.generateLinksStrip(linkArray)); + } + } + return el; + } + + /** * + * @param {market} store + * @returns {Node} + */ + function storeFront(store) { + const el = document.createElement("div"); + + // Check requirements + const requirements = store.requirements; + if (requirements === false) { + return el; + } else if (typeof requirements === "string") { + el.append(requirements); + return el; + } + const linkArray = []; + + store.passage = store.passage || "Slave Markets"; + linkArray.push( + App.UI.DOM.link( + store.title, + () => { + V.slavesSeen += 1; + V.slaveMarket = store.marketType; + }, + [], + store.passage + ) + ); + if (store.bulkAvailable !== false) { + if (V.cash > (minCost * 5)) { + linkArray.push( + App.UI.DOM.link( + `x5`, + () => { + V.slaveMarket = store.marketType; + V.introType = "bulk"; + V.numSlaves = 5; + }, + [], + `Bulk Slave Generate` + ) + ); + } + if (V.cash > (minCost * 10)) { + linkArray.push( + App.UI.DOM.link( + `x10`, + () => { + V.slaveMarket = store.marketType; + V.introType = "bulk"; + V.numSlaves = 10; + }, + [], + `Bulk Slave Generate` + ) + ); + } + } + el.append(App.UI.DOM.generateLinksStrip(linkArray)); + + if (store.sale) { + el.append(` ${store.sale}`); + } + + if (store.note) { + App.UI.DOM.appendNewElement("span", el, ` ${store.note}`, "note"); + } + if (["GRI", "HA", "NUL", "SCP", "TCR", "TFS", "TGA", "TSS", "LDE", "TUO"].includes(store.marketType)) { + if (V[store.marketType].schoolSale === 1) { + App.UI.DOM.appendNewElement("span", el, `Offering your first purchase at half price this week. `, "yellow"); + } + } + return el; + } +}; diff --git a/src/markets/theMarket/sellSlaves.js b/src/markets/theMarket/sellSlaves.js new file mode 100644 index 0000000000000000000000000000000000000000..6caea63744ba827f055c53029763292f999aba92 --- /dev/null +++ b/src/markets/theMarket/sellSlaves.js @@ -0,0 +1,17 @@ +App.UI.sellSlaves = function() { + const el = new DocumentFragment(); + + App.UI.DOM.appendNewElement("h2", el, "Selling slaves"); + + const div = document.createElement("div"); + div.append(`While you are at the market, you may want to `); + div.append( + App.UI.DOM.passageLink( + `look at your own underperforming slaves`, + `Underperforming Slaves` + ) + ); + el.append(div); + + return el; +}; diff --git a/src/markets/buySlaves.js b/src/markets/theMarket/tradeMenials.js similarity index 73% rename from src/markets/buySlaves.js rename to src/markets/theMarket/tradeMenials.js index 9498589c637be6e666c280171c59625b575e42d4..774c4354932b998b0e94dd7080895b923c599b4f 100644 --- a/src/markets/buySlaves.js +++ b/src/markets/theMarket/tradeMenials.js @@ -1,221 +1,17 @@ -/** - * Displays the Market, where you can select individual slave markets to shop at. - * @returns {Node} - */ - -App.UI.buySlaves = function() { +App.UI.tradeMenials = function() { const el = new DocumentFragment(); - const minCost = minimumSlaveCost(); - let div; - let linkArray; - - App.UI.DOM.appendNewElement("h2", el, "The Market"); - App.UI.DOM.appendNewElement("p", el, `There are many different organizations to purchase slaves from, but many of them are selective about their customers and will only sell to you if you are reputable. `, `note`); - - App.UI.DOM.appendNewElement("h3", el, "Market status"); - if (V.slaveCostFactor > 1.1) { - App.UI.DOM.appendNewElement("div", el, `There is a bull market for slaves; the price of slaves is very high. `, "yellow"); - } else if (V.slaveCostFactor > 1) { - App.UI.DOM.appendNewElement("div", el, `The slave market is bullish; the price of slaves is high. `, "yellow"); - } else if (V.slaveCostFactor < 0.9) { - App.UI.DOM.appendNewElement("div", el, `There is a bear market for slaves; the price of slaves is very low. `, "yellow"); - } else if (V.slaveCostFactor < 1) { - App.UI.DOM.appendNewElement("div", el, `The slave market is bearish; the price of slaves is low. `, "yellow"); - } else { - App.UI.DOM.appendNewElement("div", el, `The slave market is stable; the price of slaves is average. `); - } - - App.UI.DOM.appendNewElement("h2", el, "Sex Slave Purchase Options"); - - // Cheap - el.append(storeBlock(App.Data.Markets.low)); - - // Neighbors - App.UI.DOM.appendNewElement("h3", el, "Neighboring Arcologies"); - App.UI.DOM.appendNewElement("div", el, "The arcology's prosperity and culture will affect slaves who have lived there.", "note"); - App.UI.DOM.appendNewElement("div", el, neighborsBlock()); - // Midrange - App.UI.DOM.appendNewElement("h3", el, "Midrange"); - el.append(storeBlock(App.Data.Markets.intermediate)); - - // Schools - if (V.rep > 6000) { - App.UI.DOM.appendNewElement("h3", el, "Slave Schools"); - App.UI.DOM.appendNewElement("div", el, "High prices; will be young and healthy.", "note"); - el.append(storeBlock(App.Data.Markets.schools)); - } else { - App.UI.DOM.appendNewElement("div", el, "You are not reputable enough to acquire fresh school slaves."); - } - - // High end - App.UI.DOM.appendNewElement("h3", el, "Special"); - el.append(storeBlock(App.Data.Markets.high)); - - // Selling - App.UI.DOM.appendNewElement("h2", el, "Selling slaves"); - div = document.createElement("div"); - div.append(`While you are at the market, you may want to `); - div.append( - App.UI.DOM.passageLink( - `look at your own underperforming slaves`, - `Underperforming Slaves` - ) - ); - el.append(div); - - // Menial App.UI.DOM.appendNewElement("h2", el, "Menial Slaves"); + el.append(menialBlock()); return el; - function storeBlock(storeCategory) { - const el = new DocumentFragment(); - - for (const store of storeCategory) { - el.append(storeFront(store)); - } - - return el; - } - - function neighborsBlock() { - const el = new DocumentFragment(); - for (let _i = 0; _i < V.arcologies.length; _i++) { - if (V.arcologies[_i].direction !== 0) { - linkArray = []; - const linkUnit = document.createElement("span"); - linkUnit.append( - App.UI.DOM.link( - "Slaves from", - () => { - V.slaveMarket = "neighbor"; - V.numArcology = _i; - }, - [], - "Slave Markets" - ) - ); - App.UI.DOM.appendNewElement("span", linkUnit, ` ${V.arcologies[_i].name}`, "bold"); - linkArray.push(linkUnit); - if (V.cash > (minCost * 5)) { - linkArray.push( - App.UI.DOM.link( - "x5", - () => { - V.slaveMarket = "neighbor"; - V.introType = "bulk"; - V.numSlaves = 5; - V.numArcology = _i; - }, - [], - "Slave Markets" - ) - ); - } - if (V.cash > (minCost * 10)) { - linkArray.push( - App.UI.DOM.link( - "x10", - () => { - V.slaveMarket = "neighbor"; - V.introType = "bulk"; - V.numSlaves = 10; - V.numArcology = _i; - }, - [], - "Slave Markets" - ) - ); - } - App.UI.DOM.appendNewElement("div", el, App.UI.DOM.generateLinksStrip(linkArray)); - } - } - return el; - } - - /** * - * @param {market} store - * @returns {Node} - * - */ - function storeFront(store) { - const el = document.createElement("div"); - - // Check requirements - const requirements = store.requirements; - if (requirements === false) { - return el; - } else if (typeof requirements === "string") { - el.append(requirements); - return el; - } - const linkArray = []; - - store.passage = store.passage || "Slave Markets"; - linkArray.push( - App.UI.DOM.link( - store.title, - () => { - V.slavesSeen += 1; - V.slaveMarket = store.marketType; - }, - [], - store.passage - ) - ); - if (store.bulkAvailable !== false) { - if (V.cash > (minCost * 5)) { - linkArray.push( - App.UI.DOM.link( - `x5`, - () => { - V.slaveMarket = store.marketType; - V.introType = "bulk"; - V.numSlaves = 5; - }, - [], - `Bulk Slave Generate` - ) - ); - } - if (V.cash > (minCost * 10)) { - linkArray.push( - App.UI.DOM.link( - `x10`, - () => { - V.slaveMarket = store.marketType; - V.introType = "bulk"; - V.numSlaves = 10; - }, - [], - `Bulk Slave Generate` - ) - ); - } - } - el.append(App.UI.DOM.generateLinksStrip(linkArray)); - - if (store.sale) { - el.append(` ${store.sale}`); - } - - if (store.note) { - App.UI.DOM.appendNewElement("span", el, ` ${store.note}`, "note"); - } - if (["GRI", "HA", "NUL", "SCP", "TCR", "TFS", "TGA", "TSS", "LDE", "TUO"].includes(store.marketType)) { - if (V[store.marketType].schoolSale === 1) { - App.UI.DOM.appendNewElement("span", el, `Offering your first purchase at half price this week. `, "yellow"); - } - } - return el; - } - function menialBlock() { const el = new DocumentFragment(); let div; let span; + let linkArray; div = document.createElement("div"); div.append(`Slave demand is `); diff --git a/src/uncategorized/buySlaves.tw b/src/uncategorized/buySlaves.tw index b29aa02b3bc494109d2e9f2c8921f2d62da94e01..eb4532559c26dc97358cf9c0a0f978d0ed594306 100644 --- a/src/uncategorized/buySlaves.tw +++ b/src/uncategorized/buySlaves.tw @@ -3,4 +3,8 @@ <<set $nextButton = "Back">> <<set $nextLink = "Main">> -<<includeDOM App.UI.buySlaves()>> \ No newline at end of file +<<includeDOM App.UI.buySlaves()>> + +<<includeDOM App.UI.sellSlaves()>> + +<<includeDOM App.UI.tradeMenials()>> \ No newline at end of file