Implemented remaining core features

This commit is contained in:
Thaum
2015-02-25 12:48:45 +00:00
parent 52b8c8b8d6
commit 56f8e95d81
38 changed files with 748 additions and 100 deletions

View File

@@ -1,5 +1,5 @@
var spellLevels = [
{ name: "Cantrips", level: 0 },
{ name: "Cantrip", level: 0 },
{ name: "Level 1", level: 1 },
{ name: "Level 2", level: 2 },
{ name: "Level 3", level: 3 },

View File

@@ -31,15 +31,15 @@ Template.spellListDialog.events({
var value = event.currentTarget.value
SpellLists.update(this._id, {$set: {name: value}});
},
"change #spellListSaveDCInput, input #spellListNameInput": function(event){
"change #spellListSaveDCInput, input #spellListSaveDCInput": function(event){
var value = event.currentTarget.value
SpellLists.update(this._id, {$set: {saveDC: value}});
},
"change #spellListAttackBonusInput, input #spellListNameInput": function(event){
"change #spellListAttackBonusInput, input #spellListAttackBonusInput": function(event){
var value = event.currentTarget.value
SpellLists.update(this._id, {$set: {attackBonus: value}});
},
"change #spellListMaxPreparedInput, input #spellListNameInput": function(event){
"change #spellListMaxPreparedInput, input #spellListMaxPreparedInput": function(event){
var value = event.currentTarget.value
SpellLists.update(this._id, {$set: {maxPrepared: value}});
},

View File

@@ -2,27 +2,29 @@
<div fit>
<div id="spells" class="scroll-y" fit>
<div class="containers">
<paper-shadow class="card container" hero-id="main" {{detailHero}} style="order: {{containerOrder}};">
<div class="containerTop {{colorClass}}" layout horizontal center>
<div class="containerName subhead" hero-id="title" flex>Spell Slots</div>
</div>
<div flex class="containerMain">
{{#each levels}}{{#if showSlots ..}}
<div class="itemSlot">
<paper-item class="inventoryItem spellSlot" hero-id="main" {{detailHero}} layout horizontal>
<div class="slotName">
{{name}}
</div>
<div flex layout horizontal center>
{{#each slotBubbles ..}}
<paper-icon-button class="slotBubble" icon={{icon}} disabled={{disabled}}></paper-icon-button>
{{/each}}
</div>
</paper-item>
</div>
{{/if}}{{/each}}
</div>
</paper-shadow>
{{#if hasSlots}}
<paper-shadow class="card container" hero-id="main" {{detailHero}} style="order: {{containerOrder}};">
<div class="containerTop {{colorClass}}" layout horizontal center>
<div class="containerName subhead" hero-id="title" flex>Spell Slots</div>
</div>
<div flex class="containerMain">
{{#each levels}}{{#if showSlots ..}}
<div class="itemSlot">
<paper-item class="inventoryItem spellSlot" hero-id="main" {{detailHero}} layout horizontal>
<div class="slotName">
{{name}}
</div>
<div flex layout horizontal center>
{{#each slotBubbles ..}}
<paper-icon-button class="slotBubble" icon={{icon}} disabled={{disabled}}></paper-icon-button>
{{/each}}
</div>
</paper-item>
</div>
{{/if}}{{/each}}
</div>
</paper-shadow>
{{/if}}
{{#each spellLists}}
<paper-shadow class="card container" hero-id="main" {{detailHero}} style="order: {{order}};">
<div class="containerTop {{colorClass}}" hero-id="toolbar" layout horizontal center {{detailHero}}>

View File

@@ -46,7 +46,7 @@ Template.spells.helpers({
}
if(this.components.material){
components += components? ", M" : "M";
components += "("+this.components.material+")";
components += " ("+this.components.material+")";
}
if(this.components.concentration){
components += " - Requires concentration"
@@ -83,6 +83,14 @@ Template.spells.helpers({
showSlots: function(char){
return this.level && char.attributeBase("level" + this.level +"SpellSlots");
},
hasSlots: function(){
for(var i = 1; i <= 9; i += 1){
if(this.attributeBase("level"+i+"SpellSlots")){
return true;
}
}
return false;
},
slotBubbles: function(char){
var baseSlots = char.attributeBase("level" + this.level +"SpellSlots"),
currentSlots = char.attributeValue("level" + this.level +"SpellSlots"),
@@ -165,7 +173,8 @@ Template.spells.events({
Spells.insert({
name: "New Spell",
charId: this._id,
listId: SpellLists.findOne({charId: this._id})._id
listId: SpellLists.findOne({charId: this._id})._id,
prepared: "prepared"
}, function(error, id){
if(!error){
GlobalUI.setDetail({