diff --git a/script/engine.js b/script/engine.js index ef0d725..bf643c3 100644 --- a/script/engine.js +++ b/script/engine.js @@ -7,6 +7,7 @@ var Engine = { * That would be so elegant and awesome. */ SITE_URL: encodeURIComponent("http://adarkroom.doublespeakgames.com"), + VERSION: 1.2; MAX_STORE: 99999999999999, SAVE_DISPLAY: 30 * 1000, @@ -117,10 +118,10 @@ var Engine = { Events.init(); Room.init(); - if(Engine.storeAvailable('wood')) { + if($SM.get('stores.wood')) { Outside.init(); } - if(Engine.getStore('compass') > 0) { + if($SM.get('stores.compass', true) > 0) { Path.init(); } if($SM.get('features.location.spaceShip')) { @@ -160,41 +161,15 @@ var Engine = { var savedState = JSON.parse(localStorage.gameState); if(savedState) { State = savedState; - Engine.upgradeState(); + $SM.updateOldState(); Engine.log("loaded save!"); } } catch(e) { - State = { - version: 1.2, - }; + $SM.set('verson', Engine.VERSION); Engine.event('progress', 'new game'); } }, - upgradeState: function() { - /* Use this function to make old - * save games compatible with newer versions */ - if(typeof State.version != 'number') { - Engine.log('upgraded save to v1.0'); - State.version = 1.0; - } - if(State.version == 1.0) { - // v1.1 introduced the Lodge, so get rid of lodgeless hunters - delete State.outside.workers.hunter; - delete State.income.hunter; - Engine.log('upgraded save to v1.1'); - State.version = 1.1; - } - if(State.version == 1.1) { - //v1.2 added the Swamp to the map, so add it to already generated maps - if(State.world) { - World.placeLandmark(15, World.RADIUS * 1.5, World.TILE.SWAMP, State.world.map); - } - Engine.log('upgraded save to v1.2'); - State.version = 1.2; - } - }, - event: function(cat, act) { if(typeof ga === 'function') { ga('send', 'event', cat, act); @@ -297,7 +272,7 @@ var Engine = { var diff = Math.abs(panelIndex - currentIndex); slider.animate({left: -(panelIndex * 700) + 'px'}, 300 * diff); - if(Engine.storeAvailable('wood')) { + if($SM.get('stores.wood')) { // FIXME Why does this work if there's an animation queue...? stores.animate({right: -(panelIndex * 700) + 'px'}, 300 * diff); } @@ -321,182 +296,6 @@ var Engine = { Notifications.printQueue(module); } }, - - addPerk: function(name) { - if(!$SM.get('character.perks')) { - $SM.set('character.perks', {}); - } - $SM.set('character.perks[\''+name+'\']', true); - Notifications.notify(null, Engine.Perks[name].notify); - if(Engine.activeModule == Path) { - Path.updatePerks(); - } - }, - - hasPerk: function(name) { - return typeof $SM.get('character.perks') == 'object' && $SM.get('character.perks[\''+name+'\']') == true; - }, - - setStore: function(name, number) { - $SM.set('stores[\''+name+'\']', number); - Room.updateStoresView(); - Room.updateBuildButtons(); - if($SM.get('features.location.outside')) { - Outside.updateVillage(); - } - Engine.saveGame(); - }, - - setStores: function(list) { - for(k in list) { - $SM.set('stores[\''+k+'\']', list[k]); - } - Room.updateStoresView(); - Room.updateBuildButtons(); - if($SM.get('features.location.outside')) { - Outside.updateVillage(); - } - Engine.saveGame(); - }, - - addStore: function(name, number) { - var num = $SM.get('stores[\''+name+'\']'); - if(typeof num != 'number' || isNaN(num) || num < 0) num = 0; - num += number; - if(num > Engine.MAX_STORE) num = Engine.MAX_STORE; - $SM.set('stores[\''+name+'\']', num); - Room.updateStoresView(); - Room.updateBuildButtons(); - Outside.updateVillage(); - if(Engine.activeModule == Path) { - Path.updateOutfitting(); - } - Engine.saveGame(); - }, - - addStores: function(list, ignoreCosts) { - // Make sure any income costs can be paid - if(!ignoreCosts) { - for(k in list) { - var num = $SM.get('stores[\''+k+'\']'); - if(typeof num != 'number' || isNaN(num) || num < 0) num = 0; - if(num + list[k] < 0) { - return false; - } - } - } - - // Actually do the update - for(k in list) { - var num = $SM.get('stores[\''+k+'\']'); - if(typeof num != 'number') num = 0; - num += list[k]; - num = num < 0 ? 0 : num; - num = num > Engine.MAX_STORE ? Engine.MAX_STORE : num; - $SM.set('stores[\''+k+'\']', num); - } - Room.updateStoresView(); - Room.updateBuildButtons(); - Outside.updateVillage(); - if(Engine.activeModule == Path) { - Path.updateOutfitting(); - } - Engine.saveGame(); - return true; - }, - - storeAvailable: function(name) { - return typeof $SM.get('stores[\''+name+'\']') == 'number'; - }, - - getStore: function(name) { - if(typeof $SM.get('stores[\''+name+'\']') == 'undefined') { - return 0; - } - return $SM.get('stores[\''+name+'\']'); - }, - - setIncome: function(source, options) { - var existing = $SM.get('income[\''+source+'\']'); - if(typeof existing != 'undefined') { - options.timeLeft = existing.timeLeft; - } - $SM.set('income[\''+source+'\']', options); - }, - - getIncome: function(source) { - var existing = $SM.get('income[\''+source+'\']'); - if(typeof existing != 'undefined') { - return existing; - } - return {}; - }, - - removeIncome: function(source) { - $SM.remove('income[\''+source+'\']'); - Room.updateIncomeView(); - }, - - collectIncome: function() { - if(typeof $SM.get('income') != 'undefined' && Engine.activeModule != Space) { - var changed = false; - for(var source in $SM.get('income')) { - var income = $SM.get('income[\''+source+'\']'); - if(typeof income.timeLeft != 'number') - { - income.timeLeft = 0; - } - income.timeLeft--; - - if(income.timeLeft <= 0) { - Engine.log('collection income from ' + source); - if(source == 'thieves') { - Engine.addStolen(income.stores); - } - changed = Engine.addStores(income.stores) || changed; - if(typeof income.delay == 'number') { - income.timeLeft = income.delay; - } - } - } - if(changed) { - Room.updateStoresView(); - Room.updateBuildButtons(); - Engine.saveGame(); - if(Events.activeEvent() != null) { - Events.updateButtons(); - } - } - } - Engine._incomeTimeout = setTimeout(Engine.collectIncome, 1000); - }, - - openPath: function() { - Path.init(); - Engine.event('progress', 'path'); - Notifications.notify(Room, 'the compass points ' + World.dir); - }, - - addStolen: function(stores) { - if(!$SM.get('game.stolen')) $SM.set('game.stolen', {}); - for(var k in stores) { - if(!$SM.get('game.stolen[\''+k+'\']')) $SM.set('game.stolen[\''+k+'\']', 0); - $SM.add('game.stolen[\''+k+'\']', stores[k] * -1); - } - }, - - startThieves: function() { - $SM.set('game.thieves', 1); - Engine.setIncome('thieves', { - delay: 10, - stores: { - 'wood': -10, - 'fur': -5, - 'meat': -5 - } - }); - Room.updateIncomeView(); - }, // Move the stores panel beneath top_container (or to top: 0px if top_container // either hasn't been filled in or is null) using transition_diff to sync with @@ -521,18 +320,6 @@ var Engine = { } }, - num: function(name, craftable) { - switch(craftable.type) { - case 'good': - case 'tool': - case 'weapon': - case 'upgrade': - return Engine.getStore(name); - case 'building': - return Outside.numBuilding(name); - } - }, - log: function(msg) { if(this._log) { console.log(msg); @@ -593,9 +380,16 @@ var Engine = { if(Engine.activeModule.swipeDown) { Engine.activeModule.swipeDown(e); } - } + }, + + handleStateUpdates: function(e){ + + }, }; +//listener for StateManager update events +$(Engine).on('stateUpdate', Engine.handleStateUpdates); + $(function() { Engine.init(); }); \ No newline at end of file diff --git a/script/events.js b/script/events.js index 1148c2e..e76af55 100644 --- a/script/events.js +++ b/script/events.js @@ -41,7 +41,7 @@ var Events = { // Scene reward if(scene.reward) { - Engine.addStores(scene.reward, true); + $SM.addM('stores', scene.reward); } // onLoad @@ -157,7 +157,7 @@ var Events = { var weapon = World.Weapons[weaponName]; var cd = weapon.cooldown; if(weapon.type == 'unarmed') { - if(Engine.hasPerk('unarmed master')) { + if($SM.hasPerk('unarmed master')) { cd /= 2; } } @@ -245,12 +245,12 @@ var Events = { if(weapon.type == 'unarmed') { if(!$SM.get('character.punches')) $SM.set('character.punches', 0); $SM.add('character.punches', 1); - if($SM.get('character.punches') == 50 && !Engine.hasPerk('boxer')) { - Engine.addPerk('boxer'); - } else if($SM.get('character.punches') == 150 && !Engine.hasPerk('martial artist')) { - Engine.addPerk('martial artist'); - } else if($SM.get('character.punches') == 300 && !Engine.hasPerk('unarmed master')) { - Engine.addPerk('unarmed master'); + if($SM.get('character.punches') == 50 && !$SM.hasPerk('boxer')) { + $SM.addPerk('boxer'); + } else if($SM.get('character.punches') == 150 && !$SM.hasPerk('martial artist')) { + $SM.addPerk('martial artist'); + } else if($SM.get('character.punches') == 300 && !$SM.hasPerk('unarmed master')) { + $SM.addPerk('unarmed master'); } } @@ -294,16 +294,16 @@ var Events = { if(Math.random() <= World.getHitChance()) { dmg = weapon.damage; if(typeof dmg == 'number') { - if(weapon.type == 'unarmed' && Engine.hasPerk('boxer')) { + if(weapon.type == 'unarmed' && $SM.hasPerk('boxer')) { dmg *= 2 } - if(weapon.type == 'unarmed' && Engine.hasPerk('martial artist')) { + if(weapon.type == 'unarmed' && $SM.hasPerk('martial artist')) { dmg *= 3; } - if(weapon.type == 'unarmed' && Engine.hasPerk('unarmed master')) { + if(weapon.type == 'unarmed' && $SM.hasPerk('unarmed master')) { dmg *= 2; } - if(weapon.type == 'melee' && Engine.hasPerk('barbarian')) { + if(weapon.type == 'melee' && $SM.hasPerk('barbarian')) { dmg = Math.floor(dmg * 1.5); } } @@ -417,7 +417,7 @@ var Events = { if(!$('#enemy').data('stunned')) { var toHit = scene.hit; - toHit *= Engine.hasPerk('evasive') ? 0.8 : 1; + toHit *= $SM.hasPerk('evasive') ? 0.8 : 1; var dmg = -1; if(Math.random() <= toHit) { dmg = scene.damage; @@ -646,7 +646,7 @@ var Events = { } else if(b.cost) { var disabled = false; for(var store in b.cost) { - var num = Engine.activeModule == World ? Path.outfit[store] : Engine.getStore(store); + var num = Engine.activeModule == World ? Path.outfit[store] : $SM.get('stores[\''+store+'\']', true); if(typeof num != 'number') num = 0; if(num < b.cost[store]) { // Too expensive @@ -665,7 +665,7 @@ var Events = { var costMod = {}; if(info.cost) { for(var store in info.cost) { - var num = Engine.activeModule == World ? Path.outfit[store] : Engine.getStore(store); + var num = Engine.activeModule == World ? Path.outfit[store] : $SM.get('stores[\''+store+'\']', true); if(typeof num != 'number') num = 0; if(num < info.cost[store]) { // Too expensive @@ -679,7 +679,7 @@ var Events = { } World.updateSupplies(); } else { - Engine.addStores(costMod); + $SM.addM('stores', costMod); } } @@ -689,7 +689,7 @@ var Events = { // Reward if(info.reward) { - Engine.addStores(info.reward); + $SM.addM('stores', info.reward); } Events.updateButtons(); @@ -803,5 +803,15 @@ var Events = { // Force refocus on the body. I hate you, IE. $('body').focus(); }); - } -}; \ No newline at end of file + }, + + handleStateUpdates: function(e){ + //updates to run on stores changes if an event is active + if(e.stateName.indexOf('stores') == 0 && Events.activeEvent() != null){ + Events.updateButtons(); + } + }, +}; + +//listener for StateManager update events +$(Events).on('stateUpdate', Events.handleStateUpdates); \ No newline at end of file diff --git a/script/events/global.js b/script/events/global.js index 7c623b0..85ca99a 100644 --- a/script/events/global.js +++ b/script/events/global.js @@ -33,8 +33,8 @@ Events.Global = [ ], onLoad: function() { $SM.set('game.thieves', 2); - Engine.removeIncome('thieves'); - Engine.addStores($SM.get('game.stolen')); + $SM.remove('income.thieves'); + $SM.addM('stores', $SM.get('game.stolen')); }, buttons: { 'leave': { @@ -50,8 +50,8 @@ Events.Global = [ ], onLoad: function() { $SM.set('game.thieves', 2); - Engine.removeIncome('thieves'); - Engine.addPerk('stealthy'); + $SM.remove('income.thieves'); + $SM.addPerk('stealthy'); }, buttons: { 'leave': { diff --git a/script/events/room.js b/script/events/room.js index 0350053..5d1742b 100644 --- a/script/events/room.js +++ b/script/events/room.js @@ -5,7 +5,7 @@ Events.Room = [ { /* The Nomad -- Merchant */ title: 'The Nomad', isAvailable: function() { - return Engine.activeModule == Room && Engine.getStore('fur') > 0; + return Engine.activeModule == Room && $SM.get('stores.fur', true) > 0; }, scenes: { 'start': { @@ -33,13 +33,13 @@ Events.Room = [ }, 'buyCompass': { available: function() { - return Engine.getStore('compass') < 1; + return $SM.get('stores.compass', true) < 1; }, text: 'buy compass', cost: { fur: 300, scales: 15, teeth: 5 }, reward: { 'compass': 1 }, notification: 'the old compass is dented and dusty, but it looks to work.', - onChoose: Engine.openPath + onChoose: Path.openPath }, 'goodbye': { text: 'say goodbye', @@ -51,7 +51,7 @@ Events.Room = [ }, { /* Noises Outside -- gain wood/fur */ title: 'Noises', isAvailable: function() { - return Engine.activeModule == Room && Engine.storeAvailable('wood'); + return Engine.activeModule == Room && $SM.get('stores.wood'); }, scenes: { 'start': { @@ -101,7 +101,7 @@ Events.Room = [ { /* Noises Inside -- trade wood for better good */ title: 'Noises', isAvailable: function() { - return Engine.activeModule == Room && Engine.storeAvailable('wood'); + return Engine.activeModule == Room && $SM.get('stores.wood'); }, scenes: { start: { @@ -127,12 +127,12 @@ Events.Room = [ 'the ground is littered with small scales' ], onLoad: function() { - var numWood = Engine.getStore('wood'); + var numWood = $SM.get('stores.wood', true); numWood = Math.floor(numWood * 0.1); if(numWood == 0) numWood = 1; var numScales = Math.floor(numWood / 5); if(numScales == 0) numScales = 1; - Engine.addStores({wood: -numWood, scales: numScales}); + $SM.addM('stores', {'wood': -numWood, 'scales': numScales}); }, buttons: { 'leave': { @@ -147,12 +147,12 @@ Events.Room = [ 'the ground is littered with small teeth' ], onLoad: function() { - var numWood = Engine.getStore('wood'); + var numWood = $SM.get('stores.wood', true); numWood = Math.floor(numWood * 0.1); if(numWood == 0) numWood = 1; var numTeeth = Math.floor(numWood / 5); if(numTeeth == 0) numTeeth = 1; - Engine.addStores({wood: -numWood, teeth: numTeeth}); + $SM.addM('stores', {'wood': -numWood, 'teeth': numTeeth}); }, buttons: { 'leave': { @@ -167,12 +167,12 @@ Events.Room = [ 'the ground is littered with scraps of cloth' ], onLoad: function() { - var numWood = Engine.getStore('wood'); + var numWood = $SM.get('stores.wood', true); numWood = Math.floor(numWood * 0.1); if(numWood == 0) numWood = 1; var numCloth = Math.floor(numWood / 5); if(numCloth == 0) numCloth = 1; - Engine.addStores({wood: -numWood, cloth: numCloth}); + $SM.addM('stores', {'wood': -numWood, 'cloth': numCloth}); }, buttons: { 'leave': { @@ -186,7 +186,7 @@ Events.Room = [ { /* The Beggar -- trade fur for better good */ title: 'The Beggar', isAvailable: function() { - return Engine.activeModule == Room && Engine.storeAvailable('fur'); + return Engine.activeModule == Room && $SM.get('stores.fur'); }, scenes: { start: { @@ -257,7 +257,7 @@ Events.Room = [ { /* Mysterious Wanderer -- wood gambling */ title: 'The Mysterious Wanderer', isAvailable: function() { - return Engine.activeModule == Room && Engine.storeAvailable('wood'); + return Engine.activeModule == Room && $SM.get('stores.wood'); }, scenes: { start: { @@ -290,7 +290,7 @@ Events.Room = [ onLoad: function() { if(Math.random() < 0.5) { setTimeout(function() { - Engine.addStore('wood', 300); + $SM.add('stores.wood', 300); Notifications.notify(Room, 'the mysterious wanderer returns, cart piled high with wood.'); }, 60 * 1000); } @@ -309,7 +309,7 @@ Events.Room = [ onLoad: function() { if(Math.random() < 0.3) { setTimeout(function() { - Engine.addStore('wood', 1500); + $SM.add('stores.wood', 1500); Notifications.notify(Room, 'the mysterious wanderer returns, cart piled high with wood.'); }, 60 * 1000); } @@ -327,7 +327,7 @@ Events.Room = [ { /* Mysterious Wanderer -- fur gambling */ title: 'The Mysterious Wanderer', isAvailable: function() { - return Engine.activeModule == Room && Engine.storeAvailable('fur'); + return Engine.activeModule == Room && $SM.get('stores.fur'); }, scenes: { start: { @@ -360,7 +360,7 @@ Events.Room = [ onLoad: function() { if(Math.random() < 0.5) { setTimeout(function() { - Engine.addStore('fur', 300); + $SM.add('stores.fur', 300); Notifications.notify(Room, 'the mysterious wanderer returns, cart piled high with furs.'); }, 60 * 1000); } @@ -379,7 +379,7 @@ Events.Room = [ onLoad: function() { if(Math.random() < 0.3) { setTimeout(function() { - Engine.addStore('fur', 1500); + $SM.add('stores.fur', 1500); Notifications.notify(Room, 'the mysterious wanderer returns, cart piled high with furs.'); }, 60 * 1000); } @@ -417,10 +417,10 @@ Events.Room = [ text: 'learn scouting', cost: { 'fur': 1000, 'scales': 50, 'teeth': 20 }, available: function() { - return !Engine.hasPerk('scout'); + return !$SM.hasPerk('scout'); }, onChoose: function() { - Engine.addPerk('scout'); + $SM.addPerk('scout'); } }, 'leave': { @@ -468,30 +468,30 @@ Events.Room = [ 'evasion': { text: 'evasion', available: function() { - return !Engine.hasPerk('evasive'); + return !$SM.hasPerk('evasive'); }, onChoose: function() { - Engine.addPerk('evasive'); + $SM.addPerk('evasive'); }, nextScene: 'end' }, 'precision': { text: 'precision', available: function() { - return !Engine.hasPerk('precise'); + return !$SM.hasPerk('precise'); }, onChoose: function() { - Engine.addPerk('precise'); + $SM.addPerk('precise'); }, nextScene: 'end' }, 'force': { text: 'force', available: function() { - return !Engine.hasPerk('barbarian'); + return !$SM.hasPerk('barbarian'); }, onChoose: function() { - Engine.addPerk('barbarian'); + $SM.addPerk('barbarian'); }, nextScene: 'end' }, @@ -536,7 +536,7 @@ Events.Room = [ 'some weird metal he picked up on his travels.' ], onLoad: function() { - Engine.addStore('alien alloy', 1); + $SM.add('stores[\'alien alloy\']', 1); }, buttons: { 'bye': { @@ -552,7 +552,7 @@ Events.Room = [ 'some weird glowing boxes he picked up on his travels.' ], onLoad: function() { - Engine.addStore('energy cell', 3); + $SM.add('stores[\'energy cell\']', 3); }, buttons: { 'bye': { @@ -568,7 +568,7 @@ Events.Room = [ 'all he has are some scales.' ], onLoad: function() { - Engine.addStore('scales', 5); + $SM.add('stores.scales', 5); }, buttons: { 'bye': { diff --git a/script/events/setpieces.js b/script/events/setpieces.js index 9e00e9f..1eaa283 100644 --- a/script/events/setpieces.js +++ b/script/events/setpieces.js @@ -74,7 +74,7 @@ Events.Setpieces = { 'his time here, now, is his penance.' ], onLoad: function() { - Engine.addPerk('gastronome'); + $SM.addPerk('gastronome'); World.markVisited(World.curPos[0], World.curPos[1]); }, buttons: { diff --git a/script/outside.js b/script/outside.js index c86c002..bee2027 100644 --- a/script/outside.js +++ b/script/outside.js @@ -432,7 +432,7 @@ var Outside = { for(var k in $SM.get('game.outside.buildings')) { if(k == 'trap') { var numTraps = $SM.get('game.outside.buildings[\''+k+'\']'); - var numBait = Engine.getStore('bait'); + var numBait = $SM.get('stores.bait', true); var traps = numTraps - numBait; traps = traps < 0 ? 0 : traps; Outside.updateVillageRow(k, traps, village); @@ -510,7 +510,7 @@ var Outside = { var tooltip = $('.tooltip', 'div#workers_row_' + worker.replace(' ', '-')); tooltip.empty(); var needsUpdate = false; - var curIncome = Engine.getIncome(worker); + var curIncome = $SM.getIncome(worker); for(var store in income.stores) { stores[store] = income.stores[store] * num; if(curIncome[store] != stores[store]) needsUpdate = true; @@ -520,7 +520,7 @@ var Outside = { row.appendTo(tooltip); } if(needsUpdate) { - Engine.setIncome(worker, { + $SM.setIncome(worker, { delay: income.delay, stores: stores }); @@ -588,14 +588,15 @@ var Outside = { gatherWood: function() { Notifications.notify(Outside, "dry brush and dead branches litter the forest floor") - Engine.setStore('wood', Engine.getStore('wood') + (Outside.numBuilding('cart') > 0 ? 50 : 10)); + var gatherAmt = Outside.numBuilding('cart') > 0 ? 50 : 10; + $SM.add('stores.wood', gatherAmt); }, checkTraps: function() { var drops = {}; var msg = []; var numTraps = Outside.numBuilding('trap'); - var numBait = Engine.getStore('bait'); + var numBait = $SM.get('stores.bait', true); var numDrops = numTraps + (numBait < numTraps ? numBait : numTraps); for(var i = 0; i < numDrops; i++) { var roll = Math.random(); @@ -626,6 +627,16 @@ var Outside = { drops['bait'] = -baitUsed; Notifications.notify(Outside, s); - Engine.addStores(drops); - } -} \ No newline at end of file + $SM.addM('stores', drops); + }, + + handleStateUpdates: function(e){ + //updates to run on stores changes + if(e.stateName.indexOf('stores') == 0){ + Outside.updateVillage(); + } + }, +}; + +//listener for StateManager update events +$(Outside).on('stateUpdate', Outside.handleStateUpdates); \ No newline at end of file diff --git a/script/path.js b/script/path.js index d880eb2..8153e64 100644 --- a/script/path.js +++ b/script/path.js @@ -51,6 +51,12 @@ var Path = { Engine.updateSlider(); }, + openPath: function() { + Path.init(); + Engine.event('progress', 'path'); + Notifications.notify(Room, 'the compass points ' + World.dir); + }, + getWeight: function(thing) { var w = Path.Weight[thing]; if(typeof w != 'number') w = 1; @@ -59,11 +65,11 @@ var Path = { }, getCapacity: function() { - if(Engine.getStore('convoy') > 0) { + if($SM.get('stores.convoy', true) > 0) { return Path.DEFAULT_BAG_SPACE + 60; - } else if(Engine.getStore('wagon') > 0) { + } else if($SM.get('stores.wagon', true) > 0) { return Path.DEFAULT_BAG_SPACE + 30; - } else if(Engine.getStore('rucksack') > 0) { + } else if($SM.get('stores.rucksack', true) > 0) { return Path.DEFAULT_BAG_SPACE + 10; } return Path.DEFAULT_BAG_SPACE; @@ -121,11 +127,11 @@ var Path = { // Add the armour row var armour = "none"; - if(Engine.getStore('s armour') > 0) + if($SM.get('stores[\'s armour\']', true) > 0) armour = "steel"; - else if(Engine.getStore('i armour') > 0) + else if($SM.get('stores[\'i armour\']', true) > 0) armour = "iron"; - else if(Engine.getStore('l armour') > 0) + else if($SM.get('stores[\'l armour']', true) > 0) armour = "leather"; var aRow = $('#armourRow'); if(aRow.length == 0) { @@ -169,7 +175,7 @@ var Path = { var have = $SM.get('stores[\''+k+'\']'); var num = Path.outfit[k]; num = typeof num == 'number' ? num : 0; - var numAvailable = Engine.getStore(k); + var numAvailable = $SM.get('stores[\''+k+'\']', true); var row = $('div#outfit_row_' + k.replace(' ', '-'), outfit); if((store.type == 'tool' || store.type == 'weapon') && have > 0) { total += num * Path.getWeight(k); @@ -238,7 +244,7 @@ var Path = { $('