1
0
mirror of https://github.com/kihashi/stardew_community_checklist.git synced 2025-10-19 08:03:17 +00:00

Added functions to calculate how many items are in a room.

This commit is contained in:
John Cleaver 2016-04-03 17:05:41 -04:00
parent 46ca0ef3db
commit 12be3f73f4

16
main.js
View File

@ -116,6 +116,22 @@ var v = new Vue({
}
}
return "";
},
getRoomItemsRequired: function(roomId) {
return this.static.bundles.reduce(function(previousValue, nextValue){
if(nextValue.room === roomId){
return previousValue + nextValue.items_required;
}
else{
return previousValue;
}
}, 0)
},
getRoomItemsChecked: function(roomId){
return this.static.bundles
.filter(function(b){ return b.room === roomId; })
.map(function(b){ return b.id; })
.reduce(function(p, c){ return p + v.user_data[c].length; }, 0);
}
}
});