Added reasonable storage limits to most string and array schemas
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import SimpleSchema from 'simpl-schema';
|
||||
import STORAGE_LIMITS from '/imports/constants/STORAGE_LIMITS.js';
|
||||
|
||||
let CreatureFolders = new Mongo.Collection('creatureFolders');
|
||||
|
||||
@@ -7,6 +8,7 @@ let creatureFolderSchema = new SimpleSchema({
|
||||
type: String,
|
||||
trim: false,
|
||||
optional: true,
|
||||
max: STORAGE_LIMITS.name,
|
||||
},
|
||||
creatures: {
|
||||
type: Array,
|
||||
|
||||
@@ -5,6 +5,7 @@ import ChildSchema from '/imports/api/parenting/ChildSchema.js';
|
||||
import SoftRemovableSchema from '/imports/api/parenting/SoftRemovableSchema.js';
|
||||
import propertySchemasIndex from '/imports/api/properties/computedPropertySchemasIndex.js';
|
||||
import { storedIconsSchema } from '/imports/api/icons/Icons.js';
|
||||
import STORAGE_LIMITS from '/imports/constants/STORAGE_LIMITS.js';
|
||||
|
||||
let CreatureProperties = new Mongo.Collection('creatureProperties');
|
||||
|
||||
@@ -16,9 +17,11 @@ let CreaturePropertySchema = new SimpleSchema({
|
||||
tags: {
|
||||
type: Array,
|
||||
defaultValue: [],
|
||||
maxCount: STORAGE_LIMITS.tagCount,
|
||||
},
|
||||
'tags.$': {
|
||||
type: String,
|
||||
max: STORAGE_LIMITS.tagLength,
|
||||
},
|
||||
disabled: {
|
||||
type: Boolean,
|
||||
@@ -27,6 +30,7 @@ let CreaturePropertySchema = new SimpleSchema({
|
||||
icon: {
|
||||
type: storedIconsSchema,
|
||||
optional: true,
|
||||
max: STORAGE_LIMITS.icon,
|
||||
},
|
||||
// Reference to the library node that this property was copied from
|
||||
libraryNodeId: {
|
||||
|
||||
@@ -2,6 +2,7 @@ import SimpleSchema from 'simpl-schema';
|
||||
import deathSaveSchema from '/imports/api/properties/subSchemas/DeathSavesSchema.js'
|
||||
import ColorSchema from '/imports/api/properties/subSchemas/ColorSchema.js';
|
||||
import SharingSchema from '/imports/api/sharing/SharingSchema.js';
|
||||
import STORAGE_LIMITS from '/imports/constants/STORAGE_LIMITS.js';
|
||||
|
||||
//set up the collection for creatures
|
||||
let Creatures = new Mongo.Collection('creatures');
|
||||
@@ -47,7 +48,7 @@ let CreatureSettingsSchema = new SimpleSchema({
|
||||
discordWebhook: {
|
||||
type: String,
|
||||
optional: true,
|
||||
max: 200,
|
||||
max: STORAGE_LIMITS.url,
|
||||
},
|
||||
});
|
||||
|
||||
@@ -57,22 +58,27 @@ let CreatureSchema = new SimpleSchema({
|
||||
type: String,
|
||||
defaultValue: '',
|
||||
optional: true,
|
||||
max: STORAGE_LIMITS.name,
|
||||
},
|
||||
alignment: {
|
||||
type: String,
|
||||
optional: true
|
||||
optional: true,
|
||||
max: STORAGE_LIMITS.name,
|
||||
},
|
||||
gender: {
|
||||
type: String,
|
||||
optional: true
|
||||
optional: true,
|
||||
max: STORAGE_LIMITS.name,
|
||||
},
|
||||
picture: {
|
||||
type: String,
|
||||
optional: true
|
||||
optional: true,
|
||||
max: STORAGE_LIMITS.url,
|
||||
},
|
||||
avatarPicture: {
|
||||
type: String,
|
||||
optional: true,
|
||||
max: STORAGE_LIMITS.url,
|
||||
},
|
||||
// Mechanics
|
||||
deathSave: {
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import SimpleSchema from 'simpl-schema';
|
||||
import { ValidatedMethod } from 'meteor/mdg:validated-method';
|
||||
import { RateLimiterMixin } from 'ddp-rate-limiter-mixin';
|
||||
import { getUserTier } from '/imports/api/users/patreon/tiers.js';
|
||||
import { assertEditPermission } from '/imports/api/creature/creatures/creaturePermissions.js';
|
||||
import Creatures from '/imports/api/creature/creatures/Creatures.js';
|
||||
import { recomputeCreatureById } from '/imports/api/creature/computation/methods/recomputeCreature.js';
|
||||
import STORAGE_LIMITS from '/imports/constants/STORAGE_LIMITS.js';
|
||||
|
||||
let Experiences = new Mongo.Collection('experiences');
|
||||
|
||||
@@ -12,6 +12,7 @@ let ExperienceSchema = new SimpleSchema({
|
||||
name: {
|
||||
type: String,
|
||||
optional: true,
|
||||
max: STORAGE_LIMITS.name,
|
||||
},
|
||||
// The amount of XP this experience gives
|
||||
xp: {
|
||||
|
||||
@@ -1,14 +1,17 @@
|
||||
import SimpleSchema from 'simpl-schema';
|
||||
import STORAGE_LIMITS from '/imports/constants/STORAGE_LIMITS.js';
|
||||
|
||||
let ExperienceSchema = new SimpleSchema({
|
||||
title: {
|
||||
type: String,
|
||||
optional: true,
|
||||
max: STORAGE_LIMITS.name,
|
||||
},
|
||||
// Potentially long description of the event
|
||||
description: {
|
||||
type: String,
|
||||
optional: true,
|
||||
max: STORAGE_LIMITS.description,
|
||||
},
|
||||
// The real-world date that it occured
|
||||
date: {
|
||||
@@ -24,14 +27,17 @@ let ExperienceSchema = new SimpleSchema({
|
||||
worldDate: {
|
||||
type: String,
|
||||
optional: true,
|
||||
max: STORAGE_LIMITS.name,
|
||||
},
|
||||
// Tags to better find this entry later
|
||||
tags: {
|
||||
type: Array,
|
||||
defaultValue: [],
|
||||
maxCount: STORAGE_LIMITS.tagCount,
|
||||
},
|
||||
'tags.$': {
|
||||
type: String,
|
||||
max: STORAGE_LIMITS.tagLength,
|
||||
},
|
||||
// ID of the journal this entry belongs to
|
||||
journalId: {
|
||||
|
||||
@@ -10,6 +10,7 @@ import {
|
||||
prettifyParseError
|
||||
} from '/imports/parser/parser.js';
|
||||
const PER_CREATURE_LOG_LIMIT = 100;
|
||||
import STORAGE_LIMITS from '/imports/constants/STORAGE_LIMITS.js';
|
||||
|
||||
if (Meteor.isServer){
|
||||
var sendWebhookAsCreature = require('/imports/server/discord/sendWebhook.js').sendWebhookAsCreature;
|
||||
@@ -21,7 +22,7 @@ let CreatureLogSchema = new SimpleSchema({
|
||||
content: {
|
||||
type: Array,
|
||||
defaultValue: [],
|
||||
maxCount: 25,
|
||||
maxCount: STORAGE_LIMITS.logContentCount,
|
||||
},
|
||||
'content.$': {
|
||||
type: LogContentSchema,
|
||||
@@ -45,6 +46,7 @@ let CreatureLogSchema = new SimpleSchema({
|
||||
creatureName: {
|
||||
type: String,
|
||||
optional: true,
|
||||
max: STORAGE_LIMITS.name,
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
@@ -1,18 +1,21 @@
|
||||
import SimpleSchema from 'simpl-schema';
|
||||
import ErrorSchema from '/imports/api/properties/subSchemas/ErrorSchema.js';
|
||||
import RollDetailsSchema from '/imports/api/properties/subSchemas/RollDetailsSchema.js';
|
||||
import STORAGE_LIMITS from '/imports/constants/STORAGE_LIMITS.js';
|
||||
|
||||
let LogContentSchema = new SimpleSchema({
|
||||
// The name of the field, included in discord webhook message
|
||||
name: {
|
||||
type: String,
|
||||
optional: true,
|
||||
max: STORAGE_LIMITS.name,
|
||||
},
|
||||
// The details of the field, included in discord webhook message
|
||||
// Markdown support
|
||||
value: {
|
||||
type: String,
|
||||
optional: true,
|
||||
max: STORAGE_LIMITS.summary,
|
||||
},
|
||||
context: {
|
||||
type: Object,
|
||||
@@ -21,6 +24,7 @@ let LogContentSchema = new SimpleSchema({
|
||||
'context.errors':{
|
||||
type: Array,
|
||||
defaultValue: [],
|
||||
maxCount: STORAGE_LIMITS.errorCount,
|
||||
},
|
||||
'context.errors.$': {
|
||||
type: ErrorSchema,
|
||||
@@ -28,6 +32,7 @@ let LogContentSchema = new SimpleSchema({
|
||||
'context.rolls': {
|
||||
type: Array,
|
||||
defaultValue: [],
|
||||
maxCount: STORAGE_LIMITS.rollCount,
|
||||
},
|
||||
'context.rolls.$': {
|
||||
type: RollDetailsSchema,
|
||||
|
||||
@@ -2,6 +2,7 @@ import SimpleSchema from 'simpl-schema';
|
||||
import { ValidatedMethod } from 'meteor/mdg:validated-method';
|
||||
import { RateLimiterMixin } from 'ddp-rate-limiter-mixin';
|
||||
import { assertAdmin } from '/imports/api/sharing/sharingPermissions.js';
|
||||
import STORAGE_LIMITS from '/imports/constants/STORAGE_LIMITS.js';
|
||||
|
||||
let Icons = new Mongo.Collection('icons');
|
||||
|
||||
@@ -9,22 +10,27 @@ let iconsSchema = new SimpleSchema({
|
||||
name: {
|
||||
type: String,
|
||||
unique: true,
|
||||
max: STORAGE_LIMITS.name,
|
||||
index: 1,
|
||||
},
|
||||
description: {
|
||||
type: String,
|
||||
optional: true,
|
||||
max: STORAGE_LIMITS.description,
|
||||
},
|
||||
tags: {
|
||||
type: Array,
|
||||
optional: true,
|
||||
maxCount: STORAGE_LIMITS.tagCount,
|
||||
index: 1,
|
||||
},
|
||||
'tags.$': {
|
||||
type: String,
|
||||
max: STORAGE_LIMITS.tagLength,
|
||||
},
|
||||
shape: {
|
||||
type: String,
|
||||
max: STORAGE_LIMITS.icon,
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@ import simpleSchemaMixin from '/imports/api/creature/mixins/simpleSchemaMixin.js
|
||||
import { assertEditPermission, assertOwnership } from '/imports/api/sharing/sharingPermissions.js';
|
||||
import LibraryNodes from '/imports/api/library/LibraryNodes.js';
|
||||
import { getUserTier } from '/imports/api/users/patreon/tiers.js'
|
||||
import STORAGE_LIMITS from '/imports/constants/STORAGE_LIMITS.js';
|
||||
|
||||
/**
|
||||
* Libraries are trees of library nodes where each node represents a character
|
||||
@@ -21,11 +22,8 @@ let Libraries = new Mongo.Collection('libraries');
|
||||
let LibrarySchema = new SimpleSchema({
|
||||
name: {
|
||||
type: String,
|
||||
max: STORAGE_LIMITS.name,
|
||||
},
|
||||
isDefault: {
|
||||
type: Boolean,
|
||||
optional: true,
|
||||
},
|
||||
});
|
||||
|
||||
LibrarySchema.extend(SharingSchema);
|
||||
@@ -39,7 +37,7 @@ const insertLibrary = new ValidatedMethod({
|
||||
mixins: [
|
||||
simpleSchemaMixin,
|
||||
],
|
||||
schema: LibrarySchema.omit('owner', 'isDefault'),
|
||||
schema: LibrarySchema.omit('owner'),
|
||||
run(library) {
|
||||
if (!this.userId) {
|
||||
throw new Meteor.Error('Libraries.methods.insert.denied',
|
||||
@@ -78,30 +76,6 @@ const updateLibraryName = new ValidatedMethod({
|
||||
},
|
||||
});
|
||||
|
||||
const setLibraryDefault = new ValidatedMethod({
|
||||
name: 'libraries.makeLibraryDefault',
|
||||
validate: new SimpleSchema({
|
||||
_id: {
|
||||
type: String,
|
||||
regEx: SimpleSchema.RegEx.id
|
||||
},
|
||||
isDefault: {
|
||||
type: Boolean,
|
||||
},
|
||||
}).validator(),
|
||||
mixins: [RateLimiterMixin],
|
||||
rateLimit: {
|
||||
numRequests: 5,
|
||||
timeInterval: 5000,
|
||||
},
|
||||
run({_id, isDefault}) {
|
||||
if (!Meteor.users.isAdmin()){
|
||||
throw new Meteor.Error('Permission denied', 'User must be admin to set libraries as default');
|
||||
}
|
||||
return Libraries.update(_id, {$set: {isDefault}});
|
||||
},
|
||||
});
|
||||
|
||||
const removeLibrary = new ValidatedMethod({
|
||||
name: 'libraries.remove',
|
||||
validate: new SimpleSchema({
|
||||
@@ -128,4 +102,4 @@ export function removeLibaryWork(libraryId){
|
||||
LibraryNodes.remove({'ancestors.id': libraryId});
|
||||
}
|
||||
|
||||
export { LibrarySchema, insertLibrary, setLibraryDefault, updateLibraryName, removeLibrary };
|
||||
export { LibrarySchema, insertLibrary, updateLibraryName, removeLibrary };
|
||||
|
||||
@@ -13,6 +13,7 @@ import SoftRemovableSchema from '/imports/api/parenting/SoftRemovableSchema.js';
|
||||
import { storedIconsSchema } from '/imports/api/icons/Icons.js';
|
||||
import '/imports/api/library/methods/index.js';
|
||||
import { updateReferenceNodeWork } from '/imports/api/library/methods/updateReferenceNode.js';
|
||||
import STORAGE_LIMITS from '/imports/constants/STORAGE_LIMITS.js';
|
||||
|
||||
let LibraryNodes = new Mongo.Collection('libraryNodes');
|
||||
|
||||
@@ -24,13 +25,16 @@ let LibraryNodeSchema = new SimpleSchema({
|
||||
tags: {
|
||||
type: Array,
|
||||
defaultValue: [],
|
||||
maxCount: STORAGE_LIMITS.tagCount,
|
||||
},
|
||||
'tags.$': {
|
||||
type: String,
|
||||
max: STORAGE_LIMITS.tagLength,
|
||||
},
|
||||
icon: {
|
||||
type: storedIconsSchema,
|
||||
optional: true,
|
||||
max: STORAGE_LIMITS.icon,
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
import SimpleSchema from 'simpl-schema';
|
||||
|
||||
Blacklist = new Mongo.Collection("blacklist");
|
||||
|
||||
Schemas.Blacklist = new SimpleSchema({
|
||||
userId: {
|
||||
type: String,
|
||||
},
|
||||
});
|
||||
|
||||
Blacklist.attachSchema(Schemas.Blacklist);
|
||||
@@ -1,29 +0,0 @@
|
||||
import SimpleSchema from 'simpl-schema';
|
||||
|
||||
ChangeLogs = new Mongo.Collection("changeLogs");
|
||||
|
||||
Schemas.ChangeLog = new SimpleSchema({
|
||||
version: {
|
||||
type: String,
|
||||
},
|
||||
changes: {
|
||||
type: [String],
|
||||
},
|
||||
});
|
||||
|
||||
ChangeLogs.attachSchema(Schemas.ChangeLog);
|
||||
|
||||
ChangeLogs.allow({
|
||||
insert: function(userId, doc) {
|
||||
var user = Meteor.users.findOne(userId);
|
||||
if (user) return _.contains(user.roles, "admin");
|
||||
},
|
||||
update: function(userId, doc, fields, modifier) {
|
||||
var user = Meteor.users.findOne(userId);
|
||||
if (user) return _.contains(user.roles, "admin");
|
||||
},
|
||||
remove: function(userId, doc) {
|
||||
var user = Meteor.users.findOne(userId);
|
||||
if (user) return _.contains(user.roles, "admin");
|
||||
},
|
||||
});
|
||||
@@ -1,81 +0,0 @@
|
||||
import SimpleSchema from 'simpl-schema';
|
||||
|
||||
Reports = new Mongo.Collection("reports");
|
||||
|
||||
Schemas.Report = new SimpleSchema({
|
||||
owner: {
|
||||
type: String,
|
||||
regEx: SimpleSchema.RegEx.Id,
|
||||
},
|
||||
title: {
|
||||
type: String,
|
||||
trim: false,
|
||||
optional: true,
|
||||
},
|
||||
description: {
|
||||
type: String,
|
||||
trim: false,
|
||||
optional: true,
|
||||
},
|
||||
type: {
|
||||
type: String,
|
||||
allowedValues: ["General Feedback", "Bug", "Suggested Change", "Feature Request"],
|
||||
defaultValue: "General Feedback",
|
||||
},
|
||||
//the immediate impact of doing this action (eg. -1 rages)
|
||||
severity: {
|
||||
type: SimpleSchema.Integer,
|
||||
defaultValue: 5,
|
||||
min: 1,
|
||||
max: 10,
|
||||
},
|
||||
metaData: {
|
||||
type: Object,
|
||||
blackbox: true,
|
||||
},
|
||||
});
|
||||
|
||||
Reports.attachSchema(Schemas.Report);
|
||||
|
||||
Meteor.methods({
|
||||
insertReport: function(report) {
|
||||
check(report, {
|
||||
title: String,
|
||||
description: String,
|
||||
type: String,
|
||||
severity: Number,
|
||||
metaData: Object,
|
||||
});
|
||||
report.owner = this.userId;
|
||||
var id = Reports.insert(report);
|
||||
var user = Meteor.users.findOne(this.userId);
|
||||
var sender = user &&
|
||||
user.emails &&
|
||||
user.emails[0] &&
|
||||
user.emails[0].address ||
|
||||
user.services &&
|
||||
user.services.google &&
|
||||
user.services.google.email ||
|
||||
"reports@dicecloud.com";
|
||||
var bodyText = "Report ID: " + id +
|
||||
"\nSeverity: " + report.severity +
|
||||
"\nType: " + report.type +
|
||||
"\n\n" + report.description;
|
||||
Email.send({
|
||||
from: sender,
|
||||
to: "stefan.zermatten@gmail.com",
|
||||
subject: "DiceCloud feedback - " + report.title,
|
||||
text: bodyText,
|
||||
});
|
||||
},
|
||||
deleteReport: function(id) {
|
||||
var user = Meteor.users.findOne(this.userId);
|
||||
if (!_.contains(user.roles, "admin")){
|
||||
throw new Meteor.Error(
|
||||
"not admin",
|
||||
"The user must be an administrator to delete feedback"
|
||||
);
|
||||
}
|
||||
Reports.remove(id);
|
||||
},
|
||||
});
|
||||
@@ -1,4 +1,5 @@
|
||||
import SimpleSchema from 'simpl-schema';
|
||||
import STORAGE_LIMITS from '/imports/constants/STORAGE_LIMITS.js';
|
||||
|
||||
const RefSchema = new SimpleSchema({
|
||||
id: {
|
||||
@@ -12,7 +13,8 @@ const RefSchema = new SimpleSchema({
|
||||
index: 1
|
||||
},
|
||||
collection: {
|
||||
type: String
|
||||
type: String,
|
||||
max: STORAGE_LIMITS.collectionName,
|
||||
},
|
||||
});
|
||||
|
||||
@@ -27,7 +29,7 @@ let ChildSchema = new SimpleSchema({
|
||||
ancestors: {
|
||||
type: Array,
|
||||
defaultValue: [],
|
||||
max: 100,
|
||||
maxCount: STORAGE_LIMITS.ancestorCount,
|
||||
},
|
||||
'ancestors.$': {
|
||||
type: RefSchema,
|
||||
|
||||
@@ -43,15 +43,6 @@ let ActionSchema = new SimpleSchema({
|
||||
'multipleTargets',
|
||||
],
|
||||
},
|
||||
tags: {
|
||||
type: Array,
|
||||
defaultValue: [],
|
||||
maxCount: STORAGE_LIMITS.tagCount,
|
||||
},
|
||||
'tags.$': {
|
||||
type: String,
|
||||
max: STORAGE_LIMITS.tagLength,
|
||||
},
|
||||
// Duplicate the ResourceSchema here so we can extend it elegantly.
|
||||
resources: {
|
||||
type: Object,
|
||||
@@ -75,6 +66,7 @@ let ActionSchema = new SimpleSchema({
|
||||
'resources.itemsConsumed.$.tag': {
|
||||
type: String,
|
||||
optional: true,
|
||||
max: STORAGE_LIMITS.tagLength,
|
||||
},
|
||||
'resources.itemsConsumed.$.quantity': {
|
||||
type: Number,
|
||||
@@ -83,6 +75,7 @@ let ActionSchema = new SimpleSchema({
|
||||
'resources.itemsConsumed.$.itemId': {
|
||||
type: String,
|
||||
optional: true,
|
||||
max: STORAGE_LIMITS.name,
|
||||
},
|
||||
'resources.attributesConsumed': {
|
||||
type: Array,
|
||||
@@ -102,6 +95,7 @@ let ActionSchema = new SimpleSchema({
|
||||
'resources.attributesConsumed.$.variableName': {
|
||||
type: String,
|
||||
optional: true,
|
||||
max: STORAGE_LIMITS.variableName,
|
||||
},
|
||||
'resources.attributesConsumed.$.quantity': {
|
||||
type: Number,
|
||||
@@ -175,6 +169,7 @@ const ComputedOnlyActionSchema = new SimpleSchema({
|
||||
'resources.itemsConsumed.$.itemIcon': {
|
||||
type: storedIconsSchema,
|
||||
optional: true,
|
||||
max: STORAGE_LIMITS.icon,
|
||||
},
|
||||
'resources.itemsConsumed.$.itemColor': {
|
||||
type: String,
|
||||
|
||||
@@ -1,5 +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';
|
||||
|
||||
const AdjustmentSchema = new SimpleSchema({
|
||||
// The roll that determines how much to change the attribute
|
||||
@@ -8,6 +9,7 @@ const AdjustmentSchema = new SimpleSchema({
|
||||
type: String,
|
||||
optional: true,
|
||||
defaultValue: '1',
|
||||
max: STORAGE_LIMITS.calculation,
|
||||
},
|
||||
// Who this adjustment applies to
|
||||
target: {
|
||||
@@ -23,6 +25,7 @@ const AdjustmentSchema = new SimpleSchema({
|
||||
stat: {
|
||||
type: String,
|
||||
optional: true,
|
||||
max: STORAGE_LIMITS.variableName,
|
||||
},
|
||||
operation: {
|
||||
type: String,
|
||||
@@ -39,6 +42,7 @@ const ComputedOnlyAdjustmentSchema = new SimpleSchema({
|
||||
amountErrors: {
|
||||
type: Array,
|
||||
optional: true,
|
||||
maxCount: STORAGE_LIMITS.errorCount,
|
||||
},
|
||||
'amountErrors.$':{
|
||||
type: ErrorSchema,
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import SimpleSchema from 'simpl-schema';
|
||||
import { ActionSchema, ComputedOnlyActionSchema } from '/imports/api/properties/Actions.js';
|
||||
import ErrorSchema from '/imports/api/properties/subSchemas/ErrorSchema.js';
|
||||
import STORAGE_LIMITS from '/imports/constants/STORAGE_LIMITS.js';
|
||||
|
||||
// Attacks are special instances of actions
|
||||
let AttackSchema = new SimpleSchema()
|
||||
@@ -11,18 +12,22 @@ let AttackSchema = new SimpleSchema()
|
||||
type: String,
|
||||
defaultValue: 'strength.modifier + proficiencyBonus',
|
||||
optional: true,
|
||||
max: STORAGE_LIMITS.calculation,
|
||||
},
|
||||
// Set better defaults for the action
|
||||
actionType: {
|
||||
type: String,
|
||||
defaultValue: 'attack',
|
||||
max: STORAGE_LIMITS.name,
|
||||
},
|
||||
tags: {
|
||||
type: Array,
|
||||
defaultValue: ['attack'],
|
||||
maxCount: STORAGE_LIMITS.tagCount,
|
||||
},
|
||||
'tags.$': {
|
||||
type: String,
|
||||
max: STORAGE_LIMITS.tagLength,
|
||||
},
|
||||
});
|
||||
|
||||
@@ -36,6 +41,7 @@ const ComputedOnlyAttackSchema = new SimpleSchema()
|
||||
rollBonusErrors: {
|
||||
type: Array,
|
||||
optional: true,
|
||||
maxCount: STORAGE_LIMITS.errorCount,
|
||||
},
|
||||
'rollBonusErrors.$':{
|
||||
type: ErrorSchema,
|
||||
|
||||
@@ -2,6 +2,7 @@ import SimpleSchema from 'simpl-schema';
|
||||
import ErrorSchema from '/imports/api/properties/subSchemas/ErrorSchema.js';
|
||||
import VARIABLE_NAME_REGEX from '/imports/constants/VARIABLE_NAME_REGEX.js';
|
||||
import InlineComputationSchema from '/imports/api/properties/subSchemas/InlineComputationSchema.js';
|
||||
import STORAGE_LIMITS from '/imports/constants/STORAGE_LIMITS.js';
|
||||
|
||||
/*
|
||||
* Attributes are numbered stats of a character
|
||||
@@ -10,6 +11,7 @@ let AttributeSchema = new SimpleSchema({
|
||||
name: {
|
||||
type: String,
|
||||
defaultValue: 'New Attribute',
|
||||
max: STORAGE_LIMITS.name,
|
||||
},
|
||||
// The technical, lowercase, single-word name used in formulae
|
||||
variableName: {
|
||||
@@ -17,6 +19,7 @@ let AttributeSchema = new SimpleSchema({
|
||||
regEx: VARIABLE_NAME_REGEX,
|
||||
min: 2,
|
||||
defaultValue: 'newAttribute',
|
||||
max: STORAGE_LIMITS.variableName,
|
||||
},
|
||||
// How it is displayed and computed is determined by type
|
||||
attributeType: {
|
||||
@@ -45,16 +48,19 @@ let AttributeSchema = new SimpleSchema({
|
||||
spellSlotLevelCalculation: {
|
||||
type: String,
|
||||
optional: true,
|
||||
max: STORAGE_LIMITS.calculation,
|
||||
},
|
||||
// The starting value, before effects
|
||||
baseValueCalculation: {
|
||||
type: String,
|
||||
optional: true,
|
||||
max: STORAGE_LIMITS.calculation,
|
||||
},
|
||||
// Description of what the attribute is used for
|
||||
description: {
|
||||
type: String,
|
||||
optional: true,
|
||||
max: STORAGE_LIMITS.description,
|
||||
},
|
||||
// The damage done to the attribute, always positive
|
||||
damage: {
|
||||
@@ -79,7 +85,7 @@ let ComputedOnlyAttributeSchema = new SimpleSchema({
|
||||
descriptionCalculations: {
|
||||
type: Array,
|
||||
defaultValue: [],
|
||||
maxCount: 32,
|
||||
maxCount: STORAGE_LIMITS.inlineCalculationCount,
|
||||
},
|
||||
'descriptionCalculations.$': InlineComputationSchema,
|
||||
// The result of baseValueCalculation
|
||||
@@ -93,6 +99,7 @@ let ComputedOnlyAttributeSchema = new SimpleSchema({
|
||||
},
|
||||
'baseValueErrors.$': {
|
||||
type: ErrorSchema,
|
||||
maxCount: STORAGE_LIMITS.errorCount,
|
||||
},
|
||||
// The result of spellSlotLevelCalculation
|
||||
spellSlotLevelValue: {
|
||||
@@ -102,6 +109,7 @@ let ComputedOnlyAttributeSchema = new SimpleSchema({
|
||||
spellSlotLevelErrors: {
|
||||
type: Array,
|
||||
optional: true,
|
||||
maxCount: STORAGE_LIMITS.errorCount,
|
||||
},
|
||||
'spellSlotLevelErrors.$': {
|
||||
type: ErrorSchema,
|
||||
|
||||
@@ -1,18 +1,22 @@
|
||||
import SimpleSchema from 'simpl-schema';
|
||||
import InlineComputationSchema from '/imports/api/properties/subSchemas/InlineComputationSchema.js';
|
||||
import STORAGE_LIMITS from '/imports/constants/STORAGE_LIMITS.js';
|
||||
|
||||
let BuffSchema = new SimpleSchema({
|
||||
name: {
|
||||
type: String,
|
||||
optional: true,
|
||||
max: STORAGE_LIMITS.name,
|
||||
},
|
||||
description: {
|
||||
type: String,
|
||||
optional: true,
|
||||
max: STORAGE_LIMITS.description,
|
||||
},
|
||||
duration: {
|
||||
type: String,
|
||||
optional: true,
|
||||
max: STORAGE_LIMITS.name,
|
||||
},
|
||||
applied: {
|
||||
type: Boolean,
|
||||
@@ -34,7 +38,7 @@ let ComputedOnlyBuffSchema = new SimpleSchema({
|
||||
descriptionCalculations: {
|
||||
type: Array,
|
||||
defaultValue: [],
|
||||
maxCount: 32,
|
||||
maxCount: STORAGE_LIMITS.inlineCalculationCount,
|
||||
},
|
||||
'descriptionCalculations.$': InlineComputationSchema,
|
||||
durationSpent: {
|
||||
@@ -48,6 +52,7 @@ let ComputedOnlyBuffSchema = new SimpleSchema({
|
||||
},
|
||||
'appliedBy.name': {
|
||||
type: String,
|
||||
max: STORAGE_LIMITS.name,
|
||||
},
|
||||
'appliedBy.id': {
|
||||
type: String,
|
||||
@@ -55,6 +60,7 @@ let ComputedOnlyBuffSchema = new SimpleSchema({
|
||||
},
|
||||
'appliedBy.collection': {
|
||||
type: String,
|
||||
max: STORAGE_LIMITS.collectionName,
|
||||
},
|
||||
})
|
||||
|
||||
|
||||
@@ -1,21 +1,25 @@
|
||||
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';
|
||||
|
||||
let ClassLevelSchema = new SimpleSchema({
|
||||
name: {
|
||||
type: String,
|
||||
optional: true,
|
||||
max: STORAGE_LIMITS.name,
|
||||
},
|
||||
// Only used by slot filling dialog, not computed
|
||||
description: {
|
||||
type: String,
|
||||
optional: true,
|
||||
max: STORAGE_LIMITS.description,
|
||||
},
|
||||
// The name of this class level's variable
|
||||
variableName: {
|
||||
type: String,
|
||||
min: 2,
|
||||
regEx: VARIABLE_NAME_REGEX,
|
||||
max: STORAGE_LIMITS.variableName,
|
||||
},
|
||||
level: {
|
||||
type: SimpleSchema.Integer,
|
||||
@@ -32,6 +36,7 @@ let ClassLevelSchema = new SimpleSchema({
|
||||
slotFillerCondition: {
|
||||
type: String,
|
||||
optional: true,
|
||||
max: STORAGE_LIMITS.calculation,
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
@@ -8,6 +8,8 @@ import {
|
||||
} from '/imports/parser/parser.js';
|
||||
import AccessorNode from '/imports/parser/parseTree/AccessorNode.js';
|
||||
import SymbolNode from '/imports/parser/parseTree/SymbolNode.js';
|
||||
import STORAGE_LIMITS from '/imports/constants/STORAGE_LIMITS.js';
|
||||
|
||||
/*
|
||||
* Constants are primitive values that can be used elsewhere in computations
|
||||
*/
|
||||
@@ -15,6 +17,7 @@ let ConstantSchema = new SimpleSchema({
|
||||
name: {
|
||||
type: String,
|
||||
optional: true,
|
||||
max: STORAGE_LIMITS.name,
|
||||
},
|
||||
// The technical, lowercase, single-word name used in formulae
|
||||
variableName: {
|
||||
@@ -22,15 +25,18 @@ let ConstantSchema = new SimpleSchema({
|
||||
regEx: VARIABLE_NAME_REGEX,
|
||||
min: 2,
|
||||
defaultValue: 'newConstant',
|
||||
max: STORAGE_LIMITS.variableName,
|
||||
},
|
||||
// The input value to be parsed, must return a constant node or an array
|
||||
// of constant nodes to be valid
|
||||
calculation: {
|
||||
type: String,
|
||||
optional: true,
|
||||
max: STORAGE_LIMITS.calculation,
|
||||
},
|
||||
errors: {
|
||||
type: Array,
|
||||
maxCount: STORAGE_LIMITS.errorCount,
|
||||
autoValue(){
|
||||
let calc = this.field('calculation');
|
||||
if (!calc.isSet && this.isModifier) {
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
import SimpleSchema from 'simpl-schema';
|
||||
import InlineComputationSchema from '/imports/api/properties/subSchemas/InlineComputationSchema.js';
|
||||
import STORAGE_LIMITS from '/imports/constants/STORAGE_LIMITS.js';
|
||||
|
||||
let ContainerSchema = new SimpleSchema({
|
||||
name: {
|
||||
type: String,
|
||||
optional: true,
|
||||
trim: false
|
||||
trim: false,
|
||||
max: STORAGE_LIMITS.name,
|
||||
},
|
||||
carried: {
|
||||
type: Boolean,
|
||||
@@ -29,7 +31,8 @@ let ContainerSchema = new SimpleSchema({
|
||||
description: {
|
||||
type: String,
|
||||
optional: true,
|
||||
trim: false
|
||||
trim: false,
|
||||
max: STORAGE_LIMITS.description,
|
||||
},
|
||||
});
|
||||
|
||||
@@ -37,7 +40,7 @@ const ComputedOnlyContainerSchema = new SimpleSchema({
|
||||
descriptionCalculations: {
|
||||
type: Array,
|
||||
defaultValue: [],
|
||||
maxCount: 32,
|
||||
maxCount: STORAGE_LIMITS.inlineCalculationCount,
|
||||
},
|
||||
'descriptionCalculations.$': InlineComputationSchema,
|
||||
// Weight of all the contents, zero if `contentsWeightless` is true
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import SimpleSchema from 'simpl-schema';
|
||||
import DAMAGE_TYPES from '/imports/constants/DAMAGE_TYPES.js';
|
||||
import STORAGE_LIMITS from '/imports/constants/STORAGE_LIMITS.js';
|
||||
|
||||
/*
|
||||
* DamageMultipliers are multipliers that affect how much damage is taken from
|
||||
@@ -9,10 +10,12 @@ let DamageMultiplierSchema = new SimpleSchema({
|
||||
name: {
|
||||
type: String,
|
||||
optional: true,
|
||||
max: STORAGE_LIMITS.name,
|
||||
},
|
||||
damageTypes: {
|
||||
type: Array,
|
||||
defaultValue: [],
|
||||
maxCount: STORAGE_LIMITS.damageTypeCount,
|
||||
},
|
||||
// The technical, lowercase, single-word name used in formulae
|
||||
'damageTypes.$': {
|
||||
@@ -29,17 +32,21 @@ let DamageMultiplierSchema = new SimpleSchema({
|
||||
excludeTags: {
|
||||
type: Array,
|
||||
defaultValue: [],
|
||||
maxCount: STORAGE_LIMITS.tagCount,
|
||||
},
|
||||
'excludeTags.$': {
|
||||
type: String,
|
||||
max: STORAGE_LIMITS.tagLength,
|
||||
},
|
||||
// Tags which must be present to be affected by this multiplier (AND)
|
||||
includeTags: {
|
||||
type: Array,
|
||||
defaultValue: [],
|
||||
maxCount: STORAGE_LIMITS.tagCount,
|
||||
},
|
||||
'includeTags.$': {
|
||||
type: String,
|
||||
max: STORAGE_LIMITS.tagLength,
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import SimpleSchema from 'simpl-schema';
|
||||
import DAMAGE_TYPES from '/imports/constants/DAMAGE_TYPES.js';
|
||||
import ErrorSchema from '/imports/api/properties/subSchemas/ErrorSchema.js';
|
||||
import STORAGE_LIMITS from '/imports/constants/STORAGE_LIMITS.js';
|
||||
|
||||
const DamageSchema = new SimpleSchema({
|
||||
// The roll that determines how much to damage the attribute
|
||||
@@ -9,6 +10,7 @@ const DamageSchema = new SimpleSchema({
|
||||
type: String,
|
||||
optional: true,
|
||||
defaultValue: '1d8 + strength.modifier',
|
||||
max: STORAGE_LIMITS.calculation,
|
||||
},
|
||||
// Who this damage applies to
|
||||
target: {
|
||||
@@ -35,6 +37,7 @@ const ComputedOnlyDamageSchema = new SimpleSchema({
|
||||
amountErrors: {
|
||||
type: Array,
|
||||
optional: true,
|
||||
maxCount: STORAGE_LIMITS.errorCount,
|
||||
},
|
||||
'amountErrors.$':{
|
||||
type: ErrorSchema,
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
import SimpleSchema from 'simpl-schema';
|
||||
import ErrorSchema from '/imports/api/properties/subSchemas/ErrorSchema.js';
|
||||
import STORAGE_LIMITS from '/imports/constants/STORAGE_LIMITS.js';
|
||||
|
||||
/*
|
||||
* Effects are reason-value attached to skills and abilities
|
||||
* that modify their final value or presentation in some way
|
||||
@@ -8,6 +10,7 @@ let EffectSchema = new SimpleSchema({
|
||||
name: {
|
||||
type: String,
|
||||
optional: true,
|
||||
max: STORAGE_LIMITS.name,
|
||||
},
|
||||
operation: {
|
||||
type: String,
|
||||
@@ -30,14 +33,17 @@ let EffectSchema = new SimpleSchema({
|
||||
calculation: {
|
||||
type: String,
|
||||
optional: true,
|
||||
max: STORAGE_LIMITS.calculation,
|
||||
},
|
||||
//which stats the effect is applied to
|
||||
stats: {
|
||||
type: Array,
|
||||
defaultValue: [],
|
||||
maxCount: STORAGE_LIMITS.statsToTarget,
|
||||
},
|
||||
'stats.$': {
|
||||
type: String,
|
||||
max: STORAGE_LIMITS.variableName,
|
||||
},
|
||||
});
|
||||
|
||||
@@ -51,6 +57,7 @@ const ComputedOnlyEffectSchema = new SimpleSchema({
|
||||
errors: {
|
||||
type: Array,
|
||||
optional: true,
|
||||
maxCount: STORAGE_LIMITS.errorCount,
|
||||
},
|
||||
'errors.$':{
|
||||
type: ErrorSchema,
|
||||
|
||||
@@ -1,17 +1,21 @@
|
||||
import SimpleSchema from 'simpl-schema';
|
||||
import InlineComputationSchema from '/imports/api/properties/subSchemas/InlineComputationSchema.js';
|
||||
import STORAGE_LIMITS from '/imports/constants/STORAGE_LIMITS.js';
|
||||
|
||||
let FeatureSchema = new SimpleSchema({
|
||||
name: {
|
||||
type: String,
|
||||
max: STORAGE_LIMITS.name,
|
||||
},
|
||||
summary: {
|
||||
type: String,
|
||||
optional: true,
|
||||
max: STORAGE_LIMITS.summary,
|
||||
},
|
||||
description: {
|
||||
type: String,
|
||||
optional: true,
|
||||
max: STORAGE_LIMITS.description,
|
||||
},
|
||||
});
|
||||
|
||||
@@ -20,14 +24,14 @@ let ComputedOnlyFeatureSchema = new SimpleSchema({
|
||||
summaryCalculations: {
|
||||
type: Array,
|
||||
defaultValue: [],
|
||||
maxCount: 32,
|
||||
maxCount: STORAGE_LIMITS.inlineCalculationCount,
|
||||
},
|
||||
'summaryCalculations.$': InlineComputationSchema,
|
||||
|
||||
descriptionCalculations: {
|
||||
type: Array,
|
||||
defaultValue: [],
|
||||
maxCount: 32,
|
||||
maxCount: STORAGE_LIMITS.inlineCalculationCount,
|
||||
},
|
||||
'descriptionCalculations.$': InlineComputationSchema,
|
||||
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
import SimpleSchema from 'simpl-schema';
|
||||
import STORAGE_LIMITS from '/imports/constants/STORAGE_LIMITS.js';
|
||||
|
||||
// Folders organize a character sheet into a tree, particularly to group things
|
||||
// like 'race' and 'background'
|
||||
let FolderSchema = new SimpleSchema({
|
||||
name: {
|
||||
type: String,
|
||||
max: STORAGE_LIMITS.name,
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
@@ -1,19 +1,23 @@
|
||||
import SimpleSchema from 'simpl-schema';
|
||||
import InlineComputationSchema from '/imports/api/properties/subSchemas/InlineComputationSchema.js';
|
||||
import STORAGE_LIMITS from '/imports/constants/STORAGE_LIMITS.js';
|
||||
|
||||
const ItemSchema = new SimpleSchema({
|
||||
name: {
|
||||
type: String,
|
||||
optional: true,
|
||||
max: STORAGE_LIMITS.name,
|
||||
},
|
||||
// Plural name of the item, if there is more than one
|
||||
plural: {
|
||||
type: String,
|
||||
optional: true,
|
||||
max: STORAGE_LIMITS.name,
|
||||
},
|
||||
description: {
|
||||
type: String,
|
||||
optional: true,
|
||||
max: STORAGE_LIMITS.description,
|
||||
},
|
||||
// Number currently held
|
||||
quantity: {
|
||||
@@ -58,7 +62,7 @@ let ComputedOnlyItemSchema = new SimpleSchema({
|
||||
descriptionCalculations: {
|
||||
type: Array,
|
||||
defaultValue: [],
|
||||
maxCount: 32,
|
||||
maxCount: STORAGE_LIMITS.inlineCalculationCount,
|
||||
},
|
||||
'descriptionCalculations.$': InlineComputationSchema,
|
||||
});
|
||||
|
||||
@@ -1,18 +1,22 @@
|
||||
import SimpleSchema from 'simpl-schema';
|
||||
import InlineComputationSchema from '/imports/api/properties/subSchemas/InlineComputationSchema.js';
|
||||
import STORAGE_LIMITS from '/imports/constants/STORAGE_LIMITS.js';
|
||||
|
||||
let NoteSchema = new SimpleSchema({
|
||||
name: {
|
||||
type: String,
|
||||
optional: true,
|
||||
max: STORAGE_LIMITS.name,
|
||||
},
|
||||
summary: {
|
||||
type: String,
|
||||
optional: true,
|
||||
max: STORAGE_LIMITS.summary,
|
||||
},
|
||||
description: {
|
||||
type: String,
|
||||
optional: true,
|
||||
max: STORAGE_LIMITS.description,
|
||||
},
|
||||
});
|
||||
|
||||
@@ -21,14 +25,14 @@ let ComputedOnlyNoteSchema = new SimpleSchema({
|
||||
summaryCalculations: {
|
||||
type: Array,
|
||||
defaultValue: [],
|
||||
maxCount: 32,
|
||||
maxCount: STORAGE_LIMITS.inlineCalculationCount,
|
||||
},
|
||||
'summaryCalculations.$': InlineComputationSchema,
|
||||
|
||||
descriptionCalculations: {
|
||||
type: Array,
|
||||
defaultValue: [],
|
||||
maxCount: 32,
|
||||
maxCount: STORAGE_LIMITS.inlineCalculationCount,
|
||||
},
|
||||
'descriptionCalculations.$': InlineComputationSchema,
|
||||
|
||||
|
||||
@@ -1,17 +1,21 @@
|
||||
import SimpleSchema from 'simpl-schema';
|
||||
import STORAGE_LIMITS from '/imports/constants/STORAGE_LIMITS.js';
|
||||
|
||||
let ProficiencySchema = new SimpleSchema({
|
||||
name: {
|
||||
type: String,
|
||||
optional: true,
|
||||
max: STORAGE_LIMITS.name,
|
||||
},
|
||||
// The variableNames of the skills, tags, or attributes to apply proficiency to
|
||||
stats: {
|
||||
type: Array,
|
||||
defaultValue: [],
|
||||
maxCount: STORAGE_LIMITS.statsToTarget,
|
||||
},
|
||||
'stats.$': {
|
||||
type: String,
|
||||
max: STORAGE_LIMITS.variableName,
|
||||
},
|
||||
// A number representing how proficient the character is
|
||||
// where 0.49 is half rounded down and 0.5 is half rounded up
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import SimpleSchema from 'simpl-schema';
|
||||
import STORAGE_LIMITS from '/imports/constants/STORAGE_LIMITS.js';
|
||||
|
||||
let ReferenceSchema = new SimpleSchema({
|
||||
ref: {
|
||||
@@ -13,6 +14,7 @@ let ReferenceSchema = new SimpleSchema({
|
||||
'ref.collection': {
|
||||
type: String,
|
||||
optional: true,
|
||||
max: STORAGE_LIMITS.collectionName,
|
||||
},
|
||||
// Denormalised store of referenced property's details
|
||||
cache: {
|
||||
@@ -22,6 +24,7 @@ let ReferenceSchema = new SimpleSchema({
|
||||
'cache.error': {
|
||||
type: String,
|
||||
optional: true,
|
||||
max: STORAGE_LIMITS.errorMessage,
|
||||
},
|
||||
'cache.node': {
|
||||
type: Object,
|
||||
@@ -30,9 +33,11 @@ let ReferenceSchema = new SimpleSchema({
|
||||
'cache.node.name': {
|
||||
type: String,
|
||||
optional: true,
|
||||
max: STORAGE_LIMITS.name,
|
||||
},
|
||||
'cache.node.type': {
|
||||
type: String,
|
||||
max: STORAGE_LIMITS.variableName,
|
||||
},
|
||||
'cache.node.level': {
|
||||
type: Number,
|
||||
@@ -49,6 +54,7 @@ let ReferenceSchema = new SimpleSchema({
|
||||
'cache.library.name': {
|
||||
type: String,
|
||||
optional: true,
|
||||
max: STORAGE_LIMITS.name,
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import SimpleSchema from 'simpl-schema';
|
||||
import ErrorSchema from '/imports/api/properties/subSchemas/ErrorSchema.js';
|
||||
import VARIABLE_NAME_REGEX from '/imports/constants/VARIABLE_NAME_REGEX.js';
|
||||
import STORAGE_LIMITS from '/imports/constants/STORAGE_LIMITS.js';
|
||||
|
||||
/**
|
||||
* Rolls are children to actions or other rolls, they are triggered with 0 or
|
||||
@@ -24,6 +25,7 @@ let RollSchema = new SimpleSchema({
|
||||
name: {
|
||||
type: String,
|
||||
defaultValue: 'New Roll',
|
||||
max: STORAGE_LIMITS.name,
|
||||
},
|
||||
// The technical, lowercase, single-word name used in formulae
|
||||
variableName: {
|
||||
@@ -31,20 +33,13 @@ let RollSchema = new SimpleSchema({
|
||||
regEx: VARIABLE_NAME_REGEX,
|
||||
min: 2,
|
||||
defaultValue: 'newRoll',
|
||||
max: STORAGE_LIMITS.variableName,
|
||||
},
|
||||
// The roll, can be simplified, but only computed in context
|
||||
roll: {
|
||||
type: String,
|
||||
optional: true,
|
||||
},
|
||||
// Effects can apply to this tag specifically
|
||||
// Ranged spell attack, Ranged weapon attack, etc.
|
||||
tags: {
|
||||
type: Array,
|
||||
defaultValue: [],
|
||||
},
|
||||
'tags.$': {
|
||||
type: String,
|
||||
max: STORAGE_LIMITS.calculation,
|
||||
},
|
||||
});
|
||||
|
||||
@@ -56,6 +51,7 @@ let ComputedOnlyRollSchema = new SimpleSchema({
|
||||
rollErrors: {
|
||||
type: Array,
|
||||
optional: true,
|
||||
maxCount: STORAGE_LIMITS.errorCount,
|
||||
},
|
||||
'rollErrors.$':{
|
||||
type: ErrorSchema,
|
||||
|
||||
@@ -1,5 +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';
|
||||
|
||||
// These are the rolls made when saves are called for
|
||||
// For the saving throw bonus or proficiency, see ./Skills.js
|
||||
@@ -7,11 +8,13 @@ let SavingThrowSchema = new SimpleSchema ({
|
||||
name: {
|
||||
type: String,
|
||||
optional: true,
|
||||
max: STORAGE_LIMITS.name,
|
||||
},
|
||||
// The computed DC
|
||||
dc: {
|
||||
type: String,
|
||||
optional: true,
|
||||
max: STORAGE_LIMITS.calculation,
|
||||
},
|
||||
// Who this saving throw applies to
|
||||
target: {
|
||||
@@ -27,6 +30,7 @@ let SavingThrowSchema = new SimpleSchema ({
|
||||
stat: {
|
||||
type: String,
|
||||
optional: true,
|
||||
max: STORAGE_LIMITS.variableName,
|
||||
},
|
||||
});
|
||||
|
||||
@@ -38,6 +42,7 @@ const ComputedOnlySavingThrowSchema = new SimpleSchema({
|
||||
dcErrors: {
|
||||
type: Array,
|
||||
optional: true,
|
||||
maxCount: STORAGE_LIMITS.errorCount,
|
||||
},
|
||||
'dcErrors.$':{
|
||||
type: ErrorSchema,
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
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 STORAGE_LIMITS from '/imports/constants/STORAGE_LIMITS.js';
|
||||
|
||||
/*
|
||||
* Skills are anything that results in a modifier to be added to a D20
|
||||
@@ -10,6 +11,7 @@ let SkillSchema = new SimpleSchema({
|
||||
name: {
|
||||
type: String,
|
||||
optional: true,
|
||||
max: STORAGE_LIMITS.name,
|
||||
},
|
||||
// The technical, lowercase, single-word name used in formulae
|
||||
// Ignored for skilltype = save
|
||||
@@ -17,11 +19,13 @@ let SkillSchema = new SimpleSchema({
|
||||
type: String,
|
||||
regEx: VARIABLE_NAME_REGEX,
|
||||
min: 2,
|
||||
max: STORAGE_LIMITS.variableName,
|
||||
},
|
||||
// The variable name of the ability this skill relies on
|
||||
ability: {
|
||||
type: String,
|
||||
optional: true,
|
||||
max: STORAGE_LIMITS.variableName,
|
||||
},
|
||||
// What type of skill is this
|
||||
skillType: {
|
||||
@@ -42,6 +46,7 @@ let SkillSchema = new SimpleSchema({
|
||||
baseValueCalculation: {
|
||||
type: String,
|
||||
optional: true,
|
||||
max: STORAGE_LIMITS.calculation,
|
||||
},
|
||||
// The base proficiency of this skill
|
||||
baseProficiency: {
|
||||
@@ -52,6 +57,7 @@ let SkillSchema = new SimpleSchema({
|
||||
description: {
|
||||
type: String,
|
||||
optional: true,
|
||||
max: STORAGE_LIMITS.description,
|
||||
},
|
||||
});
|
||||
|
||||
@@ -69,6 +75,7 @@ let ComputedOnlySkillSchema = new SimpleSchema({
|
||||
baseValueErrors: {
|
||||
type: Array,
|
||||
optional: true,
|
||||
maxCount: STORAGE_LIMITS.errorCount,
|
||||
},
|
||||
'baseValueErrors.$': {
|
||||
type: ErrorSchema,
|
||||
@@ -107,6 +114,7 @@ let ComputedOnlySkillSchema = new SimpleSchema({
|
||||
rollBonuses: {
|
||||
type: Array,
|
||||
optional: true,
|
||||
maxCount: STORAGE_LIMITS.rollBonusCount,
|
||||
},
|
||||
'rollBonuses.$': {
|
||||
type: String,
|
||||
|
||||
@@ -1,25 +1,29 @@
|
||||
import SimpleSchema from 'simpl-schema';
|
||||
import STORAGE_LIMITS from '/imports/constants/STORAGE_LIMITS.js';
|
||||
|
||||
// SlotFiller fillers specifically fill a slot with a bit more control than
|
||||
// other properties
|
||||
|
||||
import SimpleSchema from 'simpl-schema';
|
||||
|
||||
let SlotFillerSchema = new SimpleSchema({
|
||||
name: {
|
||||
type: String,
|
||||
optional: true,
|
||||
max: STORAGE_LIMITS.name,
|
||||
},
|
||||
picture: {
|
||||
type: String,
|
||||
optional: true,
|
||||
max: STORAGE_LIMITS.url,
|
||||
},
|
||||
description: {
|
||||
type: String,
|
||||
optional: true,
|
||||
max: STORAGE_LIMITS.description,
|
||||
},
|
||||
// Overrides the type when searching for properties
|
||||
slotFillerType: {
|
||||
type: String,
|
||||
optional: true,
|
||||
max: STORAGE_LIMITS.variableName,
|
||||
},
|
||||
// Fill more than one quantity in a slot, like feats and ability score
|
||||
// improvements, filtered out of UI if there isn't space in quantityExpected
|
||||
@@ -32,6 +36,7 @@ let SlotFillerSchema = new SimpleSchema({
|
||||
slotFillerCondition: {
|
||||
type: String,
|
||||
optional: true,
|
||||
max: STORAGE_LIMITS.calculation,
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
@@ -1,30 +1,36 @@
|
||||
import SimpleSchema from 'simpl-schema';
|
||||
import ErrorSchema from '/imports/api/properties/subSchemas/ErrorSchema.js';
|
||||
import STORAGE_LIMITS from '/imports/constants/STORAGE_LIMITS.js';
|
||||
|
||||
let SlotSchema = new SimpleSchema({
|
||||
name: {
|
||||
type: String,
|
||||
optional: true,
|
||||
max: STORAGE_LIMITS.name,
|
||||
},
|
||||
description: {
|
||||
type: String,
|
||||
optional: true,
|
||||
max: STORAGE_LIMITS.description,
|
||||
},
|
||||
slotType: {
|
||||
type: String,
|
||||
optional: true,
|
||||
max: STORAGE_LIMITS.variableName,
|
||||
},
|
||||
slotTags: {
|
||||
type: Array,
|
||||
defaultValue: [],
|
||||
maxCount: STORAGE_LIMITS.tagCount,
|
||||
},
|
||||
'slotTags.$': {
|
||||
type: String,
|
||||
max: STORAGE_LIMITS.tagLength,
|
||||
},
|
||||
extraTags: {
|
||||
type: Array,
|
||||
defaultValue: [],
|
||||
maxCount: 5,
|
||||
maxCount: STORAGE_LIMITS.extraTagsCount,
|
||||
},
|
||||
'extraTags.$': {
|
||||
type: Object,
|
||||
@@ -39,17 +45,22 @@ let SlotSchema = new SimpleSchema({
|
||||
'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,
|
||||
},
|
||||
quantityExpected: {
|
||||
type: String,
|
||||
optional: true,
|
||||
defaultValue: '1',
|
||||
max: STORAGE_LIMITS.calculation,
|
||||
},
|
||||
ignored: {
|
||||
type: Boolean,
|
||||
@@ -58,6 +69,7 @@ let SlotSchema = new SimpleSchema({
|
||||
slotCondition: {
|
||||
type: String,
|
||||
optional: true,
|
||||
max: STORAGE_LIMITS.calculation,
|
||||
},
|
||||
hideWhenFull: {
|
||||
type: Boolean,
|
||||
@@ -86,6 +98,7 @@ const ComputedOnlySlotSchema = new SimpleSchema({
|
||||
slotConditionErrors: {
|
||||
type: Array,
|
||||
optional: true,
|
||||
maxCount: STORAGE_LIMITS.errorCount,
|
||||
},
|
||||
'slotConditionErrors.$':{
|
||||
type: ErrorSchema,
|
||||
@@ -99,6 +112,7 @@ const ComputedOnlySlotSchema = new SimpleSchema({
|
||||
quantityExpectedErrors: {
|
||||
type: Array,
|
||||
optional: true,
|
||||
maxCount: STORAGE_LIMITS.errorCount,
|
||||
},
|
||||
'quantityExpectedErrors.$':{
|
||||
type: ErrorSchema,
|
||||
|
||||
@@ -1,30 +1,36 @@
|
||||
import SimpleSchema from 'simpl-schema';
|
||||
import ErrorSchema from '/imports/api/properties/subSchemas/ErrorSchema.js';
|
||||
import InlineComputationSchema from '/imports/api/properties/subSchemas/InlineComputationSchema.js';
|
||||
import STORAGE_LIMITS from '/imports/constants/STORAGE_LIMITS.js';
|
||||
|
||||
let SpellListSchema = new SimpleSchema({
|
||||
name: {
|
||||
type: String,
|
||||
optional: true,
|
||||
max: STORAGE_LIMITS.name,
|
||||
},
|
||||
description: {
|
||||
type: String,
|
||||
optional: true,
|
||||
max: STORAGE_LIMITS.description,
|
||||
},
|
||||
// Calculation of how many spells in this list can be prepared
|
||||
maxPrepared: {
|
||||
type: String,
|
||||
optional: true,
|
||||
max: STORAGE_LIMITS.calculation,
|
||||
},
|
||||
// Calculation of The attack roll bonus used by spell attacks in this list
|
||||
attackRollBonus: {
|
||||
type: String,
|
||||
optional: true,
|
||||
max: STORAGE_LIMITS.calculation,
|
||||
},
|
||||
// Calculation of the save dc used by spells in this list
|
||||
dc: {
|
||||
type: String,
|
||||
optional: true,
|
||||
max: STORAGE_LIMITS.calculation,
|
||||
},
|
||||
});
|
||||
|
||||
@@ -32,7 +38,7 @@ const ComputedOnlySpellListSchema = new SimpleSchema({
|
||||
descriptionCalculations: {
|
||||
type: Array,
|
||||
defaultValue: [],
|
||||
maxCount: 32,
|
||||
maxCount: STORAGE_LIMITS.inlineCalculationCount,
|
||||
},
|
||||
'descriptionCalculations.$': InlineComputationSchema,
|
||||
|
||||
@@ -44,6 +50,7 @@ const ComputedOnlySpellListSchema = new SimpleSchema({
|
||||
maxPreparedErrors: {
|
||||
type: Array,
|
||||
optional: true,
|
||||
maxCount: STORAGE_LIMITS.errorCount,
|
||||
},
|
||||
'maxPreparedErrors.$':{
|
||||
type: ErrorSchema,
|
||||
@@ -57,6 +64,7 @@ const ComputedOnlySpellListSchema = new SimpleSchema({
|
||||
attackRollBonusErrors: {
|
||||
type: Array,
|
||||
optional: true,
|
||||
maxCount: STORAGE_LIMITS.errorCount,
|
||||
},
|
||||
'attackRollBonusErrors.$':{
|
||||
type: ErrorSchema,
|
||||
@@ -70,6 +78,7 @@ const ComputedOnlySpellListSchema = new SimpleSchema({
|
||||
dcErrors: {
|
||||
type: Array,
|
||||
optional: true,
|
||||
maxCount: STORAGE_LIMITS.errorCount,
|
||||
},
|
||||
'dcErrors.$':{
|
||||
type: ErrorSchema,
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { ActionSchema, ComputedOnlyActionSchema } from '/imports/api/properties/Actions.js';
|
||||
import SimpleSchema from 'simpl-schema';
|
||||
import STORAGE_LIMITS from '/imports/constants/STORAGE_LIMITS.js';
|
||||
|
||||
const magicSchools = [
|
||||
'abjuration',
|
||||
@@ -18,6 +19,7 @@ let SpellSchema = new SimpleSchema({})
|
||||
name: {
|
||||
type: String,
|
||||
optional: true,
|
||||
max: STORAGE_LIMITS.name,
|
||||
},
|
||||
// If it's always prepared, it doesn't count against the number of spells
|
||||
// prepared in a spell list, and enabled should be true
|
||||
@@ -42,15 +44,18 @@ let SpellSchema = new SimpleSchema({})
|
||||
type: String,
|
||||
optional: true,
|
||||
defaultValue: 'action',
|
||||
max: STORAGE_LIMITS.name,
|
||||
},
|
||||
range: {
|
||||
type: String,
|
||||
optional: true,
|
||||
max: STORAGE_LIMITS.name,
|
||||
},
|
||||
duration: {
|
||||
type: String,
|
||||
optional: true,
|
||||
defaultValue: 'Instantaneous',
|
||||
max: STORAGE_LIMITS.name,
|
||||
},
|
||||
verbal: {
|
||||
type: Boolean,
|
||||
@@ -67,6 +72,7 @@ let SpellSchema = new SimpleSchema({})
|
||||
material: {
|
||||
type: String,
|
||||
optional: true,
|
||||
max: STORAGE_LIMITS.name,
|
||||
},
|
||||
ritual: {
|
||||
type: Boolean,
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
import SimpleSchema from 'simpl-schema';
|
||||
import ErrorSchema from '/imports/api/properties/subSchemas/ErrorSchema.js';
|
||||
import STORAGE_LIMITS from '/imports/constants/STORAGE_LIMITS.js';
|
||||
|
||||
const ToggleSchema = new SimpleSchema({
|
||||
name: {
|
||||
type: String,
|
||||
optional: true,
|
||||
max: STORAGE_LIMITS.name,
|
||||
},
|
||||
disabled: {
|
||||
type: Boolean,
|
||||
@@ -19,6 +21,7 @@ const ToggleSchema = new SimpleSchema({
|
||||
condition: {
|
||||
type: String,
|
||||
optional: true,
|
||||
max: STORAGE_LIMITS.calculation,
|
||||
},
|
||||
});
|
||||
|
||||
@@ -32,6 +35,7 @@ const ComputedOnlyToggleSchema = new SimpleSchema({
|
||||
errors: {
|
||||
type: Array,
|
||||
optional: true,
|
||||
maxCount: STORAGE_LIMITS.errorCount,
|
||||
},
|
||||
'errors.$': {
|
||||
type: ErrorSchema,
|
||||
|
||||
@@ -1,11 +1,14 @@
|
||||
import SimpleSchema from 'simpl-schema';
|
||||
import STORAGE_LIMITS from '/imports/constants/STORAGE_LIMITS.js';
|
||||
|
||||
const ErrorSchema = new SimpleSchema({
|
||||
message: {
|
||||
type: String,
|
||||
max: STORAGE_LIMITS.errorMessage,
|
||||
},
|
||||
type: {
|
||||
type: String,
|
||||
max: STORAGE_LIMITS.name,
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
@@ -1,18 +1,22 @@
|
||||
import SimpleSchema from 'simpl-schema';
|
||||
import ErrorSchema from '/imports/api/properties/subSchemas/ErrorSchema.js';
|
||||
import STORAGE_LIMITS from '/imports/constants/STORAGE_LIMITS.js';
|
||||
|
||||
const InlineComputationSchema = new SimpleSchema({
|
||||
// The part between bracers {}
|
||||
calculation: {
|
||||
type: String,
|
||||
max: STORAGE_LIMITS.calculation,
|
||||
},
|
||||
result: {
|
||||
type: String,
|
||||
optional: true,
|
||||
max: STORAGE_LIMITS.calculation,
|
||||
},
|
||||
errors: {
|
||||
type: Array,
|
||||
optional: true,
|
||||
maxCount: STORAGE_LIMITS.errorCount,
|
||||
},
|
||||
'errors.$': ErrorSchema,
|
||||
});
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import SimpleSchema from 'simpl-schema';
|
||||
import STORAGE_LIMITS from '/imports/constants/STORAGE_LIMITS.js';
|
||||
|
||||
const RollDetailsSchema = new SimpleSchema({
|
||||
number: {
|
||||
@@ -10,6 +11,7 @@ const RollDetailsSchema = new SimpleSchema({
|
||||
values: {
|
||||
type: Array,
|
||||
defaultValue: [],
|
||||
maxCount: STORAGE_LIMITS.diceRollValuesCount,
|
||||
},
|
||||
'values.$': {
|
||||
type: Number,
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import SimpleSchema from 'simpl-schema';
|
||||
import '/imports/api/sharing/sharing.js';
|
||||
import STORAGE_LIMITS from '/imports/constants/STORAGE_LIMITS.js';
|
||||
|
||||
let SharingSchema = new SimpleSchema({
|
||||
owner: {
|
||||
@@ -11,9 +12,9 @@ let SharingSchema = new SimpleSchema({
|
||||
type: Array,
|
||||
defaultValue: [],
|
||||
index: 1,
|
||||
max: 50,
|
||||
maxCount: STORAGE_LIMITS.readersCount,
|
||||
},
|
||||
"readers.$": {
|
||||
'readers.$': {
|
||||
type: String,
|
||||
regEx: SimpleSchema.RegEx.Id
|
||||
},
|
||||
@@ -21,9 +22,9 @@ let SharingSchema = new SimpleSchema({
|
||||
type: Array,
|
||||
defaultValue: [],
|
||||
index: 1,
|
||||
max: 20,
|
||||
maxCount: STORAGE_LIMITS.writersCount,
|
||||
},
|
||||
"writers.$": {
|
||||
'writers.$': {
|
||||
type: String,
|
||||
regEx: SimpleSchema.RegEx.Id
|
||||
},
|
||||
|
||||
@@ -1,14 +1,32 @@
|
||||
const STORAGE_LIMITS = Object.freeze({
|
||||
name: 140,
|
||||
// String lengths
|
||||
calculation: 256,
|
||||
collectionName: 64,
|
||||
color: 10000,
|
||||
summary: 10000,
|
||||
description: 49473, //the length of the Bee Movie script
|
||||
inlineCalculationCount: 32,
|
||||
errorMessage: 256,
|
||||
icon: 10000,
|
||||
name: 128,
|
||||
summary: 10000,
|
||||
tagLength: 128,
|
||||
url: 256,
|
||||
variableName: 64,
|
||||
|
||||
//Array counts
|
||||
ancestorCount: 100,
|
||||
damageTypeCount: 32,
|
||||
diceRollValuesCount: 100,
|
||||
errorCount: 32,
|
||||
tagCount: 64,
|
||||
tagLength: 140,
|
||||
extraTagsCount: 5,
|
||||
inlineCalculationCount: 32,
|
||||
logContentCount: 32,
|
||||
readersCount: 50,
|
||||
resourcesCount: 32,
|
||||
calculation: 280,
|
||||
rollCount: 64,
|
||||
rollBonusCount: 32,
|
||||
statsToTarget: 32,
|
||||
tagCount: 64,
|
||||
writersCount: 20,
|
||||
});
|
||||
|
||||
export default STORAGE_LIMITS;
|
||||
|
||||
@@ -2,6 +2,7 @@ import ParseNode from '/imports/parser/parseTree/ParseNode.js';
|
||||
import RollArrayNode from '/imports/parser/parseTree/RollArrayNode.js';
|
||||
import ErrorNode from '/imports/parser/parseTree/ErrorNode.js';
|
||||
import roll from '/imports/parser/roll.js';
|
||||
import STORAGE_LIMITS from '/imports/constants/STORAGE_LIMITS.js';
|
||||
|
||||
export default class RollNode extends ParseNode {
|
||||
constructor({left, right}) {
|
||||
@@ -42,9 +43,9 @@ export default class RollNode extends ParseNode {
|
||||
if (context.doubleRolls){
|
||||
number *= 2;
|
||||
}
|
||||
if (number > 100) return new ErrorNode({
|
||||
if (number > STORAGE_LIMITS.diceRollValuesCount) return new ErrorNode({
|
||||
node: this,
|
||||
error: 'Can\'t roll more than 100 dice at once',
|
||||
error: `Can't roll more than ${STORAGE_LIMITS.diceRollValuesCount} dice at once`,
|
||||
context,
|
||||
});
|
||||
let diceSize = right.value;
|
||||
|
||||
Reference in New Issue
Block a user