diff --git a/app/imports/api/creature/getActiveProperties.js b/app/imports/api/creature/getActiveProperties.js index f1311c71..bc954e88 100644 --- a/app/imports/api/creature/getActiveProperties.js +++ b/app/imports/api/creature/getActiveProperties.js @@ -5,16 +5,23 @@ export default function getActiveProperties({ ancestorId, filter = {}, options, - includeUntoggled = false + includeUntoggled = false, + excludeAncestors, }){ - filter = getActivePropertyFilter({ancestorId, filter, includeUntoggled}); + filter = getActivePropertyFilter({ + ancestorId, + filter, + includeUntoggled, + excludeAncestors, + }); return CreatureProperties.find(filter, options).fetch(); } export function getActivePropertyFilter({ ancestorId, filter = {}, - includeUntoggled = false + includeUntoggled = false, + excludeAncestors = [], }){ if (!ancestorId){ throw 'Ancestor Id is required to get active properties' @@ -47,9 +54,12 @@ export function getActivePropertyFilter({ // Get all the properties that are decendents of the ancestor of interest but // aren't from the excluded decendents + if (filter['ancestors.id'] && Meteor.isClient){ + console.warn('Filtering on ancestor id is ignored') + } filter['ancestors.id'] = { $eq: ancestorId, - $nin: disabledAncestorIds, + $nin: disabledAncestorIds.concat(excludeAncestors), }; // Get properties that aren't removed filter.removed = {$ne: true}; diff --git a/app/imports/api/properties/SpellLists.js b/app/imports/api/properties/SpellLists.js index 45628d8d..4e14b217 100644 --- a/app/imports/api/properties/SpellLists.js +++ b/app/imports/api/properties/SpellLists.js @@ -1,5 +1,6 @@ import SimpleSchema from 'simpl-schema'; import ErrorSchema from '/imports/api/properties/subSchemas/ErrorSchema.js'; +import VARIABLE_NAME_REGEX from '/imports/constants/VARIABLE_NAME_REGEX.js'; let SpellListSchema = new SimpleSchema({ name: { @@ -10,6 +11,12 @@ let SpellListSchema = new SimpleSchema({ type: String, optional: true, }, + variableName: { + type: String, + regEx: VARIABLE_NAME_REGEX, + min: 2, + optional: true, + }, // Calculation of how many spells in this list can be prepared maxPrepared: { type: String, diff --git a/app/imports/api/properties/Spells.js b/app/imports/api/properties/Spells.js index 8467b7e1..ecb1fd88 100644 --- a/app/imports/api/properties/Spells.js +++ b/app/imports/api/properties/Spells.js @@ -1,5 +1,6 @@ import { ActionSchema, ComputedOnlyActionSchema } from '/imports/api/properties/Actions.js'; import SimpleSchema from 'simpl-schema'; +import VARIABLE_NAME_REGEX from '/imports/constants/VARIABLE_NAME_REGEX.js'; const magicSchools = [ 'abjuration', @@ -38,13 +39,15 @@ let SpellSchema = new SimpleSchema({}) type: Boolean, optional: true, }, - // Spell lists that this spell appears on + // Spell list that this spell appears on spellLists: { type: Array, defaultValue: [], }, 'spellLists.$': { type: String, + regEx: VARIABLE_NAME_REGEX, + min: 2, }, description: { type: String, diff --git a/app/imports/ui/creature/character/characterSheetTabs/SpellsTab.vue b/app/imports/ui/creature/character/characterSheetTabs/SpellsTab.vue index 6cfd8075..3c2b4aa4 100644 --- a/app/imports/ui/creature/character/characterSheetTabs/SpellsTab.vue +++ b/app/imports/ui/creature/character/characterSheetTabs/SpellsTab.vue @@ -1,27 +1,20 @@ - - + - + + + diff --git a/app/imports/ui/properties/forms/SpellListForm.vue b/app/imports/ui/properties/forms/SpellListForm.vue index 6f854787..e9e6086a 100644 --- a/app/imports/ui/properties/forms/SpellListForm.vue +++ b/app/imports/ui/properties/forms/SpellListForm.vue @@ -8,6 +8,14 @@ :error-messages="errors.name" @change="change('name', ...arguments)" /> +