mirror of
https://github.com/doublespeakgames/adarkroom.git
synced 2026-05-28 00:01:54 +08:00
Merge pull request #471 from code-kit/master
More Weapons/Tools Information on Path Tab
This commit is contained in:
+27
-14
@@ -157,20 +157,19 @@ var Path = {
|
|||||||
$('.row_val', wRow).text(World.getMaxWater());
|
$('.row_val', wRow).text(World.getMaxWater());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
var space = Path.getFreeSpace();
|
var space = Path.getFreeSpace();
|
||||||
var total = 0;
|
var currentBagCapacity = 0;
|
||||||
// Add the non-craftables to the craftables
|
// Add the non-craftables to the craftables
|
||||||
var carryable = $.extend({
|
var carryable = $.extend({
|
||||||
'cured meat': { type: 'tool' },
|
'cured meat': { type: 'tool', desc: 'restores '+ World.MEAT_HEAL + ' hp' },
|
||||||
'bullets': { type: 'tool' },
|
'bullets': { type: 'tool', desc: 'use with rifle' },
|
||||||
'grenade': {type: 'weapon' },
|
'grenade': {type: 'weapon' },
|
||||||
'bolas': {type: 'weapon' },
|
'bolas': {type: 'weapon' },
|
||||||
'laser rifle': {type: 'weapon' },
|
'laser rifle': {type: 'weapon' },
|
||||||
'energy cell': {type: 'tool' },
|
'energy cell': {type: 'tool', desc: 'use with laser rifle' },
|
||||||
'bayonet': {type: 'weapon' },
|
'bayonet': {type: 'weapon' },
|
||||||
'charm': {type: 'tool'},
|
'charm': {type: 'tool'},
|
||||||
'medicine': {type: 'tool'}
|
'medicine': {type: 'tool', desc: 'restores ' + World.MEDS_HEAL + ' hp' }
|
||||||
}, Room.Craftables);
|
}, Room.Craftables);
|
||||||
|
|
||||||
for(var k in carryable) {
|
for(var k in carryable) {
|
||||||
@@ -184,9 +183,9 @@ var Path = {
|
|||||||
|
|
||||||
var row = $('div#outfit_row_' + k.replace(' ', '-'), outfit);
|
var row = $('div#outfit_row_' + k.replace(' ', '-'), outfit);
|
||||||
if((store.type == 'tool' || store.type == 'weapon') && have > 0) {
|
if((store.type == 'tool' || store.type == 'weapon') && have > 0) {
|
||||||
total += num * Path.getWeight(k);
|
currentBagCapacity += num * Path.getWeight(k);
|
||||||
if(row.length === 0) {
|
if(row.length === 0) {
|
||||||
row = Path.createOutfittingRow(k, num, store.name);
|
row = Path.createOutfittingRow(k, num, store, store.name);
|
||||||
|
|
||||||
var curPrev = null;
|
var curPrev = null;
|
||||||
outfit.children().each(function(i) {
|
outfit.children().each(function(i) {
|
||||||
@@ -225,21 +224,27 @@ var Path = {
|
|||||||
row.remove();
|
row.remove();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Path.updateBagSpace(currentBagCapacity);
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
updateBagSpace: function(currentBagCapacity) {
|
||||||
// Update bagspace
|
// 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) {
|
if(Path.outfit['cured meat'] > 0) {
|
||||||
Button.setDisabled($('#embarkButton'), false);
|
Button.setDisabled($('#embarkButton'), false);
|
||||||
} else {
|
} else {
|
||||||
Button.setDisabled($('#embarkButton'), true);
|
Button.setDisabled($('#embarkButton'), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
createOutfittingRow: function(key, num, name) {
|
createOutfittingRow: function(key, num, store) {
|
||||||
if(!name) name = _(key);
|
if(!store.name) store.name = _(key);
|
||||||
var row = $('<div>').attr('id', 'outfit_row_' + key.replace(' ', '-')).addClass('outfitRow').attr('key',key);
|
var row = $('<div>').attr('id', 'outfit_row_' + key.replace(' ', '-')).addClass('outfitRow').attr('key',key);
|
||||||
$('<div>').addClass('row_key').text(name).appendTo(row);
|
$('<div>').addClass('row_key').text(store.name).appendTo(row);
|
||||||
var val = $('<div>').addClass('row_val').appendTo(row);
|
var val = $('<div>').addClass('row_val').appendTo(row);
|
||||||
|
|
||||||
$('<span>').text(num).appendTo(val);
|
$('<span>').text(num).appendTo(val);
|
||||||
@@ -251,6 +256,14 @@ var Path = {
|
|||||||
|
|
||||||
var numAvailable = $SM.get('stores["'+key+'"]', true);
|
var numAvailable = $SM.get('stores["'+key+'"]', true);
|
||||||
var tt = $('<div>').addClass('tooltip bottom right').appendTo(row);
|
var tt = $('<div>').addClass('tooltip bottom right').appendTo(row);
|
||||||
|
|
||||||
|
if(store.type == 'weapon') {
|
||||||
|
$('<div>').addClass('row_key').text(_('damage')).appendTo(tt);
|
||||||
|
$('<div>').addClass('row_val').text(World.getDamage(key)).appendTo(tt);
|
||||||
|
} else if(store.type == 'tool' && store.desc != "undefined") {
|
||||||
|
$('<div>').addClass('row_key').text(store.desc).appendTo(tt);
|
||||||
|
}
|
||||||
|
|
||||||
$('<div>').addClass('row_key').text(_('weight')).appendTo(tt);
|
$('<div>').addClass('row_key').text(_('weight')).appendTo(tt);
|
||||||
$('<div>').addClass('row_val').text(Path.getWeight(key)).appendTo(tt);
|
$('<div>').addClass('row_val').text(Path.getWeight(key)).appendTo(tt);
|
||||||
$('<div>').addClass('row_key').text(_('available')).appendTo(tt);
|
$('<div>').addClass('row_key').text(_('available')).appendTo(tt);
|
||||||
|
|||||||
@@ -552,6 +552,10 @@ var World = {
|
|||||||
return World.state.map[World.curPos[0]][World.curPos[1]];
|
return World.state.map[World.curPos[0]][World.curPos[1]];
|
||||||
},
|
},
|
||||||
|
|
||||||
|
getDamage: function(thing) {
|
||||||
|
return World.Weapons[thing].damage;
|
||||||
|
},
|
||||||
|
|
||||||
narrateMove: function(oldTile, newTile) {
|
narrateMove: function(oldTile, newTile) {
|
||||||
var msg = null;
|
var msg = null;
|
||||||
switch(oldTile) {
|
switch(oldTile) {
|
||||||
|
|||||||
Reference in New Issue
Block a user