Merge feature-nested-sets into develop
This commit is contained in:
@@ -1,13 +1,60 @@
|
||||
import SimpleSchema from 'simpl-schema';
|
||||
import createPropertySchema from '/imports/api/properties/subSchemas/createPropertySchema.js';
|
||||
import { storedIconsSchema } from '/imports/api/icons/Icons.js';
|
||||
import STORAGE_LIMITS from '/imports/constants/STORAGE_LIMITS.js';
|
||||
import VARIABLE_NAME_REGEX from '/imports/constants/VARIABLE_NAME_REGEX.js';
|
||||
import createPropertySchema from '/imports/api/properties/subSchemas/createPropertySchema';
|
||||
import { storedIconsSchema } from '/imports/api/icons/Icons';
|
||||
import STORAGE_LIMITS from '/imports/constants/STORAGE_LIMITS';
|
||||
import VARIABLE_NAME_REGEX from '/imports/constants/VARIABLE_NAME_REGEX';
|
||||
import { CreatureProperty } from '/imports/api/creature/creatureProperties/CreatureProperties';
|
||||
import { InlineCalculation } from '/imports/api/properties/subSchemas/inlineCalculationField';
|
||||
import { CalculatedField } from '/imports/api/properties/subSchemas/computedField';
|
||||
|
||||
export interface Action extends ActionBase {
|
||||
type: 'action'
|
||||
}
|
||||
|
||||
export interface ActionBase extends CreatureProperty {
|
||||
name?: string
|
||||
summary?: InlineCalculation
|
||||
description?: InlineCalculation
|
||||
actionType: 'action' | 'bonus' | 'attack' | 'reaction' | 'free' | 'long' | 'event'
|
||||
variableName?: string
|
||||
target: 'self' | 'singleTarget' | 'multipleTargets'
|
||||
attackRoll?: CalculatedField
|
||||
uses?: CalculatedField
|
||||
usesUsed?: number
|
||||
reset?: string
|
||||
silent?: boolean
|
||||
insufficientResources?: boolean
|
||||
usesLeft?: number
|
||||
overridden?: boolean
|
||||
// Resources
|
||||
resources: {
|
||||
itemsConsumed: {
|
||||
_id: string
|
||||
tag?: string
|
||||
itemName?: string
|
||||
quantity?: CalculatedField
|
||||
itemId?: string
|
||||
available?: number
|
||||
}[]
|
||||
attributesConsumed: {
|
||||
_id: string
|
||||
variableName?: string
|
||||
quantity?: CalculatedField
|
||||
available?: number
|
||||
statName?: string
|
||||
}[]
|
||||
conditions?: {
|
||||
_id: string,
|
||||
condition?: CalculatedField
|
||||
conditionNote?: string,
|
||||
}[]
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Actions are things a character can do
|
||||
*/
|
||||
let ActionSchema = createPropertySchema({
|
||||
const ActionSchema = createPropertySchema({
|
||||
name: {
|
||||
type: String,
|
||||
optional: true,
|
||||
@@ -1,6 +1,6 @@
|
||||
import SimpleSchema from 'simpl-schema';
|
||||
import STORAGE_LIMITS from '/imports/constants/STORAGE_LIMITS.js';
|
||||
import createPropertySchema from '/imports/api/properties/subSchemas/createPropertySchema.js';
|
||||
import STORAGE_LIMITS from '/imports/constants/STORAGE_LIMITS';
|
||||
import createPropertySchema from '/imports/api/properties/subSchemas/createPropertySchema';
|
||||
|
||||
const AdjustmentSchema = createPropertySchema({
|
||||
// The roll that determines how much to change the attribute
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import SimpleSchema from 'simpl-schema';
|
||||
import VARIABLE_NAME_REGEX from '/imports/constants/VARIABLE_NAME_REGEX.js';
|
||||
import STORAGE_LIMITS from '/imports/constants/STORAGE_LIMITS.js';
|
||||
import createPropertySchema from '/imports/api/properties/subSchemas/createPropertySchema.js';
|
||||
import VARIABLE_NAME_REGEX from '/imports/constants/VARIABLE_NAME_REGEX';
|
||||
import STORAGE_LIMITS from '/imports/constants/STORAGE_LIMITS';
|
||||
import createPropertySchema from '/imports/api/properties/subSchemas/createPropertySchema';
|
||||
|
||||
/*
|
||||
* Attributes are numbered stats of a character
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import SimpleSchema from 'simpl-schema';
|
||||
import STORAGE_LIMITS from '/imports/constants/STORAGE_LIMITS.js';
|
||||
import createPropertySchema from '/imports/api/properties/subSchemas/createPropertySchema.js';
|
||||
import STORAGE_LIMITS from '/imports/constants/STORAGE_LIMITS';
|
||||
import createPropertySchema from '/imports/api/properties/subSchemas/createPropertySchema';
|
||||
|
||||
let BranchSchema = createPropertySchema({
|
||||
branchType: {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import SimpleSchema from 'simpl-schema';
|
||||
import STORAGE_LIMITS from '/imports/constants/STORAGE_LIMITS.js';
|
||||
import createPropertySchema from '/imports/api/properties/subSchemas/createPropertySchema.js';
|
||||
import STORAGE_LIMITS from '/imports/constants/STORAGE_LIMITS';
|
||||
import createPropertySchema from '/imports/api/properties/subSchemas/createPropertySchema';
|
||||
|
||||
let BuffRemoverSchema = createPropertySchema({
|
||||
name: {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import SimpleSchema from 'simpl-schema';
|
||||
import STORAGE_LIMITS from '/imports/constants/STORAGE_LIMITS.js';
|
||||
import createPropertySchema from '/imports/api/properties/subSchemas/createPropertySchema.js';
|
||||
import STORAGE_LIMITS from '/imports/constants/STORAGE_LIMITS';
|
||||
import createPropertySchema from '/imports/api/properties/subSchemas/createPropertySchema';
|
||||
|
||||
let BuffSchema = createPropertySchema({
|
||||
name: {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import SimpleSchema from 'simpl-schema';
|
||||
import VARIABLE_NAME_REGEX from '/imports/constants/VARIABLE_NAME_REGEX.js';
|
||||
import STORAGE_LIMITS from '/imports/constants/STORAGE_LIMITS.js';
|
||||
import createPropertySchema from '/imports/api/properties/subSchemas/createPropertySchema.js';
|
||||
import VARIABLE_NAME_REGEX from '/imports/constants/VARIABLE_NAME_REGEX';
|
||||
import STORAGE_LIMITS from '/imports/constants/STORAGE_LIMITS';
|
||||
import createPropertySchema from '/imports/api/properties/subSchemas/createPropertySchema';
|
||||
|
||||
const ClassLevelSchema = createPropertySchema({
|
||||
name: {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import SimpleSchema from 'simpl-schema';
|
||||
import STORAGE_LIMITS from '/imports/constants/STORAGE_LIMITS.js';
|
||||
import createPropertySchema from '/imports/api/properties/subSchemas/createPropertySchema.js';
|
||||
import STORAGE_LIMITS from '/imports/constants/STORAGE_LIMITS';
|
||||
import createPropertySchema from '/imports/api/properties/subSchemas/createPropertySchema';
|
||||
|
||||
// Classes are like slots, except they only take class levels and enforce that
|
||||
// lower levels are taken before higher levels
|
||||
@@ -40,7 +40,7 @@ let ClassSchema = createPropertySchema({
|
||||
'extraTags.$._id': {
|
||||
type: String,
|
||||
regEx: SimpleSchema.RegEx.Id,
|
||||
autoValue(){
|
||||
autoValue() {
|
||||
if (!this.isSet) return Random.id();
|
||||
}
|
||||
},
|
||||
@@ -74,7 +74,7 @@ const ComputedOnlyClassSchema = createPropertySchema({
|
||||
type: 'computedOnlyField',
|
||||
optional: true,
|
||||
},
|
||||
|
||||
|
||||
// Denormalised fields
|
||||
level: {
|
||||
type: SimpleSchema.Integer,
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
import SimpleSchema from 'simpl-schema';
|
||||
import VARIABLE_NAME_REGEX from '/imports/constants/VARIABLE_NAME_REGEX.js';
|
||||
import ErrorSchema from '/imports/api/properties/subSchemas/ErrorSchema.js';
|
||||
import VARIABLE_NAME_REGEX from '/imports/constants/VARIABLE_NAME_REGEX';
|
||||
import ErrorSchema from '/imports/api/properties/subSchemas/ErrorSchema';
|
||||
import {
|
||||
parse,
|
||||
prettifyParseError,
|
||||
} from '/imports/parser/parser.js';
|
||||
import STORAGE_LIMITS from '/imports/constants/STORAGE_LIMITS.js';
|
||||
import resolve, { Context, traverse } from '/imports/parser/resolve.js';
|
||||
} from '/imports/parser/parser';
|
||||
import STORAGE_LIMITS from '/imports/constants/STORAGE_LIMITS';
|
||||
import resolve, { Context, traverse } from '/imports/parser/resolve';
|
||||
|
||||
/*
|
||||
* Constants are primitive values that can be used elsewhere in computations
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import SimpleSchema from 'simpl-schema';
|
||||
import STORAGE_LIMITS from '/imports/constants/STORAGE_LIMITS.js';
|
||||
import createPropertySchema from '/imports/api/properties/subSchemas/createPropertySchema.js';
|
||||
import STORAGE_LIMITS from '/imports/constants/STORAGE_LIMITS';
|
||||
import createPropertySchema from '/imports/api/properties/subSchemas/createPropertySchema';
|
||||
|
||||
let ContainerSchema = createPropertySchema({
|
||||
name: {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import SimpleSchema from 'simpl-schema';
|
||||
import STORAGE_LIMITS from '/imports/constants/STORAGE_LIMITS.js';
|
||||
import VARIABLE_NAME_REGEX from '/imports/constants/VARIABLE_NAME_REGEX.js';
|
||||
import STORAGE_LIMITS from '/imports/constants/STORAGE_LIMITS';
|
||||
import VARIABLE_NAME_REGEX from '/imports/constants/VARIABLE_NAME_REGEX';
|
||||
|
||||
/*
|
||||
* DamageMultipliers are multipliers that affect how much damage is taken from
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import SimpleSchema from 'simpl-schema';
|
||||
import createPropertySchema from '/imports/api/properties/subSchemas/createPropertySchema.js';
|
||||
import STORAGE_LIMITS from '/imports/constants/STORAGE_LIMITS.js';
|
||||
import VARIABLE_NAME_REGEX from '/imports/constants/VARIABLE_NAME_REGEX.js';
|
||||
import { SavingThrowSchema, ComputedOnlySavingThrowSchema } from '/imports/api/properties/SavingThrows.js';
|
||||
import createPropertySchema from '/imports/api/properties/subSchemas/createPropertySchema';
|
||||
import STORAGE_LIMITS from '/imports/constants/STORAGE_LIMITS';
|
||||
import VARIABLE_NAME_REGEX from '/imports/constants/VARIABLE_NAME_REGEX';
|
||||
import { SavingThrowSchema, ComputedOnlySavingThrowSchema } from '/imports/api/properties/SavingThrows';
|
||||
|
||||
const DamageSchema = createPropertySchema({
|
||||
// The roll that determines how much to damage the attribute
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import SimpleSchema from 'simpl-schema';
|
||||
import STORAGE_LIMITS from '/imports/constants/STORAGE_LIMITS.js';
|
||||
import createPropertySchema from '/imports/api/properties/subSchemas/createPropertySchema.js';
|
||||
import TagTargetingSchema from '/imports/api/properties/subSchemas/TagTargetingSchema.js';
|
||||
import STORAGE_LIMITS from '/imports/constants/STORAGE_LIMITS';
|
||||
import createPropertySchema from '/imports/api/properties/subSchemas/createPropertySchema';
|
||||
import TagTargetingSchema from '/imports/api/properties/subSchemas/TagTargetingSchema';
|
||||
|
||||
/*
|
||||
* Effects are reason-value attached to skills and abilities
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import SimpleSchema from 'simpl-schema';
|
||||
import STORAGE_LIMITS from '/imports/constants/STORAGE_LIMITS.js';
|
||||
import createPropertySchema from '/imports/api/properties/subSchemas/createPropertySchema.js';
|
||||
import STORAGE_LIMITS from '/imports/constants/STORAGE_LIMITS';
|
||||
import createPropertySchema from '/imports/api/properties/subSchemas/createPropertySchema';
|
||||
|
||||
let FeatureSchema = createPropertySchema({
|
||||
name: {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import SimpleSchema from 'simpl-schema';
|
||||
import STORAGE_LIMITS from '/imports/constants/STORAGE_LIMITS.js';
|
||||
import createPropertySchema from '/imports/api/properties/subSchemas/createPropertySchema.js';
|
||||
import STORAGE_LIMITS from '/imports/constants/STORAGE_LIMITS';
|
||||
import createPropertySchema from '/imports/api/properties/subSchemas/createPropertySchema';
|
||||
|
||||
// Folders organize a character sheet into a tree, particularly to group things
|
||||
// like 'race' and 'background'
|
||||
|
||||
@@ -1,6 +1,14 @@
|
||||
import SimpleSchema from 'simpl-schema';
|
||||
import STORAGE_LIMITS from '/imports/constants/STORAGE_LIMITS.js';
|
||||
import createPropertySchema from '/imports/api/properties/subSchemas/createPropertySchema.js';
|
||||
import STORAGE_LIMITS from '/imports/constants/STORAGE_LIMITS';
|
||||
import createPropertySchema from '/imports/api/properties/subSchemas/createPropertySchema';
|
||||
import { CreatureProperty } from '/imports/api/creature/creatureProperties/CreatureProperties';
|
||||
|
||||
export interface Item extends CreatureProperty {
|
||||
type: 'item'
|
||||
name?: string
|
||||
plural?: string
|
||||
quantity: number
|
||||
}
|
||||
|
||||
const ItemSchema = createPropertySchema({
|
||||
name: {
|
||||
@@ -1,6 +1,6 @@
|
||||
import SimpleSchema from 'simpl-schema';
|
||||
import STORAGE_LIMITS from '/imports/constants/STORAGE_LIMITS.js';
|
||||
import createPropertySchema from '/imports/api/properties/subSchemas/createPropertySchema.js';
|
||||
import STORAGE_LIMITS from '/imports/constants/STORAGE_LIMITS';
|
||||
import createPropertySchema from '/imports/api/properties/subSchemas/createPropertySchema';
|
||||
|
||||
let NoteSchema = createPropertySchema({
|
||||
name: {
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import SimpleSchema from 'simpl-schema';
|
||||
import STORAGE_LIMITS from '/imports/constants/STORAGE_LIMITS.js';
|
||||
import VARIABLE_NAME_REGEX from '/imports/constants/VARIABLE_NAME_REGEX.js';
|
||||
import createPropertySchema from '/imports/api/properties/subSchemas/createPropertySchema.js';
|
||||
import ErrorSchema from '/imports/api/properties/subSchemas/ErrorSchema.js';
|
||||
import STORAGE_LIMITS from '/imports/constants/STORAGE_LIMITS';
|
||||
import VARIABLE_NAME_REGEX from '/imports/constants/VARIABLE_NAME_REGEX';
|
||||
import createPropertySchema from '/imports/api/properties/subSchemas/createPropertySchema';
|
||||
import ErrorSchema from '/imports/api/properties/subSchemas/ErrorSchema';
|
||||
|
||||
/*
|
||||
* PointBuys are reason-value attached to skills and abilities
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import SimpleSchema from 'simpl-schema';
|
||||
import STORAGE_LIMITS from '/imports/constants/STORAGE_LIMITS.js';
|
||||
import TagTargetingSchema from '/imports/api/properties/subSchemas/TagTargetingSchema.js';
|
||||
import STORAGE_LIMITS from '/imports/constants/STORAGE_LIMITS';
|
||||
import TagTargetingSchema from '/imports/api/properties/subSchemas/TagTargetingSchema';
|
||||
|
||||
let ProficiencySchema = new SimpleSchema({
|
||||
name: {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import SimpleSchema from 'simpl-schema';
|
||||
import STORAGE_LIMITS from '/imports/constants/STORAGE_LIMITS.js';
|
||||
import STORAGE_LIMITS from '/imports/constants/STORAGE_LIMITS';
|
||||
|
||||
let ReferenceSchema = new SimpleSchema({
|
||||
ref: {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import SimpleSchema from 'simpl-schema';
|
||||
import VARIABLE_NAME_REGEX from '/imports/constants/VARIABLE_NAME_REGEX.js';
|
||||
import STORAGE_LIMITS from '/imports/constants/STORAGE_LIMITS.js';
|
||||
import createPropertySchema from '/imports/api/properties/subSchemas/createPropertySchema.js';
|
||||
import VARIABLE_NAME_REGEX from '/imports/constants/VARIABLE_NAME_REGEX';
|
||||
import STORAGE_LIMITS from '/imports/constants/STORAGE_LIMITS';
|
||||
import createPropertySchema from '/imports/api/properties/subSchemas/createPropertySchema';
|
||||
|
||||
/**
|
||||
* Rolls are children to actions or other rolls, they are triggered with 0 or
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import SimpleSchema from 'simpl-schema';
|
||||
import STORAGE_LIMITS from '/imports/constants/STORAGE_LIMITS.js';
|
||||
import createPropertySchema from '/imports/api/properties/subSchemas/createPropertySchema.js';
|
||||
import STORAGE_LIMITS from '/imports/constants/STORAGE_LIMITS';
|
||||
import createPropertySchema from '/imports/api/properties/subSchemas/createPropertySchema';
|
||||
|
||||
// These are the rolls made when saves are called for
|
||||
// For the saving throw bonus or proficiency, see ./Skills.js
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import SimpleSchema from 'simpl-schema';
|
||||
import VARIABLE_NAME_REGEX from '/imports/constants/VARIABLE_NAME_REGEX.js';
|
||||
import STORAGE_LIMITS from '/imports/constants/STORAGE_LIMITS.js';
|
||||
import createPropertySchema from '/imports/api/properties/subSchemas/createPropertySchema.js';
|
||||
import TagTargetingSchema from '/imports/api/properties/subSchemas/TagTargetingSchema.js';
|
||||
import VARIABLE_NAME_REGEX from '/imports/constants/VARIABLE_NAME_REGEX';
|
||||
import STORAGE_LIMITS from '/imports/constants/STORAGE_LIMITS';
|
||||
import createPropertySchema from '/imports/api/properties/subSchemas/createPropertySchema';
|
||||
import TagTargetingSchema from '/imports/api/properties/subSchemas/TagTargetingSchema';
|
||||
|
||||
/*
|
||||
* Skills are anything that results in a modifier to be added to a D20
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import SimpleSchema from 'simpl-schema';
|
||||
import STORAGE_LIMITS from '/imports/constants/STORAGE_LIMITS.js';
|
||||
import createPropertySchema from '/imports/api/properties/subSchemas/createPropertySchema.js';
|
||||
import STORAGE_LIMITS from '/imports/constants/STORAGE_LIMITS';
|
||||
import createPropertySchema from '/imports/api/properties/subSchemas/createPropertySchema';
|
||||
|
||||
let SlotSchema = createPropertySchema({
|
||||
name: {
|
||||
@@ -37,7 +37,7 @@ let SlotSchema = createPropertySchema({
|
||||
'extraTags.$._id': {
|
||||
type: String,
|
||||
regEx: SimpleSchema.RegEx.Id,
|
||||
autoValue(){
|
||||
autoValue() {
|
||||
if (!this.isSet) return Random.id();
|
||||
}
|
||||
},
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import SimpleSchema from 'simpl-schema';
|
||||
import STORAGE_LIMITS from '/imports/constants/STORAGE_LIMITS.js';
|
||||
import createPropertySchema from '/imports/api/properties/subSchemas/createPropertySchema.js';
|
||||
import STORAGE_LIMITS from '/imports/constants/STORAGE_LIMITS';
|
||||
import createPropertySchema from '/imports/api/properties/subSchemas/createPropertySchema';
|
||||
|
||||
let SpellListSchema = createPropertySchema({
|
||||
name: {
|
||||
|
||||
@@ -1,6 +1,30 @@
|
||||
import { ActionSchema, ComputedOnlyActionSchema } from '/imports/api/properties/Actions.js';
|
||||
import { ActionBase, ActionSchema, ComputedOnlyActionSchema } from '/imports/api/properties/Actions';
|
||||
import SimpleSchema from 'simpl-schema';
|
||||
import STORAGE_LIMITS from '/imports/constants/STORAGE_LIMITS.js';
|
||||
import STORAGE_LIMITS from '/imports/constants/STORAGE_LIMITS';
|
||||
import { CreatureProperty } from '/imports/api/creature/creatureProperties/CreatureProperties';
|
||||
|
||||
export interface Spell extends ActionBase {
|
||||
name?: string
|
||||
type: 'spell'
|
||||
alwaysPrepared?: boolean
|
||||
prepared?: boolean
|
||||
castWithoutSpellSlots?: boolean
|
||||
hasAttackRoll?: boolean
|
||||
castingTime?: string
|
||||
range?: string
|
||||
duration?: string
|
||||
verbal?: boolean
|
||||
somatic?: boolean
|
||||
concentration?: boolean
|
||||
material?: string
|
||||
ritual?: boolean
|
||||
level?: number
|
||||
school?: string
|
||||
}
|
||||
|
||||
export function isSpell(prop: CreatureProperty): prop is Spell {
|
||||
return prop.type === 'spell';
|
||||
}
|
||||
|
||||
const magicSchools = [
|
||||
'abjuration',
|
||||
@@ -1,7 +1,7 @@
|
||||
import SimpleSchema from 'simpl-schema';
|
||||
import STORAGE_LIMITS from '/imports/constants/STORAGE_LIMITS.js';
|
||||
import createPropertySchema from '/imports/api/properties/subSchemas/createPropertySchema.js';
|
||||
import TagTargetingSchema from '/imports/api/properties/subSchemas/TagTargetingSchema.js';
|
||||
import STORAGE_LIMITS from '/imports/constants/STORAGE_LIMITS';
|
||||
import createPropertySchema from '/imports/api/properties/subSchemas/createPropertySchema';
|
||||
import TagTargetingSchema from '/imports/api/properties/subSchemas/TagTargetingSchema';
|
||||
|
||||
const ToggleSchema = createPropertySchema({
|
||||
name: {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import SimpleSchema from 'simpl-schema';
|
||||
import createPropertySchema from '/imports/api/properties/subSchemas/createPropertySchema.js';
|
||||
import STORAGE_LIMITS from '/imports/constants/STORAGE_LIMITS.js';
|
||||
import createPropertySchema from '/imports/api/properties/subSchemas/createPropertySchema';
|
||||
import STORAGE_LIMITS from '/imports/constants/STORAGE_LIMITS';
|
||||
|
||||
const eventOptions = {
|
||||
doActionProperty: 'Do action',
|
||||
|
||||
@@ -1,32 +1,32 @@
|
||||
import SimpleSchema from 'simpl-schema';
|
||||
import { ComputedOnlyActionSchema } from '/imports/api/properties/Actions.js';
|
||||
import { ComputedOnlyAdjustmentSchema } from '/imports/api/properties/Adjustments.js';
|
||||
import { ComputedOnlyAttributeSchema } from '/imports/api/properties/Attributes.js';
|
||||
import { ComputedOnlyBuffSchema } from '/imports/api/properties/Buffs.js';
|
||||
import { ComputedOnlyBuffRemoverSchema } from '/imports/api/properties/BuffRemovers.js';
|
||||
import { ComputedOnlyBranchSchema } from '/imports/api/properties/Branches.js';
|
||||
import { ComputedOnlyClassSchema } from '/imports/api/properties/Classes.js';
|
||||
import { ComputedOnlyClassLevelSchema } from '/imports/api/properties/ClassLevels.js';
|
||||
import { ComputedOnlyConstantSchema } from '/imports/api/properties/Constants.js';
|
||||
import { ComputedOnlyContainerSchema } from '/imports/api/properties/Containers.js';
|
||||
import { ComputedOnlyDamageSchema } from '/imports/api/properties/Damages.js';
|
||||
import { ComputedOnlyDamageMultiplierSchema } from '/imports/api/properties/DamageMultipliers.js';
|
||||
import { ComputedOnlyEffectSchema } from '/imports/api/properties/Effects.js';
|
||||
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';
|
||||
import { ComputedOnlySavingThrowSchema } from '/imports/api/properties/SavingThrows.js';
|
||||
import { ComputedOnlySkillSchema } from '/imports/api/properties/Skills.js';
|
||||
import { ComputedOnlySlotSchema } from '/imports/api/properties/Slots.js';
|
||||
import { ComputedOnlySpellSchema } from '/imports/api/properties/Spells.js';
|
||||
import { ComputedOnlySpellListSchema } from '/imports/api/properties/SpellLists.js';
|
||||
import { ComputedOnlyToggleSchema } from '/imports/api/properties/Toggles.js';
|
||||
import { ComputedOnlyTriggerSchema } from '/imports/api/properties/Triggers.js';
|
||||
import { ComputedOnlyActionSchema } from '/imports/api/properties/Actions';
|
||||
import { ComputedOnlyAdjustmentSchema } from '/imports/api/properties/Adjustments';
|
||||
import { ComputedOnlyAttributeSchema } from '/imports/api/properties/Attributes';
|
||||
import { ComputedOnlyBuffSchema } from '/imports/api/properties/Buffs';
|
||||
import { ComputedOnlyBuffRemoverSchema } from '/imports/api/properties/BuffRemovers';
|
||||
import { ComputedOnlyBranchSchema } from '/imports/api/properties/Branches';
|
||||
import { ComputedOnlyClassSchema } from '/imports/api/properties/Classes';
|
||||
import { ComputedOnlyClassLevelSchema } from '/imports/api/properties/ClassLevels';
|
||||
import { ComputedOnlyConstantSchema } from '/imports/api/properties/Constants';
|
||||
import { ComputedOnlyContainerSchema } from '/imports/api/properties/Containers';
|
||||
import { ComputedOnlyDamageSchema } from '/imports/api/properties/Damages';
|
||||
import { ComputedOnlyDamageMultiplierSchema } from '/imports/api/properties/DamageMultipliers';
|
||||
import { ComputedOnlyEffectSchema } from '/imports/api/properties/Effects';
|
||||
import { ComputedOnlyFeatureSchema } from '/imports/api/properties/Features';
|
||||
import { ComputedOnlyFolderSchema } from '/imports/api/properties/Folders';
|
||||
import { ComputedOnlyItemSchema } from '/imports/api/properties/Items';
|
||||
import { ComputedOnlyNoteSchema } from '/imports/api/properties/Notes';
|
||||
import { ComputedOnlyPointBuySchema } from '/imports/api/properties/PointBuys';
|
||||
import { ComputedOnlyProficiencySchema } from '/imports/api/properties/Proficiencies';
|
||||
import { ComputedOnlyReferenceSchema } from '/imports/api/properties/References';
|
||||
import { ComputedOnlyRollSchema } from '/imports/api/properties/Rolls';
|
||||
import { ComputedOnlySavingThrowSchema } from '/imports/api/properties/SavingThrows';
|
||||
import { ComputedOnlySkillSchema } from '/imports/api/properties/Skills';
|
||||
import { ComputedOnlySlotSchema } from '/imports/api/properties/Slots';
|
||||
import { ComputedOnlySpellSchema } from '/imports/api/properties/Spells';
|
||||
import { ComputedOnlySpellListSchema } from '/imports/api/properties/SpellLists';
|
||||
import { ComputedOnlyToggleSchema } from '/imports/api/properties/Toggles';
|
||||
import { ComputedOnlyTriggerSchema } from '/imports/api/properties/Triggers';
|
||||
|
||||
const propertySchemasIndex = {
|
||||
action: ComputedOnlyActionSchema,
|
||||
|
||||
@@ -1,32 +1,32 @@
|
||||
import SimpleSchema from 'simpl-schema';
|
||||
import { ComputedActionSchema } from '/imports/api/properties/Actions.js';
|
||||
import { ComputedAdjustmentSchema } from '/imports/api/properties/Adjustments.js';
|
||||
import { ComputedAttributeSchema } from '/imports/api/properties/Attributes.js';
|
||||
import { ComputedBuffSchema } from '/imports/api/properties/Buffs.js';
|
||||
import { ComputedBuffRemoverSchema } from '/imports/api/properties/BuffRemovers.js';
|
||||
import { ComputedBranchSchema } from '/imports/api/properties/Branches.js';
|
||||
import { ComputedClassSchema } from '/imports/api/properties/Classes.js';
|
||||
import { ComputedClassLevelSchema } from '/imports/api/properties/ClassLevels.js';
|
||||
import { ConstantSchema } from '/imports/api/properties/Constants.js';
|
||||
import { ComputedContainerSchema } from '/imports/api/properties/Containers.js';
|
||||
import { ComputedDamageSchema } from '/imports/api/properties/Damages.js';
|
||||
import { DamageMultiplierSchema } from '/imports/api/properties/DamageMultipliers.js';
|
||||
import { ComputedEffectSchema } from '/imports/api/properties/Effects.js';
|
||||
import { ComputedFeatureSchema } from '/imports/api/properties/Features.js';
|
||||
import { ComputedFolderSchema } 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';
|
||||
import { ComputedSavingThrowSchema } from '/imports/api/properties/SavingThrows.js';
|
||||
import { ComputedSkillSchema } from '/imports/api/properties/Skills.js';
|
||||
import { ComputedSlotSchema } from '/imports/api/properties/Slots.js';
|
||||
import { ComputedSpellSchema } from '/imports/api/properties/Spells.js';
|
||||
import { ComputedSpellListSchema } from '/imports/api/properties/SpellLists.js';
|
||||
import { ComputedToggleSchema } from '/imports/api/properties/Toggles.js';
|
||||
import { ComputedTriggerSchema } from '/imports/api/properties/Triggers.js';
|
||||
import { ComputedActionSchema } from '/imports/api/properties/Actions';
|
||||
import { ComputedAdjustmentSchema } from '/imports/api/properties/Adjustments';
|
||||
import { ComputedAttributeSchema } from '/imports/api/properties/Attributes';
|
||||
import { ComputedBuffSchema } from '/imports/api/properties/Buffs';
|
||||
import { ComputedBuffRemoverSchema } from '/imports/api/properties/BuffRemovers';
|
||||
import { ComputedBranchSchema } from '/imports/api/properties/Branches';
|
||||
import { ComputedClassSchema } from '/imports/api/properties/Classes';
|
||||
import { ComputedClassLevelSchema } from '/imports/api/properties/ClassLevels';
|
||||
import { ConstantSchema } from '/imports/api/properties/Constants';
|
||||
import { ComputedContainerSchema } from '/imports/api/properties/Containers';
|
||||
import { ComputedDamageSchema } from '/imports/api/properties/Damages';
|
||||
import { DamageMultiplierSchema } from '/imports/api/properties/DamageMultipliers';
|
||||
import { ComputedEffectSchema } from '/imports/api/properties/Effects';
|
||||
import { ComputedFeatureSchema } from '/imports/api/properties/Features';
|
||||
import { ComputedFolderSchema } from '/imports/api/properties/Folders';
|
||||
import { ComputedItemSchema } from '/imports/api/properties/Items';
|
||||
import { ComputedNoteSchema } from '/imports/api/properties/Notes';
|
||||
import { ComputedPointBuySchema } from '/imports/api/properties/PointBuys';
|
||||
import { ProficiencySchema } from '/imports/api/properties/Proficiencies';
|
||||
import { ReferenceSchema } from '/imports/api/properties/References';
|
||||
import { ComputedRollSchema } from '/imports/api/properties/Rolls';
|
||||
import { ComputedSavingThrowSchema } from '/imports/api/properties/SavingThrows';
|
||||
import { ComputedSkillSchema } from '/imports/api/properties/Skills';
|
||||
import { ComputedSlotSchema } from '/imports/api/properties/Slots';
|
||||
import { ComputedSpellSchema } from '/imports/api/properties/Spells';
|
||||
import { ComputedSpellListSchema } from '/imports/api/properties/SpellLists';
|
||||
import { ComputedToggleSchema } from '/imports/api/properties/Toggles';
|
||||
import { ComputedTriggerSchema } from '/imports/api/properties/Triggers';
|
||||
|
||||
const propertySchemasIndex = {
|
||||
action: ComputedActionSchema,
|
||||
|
||||
@@ -1,32 +1,32 @@
|
||||
import SimpleSchema from 'simpl-schema';
|
||||
import { ActionSchema } from '/imports/api/properties/Actions.js';
|
||||
import { AdjustmentSchema } from '/imports/api/properties/Adjustments.js';
|
||||
import { AttributeSchema } from '/imports/api/properties/Attributes.js';
|
||||
import { BuffSchema } from '/imports/api/properties/Buffs.js';
|
||||
import { BuffRemoverSchema } from '/imports/api/properties/BuffRemovers.js';
|
||||
import { BranchSchema } from '/imports/api/properties/Branches.js';
|
||||
import { ClassSchema } from '/imports/api/properties/Classes.js';
|
||||
import { ClassLevelSchema } from '/imports/api/properties/ClassLevels.js';
|
||||
import { ConstantSchema } from '/imports/api/properties/Constants.js';
|
||||
import { DamageSchema } from '/imports/api/properties/Damages.js';
|
||||
import { DamageMultiplierSchema } from '/imports/api/properties/DamageMultipliers.js';
|
||||
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';
|
||||
import { SavingThrowSchema } from '/imports/api/properties/SavingThrows.js';
|
||||
import { SkillSchema } from '/imports/api/properties/Skills.js';
|
||||
import { SlotSchema } from '/imports/api/properties/Slots.js';
|
||||
import { SpellListSchema } from '/imports/api/properties/SpellLists.js';
|
||||
import { SpellSchema } from '/imports/api/properties/Spells.js';
|
||||
import { ToggleSchema } from '/imports/api/properties/Toggles.js';
|
||||
import { TriggerSchema } from '/imports/api/properties/Triggers.js';
|
||||
import { ContainerSchema } from '/imports/api/properties/Containers.js';
|
||||
import { ItemSchema } from '/imports/api/properties/Items.js';
|
||||
import { ActionSchema } from '/imports/api/properties/Actions';
|
||||
import { AdjustmentSchema } from '/imports/api/properties/Adjustments';
|
||||
import { AttributeSchema } from '/imports/api/properties/Attributes';
|
||||
import { BuffSchema } from '/imports/api/properties/Buffs';
|
||||
import { BuffRemoverSchema } from '/imports/api/properties/BuffRemovers';
|
||||
import { BranchSchema } from '/imports/api/properties/Branches';
|
||||
import { ClassSchema } from '/imports/api/properties/Classes';
|
||||
import { ClassLevelSchema } from '/imports/api/properties/ClassLevels';
|
||||
import { ConstantSchema } from '/imports/api/properties/Constants';
|
||||
import { DamageSchema } from '/imports/api/properties/Damages';
|
||||
import { DamageMultiplierSchema } from '/imports/api/properties/DamageMultipliers';
|
||||
import { EffectSchema } from '/imports/api/properties/Effects';
|
||||
import { FeatureSchema } from '/imports/api/properties/Features';
|
||||
import { FolderSchema } from '/imports/api/properties/Folders';
|
||||
import { NoteSchema } from '/imports/api/properties/Notes';
|
||||
import { PointBuySchema } from '/imports/api/properties/PointBuys';
|
||||
import { ProficiencySchema } from '/imports/api/properties/Proficiencies';
|
||||
import { ReferenceSchema } from '/imports/api/properties/References';
|
||||
import { RollSchema } from '/imports/api/properties/Rolls';
|
||||
import { SavingThrowSchema } from '/imports/api/properties/SavingThrows';
|
||||
import { SkillSchema } from '/imports/api/properties/Skills';
|
||||
import { SlotSchema } from '/imports/api/properties/Slots';
|
||||
import { SpellListSchema } from '/imports/api/properties/SpellLists';
|
||||
import { SpellSchema } from '/imports/api/properties/Spells';
|
||||
import { ToggleSchema } from '/imports/api/properties/Toggles';
|
||||
import { TriggerSchema } from '/imports/api/properties/Triggers';
|
||||
import { ContainerSchema } from '/imports/api/properties/Containers';
|
||||
import { ItemSchema } from '/imports/api/properties/Items';
|
||||
|
||||
const propertySchemasIndex = {
|
||||
action: ActionSchema,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import SimpleSchema from 'simpl-schema';
|
||||
import STORAGE_LIMITS from '/imports/constants/STORAGE_LIMITS.js';
|
||||
import STORAGE_LIMITS from '/imports/constants/STORAGE_LIMITS';
|
||||
|
||||
const ErrorSchema = new SimpleSchema({
|
||||
message: {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import SimpleSchema from 'simpl-schema';
|
||||
import ErrorSchema from '/imports/api/properties/subSchemas/ErrorSchema.js';
|
||||
import STORAGE_LIMITS from '/imports/constants/STORAGE_LIMITS.js';
|
||||
import ErrorSchema from '/imports/api/properties/subSchemas/ErrorSchema';
|
||||
import STORAGE_LIMITS from '/imports/constants/STORAGE_LIMITS';
|
||||
|
||||
const InlineComputationSchema = new SimpleSchema({
|
||||
// The part between bracers {}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import SimpleSchema from 'simpl-schema';
|
||||
import STORAGE_LIMITS from '/imports/constants/STORAGE_LIMITS.js';
|
||||
import STORAGE_LIMITS from '/imports/constants/STORAGE_LIMITS';
|
||||
|
||||
const RollDetailsSchema = new SimpleSchema({
|
||||
number: {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import SimpleSchema from 'simpl-schema';
|
||||
import ResultsSchema from '/imports/api/properties/subSchemas/ResultsSchema.js';
|
||||
import ResultsSchema from '/imports/api/properties/subSchemas/ResultsSchema';
|
||||
|
||||
let RollResultsSchema = new SimpleSchema({
|
||||
_id: {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import SimpleSchema from 'simpl-schema';
|
||||
import STORAGE_LIMITS from '/imports/constants/STORAGE_LIMITS.js';
|
||||
import STORAGE_LIMITS from '/imports/constants/STORAGE_LIMITS';
|
||||
|
||||
const TagTargetingSchema = new SimpleSchema({
|
||||
// True when targeting by tags instead of stats
|
||||
|
||||
@@ -1,6 +1,16 @@
|
||||
import SimpleSchema from 'simpl-schema';
|
||||
import ErrorSchema from '/imports/api/properties/subSchemas/ErrorSchema.js';
|
||||
import STORAGE_LIMITS from '/imports/constants/STORAGE_LIMITS.js';
|
||||
import ErrorSchema from '/imports/api/properties/subSchemas/ErrorSchema';
|
||||
import STORAGE_LIMITS from '/imports/constants/STORAGE_LIMITS';
|
||||
|
||||
export interface CalculatedField {
|
||||
calculation?: string,
|
||||
value?: string | number,
|
||||
effectIds?: string[],
|
||||
parseNode?: any,
|
||||
parseError?: any,
|
||||
hash?: number,
|
||||
errors?: any[],
|
||||
}
|
||||
|
||||
// Get schemas that apply fields directly so they can be gracefully extended
|
||||
// because {type: Schema} fields can't be extended
|
||||
@@ -1,17 +1,17 @@
|
||||
import {
|
||||
inlineCalculationFieldToCompute,
|
||||
computedOnlyInlineCalculationField,
|
||||
} from '/imports/api/properties/subSchemas/inlineCalculationField.js';
|
||||
} from '/imports/api/properties/subSchemas/inlineCalculationField';
|
||||
import {
|
||||
fieldToCompute,
|
||||
computedOnlyField,
|
||||
} from '/imports/api/properties/subSchemas/computedField.js';
|
||||
} from '/imports/api/properties/subSchemas/computedField';
|
||||
import SimpleSchema from 'simpl-schema';
|
||||
|
||||
// Search through the schema for keys whose type is 'fieldToCompute' etc.
|
||||
// replace the type with Object and attach extend the schema with
|
||||
// the required fields to make the computation work
|
||||
export default function createPropertySchema(definition){
|
||||
export default function createPropertySchema(definition) {
|
||||
const computationFields = {
|
||||
inlineCalculationFieldToCompute: [],
|
||||
computedOnlyInlineCalculationField: [],
|
||||
@@ -20,18 +20,18 @@ export default function createPropertySchema(definition){
|
||||
};
|
||||
const computedKeys = Object.keys(computationFields);
|
||||
|
||||
for (let key in definition){
|
||||
for (let key in definition) {
|
||||
const def = definition[key];
|
||||
if (computedKeys.includes(def.type)){
|
||||
if (computedKeys.includes(def.type)) {
|
||||
computationFields[def.type].push(key);
|
||||
applyDefaultCalculationValue(definition, key);
|
||||
def.type = Object;
|
||||
if (!def.optional){
|
||||
if (!def.optional) {
|
||||
console.warn(
|
||||
`computed field: '${key}' of '${def.type}' is expected to be optional`
|
||||
);
|
||||
}
|
||||
if (def.removeBeforeCompute){
|
||||
if (def.removeBeforeCompute) {
|
||||
console.warn(
|
||||
`computed field: '${key}' of '${def.type}' should not be removed before computation`
|
||||
)
|
||||
@@ -58,12 +58,12 @@ export default function createPropertySchema(definition){
|
||||
return schema
|
||||
}
|
||||
|
||||
function applyDefaultCalculationValue(definition, key){
|
||||
function applyDefaultCalculationValue(definition, key) {
|
||||
const def = definition[key];
|
||||
if (
|
||||
def.type === 'computedOnlyField' ||
|
||||
def.type === 'computedOnlyInlineCalculationField'
|
||||
){
|
||||
) {
|
||||
// don't apply defaults to computed only fields
|
||||
// because it would add the calculation field which should only appear
|
||||
// on the fields to compute
|
||||
@@ -72,12 +72,12 @@ function applyDefaultCalculationValue(definition, key){
|
||||
let defaultValue = def.defaultValue;
|
||||
if (!defaultValue) return;
|
||||
let calcField;
|
||||
if (def.type === 'fieldToCompute'){
|
||||
if (def.type === 'fieldToCompute') {
|
||||
calcField = key + '.calculation'
|
||||
} else {
|
||||
calcField = key + '.text'
|
||||
}
|
||||
if (definition[calcField]){
|
||||
if (definition[calcField]) {
|
||||
definition[calcField].defaultValue = defaultValue;
|
||||
} else {
|
||||
definition[calcField] = {
|
||||
|
||||
@@ -1,10 +1,18 @@
|
||||
import SimpleSchema from 'simpl-schema';
|
||||
import ErrorSchema from '/imports/api/properties/subSchemas/ErrorSchema.js';
|
||||
import STORAGE_LIMITS from '/imports/constants/STORAGE_LIMITS.js';
|
||||
import ErrorSchema from '/imports/api/properties/subSchemas/ErrorSchema';
|
||||
import STORAGE_LIMITS from '/imports/constants/STORAGE_LIMITS';
|
||||
import { CalculatedField } from './computedField';
|
||||
|
||||
export interface InlineCalculation {
|
||||
text?: string,
|
||||
hash?: number,
|
||||
value?: string,
|
||||
inlineCalculations: CalculatedField[],
|
||||
}
|
||||
|
||||
// Get schemas that apply fields directly so they can be gracefully extended
|
||||
// because {type: Schema} fields can't be extended
|
||||
function inlineCalculationFieldToCompute(field){
|
||||
function inlineCalculationFieldToCompute(field) {
|
||||
return new SimpleSchema({
|
||||
// The object should already be set, but set again just in case
|
||||
[field]: {
|
||||
@@ -20,7 +28,7 @@ function inlineCalculationFieldToCompute(field){
|
||||
});
|
||||
}
|
||||
|
||||
function computedOnlyInlineCalculationField(field){
|
||||
function computedOnlyInlineCalculationField(field) {
|
||||
return new SimpleSchema({
|
||||
// The object should already be set, but set again just in case
|
||||
[field]: {
|
||||
@@ -30,9 +38,8 @@ function computedOnlyInlineCalculationField(field){
|
||||
},
|
||||
// a hash of the text to see if the current cached values need to be updated
|
||||
[`${field}.hash`]: {
|
||||
type: String,
|
||||
type: Number,
|
||||
optional: true,
|
||||
max: STORAGE_LIMITS.inlineCalculationField,
|
||||
},
|
||||
[`${field}.value`]: {
|
||||
type: String,
|
||||
@@ -90,7 +97,7 @@ function computedOnlyInlineCalculationField(field){
|
||||
});
|
||||
}
|
||||
|
||||
function computedInlineCalculationField(field){
|
||||
function computedInlineCalculationField(field) {
|
||||
return inlineCalculationFieldToCompute(field).extend(
|
||||
computedOnlyInlineCalculationField(field)
|
||||
)
|
||||
Reference in New Issue
Block a user