diff --git a/src/markets/market.tw b/src/markets/market.tw new file mode 100644 index 0000000000000000000000000000000000000000..db77f0628d9170a2d5140148454e553d8b309e98 --- /dev/null +++ b/src/markets/market.tw @@ -0,0 +1,4 @@ +:: Market [nobr jump-to-safe jump-from-safe] +<span id="slave-markets"> + <<includeDOM App.Markets[V.market.market]()>> +</span> \ No newline at end of file diff --git a/src/markets/marketUI.js b/src/markets/marketUI.js index 9fcc1ff6083cfc69b7a3245ca3e4cc730af0c747..84c48fd89d99d021e24f8202e5dbdcfdd97cf027 100644 --- a/src/markets/marketUI.js +++ b/src/markets/marketUI.js @@ -107,6 +107,7 @@ App.Markets.purchaseFramework = function(slaveMarket, {numArcology, sTitleSingul student(); cashX(forceNeg(cost), "slaveTransfer", slave); V.newSlaves.push(slave); + V.newSlaveIndex = 0; }, [], "Bulk Slave Intro" @@ -122,7 +123,8 @@ App.Markets.purchaseFramework = function(slaveMarket, {numArcology, sTitleSingul el, App.UI.DOM.passageLink( title.finish, - "Bulk Slave Intro" + "Bulk Slave Intro", + () => V.newSlaveIndex = 0, ) ); } diff --git a/src/markets/specificMarkets/householdLiquidator.js b/src/markets/specificMarkets/householdLiquidator.js index 83b182635701e6f650e1b9e56191cd45f9399809..57abad8bf0665a4c370e00677be59e2f7d1f646e 100644 --- a/src/markets/specificMarkets/householdLiquidator.js +++ b/src/markets/specificMarkets/householdLiquidator.js @@ -118,6 +118,7 @@ App.Markets["Household Liquidator"] = function() { () => { V.newSlaves = _newSlaves; V.newSlaves.forEach((s) => cashX(forceNeg(_totalCost / V.newSlaves.length), "slaveTransfer", s)); + V.newSlaveIndex = 0; }, [], "Bulk Slave Intro" diff --git a/src/markets/theMarket/buySlaves.js b/src/markets/theMarket/buySlaves.js index 041addc710f6869956844218de490f3facc4e0d2..dcd140b9d17c994d5cd960ea97e32510555b250b 100644 --- a/src/markets/theMarket/buySlaves.js +++ b/src/markets/theMarket/buySlaves.js @@ -67,13 +67,16 @@ App.UI.buySlaves = function() { App.UI.DOM.link( "Slaves from", () => { - App.UI.specificMarket({ + V.market = { market: "neighbor", slaveMarket: 0, newSlaves: [], numArcology: _i - }); + }; + updateNav(); }, + [], + "Market" ) ); App.UI.DOM.appendNewElement("span", linkUnit, ` ${V.arcologies[_i].name}`, "bold"); @@ -146,13 +149,16 @@ App.UI.buySlaves = function() { App.UI.DOM.link( store.title, () => { - App.UI.specificMarket({ + V.market = { market: store.marketType, slaveMarket: 0, newSlaves: [], numArcology: 1 - }); + }; + updateNav(); }, + [], + "Market" ) ); } @@ -203,4 +209,19 @@ App.UI.buySlaves = function() { } return el; } + + function updateNav() { + // Sidebar + V.nextButton = "Back"; + V.nextLink = "Buy Slaves"; + V.returnTo = "Buy Slaves"; + V.encyclopedia = "Kidnapped Slaves"; + // Multi-Purchase Support + if (V.newSlaves.length > 0) { + V.nextButton = "Continue"; + V.nextLink = "Bulk Slave Intro"; + V.returnTo = "Main"; + V.newSlaveIndex = 0; + } + } }; diff --git a/src/markets/theMarket/market.js b/src/markets/theMarket/market.js index e93c1bc6cfd3267fc129790ac862027285230890..d2194982a356d2de735203f8a9e74d58d81f03c9 100644 --- a/src/markets/theMarket/market.js +++ b/src/markets/theMarket/market.js @@ -16,33 +16,3 @@ App.UI.market = function() { return span; }; - -App.UI.specificMarket = function({market, slaveMarket, newSlaves = [], numArcology} = {}) { - const el = new DocumentFragment(); - - // Temp - V.newSlaves = newSlaves; - - // Sidebar - V.nextButton = "Back"; - V.nextLink = "Buy Slaves"; - V.returnTo = "Buy Slaves"; - V.encyclopedia = "Kidnapped Slaves"; - // Multi-Purchase Support - if (newSlaves.length > 0) { - V.nextButton = "Continue"; - V.nextLink = "Bulk Slave Intro"; - V.returnTo = "Main"; - V.newSlaveIndex = 0; - } - - // fake a new passage so we can preserve some persistent data without globals - App.Utils.scheduleSidebarRefresh(); // TODO: not updating back button - window.scrollTo(0, 0); - el.append( - App.Markets[market](numArcology) - ); - - - return jQuery("#slave-markets").empty().append(el); -};