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");
|
||||
|
||||
Schemas.Spell = new SimpleSchema({
|
||||
charId: {type: String, regEx: SimpleSchema.RegEx.Id},
|
||||
name: {type: String},
|
||||
description:{type: String},
|
||||
castingTime:{type: String},
|
||||
range: {type: String},
|
||||
duration: {type: Number},
|
||||
"components.verbal": {type: Boolean},
|
||||
"components.somatic": {type: Boolean},
|
||||
charId: {type: String, regEx: SimpleSchema.RegEx.Id},
|
||||
listId: {type: String, regEx: SimpleSchema.RegEx.Id},
|
||||
prepared: {type: Boolean, defaultValue: false},
|
||||
prepareCost: {type: Number, defaultValue: 1}, //0 for spells that "dont count against your max number of spells prepared", 1 otherwise
|
||||
name: {type: String},
|
||||
description: {type: String, optional: true},
|
||||
castingTime: {type: String, optional: true},
|
||||
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.concentration": {type: Boolean},
|
||||
ritual: {type: Boolean},
|
||||
selfBuffs: {type: [Schemas.Buff], defaultValue: []},
|
||||
level: {type: Number},
|
||||
class: {type: String}
|
||||
"components.concentration": {type: Boolean, defaultValue: false},
|
||||
ritual: {type: Boolean, defaultValue: false},
|
||||
level: {type: Number, defaultValue: 0}
|
||||
});
|
||||
|
||||
Spells.attachSchema(Schemas.Spell);
|
||||
|
||||
Reference in New Issue
Block a user