diff --git a/app/imports/api/properties/PointBuys.js b/app/imports/api/properties/PointBuys.js index 95cc1634..3be53ae2 100644 --- a/app/imports/api/properties/PointBuys.js +++ b/app/imports/api/properties/PointBuys.js @@ -27,10 +27,18 @@ let PointBuySchema = createPropertySchema({ 'values': { type: Array, defaultValue: [], + maxCount: STORAGE_LIMITS.pointBuyRowsCount, }, 'values.$': { type: Object, }, + 'values.$._id': { + type: String, + regEx: SimpleSchema.RegEx.Id, + autoValue(){ + if (!this.isSet) return Random.id(); + } + }, 'values.$.name': { type: String, optional: true, @@ -47,6 +55,18 @@ let PointBuySchema = createPropertySchema({ type: Number, optional: true, }, + 'values.$.min': { + type: 'fieldToCompute', + optional: true, + }, + 'values.$.max': { + type: 'fieldToCompute', + optional: true, + }, + 'values.$.cost': { + type: 'fieldToCompute', + optional: true, + }, min: { type: 'fieldToCompute', optional: true, @@ -74,11 +94,31 @@ const ComputedOnlyPointBuySchema = createPropertySchema({ type: 'computedOnlyField', optional: true, }, - total: { + cost: { type: 'computedOnlyField', optional: true, }, - cost: { + 'values': { + type: Array, + defaultValue: [], + maxCount: STORAGE_LIMITS.pointBuyRowsCount, + }, + 'values.$': { + type: Object, + }, + 'values.$.min': { + type: 'computedOnlyField', + optional: true, + }, + 'values.$.max': { + type: 'computedOnlyField', + optional: true, + }, + 'values.$.cost': { + type: 'computedOnlyField', + optional: true, + }, + total: { type: 'computedOnlyField', optional: true, }, @@ -87,6 +127,11 @@ const ComputedOnlyPointBuySchema = createPropertySchema({ optional: true, removeBeforeCompute: true, }, + error: { + type: String, + optional: true, + removeBeforeCompute: true, + }, }); const ComputedPointBuySchema = new SimpleSchema() diff --git a/app/imports/api/properties/computedOnlyPropertySchemasIndex.js b/app/imports/api/properties/computedOnlyPropertySchemasIndex.js index d490e4e3..489f5b19 100644 --- a/app/imports/api/properties/computedOnlyPropertySchemasIndex.js +++ b/app/imports/api/properties/computedOnlyPropertySchemasIndex.js @@ -15,6 +15,7 @@ import { ComputedOnlyFeatureSchema } from '/imports/api/properties/Features.js'; import { ComputedOnlyFolderSchema } from '/imports/api/properties/Folders.js'; import { ComputedOnlyItemSchema } from '/imports/api/properties/Items.js'; import { ComputedOnlyNoteSchema } from '/imports/api/properties/Notes.js'; +import { ComputedOnlyPointBuySchema } from '/imports/api/properties/PointBuys.js'; import { ComputedOnlyProficiencySchema } from '/imports/api/properties/Proficiencies.js'; import { ComputedOnlyReferenceSchema } from '/imports/api/properties/References.js'; import { ComputedOnlyRollSchema } from '/imports/api/properties/Rolls.js'; @@ -44,6 +45,7 @@ const propertySchemasIndex = { folder: ComputedOnlyFolderSchema, item: ComputedOnlyItemSchema, note: ComputedOnlyNoteSchema, + pointBuy: ComputedOnlyPointBuySchema, proficiency: ComputedOnlyProficiencySchema, propertySlot: ComputedOnlySlotSchema, reference: ComputedOnlyReferenceSchema, diff --git a/app/imports/api/properties/computedPropertySchemasIndex.js b/app/imports/api/properties/computedPropertySchemasIndex.js index 9084e3b7..01741b49 100644 --- a/app/imports/api/properties/computedPropertySchemasIndex.js +++ b/app/imports/api/properties/computedPropertySchemasIndex.js @@ -15,6 +15,7 @@ import { ComputedFeatureSchema } from '/imports/api/properties/Features.js'; import { FolderSchema } from '/imports/api/properties/Folders.js'; import { ComputedItemSchema } from '/imports/api/properties/Items.js'; import { ComputedNoteSchema } from '/imports/api/properties/Notes.js'; +import { ComputedPointBuySchema } from '/imports/api/properties/PointBuys.js'; import { ProficiencySchema } from '/imports/api/properties/Proficiencies.js'; import { ReferenceSchema } from '/imports/api/properties/References.js'; import { ComputedRollSchema } from '/imports/api/properties/Rolls.js'; @@ -42,6 +43,7 @@ const propertySchemasIndex = { feature: ComputedFeatureSchema, folder: FolderSchema, note: ComputedNoteSchema, + pointBuy: ComputedPointBuySchema, proficiency: ProficiencySchema, propertySlot: ComputedSlotSchema, reference: ReferenceSchema, diff --git a/app/imports/api/properties/propertySchemasIndex.js b/app/imports/api/properties/propertySchemasIndex.js index cc4b77ee..0f2f8cb0 100644 --- a/app/imports/api/properties/propertySchemasIndex.js +++ b/app/imports/api/properties/propertySchemasIndex.js @@ -13,6 +13,7 @@ import { EffectSchema } from '/imports/api/properties/Effects.js'; import { FeatureSchema } from '/imports/api/properties/Features.js'; import { FolderSchema } from '/imports/api/properties/Folders.js'; import { NoteSchema } from '/imports/api/properties/Notes.js'; +import { PointBuySchema } from '/imports/api/properties/PointBuys.js'; import { ProficiencySchema } from '/imports/api/properties/Proficiencies.js'; import { ReferenceSchema } from '/imports/api/properties/References.js'; import { RollSchema } from '/imports/api/properties/Rolls.js'; @@ -42,6 +43,7 @@ const propertySchemasIndex = { feature: FeatureSchema, folder: FolderSchema, note: NoteSchema, + pointBuy: PointBuySchema, proficiency: ProficiencySchema, propertySlot: SlotSchema, reference: ReferenceSchema, diff --git a/app/imports/constants/PROPERTIES.js b/app/imports/constants/PROPERTIES.js index c2aa3be1..3d75bd06 100644 --- a/app/imports/constants/PROPERTIES.js +++ b/app/imports/constants/PROPERTIES.js @@ -96,7 +96,13 @@ const PROPERTIES = Object.freeze({ icon: 'mdi-note-outline', name: 'Note', helpText: 'Notes about your character and their adventures', - suggestedParents: ['folder'], + suggestedParents: ['note', 'folder'], + }, + pointBuy: { + icon: 'mdi-table', + name: 'Point Buy', + helpText: 'A point buy table that allows the user to select an array of values that match a given cost', + suggestedParents: [], }, proficiency: { icon: 'mdi-brightness-1', diff --git a/app/imports/constants/STORAGE_LIMITS.js b/app/imports/constants/STORAGE_LIMITS.js index 6e116b07..cbc647e6 100644 --- a/app/imports/constants/STORAGE_LIMITS.js +++ b/app/imports/constants/STORAGE_LIMITS.js @@ -32,6 +32,7 @@ const STORAGE_LIMITS = Object.freeze({ tagCount: 64, writersCount: 20, libraryCollectionCount: 32, + pointBuyRowsCount: 32, }); export default STORAGE_LIMITS; diff --git a/app/imports/ui/properties/forms/PointBuyForm.vue b/app/imports/ui/properties/forms/PointBuyForm.vue new file mode 100644 index 00000000..b50d1a36 --- /dev/null +++ b/app/imports/ui/properties/forms/PointBuyForm.vue @@ -0,0 +1,129 @@ + + + diff --git a/app/imports/ui/properties/forms/shared/propertyFormIndex.js b/app/imports/ui/properties/forms/shared/propertyFormIndex.js index 1aa8f42e..63c4fe45 100644 --- a/app/imports/ui/properties/forms/shared/propertyFormIndex.js +++ b/app/imports/ui/properties/forms/shared/propertyFormIndex.js @@ -14,6 +14,7 @@ const FeatureForm = () => import('/imports/ui/properties/forms/FeatureForm.vue') const FolderForm = () => import('/imports/ui/properties/forms/FolderForm.vue'); const ItemForm = () => import('/imports/ui/properties/forms/ItemForm.vue'); const NoteForm = () => import('/imports/ui/properties/forms/NoteForm.vue'); +const PointBuyForm = () => import('/imports/ui/properties/forms/PointBuyForm.vue'); const ProficiencyForm = () => import('/imports/ui/properties/forms/ProficiencyForm.vue'); const ReferenceForm = () => import('/imports/ui/properties/forms/ReferenceForm.vue'); const RollForm = () => import('/imports/ui/properties/forms/RollForm.vue'); @@ -43,6 +44,7 @@ export default { folder: FolderForm, item: ItemForm, note: NoteForm, + pointBuy: PointBuyForm, proficiency: ProficiencyForm, propertySlot: SlotForm, reference: ReferenceForm,