diff --git a/script/path.js b/script/path.js index 3d5b776..d5dc042 100644 --- a/script/path.js +++ b/script/path.js @@ -157,20 +157,19 @@ var Path = { $('.row_val', wRow).text(World.getMaxWater()); } - var space = Path.getFreeSpace(); - var total = 0; + var currentBagCapacity = 0; // Add the non-craftables to the craftables var carryable = $.extend({ - 'cured meat': { type: 'tool' }, - 'bullets': { type: 'tool' }, + 'cured meat': { type: 'tool', desc: 'restores '+ World.MEAT_HEAL + ' hp' }, + 'bullets': { type: 'tool', desc: 'use with rifle' }, 'grenade': {type: 'weapon' }, 'bolas': {type: 'weapon' }, 'laser rifle': {type: 'weapon' }, - 'energy cell': {type: 'tool' }, + 'energy cell': {type: 'tool', desc: 'use with laser rifle' }, 'bayonet': {type: 'weapon' }, 'charm': {type: 'tool'}, - 'medicine': {type: 'tool'} + 'medicine': {type: 'tool', desc: 'restores ' + World.MEDS_HEAL + ' hp' } }, Room.Craftables); for(var k in carryable) { @@ -184,9 +183,9 @@ var Path = { var row = $('div#outfit_row_' + k.replace(' ', '-'), outfit); if((store.type == 'tool' || store.type == 'weapon') && have > 0) { - total += num * Path.getWeight(k); + currentBagCapacity += num * Path.getWeight(k); if(row.length === 0) { - row = Path.createOutfittingRow(k, num, store.name); + row = Path.createOutfittingRow(k, num, store, store.name); var curPrev = null; outfit.children().each(function(i) { @@ -225,21 +224,27 @@ var Path = { row.remove(); } } - + + Path.updateBagSpace(currentBagCapacity); + + }, + + updateBagSpace: function(currentBagCapacity) { // Update bagspace - $('#bagspace').text(_('free {0}/{1}', Math.floor(Path.getCapacity() - total) , Path.getCapacity())); - + $('#bagspace').text(_('free {0}/{1}', Math.floor(Path.getCapacity() - currentBagCapacity) , Path.getCapacity())); + if(Path.outfit['cured meat'] > 0) { Button.setDisabled($('#embarkButton'), false); } else { Button.setDisabled($('#embarkButton'), true); } + }, - createOutfittingRow: function(key, num, name) { - if(!name) name = _(key); + createOutfittingRow: function(key, num, store) { + if(!store.name) store.name = _(key); var row = $('
').attr('id', 'outfit_row_' + key.replace(' ', '-')).addClass('outfitRow').attr('key',key); - $('
').addClass('row_key').text(name).appendTo(row); + $('
').addClass('row_key').text(store.name).appendTo(row); var val = $('
').addClass('row_val').appendTo(row); $('').text(num).appendTo(val); @@ -251,6 +256,14 @@ var Path = { var numAvailable = $SM.get('stores["'+key+'"]', true); var tt = $('
').addClass('tooltip bottom right').appendTo(row); + + if(store.type == 'weapon') { + $('
').addClass('row_key').text(_('damage')).appendTo(tt); + $('
').addClass('row_val').text(World.getDamage(key)).appendTo(tt); + } else if(store.type == 'tool' && store.desc != "undefined") { + $('
').addClass('row_key').text(store.desc).appendTo(tt); + } + $('
').addClass('row_key').text(_('weight')).appendTo(tt); $('
').addClass('row_val').text(Path.getWeight(key)).appendTo(tt); $('
').addClass('row_key').text(_('available')).appendTo(tt); diff --git a/script/world.js b/script/world.js index 177e103..d40e629 100644 --- a/script/world.js +++ b/script/world.js @@ -552,6 +552,10 @@ var World = { return World.state.map[World.curPos[0]][World.curPos[1]]; }, + getDamage: function(thing) { + return World.Weapons[thing].damage; + }, + narrateMove: function(oldTile, newTile) { var msg = null; switch(oldTile) {