Improved property viewers, added some new ones

This commit is contained in:
Stefan Zermatten
2019-08-06 13:16:46 +02:00
parent b70634f5de
commit 45c84e28a3
33 changed files with 379 additions and 197 deletions

View File

@@ -1,5 +1,5 @@
import SimpleSchema from 'simpl-schema';
import { EffectSchema } from '/imports/api/properties/Effects.js';
import { StoredEffectSchema } from '/imports/api/properties/Effects.js';
let BuffSchema = new SimpleSchema({
name: {
@@ -25,7 +25,7 @@ let StoredBuffSchema = new SimpleSchema({
defaultValue: [],
},
'effects.$': {
type: EffectSchema,
type: StoredEffectSchema,
},
target: {
type: String,

View File

@@ -5,13 +5,6 @@ import SimpleSchema from 'simpl-schema';
* that modify their final value or presentation in some way
*/
let EffectSchema = new SimpleSchema({
_id: {
type: String,
regEx: SimpleSchema.RegEx.Id,
autoValue(){
if (!this.isSet) return Random.id();
}
},
name: {
type: String,
optional: true,
@@ -43,6 +36,16 @@ let EffectSchema = new SimpleSchema({
},
});
const StoredEffectSchema = new SimpleSchema({
_id: {
type: String,
regEx: SimpleSchema.RegEx.Id,
autoValue(){
if (!this.isSet) return Random.id();
}
},
}).extend(EffectSchema);
const ComputedEffectSchema = new SimpleSchema({
// The computed result of the effect
result: {
@@ -51,4 +54,4 @@ const ComputedEffectSchema = new SimpleSchema({
},
}).extend(EffectSchema);
export { EffectSchema, ComputedEffectSchema };
export { EffectSchema, StoredEffectSchema, ComputedEffectSchema };

View File

@@ -20,7 +20,7 @@ let SkillSchema = new SimpleSchema({
optional: true,
},
// What type of skill is this
type: {
skillType: {
type: String,
allowedValues: [
"skill",
@@ -43,6 +43,11 @@ let SkillSchema = new SimpleSchema({
type: Number,
optional: true,
},
// Description of what the skill is used for
description: {
type: String,
optional: true,
},
});