From 7efe1426379ae5de469bfaddd6e3640ea1a604bd Mon Sep 17 00:00:00 2001 From: Elizabeth Donohew Date: Tue, 23 Feb 2016 20:46:19 -0600 Subject: [PATCH] Shows the damage that a weapon deals only when hovering over a weapon on the path tab. --- script/path.js | 14 ++++++++++---- script/world.js | 4 ++++ 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/script/path.js b/script/path.js index d675672..05d6206 100644 --- a/script/path.js +++ b/script/path.js @@ -185,7 +185,7 @@ var Path = { if((store.type == 'tool' || store.type == 'weapon') && have > 0) { total += 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) { @@ -235,10 +235,10 @@ var Path = { } }, - 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); @@ -250,6 +250,12 @@ 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); + } + $('
').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 f0f21d9..3892bf9 100644 --- a/script/world.js +++ b/script/world.js @@ -549,6 +549,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) {