mirror of
https://github.com/doublespeakgames/adarkroom.git
synced 2026-06-08 13:37:12 +08:00
+10
-10
@@ -176,11 +176,12 @@ var Path = {
|
|||||||
for(var k in carryable) {
|
for(var k in carryable) {
|
||||||
var lk = _(k);
|
var lk = _(k);
|
||||||
var store = carryable[k];
|
var store = carryable[k];
|
||||||
var have = $SM.get('stores["'+k+'"]');
|
var have = $SM.get('stores["'+k+'"]', true);
|
||||||
var num = Path.outfit[k];
|
var num = Path.outfit[k];
|
||||||
num = typeof num == 'number' ? num : 0;
|
num = typeof num == 'number' ? num : 0;
|
||||||
if (have < num) { num = have; }
|
if (have < num) { num = have; }
|
||||||
var numAvailable = $SM.get('stores["'+k+'"]', true);
|
$SM.set('outfit["'+k+'"]', num, true);
|
||||||
|
|
||||||
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);
|
total += num * Path.getWeight(k);
|
||||||
@@ -204,7 +205,7 @@ var Path = {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$('div#' + row.attr('id') + ' > div.row_val > span', outfit).text(num);
|
$('div#' + row.attr('id') + ' > div.row_val > span', outfit).text(num);
|
||||||
$('div#' + row.attr('id') + ' .tooltip .numAvailable', outfit).text(numAvailable - num);
|
$('div#' + row.attr('id') + ' .tooltip .numAvailable', outfit).text(have - num);
|
||||||
}
|
}
|
||||||
if(num === 0) {
|
if(num === 0) {
|
||||||
$('.dnBtn', row).addClass('disabled');
|
$('.dnBtn', row).addClass('disabled');
|
||||||
@@ -213,10 +214,10 @@ var Path = {
|
|||||||
$('.dnBtn', row).removeClass('disabled');
|
$('.dnBtn', row).removeClass('disabled');
|
||||||
$('.dnManyBtn', row).removeClass('disabled');
|
$('.dnManyBtn', row).removeClass('disabled');
|
||||||
}
|
}
|
||||||
if(num >= numAvailable || space < Path.getWeight(k)) {
|
if(num == have || space < Path.getWeight(k)) {
|
||||||
$('.upBtn', row).addClass('disabled');
|
$('.upBtn', row).addClass('disabled');
|
||||||
$('.upManyBtn', row).addClass('disabled');
|
$('.upManyBtn', row).addClass('disabled');
|
||||||
} else if(space >= Path.getWeight(k)) {
|
} else {
|
||||||
$('.upBtn', row).removeClass('disabled');
|
$('.upBtn', row).removeClass('disabled');
|
||||||
$('.upManyBtn', row).removeClass('disabled');
|
$('.upManyBtn', row).removeClass('disabled');
|
||||||
}
|
}
|
||||||
@@ -266,8 +267,7 @@ var Path = {
|
|||||||
if(Path.getFreeSpace() >= Path.getWeight(supply) && cur < $SM.get('stores["'+supply+'"]', true)) {
|
if(Path.getFreeSpace() >= Path.getWeight(supply) && cur < $SM.get('stores["'+supply+'"]', true)) {
|
||||||
var maxExtraByWeight = Math.floor(Path.getFreeSpace() / Path.getWeight(supply));
|
var maxExtraByWeight = Math.floor(Path.getFreeSpace() / Path.getWeight(supply));
|
||||||
var maxExtraByStore = $SM.get('stores["'+supply+'"]', true) - cur;
|
var maxExtraByStore = $SM.get('stores["'+supply+'"]', true) - cur;
|
||||||
var maxExtraByBtn = btn.data;
|
Path.outfit[supply] = cur + Math.min(btn.data, maxExtraByWeight, maxExtraByStore);
|
||||||
Path.outfit[supply] = cur + Math.min(maxExtraByBtn, Math.min(maxExtraByWeight, maxExtraByStore));
|
|
||||||
$SM.set('outfit['+supply+']', Path.outfit[supply]);
|
$SM.set('outfit['+supply+']', Path.outfit[supply]);
|
||||||
Path.updateOutfitting();
|
Path.updateOutfitting();
|
||||||
}
|
}
|
||||||
@@ -289,7 +289,6 @@ var Path = {
|
|||||||
Path.setTitle();
|
Path.setTitle();
|
||||||
Path.updateOutfitting();
|
Path.updateOutfitting();
|
||||||
Path.updatePerks(true);
|
Path.updatePerks(true);
|
||||||
$SM.set('outfit', Path.outfit);
|
|
||||||
|
|
||||||
Engine.moveStoresView($('#perks'), transition_diff);
|
Engine.moveStoresView($('#perks'), transition_diff);
|
||||||
},
|
},
|
||||||
@@ -302,7 +301,6 @@ var Path = {
|
|||||||
for(var k in Path.outfit) {
|
for(var k in Path.outfit) {
|
||||||
$SM.add('stores["'+k+'"]', -Path.outfit[k]);
|
$SM.add('stores["'+k+'"]', -Path.outfit[k]);
|
||||||
}
|
}
|
||||||
$SM.remove('outfit');
|
|
||||||
World.onArrival();
|
World.onArrival();
|
||||||
$('#outerSlider').animate({left: '-700px'}, 300);
|
$('#outerSlider').animate({left: '-700px'}, 300);
|
||||||
Engine.activeModule = World;
|
Engine.activeModule = World;
|
||||||
@@ -311,7 +309,9 @@ var Path = {
|
|||||||
handleStateUpdates: function(e){
|
handleStateUpdates: function(e){
|
||||||
if(e.category == 'character' && e.stateName.indexOf('character.perks') === 0 && Engine.activeModule == Path){
|
if(e.category == 'character' && e.stateName.indexOf('character.perks') === 0 && Engine.activeModule == Path){
|
||||||
Path.updatePerks();
|
Path.updatePerks();
|
||||||
};
|
} else if(e.category == 'income' && Engine.activeModule == Path){
|
||||||
|
Path.updateOutfitting();
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
scrollSidebar: function(direction, reset){
|
scrollSidebar: function(direction, reset){
|
||||||
|
|||||||
+1
-1
@@ -750,7 +750,7 @@ var Room = {
|
|||||||
|
|
||||||
updateStoresView: function() {
|
updateStoresView: function() {
|
||||||
var stores = $('div#stores');
|
var stores = $('div#stores');
|
||||||
var resources = $('div#resources');
|
var resources = $('div#resources');
|
||||||
var special = $('div#special');
|
var special = $('div#special');
|
||||||
var weapons = $('div#weapons');
|
var weapons = $('div#weapons');
|
||||||
var needsAppend = false, rNeedsAppend = false, sNeedsAppend = false, wNeedsAppend = false, newRow = false;
|
var needsAppend = false, rNeedsAppend = false, sNeedsAppend = false, wNeedsAppend = false, newRow = false;
|
||||||
|
|||||||
@@ -851,6 +851,7 @@ var World = {
|
|||||||
Notifications.notify(World, _('the world fades'));
|
Notifications.notify(World, _('the world fades'));
|
||||||
World.state = null;
|
World.state = null;
|
||||||
Path.outfit = {};
|
Path.outfit = {};
|
||||||
|
$SM.remove('outfit');
|
||||||
$('#outerSlider').animate({opacity: '0'}, 600, 'linear', function() {
|
$('#outerSlider').animate({opacity: '0'}, 600, 'linear', function() {
|
||||||
$('#outerSlider').css('left', '0px');
|
$('#outerSlider').css('left', '0px');
|
||||||
$('#locationSlider').css('left', '0px');
|
$('#locationSlider').css('left', '0px');
|
||||||
|
|||||||
Reference in New Issue
Block a user