Added point buy form

This commit is contained in:
Stefan Zermatten
2022-08-17 13:42:47 +02:00
parent f2a1861279
commit 9b652fc133
8 changed files with 192 additions and 3 deletions

View File

@@ -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()

View File

@@ -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,

View File

@@ -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,

View File

@@ -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,