Added attunement to items
This commit is contained in:
@@ -9,6 +9,7 @@ Schemas.Item = new SimpleSchema({
|
||||
weight: {type: Number, min: 0, defaultValue: 0, decimal: true},
|
||||
value: {type: Number, min: 0, defaultValue: 0, decimal: true},
|
||||
enabled: {type: Boolean, defaultValue: false},
|
||||
requiresAttunement: {type: Boolean, defaultValue: false},
|
||||
color: {type: String, allowedValues: _.pluck(colorOptions, "key"), defaultValue: "q"}
|
||||
});
|
||||
|
||||
|
||||
@@ -30,6 +30,13 @@
|
||||
<div class="caption">{{round equipmentWeight}}lbs</div>
|
||||
</div>
|
||||
<div flex class="equipmentMain">
|
||||
{{#if attuned.count}}
|
||||
<div class="list-subhead" layout horizontal center>Attuned</div>
|
||||
{{/if}}
|
||||
{{#each attuned}}
|
||||
{{>inventoryItem}}
|
||||
{{/each}}
|
||||
<div class="list-subhead" layout horizontal center>{{name}}</div>
|
||||
{{#each equipment}}
|
||||
{{>inventoryItem}}
|
||||
{{/each}}
|
||||
|
||||
@@ -9,8 +9,11 @@ Template.inventory.helpers({
|
||||
items: function(charId, containerId){
|
||||
return Items.find({charId: charId, "parent.id": containerId }, {sort: {color: 1, name: 1}});
|
||||
},
|
||||
attuned: function(){
|
||||
return Items.find({ charId: this._id, enabled: true, requiresAttunement: true }, {sort: {color: 1, name: 1}});
|
||||
},
|
||||
equipment: function(){
|
||||
return Items.find({ charId: this._id, enabled: true }, {sort: {color: 1, name: 1}});
|
||||
return Items.find({ charId: this._id, enabled: true, requiresAttunement: false }, {sort: {color: 1, name: 1}});
|
||||
},
|
||||
carriedItems: function(){
|
||||
return Items.find({charId: this._id, enabled: false, "parent.id": this._id}, {sort: {color: 1, name: 1}});
|
||||
|
||||
@@ -25,6 +25,11 @@
|
||||
touch-action="pan-y">
|
||||
</paper-toggle-button>
|
||||
</div>
|
||||
<!--Equipped-->
|
||||
<div center horizontal layout>
|
||||
<div flex>Requires Attunement</div>
|
||||
<paper-checkbox id="attunementCheckbox" checked={{requiresAttunement}}></paper-checkbox>
|
||||
</div>
|
||||
<!--Quantity-->
|
||||
<paper-input-decorator label="Quantity" floatinglabel>
|
||||
<input id="quantityInput" type="number" value={{quantity}}>
|
||||
|
||||
@@ -24,24 +24,24 @@ Template.itemDialog.events({
|
||||
GlobalUI.closeDetail();
|
||||
},
|
||||
//TODO validate input (integer, non-negative, etc) for these inputs and give validation errors
|
||||
"change #itemNameInput, input #itemNameInput": function(event){
|
||||
"change #itemNameInput": function(event){
|
||||
console.log("changed Nameinput");
|
||||
var name = Template.instance().find("#itemNameInput").value;
|
||||
Items.update(this._id, {$set: {name: name}});
|
||||
},
|
||||
"change #itemPluralInput, input #itemPluralInput": function(event){
|
||||
"change #itemPluralInput": function(event){
|
||||
var plural = Template.instance().find("#itemPluralInput").value;
|
||||
Items.update(this._id, {$set: {plural: plural}});
|
||||
},
|
||||
"change #quantityInput, input #quantityInput": function(event){
|
||||
"change #quantityInput": function(event){
|
||||
var quantity = +Template.instance().find("#quantityInput").value;
|
||||
Items.update(this._id, {$set: {quantity: quantity}});
|
||||
},
|
||||
"change #weightInput, input #weightInput": function(event){
|
||||
"change #weightInput": function(event){
|
||||
var weight = +Template.instance().find("#weightInput").value;
|
||||
Items.update(this._id, {$set: {weight: weight}});
|
||||
},
|
||||
"change #valueInput, input #valueInput": function(event){
|
||||
"change #valueInput": function(event){
|
||||
var value = +Template.instance().find("#valueInput").value;
|
||||
Items.update(this._id, {$set: {value: value}});
|
||||
},
|
||||
@@ -60,6 +60,10 @@ Template.itemDialog.events({
|
||||
}
|
||||
}
|
||||
},
|
||||
"change #attunementCheckbox": function(event){
|
||||
var value = event.currentTarget.checked;
|
||||
Items.update(this._id, {$set: {requiresAttunement: value}});
|
||||
},
|
||||
"core-select #containerDropDown": function(event){
|
||||
var detail = event.originalEvent.detail;
|
||||
if(!detail.isSelected) return;
|
||||
|
||||
Reference in New Issue
Block a user