Updated viewers

Action, classlevel, constant, container, damage multiplier, damage, 
effect, feature, folder, item
This commit is contained in:
Stefan Zermatten
2021-10-19 17:19:35 +02:00
parent d6be0ae9f4
commit 1b5bb981e9
31 changed files with 651 additions and 559 deletions

View File

@@ -19,6 +19,7 @@ const ClassLevelSchema = createPropertySchema({
min: 2,
regEx: VARIABLE_NAME_REGEX,
max: STORAGE_LIMITS.variableName,
optional: true,
},
level: {
type: SimpleSchema.Integer,

View File

@@ -1,76 +1,20 @@
import SimpleSchema from 'simpl-schema';
import STORAGE_LIMITS from '/imports/constants/STORAGE_LIMITS.js';
import createPropertySchema from '/imports/api/properties/subSchemas/createPropertySchema.js';
import { SlotSchema, ComputedOnlySlotSchema } from './Slots.js';
// Classes are like slots, except they only take class levels and enforce that
// lower levels are taken before higher levels
let ClassSchema = createPropertySchema({
name: {
type: String,
optional: true,
max: STORAGE_LIMITS.name,
},
description: {
type: 'inlineCalculationFieldToCompute',
optional: true,
},
// Only `classLevel`s with the same variable name can fill the class
variableName: {
type: String,
optional: true,
max: STORAGE_LIMITS.variableName,
},
classType: {
type: String,
allowedValues: ['startingClass', 'multiClass'],
defaultValue: 'startingClass',
},
// Same tag format as Slots to match library classLevels against
slotTags: {
type: Array,
defaultValue: [],
maxCount: STORAGE_LIMITS.tagCount,
},
'slotTags.$': {
type: String,
max: STORAGE_LIMITS.tagLength,
},
extraTags: {
type: Array,
defaultValue: [],
maxCount: STORAGE_LIMITS.extraTagsCount,
},
'extraTags.$': {
type: Object,
},
'extraTags.$._id': {
type: String,
regEx: SimpleSchema.RegEx.Id,
autoValue(){
if (!this.isSet) return Random.id();
}
},
'extraTags.$.operation': {
type: String,
allowedValues: ['OR', 'NOT'],
defaultValue: 'OR',
},
'extraTags.$.tags': {
type: Array,
defaultValue: [],
maxCount: STORAGE_LIMITS.tagCount,
},
'extraTags.$.tags.$': {
type: String,
max: STORAGE_LIMITS.tagLength,
},
});
// Only `classLevel`s with the same variable name can fill the class
variableName: {
type: String,
optional: true,
max: STORAGE_LIMITS.variableName,
},
}).extend(SlotSchema);
const ComputedOnlyClassSchema = createPropertySchema({
description: {
type: 'inlineCalculationFieldToCompute',
optional: true,
},
level: {
type: SimpleSchema.Integer,
optional: true,
@@ -84,7 +28,7 @@ const ComputedOnlyClassSchema = createPropertySchema({
'missingLevels.$': {
type: SimpleSchema.Integer,
},
});
}).extend(ComputedOnlySlotSchema);
const ComputedClassSchema = new SimpleSchema()
.extend(ClassSchema)

View File

@@ -14,7 +14,7 @@ const DamageSchema = createPropertySchema({
// Who this damage applies to
target: {
type: String,
defaultValue: 'every',
defaultValue: 'target',
allowedValues: [
'self',
'target',

View File

@@ -6,6 +6,7 @@ let FeatureSchema = createPropertySchema({
name: {
type: String,
max: STORAGE_LIMITS.name,
optional: true,
},
summary: {
type: 'inlineCalculationFieldToCompute',

View File

@@ -89,7 +89,7 @@ let SlotSchema = createPropertySchema({
const ComputedOnlySlotSchema = createPropertySchema({
// Computed fields
description: {
type: 'inlineCalculationFieldToCompute',
type: 'computedOnlyInlineCalculationField',
optional: true,
},
quantityExpected: {