Merge branch 'version-2' into version-2-dev

This commit is contained in:
Stefan Zermatten
2022-08-19 09:18:55 +02:00
36 changed files with 858 additions and 197 deletions

View File

@@ -0,0 +1,79 @@
import SimpleSchema from 'simpl-schema';
import STORAGE_LIMITS from '/imports/constants/STORAGE_LIMITS.js';
import createPropertySchema from '/imports/api/properties/subSchemas/createPropertySchema.js';
let BuffRemoverSchema = createPropertySchema({
name: {
type: String,
optional: true,
max: STORAGE_LIMITS.name,
},
// This will remove just the nearest ancestor buff
targetParentBuff: {
type: Boolean,
optional: true,
},
// The following only applies when not targeting the parent buff
// Which character to remove buffs from
target: {
type: String,
allowedValues: [
'self',
'target',
],
defaultValue: 'target',
},
// remove 1 or remove all
removeAll: {
type: Boolean,
optional: true,
defaultValue: true,
},
// Buffs to remove based on tags:
targetTags: {
type: Array,
optional: true,
maxCount: STORAGE_LIMITS.tagCount,
},
'targetTags.$': {
type: String,
max: STORAGE_LIMITS.tagLength,
},
extraTags: {
type: Array,
optional: true,
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,
},
});
let ComputedOnlyBuffRemoverSchema = createPropertySchema({});
const ComputedBuffRemoverSchema = new SimpleSchema()
.extend(BuffRemoverSchema)
.extend(ComputedOnlyBuffRemoverSchema);
export { BuffRemoverSchema, ComputedOnlyBuffRemoverSchema, ComputedBuffRemoverSchema };

View File

@@ -12,6 +12,10 @@ let BuffSchema = createPropertySchema({
type: 'inlineCalculationFieldToCompute',
optional: true,
},
hideRemoveButton: {
type: Boolean,
optional: true,
},
// How many rounds this buff lasts
duration: {
type: 'fieldToCompute',

View File

@@ -1,15 +1,15 @@
import SimpleSchema from 'simpl-schema';
import STORAGE_LIMITS from '/imports/constants/STORAGE_LIMITS.js';
import createPropertySchema from '/imports/api/properties/subSchemas/createPropertySchema.js';
// Folders organize a character sheet into a tree, particularly to group things
// like 'race' and 'background'
let FolderSchema = new SimpleSchema({
let FolderSchema = new createPropertySchema({
name: {
type: String,
max: STORAGE_LIMITS.name,
},
});
const ComputedOnlyFolderSchema = new SimpleSchema({});
const ComputedOnlyFolderSchema = new createPropertySchema({});
export { FolderSchema, ComputedOnlyFolderSchema };

View File

@@ -25,6 +25,7 @@ const actionPropertyTypeOptions = {
adjustment: 'Attribute damage',
branch: 'Branch',
buff: 'Buff',
buffRemover: 'Buff Removed',
damage: 'Damage',
note: 'Note',
roll: 'Roll',

View File

@@ -3,6 +3,7 @@ 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';
@@ -33,6 +34,7 @@ const propertySchemasIndex = {
adjustment: ComputedOnlyAdjustmentSchema,
attribute: ComputedOnlyAttributeSchema,
buff: ComputedOnlyBuffSchema,
buffRemover: ComputedOnlyBuffRemoverSchema,
branch: ComputedOnlyBranchSchema,
class: ComputedOnlyClassSchema,
classLevel: ComputedOnlyClassLevelSchema,

View File

@@ -3,6 +3,7 @@ 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';
@@ -33,6 +34,7 @@ const propertySchemasIndex = {
adjustment: ComputedAdjustmentSchema,
attribute: ComputedAttributeSchema,
buff: ComputedBuffSchema,
buffRemover: ComputedBuffRemoverSchema,
branch: ComputedBranchSchema,
class: ComputedClassSchema,
classLevel: ComputedClassLevelSchema,

View File

@@ -3,6 +3,7 @@ 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';
@@ -33,6 +34,7 @@ const propertySchemasIndex = {
adjustment: AdjustmentSchema,
attribute: AttributeSchema,
buff: BuffSchema,
buffRemover: BuffRemoverSchema,
branch: BranchSchema,
class: ClassSchema,
classLevel: ClassLevelSchema,