Added a schema/collection pair for CustomBuffs
This commit is contained in:
@@ -42,10 +42,18 @@ Schemas.Buff = new SimpleSchema({
|
||||
allowedValues: _.pluck(colorOptions, "key"),
|
||||
defaultValue: "q",
|
||||
},
|
||||
//the id of the feature, buff or item that created this buff
|
||||
parent: {
|
||||
type: Schemas.Parent,
|
||||
optional: true,
|
||||
appliedBy: { //the charId of whoever applied the buff
|
||||
type: String,
|
||||
regEx: SimpleSchema.RegEx.Id,
|
||||
},
|
||||
appliedByDetails: {//the name and collection of the thing that applied the buff, and the character's name
|
||||
type: Object;
|
||||
},
|
||||
"appliedByDetails.name": {
|
||||
type: String,
|
||||
},
|
||||
"appliedByDetails.collection": {
|
||||
type: String,
|
||||
},
|
||||
});
|
||||
|
||||
@@ -53,7 +61,6 @@ Buffs.attachSchema(Schemas.Buff);
|
||||
|
||||
Buffs.attachBehaviour("softRemovable");
|
||||
makeParent(Buffs, ["name", "enabled"]); //parents of effects, attacks, proficiencies
|
||||
makeChild(Buffs, ["enabled"]); //children of lots of things
|
||||
|
||||
Buffs.allow(CHARACTER_SUBSCHEMA_ALLOW);
|
||||
Buffs.deny(CHARACTER_SUBSCHEMA_DENY);
|
||||
|
||||
@@ -532,6 +532,7 @@ if (Meteor.isServer){
|
||||
Attacks .remove({charId: character._id});
|
||||
Buffs .remove({charId: character._id});
|
||||
Classes .remove({charId: character._id});
|
||||
CustomBuffs .remove({charId: character._id});
|
||||
Effects .remove({charId: character._id});
|
||||
Experiences .remove({charId: character._id});
|
||||
Features .remove({charId: character._id});
|
||||
|
||||
57
rpg-docs/Model/Character/CustomBuffs.js
Normal file
57
rpg-docs/Model/Character/CustomBuffs.js
Normal file
@@ -0,0 +1,57 @@
|
||||
CustomBuffs = new Mongo.Collection("customBuffs");
|
||||
|
||||
Schemas.CustomBuff = new SimpleSchema({
|
||||
charId: {
|
||||
type: String,
|
||||
regEx: SimpleSchema.RegEx.Id,
|
||||
index: 1,
|
||||
},
|
||||
name: {
|
||||
type: String,
|
||||
optional: true,
|
||||
trim: false,
|
||||
},
|
||||
description: {
|
||||
type: String,
|
||||
optional: true,
|
||||
trim: false,
|
||||
},
|
||||
enabled: {
|
||||
type: Boolean,
|
||||
autoValue: function(){
|
||||
return false;
|
||||
//enabled is ALWAYS false on these, so that its children are also not enabled, so that the buff templates have no effects.
|
||||
},
|
||||
},
|
||||
type: {
|
||||
type: String,
|
||||
allowedValues: [
|
||||
"inate", //this should be "innate", but changing it could be problematic
|
||||
"custom",
|
||||
],
|
||||
},
|
||||
"lifeTime.total": {
|
||||
type: Number,
|
||||
defaultValue: 0, //0 is infinite
|
||||
min: 0,
|
||||
},
|
||||
color: {
|
||||
type: String,
|
||||
allowedValues: _.pluck(colorOptions, "key"),
|
||||
defaultValue: "q",
|
||||
},
|
||||
//the id of the feature, buff or item that creates this buff
|
||||
parent: {
|
||||
type: Schemas.Parent,
|
||||
optional: true,
|
||||
},
|
||||
});
|
||||
|
||||
CustomBuffs.attachSchema(Schemas.CustomBuff);
|
||||
|
||||
CustomBuffs.attachBehaviour("softRemovable");
|
||||
makeParent(CustomBuffs, ["name", "enabled"]); //parents of effects, attacks, proficiencies. Since this represents a template, "enabled" is always false.
|
||||
makeChild(CustomBuffs, ["enabled"]); //children of lots of things
|
||||
|
||||
CustomBuffs.allow(CHARACTER_SUBSCHEMA_ALLOW);
|
||||
CustomBuffs.deny(CHARACTER_SUBSCHEMA_DENY);
|
||||
@@ -1,6 +1,6 @@
|
||||
Meteor.startup(() => {
|
||||
const collections = [
|
||||
Attacks, Buffs, Classes, Effects, Experiences,
|
||||
Attacks, Buffs, Classes, CustomBuffs, Effects, Experiences,
|
||||
Features, Notes, Proficiencies, SpellLists, Spells,
|
||||
Containers, Items,
|
||||
];
|
||||
|
||||
@@ -13,20 +13,21 @@ Meteor.publish("singleCharacter", function(characterId){
|
||||
return [
|
||||
Characters.find({_id: characterId}),
|
||||
//get all the assets for this character including soft deleted ones
|
||||
Actions.find ({charId: characterId}, {removed: true}),
|
||||
Attacks.find ({charId: characterId}, {removed: true}),
|
||||
Buffs.find ({charId: characterId}, {removed: true}),
|
||||
Classes.find ({charId: characterId}, {removed: true}),
|
||||
Containers.find ({charId: characterId}, {removed: true}),
|
||||
Effects.find ({charId: characterId}, {removed: true}),
|
||||
Experiences.find ({charId: characterId}, {removed: true}),
|
||||
Features.find ({charId: characterId}, {removed: true}),
|
||||
Items.find ({charId: characterId}, {removed: true}),
|
||||
Notes.find ({charId: characterId}, {removed: true}),
|
||||
Spells.find ({charId: characterId}, {removed: true}),
|
||||
SpellLists.find ({charId: characterId}, {removed: true}),
|
||||
TemporaryHitPoints.find({charId: characterId}, {removed: true}),
|
||||
Proficiencies.find ({charId: characterId}, {removed: true}),
|
||||
Actions.find ({charId: characterId}, {removed: true}),
|
||||
Attacks.find ({charId: characterId}, {removed: true}),
|
||||
Buffs.find ({charId: characterId}, {removed: true}),
|
||||
Classes.find ({charId: characterId}, {removed: true}),
|
||||
Containers.find ({charId: characterId}, {removed: true}),
|
||||
CustomBuffs.find ({charId: characterId}, {removed: true}),
|
||||
Effects.find ({charId: characterId}, {removed: true}),
|
||||
Experiences.find ({charId: characterId}, {removed: true}),
|
||||
Features.find ({charId: characterId}, {removed: true}),
|
||||
Items.find ({charId: characterId}, {removed: true}),
|
||||
Notes.find ({charId: characterId}, {removed: true}),
|
||||
Spells.find ({charId: characterId}, {removed: true}),
|
||||
SpellLists.find ({charId: characterId}, {removed: true}),
|
||||
TemporaryHitPoints.find ({charId: characterId}, {removed: true}),
|
||||
Proficiencies.find ({charId: characterId}, {removed: true}),
|
||||
];
|
||||
} else {
|
||||
return [];
|
||||
|
||||
Reference in New Issue
Block a user