Began implementing spellbooks
This commit is contained in:
22
rpg-docs/Model/Character/SpellLists.js
Normal file
22
rpg-docs/Model/Character/SpellLists.js
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
SpellLists = new Meteor.Collection("spellLists");
|
||||||
|
|
||||||
|
Schemas.SpellLists = new SimpleSchema({
|
||||||
|
charId: {type: String, regEx: SimpleSchema.RegEx.Id},
|
||||||
|
name: {type: String},
|
||||||
|
saveDC: {type: String, optional: true},
|
||||||
|
attackBonus: {type: String, optional: true},
|
||||||
|
maxPrepared: {type: String, optional: true},
|
||||||
|
"settings.showUnprepared": {type: Boolean, defaultValue: true}
|
||||||
|
});
|
||||||
|
|
||||||
|
SpellLists.attachSchema(Schemas.SpellLists);
|
||||||
|
|
||||||
|
SpellLists.helpers({
|
||||||
|
numPrepared: function(){
|
||||||
|
var num = 0;
|
||||||
|
Spells.find({charId: this.charId, listId: this._id, prepared: 1}, {fields: {prepareCost: 1}}).forEach(function(spell){
|
||||||
|
num += spell.prepareCost;
|
||||||
|
});
|
||||||
|
return num;
|
||||||
|
}
|
||||||
|
});
|
||||||
@@ -1,20 +1,21 @@
|
|||||||
Spells = new Meteor.Collection("spells");
|
Spells = new Meteor.Collection("spells");
|
||||||
|
|
||||||
Schemas.Spell = new SimpleSchema({
|
Schemas.Spell = new SimpleSchema({
|
||||||
charId: {type: String, regEx: SimpleSchema.RegEx.Id},
|
charId: {type: String, regEx: SimpleSchema.RegEx.Id},
|
||||||
name: {type: String},
|
listId: {type: String, regEx: SimpleSchema.RegEx.Id},
|
||||||
description:{type: String},
|
prepared: {type: Boolean, defaultValue: false},
|
||||||
castingTime:{type: String},
|
prepareCost: {type: Number, defaultValue: 1}, //0 for spells that "dont count against your max number of spells prepared", 1 otherwise
|
||||||
range: {type: String},
|
name: {type: String},
|
||||||
duration: {type: Number},
|
description: {type: String, optional: true},
|
||||||
"components.verbal": {type: Boolean},
|
castingTime: {type: String, optional: true},
|
||||||
"components.somatic": {type: Boolean},
|
range: {type: String, optional: true},
|
||||||
|
duration: {type: String, optional: true},
|
||||||
|
"components.verbal": {type: Boolean, defaultValue: false},
|
||||||
|
"components.somatic": {type: Boolean, defaultValue: false},
|
||||||
"components.material": {type: String, optional: true},
|
"components.material": {type: String, optional: true},
|
||||||
"components.concentration": {type: Boolean},
|
"components.concentration": {type: Boolean, defaultValue: false},
|
||||||
ritual: {type: Boolean},
|
ritual: {type: Boolean, defaultValue: false},
|
||||||
selfBuffs: {type: [Schemas.Buff], defaultValue: []},
|
level: {type: Number, defaultValue: 0}
|
||||||
level: {type: Number},
|
|
||||||
class: {type: String}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
Spells.attachSchema(Schemas.Spell);
|
Spells.attachSchema(Schemas.Spell);
|
||||||
|
|||||||
3
rpg-docs/client/views/character/spells/spells.css
Normal file
3
rpg-docs/client/views/character/spells/spells.css
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
#spells {
|
||||||
|
padding: 4px;
|
||||||
|
}
|
||||||
30
rpg-docs/client/views/character/spells/spells.html
Normal file
30
rpg-docs/client/views/character/spells/spells.html
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
<template name="spells">
|
||||||
|
<div fit>
|
||||||
|
<div id="spells" class="scroll-y" fit>
|
||||||
|
<div class="containers">
|
||||||
|
{{#each spellLevels}}
|
||||||
|
<paper-shadow class="card container" hero-id="main" {{detailHero}}>
|
||||||
|
<div class="containerTop green white-text" hero-id="toolbar" layout horizontal center {{detailHero}}>
|
||||||
|
<div class="containerName title" hero-id="title" flex {{detailHero}}>{{name}}</div>
|
||||||
|
{{#if attribute}}<div class="subhead">{{../attributeValue attribute}} / {{../attributeBase attribute}}</div>{{/if}}
|
||||||
|
</div>
|
||||||
|
<div flex class="containerMain">
|
||||||
|
{{#each spellsAtLevel}}
|
||||||
|
<div class="itemSlot">
|
||||||
|
<paper-item class="inventoryItem" hero-id="main" {{detailHero}}>
|
||||||
|
{{name}}
|
||||||
|
</paper-item>
|
||||||
|
</div>
|
||||||
|
{{/each}}
|
||||||
|
</div>
|
||||||
|
</paper-shadow>
|
||||||
|
{{/each}}
|
||||||
|
<div class="fab-buffer"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<paper-fab-menu id="inventoryAddMenu" icon="add" closeIcon="close" duration="0.3">
|
||||||
|
<paper-fab-menu-item id="addSpell" icon="note-add" color="#d23f31" tooltip="Spell"></paper-fab-menu-item>
|
||||||
|
<paper-fab-menu-item id="addSpellList" icon="work" color="#d23f31" tooltip="Spell List"></paper-fab-menu-item>
|
||||||
|
</paper-fab-menu>
|
||||||
|
</template>
|
||||||
21
rpg-docs/client/views/character/spells/spells.js
Normal file
21
rpg-docs/client/views/character/spells/spells.js
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
var spellLevels = [
|
||||||
|
{ name: "Cantrips", level: 0 },
|
||||||
|
{ name: "Level 1", level: 1, attribute: "level1SpellSlots" },
|
||||||
|
{ name: "Level 2", level: 2, attribute: "level2SpellSlots" },
|
||||||
|
{ name: "Level 3", level: 3, attribute: "level3SpellSlots" },
|
||||||
|
{ name: "Level 4", level: 4, attribute: "level4SpellSlots" },
|
||||||
|
{ name: "Level 5", level: 5, attribute: "level5SpellSlots" },
|
||||||
|
{ name: "Level 6", level: 6, attribute: "level6SpellSlots" },
|
||||||
|
{ name: "Level 7", level: 7, attribute: "level7SpellSlots" },
|
||||||
|
{ name: "Level 8", level: 8, attribute: "level8SpellSlots" },
|
||||||
|
{ name: "Level 9", level: 9, attribute: "level9SpellSlots" },
|
||||||
|
];
|
||||||
|
|
||||||
|
Template.spells.helpers({
|
||||||
|
spellLevels: function(){
|
||||||
|
return spellLevels;
|
||||||
|
},
|
||||||
|
spellsAtLevel: function(){
|
||||||
|
return Spells.find( {charId: Template.parentData()._id, level: this.level} )
|
||||||
|
}
|
||||||
|
})
|
||||||
Reference in New Issue
Block a user