diff --git a/app/imports/api/creature/getActiveProperties.js b/app/imports/api/creature/getActiveProperties.js index e6a6158d..d4c7d7ac 100644 --- a/app/imports/api/creature/getActiveProperties.js +++ b/app/imports/api/creature/getActiveProperties.js @@ -7,6 +7,7 @@ export default function getActiveProperties({ options = {sort: {order: 1}}, includeUntoggled = false, includeUnprepared = false, + includeUnequipped = false, excludeAncestors, }){ filter = getActivePropertyFilter({ @@ -14,6 +15,7 @@ export default function getActiveProperties({ filter, includeUntoggled, includeUnprepared, + includeUnequipped, excludeAncestors, }); return CreatureProperties.find(filter, options).fetch(); @@ -24,6 +26,7 @@ export function getActivePropertyFilter({ filter = {}, includeUntoggled = false, includeUnprepared = false, + includeUnequipped = false, excludeAncestors = [], }){ if (!ancestorId){ @@ -34,17 +37,20 @@ export function getActivePropertyFilter({ 'ancestors.id': ancestorId, $or: [ {disabled: true}, // Everything can be disabled - {equipped: false}, // Items can be equipped {applied: false}, // Buffs can be applied ], }; + if (!includeUnequipped){ + disabledAncestorsFilter.$or.push({type: 'item', equipped: {$ne: true}}); + } if (!includeUntoggled){ disabledAncestorsFilter.$or.push({toggleResult: false}); } if (!includeUnprepared){ disabledAncestorsFilter.$or.push({ - prepared: false, - alwaysPrepared: false + type: 'spell', + prepared: {$ne: true}, + alwaysPrepared: {$ne: true} }); } let disabledAncestorIds = CreatureProperties.find(disabledAncestorsFilter, { diff --git a/app/imports/api/parenting/parenting.js b/app/imports/api/parenting/parenting.js index 0c9132c3..52a83d3d 100644 --- a/app/imports/api/parenting/parenting.js +++ b/app/imports/api/parenting/parenting.js @@ -154,6 +154,14 @@ export function updateParent({docRef, parentRef}){ // Get the parent and its ancestry let {parentDoc, parent, ancestors} = getAncestry({parentRef}); + // Check that the doc isn't its own ancestor + ancestors.forEach(ancestor => { + if (docRef.id === ancestor.id){ + throw new Meteor.Error('invalid parenting', + 'A doc can\'t be its own ancestor') + } + }); + // If the doc and its parent are in the same collection, apply the allowed // parent rules based on type if (docRef.collection === parentRef.collection){ diff --git a/app/imports/ui/components/IncrementButton.vue b/app/imports/ui/components/IncrementButton.vue index 608ecc08..c231d136 100644 --- a/app/imports/ui/components/IncrementButton.vue +++ b/app/imports/ui/components/IncrementButton.vue @@ -11,6 +11,7 @@ add diff --git a/app/imports/ui/creature/character/characterSheetTabs/InventoryTab.vue b/app/imports/ui/creature/character/characterSheetTabs/InventoryTab.vue index 8b71d30a..3f29124c 100644 --- a/app/imports/ui/creature/character/characterSheetTabs/InventoryTab.vue +++ b/app/imports/ui/creature/character/characterSheetTabs/InventoryTab.vue @@ -2,26 +2,32 @@
- - - + + + Equipped + - + + +
+
+ + + Carried + + + @@ -32,7 +38,6 @@ >
@@ -42,23 +47,27 @@ diff --git a/app/imports/ui/properties/components/inventory/ItemList.vue b/app/imports/ui/properties/components/inventory/ItemList.vue new file mode 100644 index 00000000..5eff12a3 --- /dev/null +++ b/app/imports/ui/properties/components/inventory/ItemList.vue @@ -0,0 +1,113 @@ + + + diff --git a/app/imports/ui/properties/components/inventory/ItemListTile.vue b/app/imports/ui/properties/components/inventory/ItemListTile.vue new file mode 100644 index 00000000..64c8aec8 --- /dev/null +++ b/app/imports/ui/properties/components/inventory/ItemListTile.vue @@ -0,0 +1,102 @@ + + + + + diff --git a/app/imports/ui/properties/components/spells/SpellList.vue b/app/imports/ui/properties/components/spells/SpellList.vue index d5ecd025..d49dd4b1 100644 --- a/app/imports/ui/properties/components/spells/SpellList.vue +++ b/app/imports/ui/properties/components/spells/SpellList.vue @@ -6,6 +6,7 @@ >