Compare commits

...

16 Commits

Author SHA1 Message Date
Stefan Zermatten
c4dc5895aa Relaxed rate limiting on icon search, improved error messaging 2020-06-22 00:20:40 +02:00
Stefan Zermatten
cffe0ee574 Added minimal UI to display applied buffs 2020-06-22 00:14:07 +02:00
Stefan Zermatten
ce51be7b8e moved proficiencies after actions on the stats tab 2020-06-21 23:57:19 +02:00
Stefan Zermatten
315073bd8e Refactored actions and let actions apply buffs to self 2020-06-21 23:54:51 +02:00
Stefan Zermatten
50b99ef54f Improved performance of adding library properties with many decendants 2020-06-21 23:24:07 +02:00
Stefan Zermatten
9b01f5fb45 Improved actions UI, Actions (including spells) can now have icons 2020-06-17 13:23:13 +02:00
Stefan Zermatten
389785f5db Fixed bug where library large screen view won't scroll 2020-06-17 13:22:48 +02:00
Stefan Zermatten
e1bfb173ab Overhauled action detail view 2020-06-16 13:51:58 +02:00
Stefan Zermatten
ecba587253 Fixed a bug with proficiency forms not editing proficiency correctly 2020-06-16 12:35:50 +02:00
Stefan Zermatten
3f540d0f14 Overhaul of character action components, actions now consume resources 2020-06-15 22:30:27 +02:00
Stefan Zermatten
dc18734d1f Backend work to support actions consuming their resources on use 2020-06-13 23:11:49 +02:00
Stefan Zermatten
1535e00093 Denormalized some calculations into recomputation step 2020-06-07 21:08:53 +02:00
Stefan Zermatten
5198c655e9 Added subscription rate limiting 2020-06-06 14:30:15 +02:00
Stefan Zermatten
8d41643136 Increased damage property rate limit to 4/s 2020-06-06 14:25:23 +02:00
Stefan Zermatten
ea8d036c72 Added rate limiting to all methods 2020-06-06 14:23:13 +02:00
Stefan Zermatten
93d566e263 Exposed methods and publications to http requests, changed method names 2020-06-06 12:31:07 +02:00
72 changed files with 1930 additions and 380 deletions

View File

@@ -50,3 +50,6 @@ akryum:vue-component
accounts-patreon
bozhao:link-accounts
peerlibrary:reactive-publish
simple:rest
simple:rest-method-mixin
mikowals:batch-insert

View File

@@ -72,6 +72,7 @@ meteorhacks:subs-manager@1.6.4
meteortesting:browser-tests@1.3.3
meteortesting:mocha@1.1.5
meteortesting:mocha-core@7.0.1
mikowals:batch-insert@1.1.9
minifier-css@1.5.0
minifier-js@2.6.0
minimongo@1.6.0
@@ -115,6 +116,9 @@ service-configuration@1.0.11
session@1.2.0
sha@1.0.9
shell-server@0.5.0
simple:json-routes@2.1.0
simple:rest@1.1.1
simple:rest-method-mixin@1.0.1
socket-stream-client@0.3.0
spacebars@1.0.15
spacebars-compiler@1.1.3

View File

@@ -0,0 +1,11 @@
import SimpleSchema from 'simpl-schema';
let Campaigns = new Mongo.Collection('campaigns');
let CampaignSchema = new SimpleSchema({
});
Campaigns.attachSchema(CampaignSchema);
export default Campaigns;

View File

@@ -1,9 +1,51 @@
import SimpleSchema from 'simpl-schema';
let Encounters = new Mongo.Collection("encounters");
let Encounters = new Mongo.Collection('encounters');
const CreatureInitiativeSchema = new SimpleSchema({
name: {
type: String,
optional: true,
},
initiativeRoll: {
type: SimpleSchema.Integer,
},
});
const InitiativeSchema = new SimpleSchema({
// An ordered list of all creatures in the initiative order
creatures: {
type: Array,
defaultValue: [],
},
'creatures.$': {
type: CreatureInitiativeSchema,
},
active: {
type: Boolean,
defaultValue: false,
},
roundNumber: {
type: SimpleSchema.Integer,
defaultValue: 0,
},
initiativeNumber: {
type: SimpleSchema.Integer,
optional: true,
},
});
// A creature can be in one ecounter at a time.
// All creatures in an encounter have a shared time and space.
let EncounterSchema = new SimpleSchema({
//an encounter is a single flow of time all parties in an encounter are in-sync time wise
name: {
type: String,
optional: true,
},
initiative: {
type: InitiativeSchema,
defaultValue: {},
},
});
Encounters.attachSchema(EncounterSchema);

View File

@@ -1,22 +1,21 @@
import SimpleSchema from 'simpl-schema';
let Parties = new Mongo.Collection("parties");
let Parties = new Mongo.Collection('parties');
let partySchema = new SimpleSchema({
name: {
type: String,
defaultValue: "New Party",
defaultValue: 'New Party',
trim: false,
optional: true,
},
characters: {
creatures: {
type: Array,
defaultValue: [],
},
characters: {
'creatures.$': {
type: String,
regEx: SimpleSchema.RegEx.Id,
index: 1,
},
owner: {
type: String,
@@ -26,24 +25,4 @@ let partySchema = new SimpleSchema({
Parties.attachSchema(partySchema);
Parties.allow({
insert: function(userId, doc) {
return userId && doc.owner === userId;
},
update: function(userId, doc, fields, modifier) {
return userId && doc.owner === userId;
},
remove: function(userId, doc) {
return userId && doc.owner === userId;
},
fetch: ["owner"],
});
Parties.deny({
update: function(userId, docs, fields, modifier) {
// can't change owners
return _.contains(fields, "owner");
}
});
export default Parties;

View File

@@ -1,5 +1,6 @@
import { Meteor } from 'meteor/meteor';
import { Mongo } from 'meteor/mongo';
import { RateLimiterMixin } from 'ddp-rate-limiter-mixin';
import { ValidatedMethod } from 'meteor/mdg:validated-method';
import SimpleSchema from 'simpl-schema';
import ColorSchema from '/imports/api/properties/subSchemas/ColorSchema.js';
@@ -19,6 +20,8 @@ import {
import {setDocToLastOrder} from '/imports/api/parenting/order.js';
import { storedIconsSchema } from '/imports/api/icons/Icons.js';
import '/imports/api/creature/actions/doAction.js';
let CreatureProperties = new Mongo.Collection('creatureProperties');
let CreaturePropertySchema = new SimpleSchema({
@@ -55,7 +58,7 @@ for (let key in propertySchemasIndex){
});
}
function getCreature(property){
export function getCreature(property){
if (!property) throw new Meteor.Error('No property provided');
let creature = Creatures.findOne(property.ancestors[0].id);
if (!creature) throw new Meteor.Error('Creature does not exist');
@@ -76,8 +79,13 @@ function recomputeCreatures(property){
}
const insertProperty = new ValidatedMethod({
name: 'CreatureProperties.methods.insert',
name: 'creatureProperties.insert',
validate: null,
mixins: [RateLimiterMixin],
rateLimit: {
numRequests: 5,
timeInterval: 5000,
},
run({creatureProperty}) {
delete creatureProperty._id;
assertPropertyEditPermission(creatureProperty, this.userId);
@@ -88,13 +96,18 @@ const insertProperty = new ValidatedMethod({
});
const duplicateProperty = new ValidatedMethod({
name: 'CreatureProperties.methods.duplicate',
name: 'creatureProperties.duplicate',
validate: new SimpleSchema({
_id: {
type: String,
regEx: SimpleSchema.RegEx.Id,
}
}).validator(),
mixins: [RateLimiterMixin],
rateLimit: {
numRequests: 5,
timeInterval: 5000,
},
run({_id}) {
let creatureProperty = CreatureProperties.findOne(_id);
assertPropertyEditPermission(creatureProperty, this.userId);
@@ -105,7 +118,7 @@ const duplicateProperty = new ValidatedMethod({
});
const insertPropertyFromLibraryNode = new ValidatedMethod({
name: 'CreatureProperties.methods.insertPropertyFromLibraryNode',
name: 'creatureProperties.insertPropertyFromLibraryNode',
validate: new SimpleSchema({
nodeId: {
type: String,
@@ -115,6 +128,11 @@ const insertPropertyFromLibraryNode = new ValidatedMethod({
type: RefSchema,
},
}).validator(),
mixins: [RateLimiterMixin],
rateLimit: {
numRequests: 5,
timeInterval: 5000,
},
run({nodeId, parentRef}) {
// get the new ancestry for the properties
let {parentDoc, ancestors} = getAncestry({parentRef});
@@ -140,7 +158,7 @@ const insertPropertyFromLibraryNode = new ValidatedMethod({
'ancestors.id': nodeId,
removed: {$ne: true},
}).fetch();
// The root node is last in the array of nodes
// The root node is last in the array of nodes
nodes.push(node);
// re-map all the ancestors
@@ -163,22 +181,21 @@ const insertPropertyFromLibraryNode = new ValidatedMethod({
});
// Insert the creature properties
let docId;
nodes.forEach(doc => {
docId = CreatureProperties.insert(doc);
});
let insertedDocIds = CreatureProperties.batchInsert(nodes);
// get the root inserted doc
let rootId = insertedDocIds[insertedDocIds.length - 1];
// Recompute the creatures doc was attached to
let doc = CreatureProperties.findOne(docId);
recomputeCreatures(doc);
recomputeCreatures(node);
// Return the docId of the last property, the inserted root property
return docId;
return rootId;
},
})
const updateProperty = new ValidatedMethod({
name: 'CreatureProperties.methods.update',
name: 'creatureProperties.update',
validate({_id, path}){
if (!_id) return false;
// We cannot change these fields with a simple update
@@ -192,6 +209,11 @@ const updateProperty = new ValidatedMethod({
'This property can\'t be updated directly');
}
},
mixins: [RateLimiterMixin],
rateLimit: {
numRequests: 5,
timeInterval: 5000,
},
run({_id, path, value}) {
let property = CreatureProperties.findOne(_id);
assertPropertyEditPermission(property, this.userId);
@@ -210,8 +232,39 @@ const updateProperty = new ValidatedMethod({
},
});
export function damagePropertyWork({property, operation, value}){
if (operation === 'set'){
let currentValue = property.value;
// Set represents what we want the value to be after damage
// So we need the actual damage to get to that value
let damage = currentValue - value;
// Damage can't exceed total value
if (damage > currentValue) damage = currentValue;
// Damage must be positive
if (damage < 0) damage = 0;
CreatureProperties.update(property._id, {
$set: {damage}
}, {
selector: property
});
} else if (operation === 'increment'){
let currentValue = property.value - (property.damage || 0);
let currentDamage = property.damage;
let increment = value;
// Can't increase damage above the remaining value
if (increment > currentValue) increment = currentValue;
// Can't decrease damage below zero
if (-increment > currentDamage) increment = -currentDamage;
CreatureProperties.update(property._id, {
$inc: {damage: increment}
}, {
selector: property
});
}
}
const damageProperty = new ValidatedMethod({
name: 'CreatureProperties.methods.adjust',
name: 'creatureProperties.damage',
validate: new SimpleSchema({
_id: SimpleSchema.RegEx.Id,
operation: {
@@ -220,6 +273,11 @@ const damageProperty = new ValidatedMethod({
},
value: Number,
}).validator(),
mixins: [RateLimiterMixin],
rateLimit: {
numRequests: 20,
timeInterval: 5000,
},
run({_id, operation, value}) {
let currentProperty = CreatureProperties.findOne(_id);
// Check permissions
@@ -232,40 +290,41 @@ const damageProperty = new ValidatedMethod({
`Property of type "${currentProperty.type}" can't be damaged`
);
}
if (operation === 'set'){
let currentValue = currentProperty.value;
// Set represents what we want the value to be after damage
// So we need the actual damage to get to that value
let damage = currentValue - value;
// Damage can't exceed total value
if (damage > currentValue) damage = currentValue;
// Damage must be positive
if (damage < 0) damage = 0;
CreatureProperties.update(_id, {
$set: {damage}
}, {
selector: currentProperty
});
} else if (operation === 'increment'){
let currentValue = currentProperty.value - (currentProperty.damage || 0);
let currentDamage = currentProperty.damage;
let increment = value;
// Can't increase damage above the remaining value
if (increment > currentValue) increment = currentValue;
// Can't decrease damage below zero
if (-increment > currentDamage) increment = -currentDamage;
CreatureProperties.update(_id, {
$inc: {damage: increment}
}, {
selector: currentProperty
});
}
damagePropertyWork({property: currentProperty, operation, value})
recomputeCreatures(currentProperty);
},
});
export function adjustQuantityWork({property, operation, value}){
// Check if property has quantity
let schema = CreatureProperties.simpleSchema(property);
if (!schema.allowsKey('quantity')){
throw new Meteor.Error(
'Adjust quantity failed',
`Property of type "${property.type}" doesn't have a quantity`
);
}
if (operation === 'set'){
CreatureProperties.update(property._id, {
$set: {quantity: value}
}, {
selector: property
});
} else if (operation === 'increment'){
// value here is 'damage'
value = -value;
let currentQuantity = property.quantity;
if (currentQuantity + value < 0) value = -currentQuantity;
CreatureProperties.update(property._id, {
$inc: {quantity: value}
}, {
selector: property
});
}
}
const adjustQuantity = new ValidatedMethod({
name: 'CreatureProperties.methods.adjustQuantity',
name: 'creatureProperties.adjustQuantity',
validate: new SimpleSchema({
_id: SimpleSchema.RegEx.Id,
operation: {
@@ -274,41 +333,65 @@ const adjustQuantity = new ValidatedMethod({
},
value: Number,
}).validator(),
mixins: [RateLimiterMixin],
rateLimit: {
numRequests: 5,
timeInterval: 5000,
},
run({_id, operation, value}) {
let currentProperty = CreatureProperties.findOne(_id);
// Check permissions
assertPropertyEditPermission(currentProperty, this.userId);
// Check if property can take damage
let schema = CreatureProperties.simpleSchema(currentProperty);
if (!schema.allowsKey('quantity')){
throw new Meteor.Error(
'Adjust quantity failed',
`Property of type "${currentProperty.type}" doesn't have a quantity`
);
}
if (operation === 'set'){
CreatureProperties.update(_id, {
$set: {quantity: value}
}, {
selector: currentProperty
});
} else if (operation === 'increment'){
// value here is 'damage'
value = -value;
let currentQuantity = currentProperty.quantity;
if (currentQuantity + value < 0) value = -currentQuantity;
CreatureProperties.update(_id, {
$inc: {quantity: value}
}, {
selector: currentProperty
});
}
adjustQuantityWork({property: currentProperty, operation, value});
recomputeCreatures(currentProperty);
},
});
const selectAmmoItem = new ValidatedMethod({
name: 'creatureProperties.selectAmmoItem',
validate: new SimpleSchema({
actionId: SimpleSchema.RegEx.Id,
itemId: SimpleSchema.RegEx.Id,
itemConsumedIndex: Number,
}).validator(),
mixins: [RateLimiterMixin],
rateLimit: {
numRequests: 5,
timeInterval: 5000,
},
run({actionId, itemId, itemConsumedIndex}) {
let action = CreatureProperties.findOne(actionId);
// Check permissions
assertPropertyEditPermission(action, this.userId);
// Check that this index has a document to edit
let itemConsumed = action.resources.itemsConsumed[itemConsumedIndex];
if (!itemConsumed){
throw new Meteor.Error('Resouce not found',
'Could not set ammo, because the ammo document was not found');
}
let itemToLink = CreatureProperties.findOne(itemId);
if (!itemToLink){
throw new Meteor.Error('Item not found',
'Could not set ammo: the item was not found');
}
let path = `resources.itemsConsumed.${itemConsumedIndex}.itemId`;
CreatureProperties.update(actionId, {
$set: {[path]: itemId}
}, {
selector: action,
});
recomputeCreatures(action);
},
});
const pushToProperty = new ValidatedMethod({
name: 'CreatureProperties.methods.push',
name: 'creatureProperties.push',
validate: null,
mixins: [RateLimiterMixin],
rateLimit: {
numRequests: 5,
timeInterval: 5000,
},
run({_id, path, value}){
let property = CreatureProperties.findOne(_id);
assertPropertyEditPermission(property, this.userId);
@@ -322,8 +405,13 @@ const pushToProperty = new ValidatedMethod({
});
const pullFromProperty = new ValidatedMethod({
name: 'CreatureProperties.methods.pull',
name: 'creatureProperties.pull',
validate: null,
mixins: [RateLimiterMixin],
rateLimit: {
numRequests: 5,
timeInterval: 5000,
},
run({_id, path, itemId}){
let property = CreatureProperties.findOne(_id);
assertPropertyEditPermission(property, this.userId);
@@ -338,10 +426,15 @@ const pullFromProperty = new ValidatedMethod({
});
const softRemoveProperty = new ValidatedMethod({
name: 'CreatureProperties.methods.softRemove',
name: 'creatureProperties.softRemove',
validate: new SimpleSchema({
_id: SimpleSchema.RegEx.Id
}).validator(),
mixins: [RateLimiterMixin],
rateLimit: {
numRequests: 5,
timeInterval: 5000,
},
run({_id}){
let property = CreatureProperties.findOne(_id);
assertPropertyEditPermission(property, this.userId);
@@ -360,6 +453,7 @@ export {
updateProperty,
damageProperty,
adjustQuantity,
selectAmmoItem,
pushToProperty,
pullFromProperty,
softRemoveProperty,

View File

@@ -1,4 +1,5 @@
import { ValidatedMethod } from 'meteor/mdg:validated-method';
import { RateLimiterMixin } from 'ddp-rate-limiter-mixin';
import SimpleSchema from 'simpl-schema';
import deathSaveSchema from '/imports/api/properties/subSchemas/DeathSavesSchema.js'
import ColorSchema from '/imports/api/properties/subSchemas/ColorSchema.js';
@@ -120,10 +121,16 @@ Creatures.attachSchema(CreatureSchema);
const insertCreature = new ValidatedMethod({
name: 'Creatures.methods.insertCreature',
name: 'creatures.insertCreature',
validate: null,
mixins: [RateLimiterMixin],
rateLimit: {
numRequests: 5,
timeInterval: 5000,
},
run() {
if (!this.userId) {
throw new Meteor.Error('Creatures.methods.insert.denied',
@@ -146,7 +153,7 @@ const insertCreature = new ValidatedMethod({
});
const updateCreature = new ValidatedMethod({
name: 'Creatures.methods.update',
name: 'creatures.update',
validate({_id, path}){
if (!_id) return false;
// Allowed fields
@@ -164,6 +171,11 @@ const updateCreature = new ValidatedMethod({
'This field can\'t be updated using this method');
}
},
mixins: [RateLimiterMixin],
rateLimit: {
numRequests: 5,
timeInterval: 5000,
},
run({_id, path, value}) {
let creature = Creatures.findOne(_id);
assertEditPermission(creature, this.userId);

View File

@@ -0,0 +1,5 @@
import spendResources from '/imports/api/creature/actions/spendResources.js'
export default function applyAction({prop}){
spendResources(prop);
}

View File

@@ -0,0 +1,61 @@
import {
setLineageOfDocs,
renewDocIds
} from '/imports/api/parenting/parenting.js';
import {setDocToLastOrder} from '/imports/api/parenting/order.js';
import CreatureProperties from '/imports/api/creature/CreatureProperties.js';
export default function applyBuff({
prop,
children,
creature,
targets = [],
//actionContext,
}){
let buffTargets = prop.target === 'self' ? [creature] : targets;
//let scope = {
// ...creature.variables,
// ...actionContext,
//};
// TODO
// If the target is not self, walk through all decendants and replace
// variables in calculations with their values from the creature scope
// If the target is self, replace all the target.x references with just x
// Then copy the decendants of the buff to the targets
prop.applied = true;
let propList = [prop];
function addChildrenToPropList(children){
children.forEach(child => {
propList.push(child.node);
addChildrenToPropList(child.children);
});
}
addChildrenToPropList(children);
let oldParent = {
id: prop.parent.id,
collection: prop.parent.collection,
};
buffTargets.forEach(target => {
copyNodeListToTarget(propList, target, oldParent);
});
}
function copyNodeListToTarget(propList, target, oldParent){
let ancestry = [{collection: 'creatures', id: target._id}];
setLineageOfDocs({
docArray: propList,
newAncestry: ancestry,
oldParent,
});
renewDocIds({
docArray: propList,
});
setDocToLastOrder({
collection: CreatureProperties,
doc: propList[0],
});
CreatureProperties.batchInsert(propList);
}

View File

@@ -0,0 +1,19 @@
import evaluateString from '/imports/api/creature/computation/afterComputation/evaluateString.js';
export default function applyDamage({
prop,
creature,
targets,
actionContext
}){
let damageTargets = prop.target === 'self' ? [creature] : targets;
let scope = {
...creature.variables,
...actionContext,
};
let {result, errors} = evaluateString(prop.amount, scope);
if (Meteor.isClient) errors.forEach(e => console.error(e));
if (Number.isFinite(result)) {
damageTargets.forEach()
}
}

View File

@@ -0,0 +1,62 @@
import applyAction from '/imports/api/creature/actions/applyAction.js';
//import applyDamage from '/imports/api/creature/actions/applyDamage.js';
import applyBuff from '/imports/api/creature/actions/applyBuff.js';
function applyProperty(options){
let prop = options.prop;
if (
prop.disabled === true || // ignore disabled props
prop.equipped === false || // ignore unequipped items
prop.toggleResult === false || // ignore untoggled toggles
prop.applied === true // ignore buffs that are already applied
){
return false;
}
switch (prop.type){
case 'action':
case 'spell':
case 'attack':
applyAction(options);
return true;
case 'damage':
// applyDamage(options);
return true;
case 'adjustment':
// applyAdjustment(options);
return true;
case 'buff':
applyBuff(options);
return false;
case 'roll':
// applyRoll(options);
return true;
case 'savingThrow':
// applySavingThrow(options);
return false;
}
}
export default function applyProperties({
forest,
creature,
targets,
actionContext
}){
forest.forEach(child => {
let walkChildren = applyProperty({
prop: child.node,
children: child.children,
creature,
targets,
actionContext
});
if (walkChildren){
applyProperties({
forest: child.children,
creature,
targets,
actionContext
});
}
});
}

View File

@@ -0,0 +1,62 @@
import SimpleSchema from 'simpl-schema';
import { ValidatedMethod } from 'meteor/mdg:validated-method';
import { RateLimiterMixin } from 'ddp-rate-limiter-mixin';
import CreatureProperties, { getCreature } from '/imports/api/creature/CreatureProperties.js';
import { assertEditPermission } from '/imports/api/creature/creaturePermissions.js';
import { recomputeCreatureByDoc } from '/imports/api/creature/computation/recomputeCreature.js';
import { nodesToTree } from '/imports/api/parenting/parenting.js';
import applyProperties from '/imports/api/creature/actions/applyProperties.js';
const doAction = new ValidatedMethod({
name: 'creatureProperties.doAction',
validate: new SimpleSchema({
actionId: SimpleSchema.RegEx.Id,
targetId: {
type: String,
regEx: SimpleSchema.RegEx.Id,
optional: true,
},
}).validator(),
mixins: [RateLimiterMixin],
rateLimit: {
numRequests: 10,
timeInterval: 5000,
},
run({actionId, targetId}) {
let action = CreatureProperties.findOne(actionId);
// Check permissions
let creature = getCreature(action);
assertEditPermission(creature, this.userId);
let target = undefined;
if (targetId) {
target = getCreature(targetId);
assertEditPermission(target, this.userId);
}
doActionWork({action, creature, target});
// Note this only recomputes the top-level creature, not the nearest one
recomputeCreatureByDoc(creature);
if (target){
recomputeCreatureByDoc(target);
}
},
});
function doActionWork({action, creature, target}){
let actionContext = {};
let decendantForest = nodesToTree({
collection: CreatureProperties,
ancestorId: action._id,
});
let startingForest = [{
node: action,
children: decendantForest,
}];
applyProperties({
forest: startingForest,
creature,
target,
actionContext
});
}
export default doAction;

View File

@@ -0,0 +1,57 @@
import CreatureProperties, { damagePropertyWork, adjustQuantityWork } from '/imports/api/creature/CreatureProperties.js';
export default function spendResources(action){
// Check Uses
if (action.usesUsed >= action.usesResult){
throw new Meteor.Error('Insufficient Uses',
'This action has no uses left');
}
// Resources
if (action.insufficientResources){
throw new Meteor.Error('Insufficient Resources',
'This creature doesn\'t have sufficient resources to perform this action');
}
// Items
let itemQuantityAdjustments = [];
action.resources.itemsConsumed.forEach(itemConsumed => {
if (!itemConsumed.itemId){
throw new Meteor.Error('Ammo not selected',
'No ammo was selected for this action');
}
let item = CreatureProperties.findOne(itemConsumed.itemId);
if (!item || item.ancestors[0].id !== action.ancestors[0].id){
throw new Meteor.Error('Ammo not found',
'The action\'s ammo was not found on the creature');
}
if (!item.equipped){
throw new Meteor.Error('Ammo not equipped',
'The selected ammo is not equipped');
}
if (!itemConsumed.quantity) return;
itemQuantityAdjustments.push({
property: item,
operation: 'increment',
value: itemConsumed.quantity,
});
});
// No more errors should be thrown after this line
// Now that we have confirmed that there are no errors, do actual work
//Items
itemQuantityAdjustments.forEach(adjustQuantityWork);
// Use uses
CreatureProperties.update(action._id, {
$inc: {usesUsed: 1}
}, {
selector: action
});
// Damage stats
action.resources.attributesConsumed.forEach(attConsumed => {
if (!attConsumed.quantity) return;
let stat = CreatureProperties.findOne(attConsumed.statId);
damagePropertyWork({
property: stat,
operation: 'increment',
value: attConsumed.quantity,
});
});
}

View File

@@ -15,6 +15,10 @@ export default class ComputationMemo {
this.classes = {};
this.togglesById = {};
this.toggleIds = new Set();
// Equipped items that might be used as ammo
this.equipmentById = {};
// Properties that have calculations, but don't impact other properties
this.endStepPropsById = {};
// First note all the ids of all the toggles
props.forEach((prop) => {
if (
@@ -38,6 +42,10 @@ export default class ComputationMemo {
) {
// Add all the stats
this.addStat(prop);
} else if (
prop.type === 'item'
) {
this.addEquipment(prop);
} else {
return true;
}
@@ -49,6 +57,8 @@ export default class ComputationMemo {
this.addProficiency(prop);
} else if (prop.type === 'classLevel'){
this.addClassLevel(prop);
} else {
this.addEndStepProp(prop);
}
});
for (let name in creature.denormalizedStats){
@@ -181,6 +191,14 @@ export default class ComputationMemo {
});
return targets;
}
addEquipment(prop){
prop = this.registerProperty(prop);
this.equipmentById[prop._id] = prop;
}
addEndStepProp(prop){
prop = this.registerProperty(prop);
this.endStepPropsById[prop._id] = prop;
}
}
function isAbility(prop){
@@ -206,7 +224,7 @@ function isSkillOperation(prop){
}
function propDetails(prop){
return propDetailsByType[prop.type]() || {};
return propDetailsByType[prop.type] && propDetailsByType[prop.type]() || {};
}
const propDetailsByType = {

View File

@@ -0,0 +1,96 @@
import evaluateCalculation from '/imports/api/creature/computation/evaluateCalculation.js';
export default function computeEndStepProperty(prop, memo){
switch (prop.type){
case 'action':
case 'spell':
computeAction(prop, memo);
break;
case 'attack':
computeAction(prop, memo);
computeAttack(prop, memo);
break;
case 'savingThrow':
computeSavingThrow(prop, memo);
break;
case 'spellList':
computeSpellList(prop, memo);
break;
}
}
function computeAction(prop, memo){
// Uses
let {value, errors} = evaluateCalculation(prop.uses, memo);
prop.usesResult = value;
if (errors.length){
prop.usesErrors = errors;
} else {
delete prop.usesErrors;
}
prop.insufficientResources = undefined;
if (prop.usesUsed >= prop.usesResult){
prop.insufficientResources = true;
}
// Attributes consumed
prop.resources.attributesConsumed.forEach((attConsumed, i) => {
if (attConsumed.variableName){
let stat = memo.statsByVariableName[attConsumed.variableName];
prop.resources.attributesConsumed[i].statId = stat && stat._id;
prop.resources.attributesConsumed[i].statName = stat && stat.name;
let available = stat && stat.currentValue || 0;
prop.resources.attributesConsumed[i].available = available;
if (available < attConsumed.quantity){
prop.insufficientResources = true;
}
}
});
// Items consumed
prop.resources.itemsConsumed.forEach((itemConsumed, i) => {
let item = itemConsumed.itemId && memo.equipmentById[itemConsumed.itemId];
prop.resources.itemsConsumed[i].itemId = item && item._id;
let available = item && item.quantity || 0;
prop.resources.itemsConsumed[i].available = available;
let name = item && item.name;
if (item && item.quantity !== 1 && item.plural){
name = item.plural;
}
prop.resources.itemsConsumed[i].itemName = name;
prop.resources.itemsConsumed[i].itemIcon = item && item.icon;
prop.resources.itemsConsumed[i].itemColor = item && item.color;
if (!item || available < itemConsumed.quantity){
prop.insufficientResources = true;
}
});
}
function computeAttack(prop, memo){
// Roll bonus
let {value, errors} = evaluateCalculation(prop.rollBonus, memo);
prop.rollBonusResult = value;
if (errors.length){
prop.rollBonusErrors = errors;
} else {
delete prop.rollBonusErrors;
}
}
function computeSavingThrow(prop, memo){
let {value, errors} = evaluateCalculation(prop.dc, memo);
prop.dcResult = value;
if (errors.length){
prop.dcErrors = errors;
} else {
delete prop.dcErrors;
}
}
function computeSpellList(prop, memo){
let {value, errors} = evaluateCalculation(prop.maxPrepared, memo);
prop.maxPreparedResult = value;
if (errors.length){
prop.maxPreparedErrors = errors;
} else {
delete prop.maxPreparedErrors;
}
}

View File

@@ -3,6 +3,7 @@ import computeLevels from '/imports/api/creature/computation/computeLevels.js';
import computeStat from '/imports/api/creature/computation/computeStat.js';
import computeEffect from '/imports/api/creature/computation/computeEffect.js';
import computeToggle from '/imports/api/creature/computation/computeToggle.js';
import computeEndStepProperty from '/imports/api/creature/computation/computeEndStepProperty.js';
export default function computeMemo(memo){
// Compute level
@@ -15,8 +16,12 @@ export default function computeMemo(memo){
each(memo.unassignedEffects, effect => {
computeEffect(effect, memo);
});
// Compute toggles which didn't already get computed by dependencies
forOwn(memo.togglesById, toggle => {
computeToggle(toggle, memo);
});
// Compute class levels
// Compute end step properties
forOwn(memo.endStepPropsById, prop => {
computeEndStepProperty(prop, memo);
});
}

View File

@@ -3,7 +3,7 @@ import math from '/imports/math.js';
/* Convert a calculation into a constant output and errors*/
export default function evaluateCalculation(string, memo){
if (!string) return string;
if (!string) return {errors: [], value: string};
let errors = [];
// Parse the string using mathjs
let calc;

View File

@@ -1,4 +1,5 @@
import { ValidatedMethod } from 'meteor/mdg:validated-method';
import { RateLimiterMixin } from 'ddp-rate-limiter-mixin';
import SimpleSchema from 'simpl-schema';
import { assertEditPermission } from '/imports/api/creature/creaturePermissions.js';
import ComputationMemo from '/imports/api/creature/computation/ComputationMemo.js';
@@ -11,12 +12,18 @@ import Creatures from '/imports/api/creature/Creatures.js';
export const recomputeCreature = new ValidatedMethod({
name: 'Creatures.methods.recomputeCreature',
name: 'creatures.recomputeCreature',
validate: new SimpleSchema({
charId: { type: String }
}).validator(),
mixins: [RateLimiterMixin],
rateLimit: {
numRequests: 5,
timeInterval: 5000,
},
run({charId}) {
let creature = Creatures.findOne(charId);
// Permission
@@ -35,6 +42,13 @@ const calculationPropertyTypes = [
'proficiency',
'classLevel',
'toggle',
'item',
// End step types
'action',
'attack',
'savingThrow',
'spellList',
'spell',
];
export function recomputeCreatureById(creatureId){
@@ -78,7 +92,7 @@ export function recomputeCreatureById(creatureId){
* - Mark the stat as computed
* - Write the computed results back to the database
*/
function recomputeCreatureByDoc(creature){
export function recomputeCreatureByDoc(creature){
const creatureId = creature._id;
let props = getActiveProperties({
ancestorId: creatureId,

View File

@@ -1,16 +1,29 @@
import { Meteor } from 'meteor/meteor'
import { isEqual, forOwn } from 'lodash';
import CreatureProperties from '/imports/api/creature/CreatureProperties.js';
// Schemas
// Calculated props
import { ComputedOnlySkillSchema } from '/imports/api/properties/Skills.js';
import { ComputedOnlyAttributeSchema } from '/imports/api/properties/Attributes.js';
import { ComputedOnlyEffectSchema } from '/imports/api/properties/Effects.js';
import { ComputedOnlyToggleSchema } from '/imports/api/properties/Toggles.js';
import CreatureProperties from '/imports/api/creature/CreatureProperties.js';
// End step props
import { ComputedOnlyActionSchema } from '/imports/api/properties/Actions.js';
import { ComputedOnlyAttackSchema } from '/imports/api/properties/Attacks.js';
import { ComputedOnlySavingThrowSchema } from '/imports/api/properties/SavingThrows.js';
import { ComputedOnlySpellListSchema } from '/imports/api/properties/SpellLists.js';
import { ComputedOnlySpellSchema } from '/imports/api/properties/Spells.js';
const schemasByType = {
'skill': ComputedOnlySkillSchema,
'attribute': ComputedOnlyAttributeSchema,
'effect': ComputedOnlyEffectSchema,
'toggle': ComputedOnlyToggleSchema,
'action': ComputedOnlyActionSchema,
'attack': ComputedOnlyAttackSchema,
'savingThrow': ComputedOnlySavingThrowSchema,
'spellList': ComputedOnlySpellListSchema,
'spell': ComputedOnlySpellSchema,
};
export default function writeAlteredProperties(memo){

View File

@@ -1,4 +1,5 @@
import { ValidatedMethod } from 'meteor/mdg:validated-method';
import { RateLimiterMixin } from 'ddp-rate-limiter-mixin';
import SimpleSchema from 'simpl-schema';
import { assertEditPermission } from '/imports/api/creature/creaturePermissions.js';
import Creatures from '/imports/api/creature/Creatures.js';
@@ -6,12 +7,18 @@ import getActiveProperties from '/imports/api/creature/getActiveProperties.js';
export const recomputeDamageMultipliers = new ValidatedMethod({
name: 'Creatures.methods.recomputeDamageMultipliers',
name: 'creatures.recomputeDamageMultipliers',
validate: new SimpleSchema({
creatureId: { type: String }
}).validator(),
mixins: [RateLimiterMixin],
rateLimit: {
numRequests: 5,
timeInterval: 5000,
},
run({creatureId}) {
// Permission
assertEditPermission(creatureId, this.userId);

View File

@@ -1,5 +1,6 @@
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/creaturePermissions.js';
import Creatures from '/imports/api/creature/Creatures.js';
@@ -64,7 +65,7 @@ const insertExperienceForCreature = function({experience, creatureId, userId}){
};
const insertExperience = new ValidatedMethod({
name: 'Experiences.methods.insert',
name: 'experiences.insert',
validate: new SimpleSchema({
experience: {
type: ExperienceSchema.omit('creatureId'),
@@ -78,6 +79,11 @@ const insertExperience = new ValidatedMethod({
regEx: SimpleSchema.RegEx.Id,
},
}).validator(),
mixins: [RateLimiterMixin],
rateLimit: {
numRequests: 5,
timeInterval: 5000,
},
run({experience, creatureIds}) {
let userId = this.userId;
if (!userId) {
@@ -99,13 +105,18 @@ const insertExperience = new ValidatedMethod({
});
const removeExperience = new ValidatedMethod({
name: 'Experiences.methods.remove',
name: 'experiences.remove',
validate: new SimpleSchema({
experienceId: {
type: String,
regEx: SimpleSchema.RegEx.Id,
},
}).validator(),
mixins: [RateLimiterMixin],
rateLimit: {
numRequests: 5,
timeInterval: 5000,
},
run({experienceId}) {
let userId = this.userId;
if (!userId) {
@@ -139,13 +150,18 @@ const removeExperience = new ValidatedMethod({
});
const recomputeExperiences = new ValidatedMethod({
name: 'Experiences.methods.recompute',
name: 'experiences.recompute',
validate: new SimpleSchema({
creatureId: {
type: String,
regEx: SimpleSchema.RegEx.Id,
},
}).validator(),
mixins: [RateLimiterMixin],
rateLimit: {
numRequests: 5,
timeInterval: 5000,
},
run({creatureId}) {
let userId = this.userId;
if (!userId) {

View File

@@ -1,5 +1,6 @@
import SimpleSchema from 'simpl-schema';
import { ValidatedMethod } from 'meteor/mdg:validated-method';
import { RateLimiterMixin } from 'ddp-rate-limiter-mixin';
import Creatures from '/imports/api/creature/Creatures.js';
import CreatureProperties from '/imports/api/creature/CreatureProperties.js'
import { assertOwnership } from '/imports/api/creature/creaturePermissions.js';
@@ -18,6 +19,11 @@ const removeCreature = new ValidatedMethod({
regEx: SimpleSchema.RegEx.Id,
},
}).validator(),
mixins: [RateLimiterMixin],
rateLimit: {
numRequests: 5,
timeInterval: 5000,
},
run({charId}) {
assertOwnership(charId, this.userId)
Creatures.remove(charId);

View File

@@ -1,5 +1,6 @@
import SimpleSchema from 'simpl-schema';
import { ValidatedMethod } from 'meteor/mdg:validated-method';
import { RateLimiterMixin } from 'ddp-rate-limiter-mixin';
import Creatures from '/imports/api/creature/Creatures.js';
import CreatureProperties from '/imports/api/creature/CreatureProperties.js';
import getActiveProperties, { getActivePropertyFilter } from '/imports/api/creature/getActiveProperties.js';
@@ -18,6 +19,11 @@ const restCreature = new ValidatedMethod({
allowedValues: ['shortRest', 'longRest'],
},
}).validator(),
mixins: [RateLimiterMixin],
rateLimit: {
numRequests: 5,
timeInterval: 5000,
},
run({creatureId, restType}) {
let creature = Creatures.findOne(creatureId, {
fields: {

View File

@@ -1,5 +1,6 @@
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';
let Icons = new Mongo.Collection('icons');
@@ -48,7 +49,7 @@ Icons.attachSchema(iconsSchema);
// This method does not validate icons against the schema, use wisely;
const writeIcons = new ValidatedMethod({
name: 'icons.methods.write',
name: 'icons.write',
validate: null,
run(icons){
assertAdmin(this.userId);
@@ -60,7 +61,7 @@ const writeIcons = new ValidatedMethod({
});
const findIcons = new ValidatedMethod({
name: 'icons.methods.find',
name: 'icons.find',
validate: new SimpleSchema({
search: {
type: String,
@@ -68,6 +69,11 @@ const findIcons = new ValidatedMethod({
optional: true,
},
}).validator(),
mixins: [RateLimiterMixin],
rateLimit: {
numRequests: 20,
timeInterval: 10000,
},
run({search}){
if (!search) return [];
if (!Meteor.isServer) return;

View File

@@ -1,4 +1,5 @@
import { ValidatedMethod } from 'meteor/mdg:validated-method';
import { RateLimiterMixin } from 'ddp-rate-limiter-mixin';
import SimpleSchema from 'simpl-schema';
import SharingSchema from '/imports/api/sharing/SharingSchema.js';
import simpleSchemaMixin from '/imports/api/creature/mixins/simpleSchemaMixin.js';
@@ -34,7 +35,7 @@ Libraries.attachSchema(LibrarySchema);
export default Libraries;
const insertLibrary = new ValidatedMethod({
name: 'Libraries.methods.insert',
name: 'libraries.insert',
mixins: [
simpleSchemaMixin,
],
@@ -55,7 +56,7 @@ const insertLibrary = new ValidatedMethod({
});
const updateLibraryName = new ValidatedMethod({
name: 'Libraries.methods.updateName',
name: 'libraries.updateName',
validate: new SimpleSchema({
_id: {
type: String,
@@ -65,6 +66,11 @@ const updateLibraryName = new ValidatedMethod({
type: String,
},
}).validator(),
mixins: [RateLimiterMixin],
rateLimit: {
numRequests: 5,
timeInterval: 5000,
},
run({_id, name}){
let library = Libraries.findOne(_id);
assertEditPermission(library, this.userId);
@@ -73,7 +79,7 @@ const updateLibraryName = new ValidatedMethod({
});
const setLibraryDefault = new ValidatedMethod({
name: 'Libraries.methods.makeLibraryDefault',
name: 'libraries.makeLibraryDefault',
validate: new SimpleSchema({
_id: {
type: String,
@@ -83,6 +89,11 @@ const setLibraryDefault = new ValidatedMethod({
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');
@@ -92,13 +103,18 @@ const setLibraryDefault = new ValidatedMethod({
});
const removeLibrary = new ValidatedMethod({
name: 'Libraries.methods.remove',
name: 'libraries.remove',
validate: new SimpleSchema({
_id: {
type: String,
regEx: SimpleSchema.RegEx.id
},
}).validator(),
mixins: [RateLimiterMixin],
rateLimit: {
numRequests: 5,
timeInterval: 5000,
},
run({_id}){
let library = Libraries.findOne(_id);
assertOwnership(library, this.userId);

View File

@@ -1,6 +1,7 @@
import { Meteor } from 'meteor/meteor';
import { Mongo } from 'meteor/mongo';
import { ValidatedMethod } from 'meteor/mdg:validated-method';
import { RateLimiterMixin } from 'ddp-rate-limiter-mixin';
import SimpleSchema from 'simpl-schema';
import ColorSchema from '/imports/api/properties/subSchemas/ColorSchema.js';
import ChildSchema from '/imports/api/parenting/ChildSchema.js';
@@ -56,8 +57,13 @@ function assertNodeEditPermission(node, userId){
}
const insertNode = new ValidatedMethod({
name: 'LibraryNodes.methods.insert',
name: 'libraryNodes.insert',
validate: null,
mixins: [RateLimiterMixin],
rateLimit: {
numRequests: 5,
timeInterval: 5000,
},
run(libraryNode) {
delete libraryNode._id;
assertNodeEditPermission(libraryNode, this.userId);
@@ -66,13 +72,18 @@ const insertNode = new ValidatedMethod({
});
const duplicateNode = new ValidatedMethod({
name: 'LibraryNodes.methods.duplicate',
name: 'libraryNodes.duplicate',
validate: new SimpleSchema({
_id: {
type: String,
regEx: SimpleSchema.RegEx.Id,
}
}).validator(),
mixins: [RateLimiterMixin],
rateLimit: {
numRequests: 5,
timeInterval: 5000,
},
run({_id}) {
let libraryNode = LibraryNodes.findOne(_id);
assertNodeEditPermission(libraryNode, this.userId);
@@ -82,7 +93,7 @@ const duplicateNode = new ValidatedMethod({
})
const updateLibraryNode = new ValidatedMethod({
name: 'LibraryNodes.methods.update',
name: 'libraryNodes.update',
validate({_id, path}){
if (!_id) return false;
// We cannot change these fields with a simple update
@@ -94,6 +105,11 @@ const updateLibraryNode = new ValidatedMethod({
return false;
}
},
mixins: [RateLimiterMixin],
rateLimit: {
numRequests: 5,
timeInterval: 5000,
},
run({_id, path, value}) {
let node = LibraryNodes.findOne(_id);
assertNodeEditPermission(node, this.userId);
@@ -112,8 +128,13 @@ const updateLibraryNode = new ValidatedMethod({
});
const pushToLibraryNode = new ValidatedMethod({
name: 'LibraryNodes.methods.push',
name: 'libraryNodes.push',
validate: null,
mixins: [RateLimiterMixin],
rateLimit: {
numRequests: 5,
timeInterval: 5000,
},
run({_id, path, value}){
let node = LibraryNodes.findOne(_id);
assertNodeEditPermission(node, this.userId);
@@ -126,8 +147,13 @@ const pushToLibraryNode = new ValidatedMethod({
});
const pullFromLibraryNode = new ValidatedMethod({
name: 'LibraryNodes.methods.pull',
name: 'libraryNodes.pull',
validate: null,
mixins: [RateLimiterMixin],
rateLimit: {
numRequests: 5,
timeInterval: 5000,
},
run({_id, path, itemId}){
let node = LibraryNodes.findOne(_id);
assertNodeEditPermission(node, this.userId);
@@ -141,10 +167,15 @@ const pullFromLibraryNode = new ValidatedMethod({
});
const softRemoveLibraryNode = new ValidatedMethod({
name: 'LibraryNodes.methods.softRemove',
name: 'libraryNodes.softRemove',
validate: new SimpleSchema({
_id: SimpleSchema.RegEx.Id
}).validator(),
mixins: [RateLimiterMixin],
rateLimit: {
numRequests: 5,
timeInterval: 5000,
},
run({_id}){
let node = LibraryNodes.findOne(_id);
assertNodeEditPermission(node, this.userId);

View File

@@ -1,6 +1,7 @@
import SimpleSchema from 'simpl-schema';
import { union } from 'lodash';
import { ValidatedMethod } from 'meteor/mdg:validated-method';
import { RateLimiterMixin } from 'ddp-rate-limiter-mixin';
import { updateParent } from '/imports/api/parenting/parenting.js';
import { reorderDocs, safeUpdateDocOrder } from '/imports/api/parenting/order.js';
import { RefSchema } from '/imports/api/parenting/ChildSchema.js';
@@ -10,7 +11,7 @@ import getCollectionByName from '/imports/api/parenting/getCollectionByName.js';
import { recomputeCreatureById } from '/imports/api/creature/computation/recomputeCreature.js';
const organizeDoc = new ValidatedMethod({
name: 'organize.methods.organizeDoc',
name: 'organize.organizeDoc',
validate: new SimpleSchema({
docRef: RefSchema,
parentRef: RefSchema,
@@ -19,6 +20,11 @@ const organizeDoc = new ValidatedMethod({
// Should end in 0.5 to place it reliably between two existing documents
},
}).validator(),
mixins: [RateLimiterMixin],
rateLimit: {
numRequests: 5,
timeInterval: 5000,
},
run({docRef, parentRef, order}) {
let doc = fetchDocByRef(docRef);
let collection = getCollectionByName(docRef.collection);
@@ -54,7 +60,7 @@ const organizeDoc = new ValidatedMethod({
});
const reorderDoc = new ValidatedMethod({
name: 'organize.methods.reorderDoc',
name: 'organize.reorderDoc',
validate: new SimpleSchema({
docRef: RefSchema,
order: {
@@ -62,6 +68,11 @@ const reorderDoc = new ValidatedMethod({
// Should end in 0.5 to place it reliably between two existing documents
},
}).validator(),
mixins: [RateLimiterMixin],
rateLimit: {
numRequests: 5,
timeInterval: 5000,
},
run({docRef, order}) {
let doc = fetchDocByRef(docRef);
assertDocEditPermission(doc, this.userId);

View File

@@ -130,7 +130,7 @@ export function renewDocIds({docArray, collectionMap}){
const remapReference = ref => {
if (idMap[ref.id]){
ref.id = idMap[ref.id];
ref.collection = collectionMap[ref.collection] || ref.collection;
ref.collection = collectionMap && collectionMap[ref.collection] || ref.collection;
}
}
docArray.forEach(doc => {
@@ -204,17 +204,11 @@ export function getName(doc){
}
}
export function nodesToTree({collection, ancestorId, filter, options}){
export function nodeArrayToTree(nodes){
// Store a dict of all the nodes
let nodeIndex = {};
let nodeList = [];
if (!options) options = {};
options.sort = {order: 1};
collection.find({
'ancestors.id': ancestorId,
removed: {$ne: true},
...filter,
}, options).forEach( node => {
nodes.forEach( node => {
let treeNode = {
node: node,
children: [],
@@ -238,3 +232,14 @@ export function nodesToTree({collection, ancestorId, filter, options}){
});
return forest;
}
export function nodesToTree({collection, ancestorId, filter, options}){
if (!options) options = {};
options.sort = {order: 1};
let nodes = collection.find({
'ancestors.id': ancestorId,
removed: {$ne: true},
...filter,
}, options);
return nodeArrayToTree(nodes);
}

View File

@@ -1,5 +1,6 @@
import SimpleSchema from 'simpl-schema';
import ResourcesSchema from '/imports/api/properties/subSchemas/ResourcesSchema.js'
import ErrorSchema from '/imports/api/properties/subSchemas/ErrorSchema.js';
import { storedIconsSchema } from '/imports/api/icons/Icons.js'
/*
* Actions are things a character can do
@@ -12,6 +13,10 @@ let ActionSchema = new SimpleSchema({
type: String,
optional: true,
},
summary: {
type: String,
optional: true,
},
description: {
type: String,
optional: true,
@@ -40,13 +45,60 @@ let ActionSchema = new SimpleSchema({
'tags.$': {
type: String,
},
// Duplicate the ResourceSchema here so we can extend it elegantly.
resources: {
type: ResourcesSchema,
type: Object,
defaultValue: {},
},
'resources.itemsConsumed': {
type: Array,
defaultValue: [],
},
'resources.itemsConsumed.$': {
type: Object,
},
'resources.itemsConsumed.$._id': {
type: String,
regEx: SimpleSchema.RegEx.Id,
autoValue(){
if (!this.isSet) return Random.id();
}
},
'resources.itemsConsumed.$.tag': {
type: String,
optional: true,
},
'resources.itemsConsumed.$.quantity': {
type: Number,
defaultValue: 1,
},
'resources.itemsConsumed.$.itemId': {
type: String,
optional: true,
},
'resources.attributesConsumed': {
type: Array,
defaultValue: [],
},
'resources.attributesConsumed.$': {
type: Object,
},
'resources.attributesConsumed.$._id': {
type: String,
regEx: SimpleSchema.RegEx.Id,
autoValue(){
if (!this.isSet) return Random.id();
}
},
'resources.attributesConsumed.$.variableName': {
type: String,
optional: true,
},
'resources.attributesConsumed.$.quantity': {
type: Number,
defaultValue: 1,
},
// Calculation of how many times this action can be used
// Only set if this action tracks its own uses, rather than adjusting
// resources
uses: {
type: String,
optional: true,
@@ -64,4 +116,69 @@ let ActionSchema = new SimpleSchema({
},
});
export { ActionSchema };
const ComputedOnlyActionSchema = new SimpleSchema({
usesResult: {
type: SimpleSchema.Integer,
optional: true,
},
usesErrors: {
type: Array,
optional: true,
},
'usesErrors.$':{
type: ErrorSchema,
},
resources: Object,
'resources.itemsConsumed': Array,
'resources.itemsConsumed.$': Object,
'resources.itemsConsumed.$.available': {
type: Number,
optional: true,
},
// This appears both in the computed and uncomputed schema because it can be
// set by both a computation or a form
'resources.itemsConsumed.$.itemId': {
type: String,
regEx: SimpleSchema.RegEx.Id,
optional: true,
},
'resources.itemsConsumed.$.itemName': {
type: String,
optional: true,
},
'resources.itemsConsumed.$.itemIcon': {
type: storedIconsSchema,
optional: true,
},
'resources.itemsConsumed.$.itemColor': {
type: String,
optional: true,
},
'resources.attributesConsumed': Array,
'resources.attributesConsumed.$': Object,
'resources.attributesConsumed.$.available': {
type: Number,
optional: true,
},
'resources.attributesConsumed.$.statId': {
type: String,
regEx: SimpleSchema.RegEx.Id,
optional: true,
},
'resources.attributesConsumed.$.statName': {
type: String,
optional: true,
},
// True if the uses left is zero, or any item or attribute consumed is
// insufficient
insufficientResources: {
type: Boolean,
optional: true,
},
});
const ComputedActionSchema = new SimpleSchema()
.extend(ActionSchema)
.extend(ComputedOnlyActionSchema);
export { ActionSchema, ComputedOnlyActionSchema, ComputedActionSchema};

View File

@@ -2,6 +2,7 @@ import SimpleSchema from 'simpl-schema';
const AdjustmentSchema = new SimpleSchema({
// The roll that determines how much to change the attribute
// This can be simplified, but should only compute when activated
amount: {
type: String,
optional: true,

View File

@@ -1,5 +1,6 @@
import SimpleSchema from 'simpl-schema';
import { ActionSchema } from '/imports/api/properties/Actions.js';
import { ActionSchema, ComputedOnlyActionSchema } from '/imports/api/properties/Actions.js';
import ErrorSchema from '/imports/api/properties/subSchemas/ErrorSchema.js';
// Attacks are special instances of actions
let AttackSchema = new SimpleSchema()
@@ -25,4 +26,24 @@ let AttackSchema = new SimpleSchema()
},
});
export { AttackSchema };
const ComputedOnlyAttackSchema = new SimpleSchema()
.extend(ComputedOnlyActionSchema)
.extend({
rollBonusResult: {
type: Number,
optional: true,
},
rollBonusErrors: {
type: Array,
optional: true,
},
'rollBonusErrors.$':{
type: ErrorSchema,
},
});
const ComputedAttackSchema = new SimpleSchema()
.extend(AttackSchema)
.extend(ComputedOnlyAttackSchema);
export { AttackSchema, ComputedOnlyAttackSchema, ComputedAttackSchema };

View File

@@ -3,6 +3,7 @@ import DAMAGE_TYPES from '/imports/constants/DAMAGE_TYPES.js';
const DamageSchema = new SimpleSchema({
// The roll that determines how much to damage the attribute
// This can be simplified, but only computed when applied
amount: {
type: String,
optional: true,

View File

@@ -38,7 +38,6 @@ let EffectSchema = new SimpleSchema({
},
'stats.$': {
type: String,
optional: true,
},
});

View File

@@ -12,7 +12,6 @@ let ProficiencySchema = new SimpleSchema({
},
'stats.$': {
type: String,
optional: true,
},
// A number representing how proficient the character is
value: {

View File

@@ -19,7 +19,7 @@ import SimpleSchema from 'simpl-schema';
* child rolls are applied
*/
let RollSchema = new SimpleSchema({
// The roll
// The roll, can be simplified, but only computed in context
roll: {
type: String,
optional: true,

View File

@@ -1,4 +1,5 @@
import SimpleSchema from 'simpl-schema';
import ErrorSchema from '/imports/api/properties/subSchemas/ErrorSchema.js';
// These are the rolls made when saves are called for
// For the saving throw bonus or proficiency, see ./Skills.js
@@ -18,4 +19,22 @@ let SavingThrowSchema = new SimpleSchema ({
},
});
export { SavingThrowSchema };
const ComputedOnlySavingThrowSchema = new SimpleSchema({
dcResult: {
type: Number,
optional: true,
},
dcErrors: {
type: Array,
optional: true,
},
'dcErrors.$':{
type: ErrorSchema,
},
});
const ComputedSavingThrowSchema = new SimpleSchema()
.extend(SavingThrowSchema)
.extend(ComputedOnlySavingThrowSchema);
export { SavingThrowSchema, ComputedOnlySavingThrowSchema, ComputedSavingThrowSchema };

View File

@@ -1,4 +1,5 @@
import SimpleSchema from 'simpl-schema';
import ErrorSchema from '/imports/api/properties/subSchemas/ErrorSchema.js';
let SpellListSchema = new SimpleSchema({
name: {
@@ -16,4 +17,22 @@ let SpellListSchema = new SimpleSchema({
},
});
export { SpellListSchema }
const ComputedOnlySpellListSchema = new SimpleSchema({
maxPreparedResult: {
type: Number,
optional: true,
},
maxPreparedErrors: {
type: Array,
optional: true,
},
'maxPreparedErrors.$':{
type: ErrorSchema,
},
});
const ComputedSpellListSchema = new SimpleSchema()
.extend(SpellListSchema)
.extend(ComputedOnlySpellListSchema);
export { SpellListSchema, ComputedOnlySpellListSchema, ComputedSpellListSchema };

View File

@@ -1,4 +1,4 @@
import { ActionSchema } from '/imports/api/properties/Actions.js';
import { ActionSchema, ComputedOnlyActionSchema } from '/imports/api/properties/Actions.js';
import SimpleSchema from 'simpl-schema';
const magicSchools = [
@@ -93,4 +93,11 @@ let SpellSchema = new SimpleSchema({})
},
});
export { SpellSchema };
const ComputedOnlySpellSchema = new SimpleSchema()
.extend(ComputedOnlyActionSchema);
const ComputedSpellSchema = new SimpleSchema()
.extend(SpellSchema)
.extend(ComputedOnlySpellSchema);
export { SpellSchema, ComputedOnlySpellSchema, ComputedSpellSchema };

View File

@@ -1,7 +1,7 @@
import SimpleSchema from 'simpl-schema';
import { ActionSchema } from '/imports/api/properties/Actions.js';
import { ComputedActionSchema } from '/imports/api/properties/Actions.js';
import { AdjustmentSchema } from '/imports/api/properties/Adjustments.js';
import { AttackSchema } from '/imports/api/properties/Attacks.js';
import { ComputedAttackSchema } from '/imports/api/properties/Attacks.js';
import { ComputedAttributeSchema } from '/imports/api/properties/Attributes.js';
import { BuffSchema } from '/imports/api/properties/Buffs.js';
import { ClassLevelSchema } from '/imports/api/properties/ClassLevels.js';
@@ -15,17 +15,17 @@ import { ItemSchema } from '/imports/api/properties/Items.js';
import { NoteSchema } from '/imports/api/properties/Notes.js';
import { ProficiencySchema } from '/imports/api/properties/Proficiencies.js';
import { RollSchema } from '/imports/api/properties/Rolls.js';
import { SavingThrowSchema } from '/imports/api/properties/SavingThrows.js';
import { ComputedSavingThrowSchema } from '/imports/api/properties/SavingThrows.js';
import { ComputedSkillSchema } from '/imports/api/properties/Skills.js';
import { SlotSchema } from '/imports/api/properties/Slots.js';
import { SpellSchema } from '/imports/api/properties/Spells.js';
import { SpellListSchema } from '/imports/api/properties/SpellLists.js';
import { ComputedSpellSchema } from '/imports/api/properties/Spells.js';
import { ComputedSpellListSchema } from '/imports/api/properties/SpellLists.js';
import { ToggleSchema } from '/imports/api/properties/Toggles.js';
const propertySchemasIndex = {
action: ActionSchema,
action: ComputedActionSchema,
adjustment: AdjustmentSchema,
attack: AttackSchema,
attack: ComputedAttackSchema,
attribute: ComputedAttributeSchema,
buff: BuffSchema,
classLevel: ClassLevelSchema,
@@ -37,11 +37,11 @@ const propertySchemasIndex = {
note: NoteSchema,
proficiency: ProficiencySchema,
roll: RollSchema,
savingThrow: SavingThrowSchema,
savingThrow: ComputedSavingThrowSchema,
skill: ComputedSkillSchema,
slot: SlotSchema,
spellList: SpellListSchema,
spell: SpellSchema,
spellList: ComputedSpellSchema,
spell: ComputedSpellListSchema,
toggle: ToggleSchema,
container: ContainerSchema,
item: ItemSchema,

View File

@@ -1,11 +1,9 @@
import SimpleSchema from 'simpl-schema';
const ErrorSchema = new SimpleSchema({
// The roll that determines how much to change the attribute
message: {
type: String,
},
// Who this adjustment applies to
type: {
type: String,
},

View File

@@ -17,6 +17,10 @@ const ItemConsumedSchema = new SimpleSchema({
type: Number,
defaultValue: 1,
},
itemId: {
type: String,
optional: true,
},
});
export default ItemConsumedSchema;

View File

@@ -4,13 +4,19 @@ import fetchDocByRef from '/imports/api/parenting/fetchDocByRef.js';
import getCollectionByName from '/imports/api/parenting/getCollectionByName.js';
import { RefSchema } from '/imports/api/parenting/ChildSchema.js';
import { ValidatedMethod } from 'meteor/mdg:validated-method';
import { RateLimiterMixin } from 'ddp-rate-limiter-mixin';
const setPublic = new ValidatedMethod({
name: 'sharing.methods.setPublic',
name: 'sharing.setPublic',
validate: new SimpleSchema({
docRef: RefSchema,
isPublic: { type: Boolean },
}).validator(),
mixins: [RateLimiterMixin],
rateLimit: {
numRequests: 5,
timeInterval: 5000,
},
run({docRef, isPublic}){
let doc = fetchDocByRef(docRef);
assertOwnership(doc, this.userId);
@@ -21,7 +27,7 @@ const setPublic = new ValidatedMethod({
});
const updateUserSharePermissions = new ValidatedMethod({
name: 'sharing.methods.updateUserSharePermissions',
name: 'sharing.updateUserSharePermissions',
validate: new SimpleSchema({
docRef: RefSchema,
userId: {
@@ -33,6 +39,11 @@ const updateUserSharePermissions = new ValidatedMethod({
allowedValues: ['reader', 'writer', 'none'],
},
}).validator(),
mixins: [RateLimiterMixin],
rateLimit: {
numRequests: 5,
timeInterval: 5000,
},
run({docRef, userId, role}){
let doc = fetchDocByRef(docRef);
if (role === 'none'){

View File

@@ -1,5 +1,6 @@
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';
let Invites= new Mongo.Collection('invites');
@@ -85,13 +86,18 @@ function alignInvitesWithPatreonTier(user){
}
const getInviteToken = new ValidatedMethod({
name: 'Invites.methods.getToken',
name: 'invites.getToken',
validate: new SimpleSchema({
inviteId: {
type: String,
regEx: SimpleSchema.RegEx.Id,
},
}).validator(),
mixins: [RateLimiterMixin],
rateLimit: {
numRequests: 5,
timeInterval: 5000,
},
run({inviteId}) {
let invite = Invites.findOne(inviteId);
if (this.userId !== invite.inviter) {
@@ -109,12 +115,17 @@ const getInviteToken = new ValidatedMethod({
});
const acceptInviteToken = new ValidatedMethod({
name: 'Invites.methods.acceptToken',
name: 'invites.acceptToken',
validate: new SimpleSchema({
inviteToken: {
type: String,
},
}).validator(),
mixins: [RateLimiterMixin],
rateLimit: {
numRequests: 5,
timeInterval: 5000,
},
run({inviteToken}) {
if (!this.userId) {
throw new Meteor.Error('Invites.methods.acceptToken.denied',
@@ -146,13 +157,18 @@ const acceptInviteToken = new ValidatedMethod({
});
const revokeInvite = new ValidatedMethod({
name: 'Invites.methods.revokeInvite',
name: 'invites.revokeInvite',
validate: new SimpleSchema({
inviteId: {
type: String,
regEx: SimpleSchema.RegEx.Id,
},
}).validator(),
mixins: [RateLimiterMixin],
rateLimit: {
numRequests: 5,
timeInterval: 5000,
},
run({inviteId}) {
if (!this.userId) {
throw new Meteor.Error('Invites.methods.revokeInvite.denied',

View File

@@ -1,5 +1,6 @@
import SimpleSchema from 'simpl-schema';
import { ValidatedMethod } from 'meteor/mdg:validated-method';
import { RateLimiterMixin } from 'ddp-rate-limiter-mixin';
const userSchema = new SimpleSchema({
username: {
@@ -87,8 +88,13 @@ const userSchema = new SimpleSchema({
Meteor.users.attachSchema(userSchema);
Meteor.users.generateApiKey = new ValidatedMethod({
name: 'Users.methods.generateApiKey',
name: 'users.generateApiKey',
validate: null,
mixins: [RateLimiterMixin],
rateLimit: {
numRequests: 5,
timeInterval: 5000,
},
run(){
if(Meteor.isClient) return;
var user = Meteor.users.findOne(this.userId);
@@ -100,10 +106,15 @@ Meteor.users.generateApiKey = new ValidatedMethod({
});
Meteor.users.setDarkMode = new ValidatedMethod({
name: 'Users.methods.setDarkMode',
name: 'users.setDarkMode',
validate: new SimpleSchema({
darkMode: { type: Boolean },
}).validator(),
mixins: [RateLimiterMixin],
rateLimit: {
numRequests: 5,
timeInterval: 5000,
},
run({darkMode}){
if (!this.userId) return;
Meteor.users.update(this.userId, {$set: {darkMode}});
@@ -111,7 +122,7 @@ Meteor.users.setDarkMode = new ValidatedMethod({
});
Meteor.users.sendVerificationEmail = new ValidatedMethod({
name: 'Users.methods.sendVerificationEmail',
name: 'users.sendVerificationEmail',
validate: new SimpleSchema({
userId:{
type: String,
@@ -121,6 +132,11 @@ Meteor.users.sendVerificationEmail = new ValidatedMethod({
type: String,
},
}).validator(),
mixins: [RateLimiterMixin],
rateLimit: {
numRequests: 5,
timeInterval: 5000,
},
run({userId, address}){
userId = this.userId || userId;
let user = Meteor.users.findOne(userId);
@@ -143,8 +159,13 @@ Meteor.users.isAdmin = function(userId){
}
Meteor.users.canPickUsername = new ValidatedMethod({
name: 'Users.methods.canPickUsername',
name: 'users.canPickUsername',
validate: userSchema.pick('username').validator(),
mixins: [RateLimiterMixin],
rateLimit: {
numRequests: 5,
timeInterval: 5000,
},
run({username}){
if (Meteor.isClient) return;
let user = Accounts.findUserByUsername(username);
@@ -157,8 +178,13 @@ Meteor.users.canPickUsername = new ValidatedMethod({
});
Meteor.users.setUsername = new ValidatedMethod({
name: 'Users.methods.setUsername',
name: 'users.setUsername',
validate: userSchema.pick('username').validator(),
mixins: [RateLimiterMixin],
rateLimit: {
numRequests: 5,
timeInterval: 5000,
},
run({username}){
if (!this.userId) throw 'Can only set your username if logged in';
if (Meteor.isClient) return;
@@ -167,7 +193,7 @@ Meteor.users.setUsername = new ValidatedMethod({
});
Meteor.users.subscribeToLibrary = new ValidatedMethod({
name: 'Users.methods.subscribeToLibrary',
name: 'users.subscribeToLibrary',
validate: new SimpleSchema({
libraryId:{
type: String,
@@ -177,6 +203,11 @@ Meteor.users.subscribeToLibrary = new ValidatedMethod({
type: Boolean,
},
}).validator(),
mixins: [RateLimiterMixin],
rateLimit: {
numRequests: 5,
timeInterval: 5000,
},
run({libraryId, subscribe}){
if (!this.userId) throw 'Can only subscribe if logged in';
if (subscribe){
@@ -192,12 +223,17 @@ Meteor.users.subscribeToLibrary = new ValidatedMethod({
});
Meteor.users.findUserByUsernameOrEmail = new ValidatedMethod({
name: 'Users.methods.findUserByUsernameOrEmail',
name: 'users.findUserByUsernameOrEmail',
validate: new SimpleSchema({
usernameOrEmail:{
type: String,
},
}).validator(),
mixins: [RateLimiterMixin],
rateLimit: {
numRequests: 5,
timeInterval: 5000,
},
run({usernameOrEmail}){
if (Meteor.isClient) return;
let user = Accounts.findUserByUsername(usernameOrEmail) ||

View File

@@ -0,0 +1,6 @@
import { SimpleRest } from 'meteor/simple:rest';
SimpleRest.configure({
// No default collection methods get end points
collections: [],
});

View File

@@ -1,3 +1,4 @@
import '/imports/server/publications/publicationRateLimit.js';
import '/imports/server/publications/characterList.js';
import '/imports/server/publications/library.js';
import '/imports/server/publications/singleCharacter.js';

View File

@@ -0,0 +1,4 @@
// Limit all subscriptions to 1/s
DDPRateLimiter.addRule({
type: 'subscription',
}, 10, 10000);

View File

@@ -75,7 +75,9 @@ export default {
this.ackErrors = null;
} else if (typeof error === 'string'){
this.ackErrors = error;
} else {
} else if (error.reason){
this.ackErrors = error.reason;
} else {
this.ackErrors = 'Something went wrong'
console.error(error);
}

View File

@@ -34,8 +34,7 @@
drag_handle
</v-icon>
<!--{{node && node.order}}-->
<component
:is="treeNodeView"
<tree-node-view
:model="node"
:selected="selected"
/>
@@ -80,13 +79,13 @@
**/
import { canBeParent } from '/imports/api/parenting/parenting.js';
import { getPropertyIcon } from '/imports/constants/PROPERTIES.js';
import treeNodeViewIndex from '/imports/ui/properties/treeNodeViews/treeNodeViewIndex.js';
import TreeNodeView from '/imports/ui/properties/treeNodeViews/TreeNodeView.vue';
export default {
name: 'TreeNode',
components: {
...treeNodeViewIndex
},
components: {
TreeNodeView,
},
props: {
node: Object,
group: String,
@@ -100,10 +99,6 @@
expanded: false,
}},
computed: {
treeNodeView(){
let type = this.node.type;
return treeNodeViewIndex[type] || treeNodeViewIndex.default;
},
hasChildren(){
return this.children && this.children.length || this.lazy && !this.expanded;
},

View File

@@ -1,7 +1,6 @@
<template lang="html">
<v-btn
:loading="loading"
:disabled="loading"
outline
style="width: 160px;"
@click="rest"

View File

@@ -21,6 +21,39 @@
</v-card-text>
</v-card>
</div>
<div
v-if="appliedBuffs.length"
class="buffs"
>
<v-card>
<v-list>
<v-subheader>Buffs and conditions</v-subheader>
<v-list-tile
v-for="buff in appliedBuffs"
:key="buff._id"
:data-id="buff._id"
@click="clickProperty({_id: buff._id})"
>
<v-list-tile-content>
<v-list-tile-title>
{{ buff.name }}
</v-list-tile-title>
</v-list-tile-content>
<v-list-tile-action>
<v-btn
icon
flat
@click.stop="softRemove(buff._id)"
>
<v-icon>delete</v-icon>
</v-btn>
</v-list-tile-action>
</v-list-tile>
</v-list>
</v-card>
</div>
<div class="ability-scores">
<v-card>
<v-list>
@@ -165,6 +198,30 @@
</v-card>
</div>
<div
v-for="action in actions"
:key="action._id"
class="actions"
>
<action-card
:model="action"
:data-id="action._id"
@click="clickProperty({_id: action._id})"
/>
</div>
<div
v-for="attack in attacks"
:key="attack._id"
class="attacks"
>
<action-card
attack
:model="attack"
:data-id="attack._id"
@click="clickProperty({_id: attack._id})"
/>
</div>
<div
v-if="weapons && weapons.length"
class="weapon-proficiencies"
@@ -187,7 +244,7 @@
</div>
<div
v-if="armors && armors.length"
class="weapon-proficiencies"
class="armor-proficiencies"
>
<v-card>
<v-list>
@@ -207,7 +264,7 @@
</div>
<div
v-if="tools && tools.length"
class="weapon-proficiencies"
class="tool-proficiencies"
>
<v-card>
<v-list>
@@ -245,54 +302,13 @@
</v-list>
</v-card>
</div>
<div
v-if="actions.length"
class="actions"
>
<v-card>
<v-list
two-line
subheader
>
<v-subheader>Actions</v-subheader>
<action-list-tile
v-for="action in actions"
:key="action._id"
:model="action"
:data-id="action._id"
@click="clickProperty({_id: action._id})"
/>
</v-list>
</v-card>
</div>
<div
v-if="attacks.length"
class="actions"
>
<v-card>
<v-list
two-line
subheader
>
<v-subheader>Attacks</v-subheader>
<attack-list-tile
v-for="attack in attacks"
:key="attack._id"
:model="attack"
:data-id="attack._id"
@click="clickProperty({_id: attack._id})"
/>
</v-list>
</v-card>
</div>
</column-layout>
</div>
</template>
<script>
import Creatures from '/imports/api/creature/Creatures.js';
import { damageProperty } from '/imports/api/creature/CreatureProperties.js';
import { damageProperty, softRemoveProperty } from '/imports/api/creature/CreatureProperties.js';
import AttributeCard from '/imports/ui/properties/components/attributes/AttributeCard.vue';
import AbilityListTile from '/imports/ui/properties/components/attributes/AbilityListTile.vue';
import ColumnLayout from '/imports/ui/components/ColumnLayout.vue';
@@ -302,8 +318,7 @@
import SkillListTile from '/imports/ui/properties/components/skills/SkillListTile.vue';
import ResourceCard from '/imports/ui/properties/components/attributes/ResourceCard.vue';
import SpellSlotListTile from '/imports/ui/properties/components/attributes/SpellSlotListTile.vue';
import ActionListTile from '/imports/ui/properties/components/actions/ActionListTile.vue';
import AttackListTile from '/imports/ui/properties/components/actions/AttackListTile.vue';
import ActionCard from '/imports/ui/properties/components/actions/ActionCard.vue';
import RestButton from '/imports/ui/creature/RestButton.vue';
import getActiveProperties from '/imports/api/creature/getActiveProperties.js';
@@ -345,8 +360,7 @@
SkillListTile,
ResourceCard,
SpellSlotListTile,
ActionListTile,
AttackListTile,
ActionCard,
},
props: {
creatureId: {
@@ -400,8 +414,18 @@
actions(){
return getProperties(this.creature, {type: 'action'});
},
appliedBuffs(){
return getProperties(this.creature, {type: 'buff', applied: true});
},
attacks(){
return getProperties(this.creature, {type: 'attack'});
let props = getProperties(this.creature, {type: 'attack'}).map(attack => {
attack.children = getActiveProperties({
ancestorId: attack._id,
options: {sort: {order: 1}},
});
return attack;
});
return props;
},
},
methods: {
@@ -421,6 +445,11 @@
if (!obj) return 0;
return Object.keys(obj).length;
},
softRemove(_id){
softRemoveProperty.call({_id}, error => {
if (error) console.error(error);
});
}
},
};
</script>

View File

@@ -35,7 +35,7 @@
</p>
</v-fade-transition>
<template v-if="!editing && !embedded">
<v-divider />
<v-divider class="my-2" />
<creature-properties-tree
v-if="!editing"
:root="{collection: 'creatureProperties', id: model._id}"

View File

@@ -36,6 +36,7 @@
<div
slot="detail"
data-id="selected-node-card"
style="overflow: hidden;"
>
<library-node-dialog
:_id="selected"

View File

@@ -0,0 +1,244 @@
<template lang="html">
<v-card
class="action-card"
:class="cardClasses"
:elevation="hovering ? 8 : undefined"
>
<div class="layout row align-center px-3">
<div class="avatar">
<v-btn
flat
icon
outline
style="margin-left: -4px; font-size: 18px;"
:color="model.color || 'primary'"
:loading="doActionLoading"
:disabled="model.insufficientResources || !context.editPermission"
@click.stop="doAction"
>
<template v-if="attack && !rollBonusTooLong">
{{ rollBonus }}
</template>
<property-icon
v-else
:model="model"
/>
</v-btn>
</div>
<div
class="action-header flex layout column justify-center pl-1"
style="height: 72px; cursor: pointer;"
@mouseover="hovering = true"
@mouseleave="hovering = false"
@click="$emit('click')"
>
<div
class="action-title my-1"
>
{{ model.name || propertyName }}
</div>
<div class="action-sub-title layout row align-center">
<div class="flex">
{{ model.actionType }}
</div>
<div v-if="model.uses">
{{ usesLeft }} uses
</div>
</div>
</div>
</div>
<div class="px-3 pb-3">
<template
v-if="model.resources.attributesConsumed.length ||
model.resources.itemsConsumed.length"
>
<attribute-consumed-view
v-for="attributeConsumed in model.resources.attributesConsumed"
:key="attributeConsumed._id"
class="action-child"
:model="attributeConsumed"
/>
<item-consumed-view
v-for="itemConsumed in model.resources.itemsConsumed"
:key="itemConsumed._id"
class="action-child"
:model="itemConsumed"
:action="model"
/>
<v-divider
v-if="model.summary || children.length"
class="my-2"
/>
</template>
<template v-if="model.summary">
<property-description :value="model.summary" />
<v-divider
v-if="children.length"
class="my-2"
/>
</template>
<tree-node-view
v-for="child in children"
:key="child._id"
class="action-child"
:model="child"
/>
</div>
</v-card>
</template>
<script>
import { getPropertyName } from '/imports/constants/PROPERTIES.js';
import numberToSignedString from '/imports/ui/utility/numberToSignedString.js';
import doAction from '/imports/api/creature/actions/doAction.js';
import getActiveProperties from '/imports/api/creature/getActiveProperties.js';
import TreeNodeView from '/imports/ui/properties/treeNodeViews/TreeNodeView.vue';
import AttributeConsumedView from '/imports/ui/properties/components/actions/AttributeConsumedView.vue';
import ItemConsumedView from '/imports/ui/properties/components/actions/ItemConsumedView.vue';
import PropertyDescription from '/imports/ui/properties/viewers/shared/PropertyDescription.vue';
import PropertyIcon from '/imports/ui/properties/shared/PropertyIcon.vue';
export default {
components: {
TreeNodeView,
AttributeConsumedView,
ItemConsumedView,
PropertyDescription,
PropertyIcon,
},
inject: {
context: {
default: {},
},
theme: {
default: {
isDark: false,
},
},
},
props: {
model: {
type: Object,
required: true,
},
attack: {
type: Boolean,
},
},
data(){return {
activated: undefined,
doActionLoading: false,
hovering: false,
}},
computed: {
rollBonus(){
if (!this.attack) return;
return numberToSignedString(this.model.rollBonusResult);
},
rollBonusTooLong(){
return this.rollBonus && this.rollBonus.length > 3;
},
totalUses(){
return Math.max(this.model.usesResult, 0);
},
usesLeft(){
return Math.max(this.model.usesResult - this.model.usesUsed, 0);
},
propertyName(){
return getPropertyName(this.model.type);
},
cardClasses() {
return {
'theme--dark': this.theme.isDark,
'theme--light': !this.theme.isDark,
'muted-text': this.model.insufficientResources,
'shrink': this.activated,
}
},
actionTypeIcon() {
return `$vuetify.icons.${this.model.actionType}`;
},
},
meteor: {
children(){
return getActiveProperties({
ancestorId: this.model._id,
filter: {'parent.id': this.model._id},
options: {sort: {order: 1}},
});
},
},
methods: {
click(e){
this.$emit('click', e);
},
doAction(){
this.doActionLoading = true;
this.shwing();
doAction.call({actionId: this.model._id}, error => {
this.doActionLoading = false;
if (error){
console.error(error);
}
});
},
shwing(){
this.activated = true;
setTimeout(() => {
this.activated = undefined;
}, 300);
}
}
}
</script>
<style lang="css" scoped>
.action-title {
font-size: 16px;
font-weight: 400;
height: 24px;
line-height: 24px;
position: relative;
text-align: left;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
transition: .3s cubic-bezier(.25,.8,.5,1);
width: 100%;
}
.action-sub-title {
color: #9e9e9e;
flex-grow: 0;
font-size: 12px;
line-height: 12px;
height: 14px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
width: 100%;
}
.action-child {
height: 32px;
}
.theme--light.muted-text {
color: rgba(0,0,0,.3) !important;
}
.theme--dark.muted-text {
color: hsla(0,0%,100%,.3) !important;
}
.action-card {
transition: transform 0.15s cubic;
}
</style>
<style lang="css">
.action-card.theme--light.muted-text .v-icon {
color: rgba(0,0,0,.3) !important;
}
.action-card.theme--dark.muted-text .v-icon {
color: hsla(0,0%,100%,.3) !important;
}
.action-card .property-description > p:last-of-type {
margin-bottom: 0;
}
</style>

View File

@@ -1,36 +0,0 @@
<template lang="html">
<v-list-tile
class="ability-list-tile"
v-on="hasClickListener ? {click} : {}"
>
<v-list-tile-content>
<v-list-tile-title>
{{ model.name }}
</v-list-tile-title>
</v-list-tile-content>
</v-list-tile>
</template>
<script>
export default {
props: {
model: {
type: Object,
required: true,
}
},
computed: {
hasClickListener(){
return this.$listeners && this.$listeners.click
},
},
methods: {
click(e){
this.$emit('click', e);
},
}
}
</script>
<style lang="css" scoped>
</style>

View File

@@ -1,49 +0,0 @@
<template lang="html">
<v-list-tile
class="ability-list-tile"
avatar
v-on="hasClickListener ? {click} : {}"
>
<v-list-tile-avatar color="grey darken-1">
<computed
signed
:value="model.rollBonus"
class="white--text headline"
/>
</v-list-tile-avatar>
<v-list-tile-content>
<v-list-tile-title>
{{ model.name }}
</v-list-tile-title>
</v-list-tile-content>
</v-list-tile>
</template>
<script>
import ComputedForCreature from '/imports/ui/components/computation/ComputedForCreature.vue';
export default {
components: {
Computed: ComputedForCreature,
},
props: {
model: {
type: Object,
required: true,
}
},
computed: {
hasClickListener(){
return this.$listeners && this.$listeners.click
},
},
methods: {
click(e){
this.$emit('click', e);
},
}
}
</script>
<style lang="css" scoped>
</style>

View File

@@ -0,0 +1,34 @@
<template lang="html">
<div
class="layout row align-center justify-start"
:class="insufficient && 'error--text'"
>
<div
class="mr-2"
style="width: 24px; text-align: center;"
>
{{ model.quantity }}
</div>
<div
class="text-no-wrap text-truncate"
>
{{ model.statName || model.variableName }}
</div>
</div>
</template>
<script>
export default {
props: {
model: {
type: Object,
default: () => ({}),
},
},
computed: {
insufficient(){
return this.model.quantity > this.model.available;
},
},
}
</script>

View File

@@ -0,0 +1,133 @@
<template lang="html">
<div
:class="{
'theme--dark': theme.isDark,
'theme--light': !theme.isDark,
}"
>
<v-menu
v-if="context.creature"
transition="slide-y-transition"
lazy
:disabled="!context.editPermission"
>
<template #activator="{ on }">
<div
class="layout row align-center justify-start"
style="height: 100%;"
:class="{
'error--text': insufficient,
'clickable': context.creature && context.editPermission,
'left-pad': leftPad,
}"
v-on="on"
>
<svg-icon
v-if="model.itemIcon"
class="mr-2"
:shape="model.itemIcon.shape"
:color="model.itemColor"
/>
<div
class="mr-2 text-no-wrap"
style="min-width: 24px; text-align: center;"
>
<template v-if="model.quantity !== 0 && insufficient">
{{ model.available }} / {{ model.quantity }}
</template>
<template v-else>
{{ model.available }}
</template>
</div>
<div
class="text-no-wrap text-truncate flex"
>
<template v-if="model.itemId">
{{ model.itemName }}
</template>
<span
v-else
class="error--text"
>
Select ammo
</span>
</div>
<v-icon v-if="context.editPermission">
arrow_drop_down
</v-icon>
</div>
</template>
<select-item-to-consume
:action="action"
:item-consumed="model"
/>
</v-menu>
<div
v-else
class="layout row align-center justify-start"
:class="{'left-pad': leftPad}"
>
<div
class="mr-2"
style="width: 24px; text-align: center;"
>
{{ model.quantity }}
</div>
<div
class="text-no-wrap text-truncate"
>
[{{ model.tag }}]
</div>
</div>
</div>
</template>
<script>
import SelectItemToConsume from '/imports/ui/properties/components/actions/SelectItemToConsume.vue';
export default {
components: {
SelectItemToConsume,
},
inject: {
context: {
default: {},
},
theme: {
default: {
isDark: false,
},
},
},
props: {
model: {
type: Object,
default: () => ({}),
},
action: {
type: Object,
required: true,
},
leftPad: Boolean,
},
computed: {
insufficient(){
return this.model.quantity > this.model.available;
},
},
}
</script>
<style lang="css" scoped>
.clickable {
cursor: pointer;
}
.theme--light .clickable:hover {
background: rgba(0,0,0,.04);
}
.theme--dark .clickable:hover {
background: hsla(0,0%,100%,.08);
}
.left-pad {
padding-left: 44px;
}
</style>

View File

@@ -0,0 +1,73 @@
<template lang="html">
<v-list v-if="items.length">
<v-list-tile
v-for="item in items"
:key="item._id"
@click="selectItem(item._id)"
>
<item-tree-node
:model="item"
:selected="itemConsumed.itemId === item._id"
/>
</v-list-tile>
</v-list>
<v-card v-else>
<v-card-text>
No equipped items found with the tag "{{ itemConsumed.tag }}"
</v-card-text>
</v-card>
</template>
<script>
import ItemTreeNode from '/imports/ui/properties/treeNodeViews/ItemTreeNode.vue';
import getActiveProperties from '/imports/api/creature/getActiveProperties.js';
import { selectAmmoItem } from '/imports/api/creature/CreatureProperties.js';
import { findIndex } from 'lodash';
export default {
components: {
ItemTreeNode
},
props: {
action: {
type: Object,
required: true,
},
itemConsumed: {
type: Object,
required: true,
},
},
meteor: {
items(){
return getActiveProperties({
ancestorId: this.action.ancestors[0].id,
filter: {
tags: this.itemConsumed.tag,
equipped: true,
},
options: {
fields: {equipped: false},
}
});
}
},
methods:{
selectItem(itemId){
let itemConsumedIndex = findIndex(
this.action.resources.itemsConsumed,
item => item._id === this.itemConsumed._id
);
selectAmmoItem.call({
actionId: this.action._id,
itemId,
itemConsumedIndex
}, error => {
if (error) console.error(error);
});
}
}
}
</script>
<style lang="css" scoped>
</style>

View File

@@ -1,5 +1,13 @@
<template lang="html">
<div :class="attackForm ? 'attack-form' : 'action-form'">
<div class="layout column align-center">
<icon-picker
label="Icon"
:value="model.icon"
:error-messages="errors.icon"
@change="change('icon', ...arguments)"
/>
</div>
<text-field
ref="focusFirst"
label="Name"
@@ -23,8 +31,16 @@
:error-messages="errors.rollBonus"
@change="change('rollBonus', ...arguments)"
/>
<text-area
label="Summary"
hint="This will appear in the action card in the character sheet"
:value="model.summary"
:error-messages="errors.summary"
@change="change('summary', ...arguments)"
/>
<text-area
label="Description"
hint="The rest of the description that doesn't fit in the summary goes here"
:value="model.description"
:error-messages="errors.description"
@change="change('description', ...arguments)"

View File

@@ -13,6 +13,7 @@
:error-messages="errors.description"
@change="change('description', ...arguments)"
/>
<!-- Duration not implemented yet
<text-field
label="Duration"
hint="How long the buff lasts"
@@ -20,6 +21,16 @@
:error-messages="errors.duration"
@change="change('duration', ...arguments)"
/>
-->
<smart-select
label="Target"
:hint="targetOptionHint"
:items="targetOptions"
:value="model.target"
:error-messages="errors.target"
:menu-props="{auto: true, lazy: true}"
@change="change('target', ...arguments)"
/>
</div>
</template>

View File

@@ -9,9 +9,11 @@
/>
<div class="layout row wrap justify-start proficiency-form">
<smart-combobox
label="Skill"
label="Skills"
class="mr-2"
multiple
chips
deletable-chips
:value="model.stats"
:items="skillList"
:error-messages="errors.stats"
@@ -22,7 +24,7 @@
style="flex-basis: 300px;"
:clearable="false"
:value="model.value"
@change="change('stats', ...arguments)"
@change="change('value', ...arguments)"
/>
</div>
</div>

View File

@@ -0,0 +1,30 @@
<template lang="html">
<component
:is="treeNodeView"
:model="model"
:selected="selected"
/>
</template>
<script>
import treeNodeViewIndex from '/imports/ui/properties/treeNodeViews/treeNodeViewIndex.js';
export default {
components: {
...treeNodeViewIndex
},
props: {
model: {
type: Object,
required: true,
},
selected: Boolean,
},
computed: {
treeNodeView(){
let type = this.model.type;
return treeNodeViewIndex[type] || treeNodeViewIndex.default;
},
}
}
</script>

View File

@@ -1,47 +1,144 @@
<template lang="html">
<div class="action-viewer">
<property-field
name="Action type"
:value="model.actionType"
/>
<property-field
name="Target"
:value="model.target"
/>
<property-field
v-if="model.tags.length"
name="tags"
:value="model.tags.join(', ')"
/>
<property-field
name="Uses"
<div class="action-sub-title layout row align-center justify-space-between wrap mb-3">
<property-tags
:tags="model.tags"
no-margin
class="mx-2"
/>
<div
v-if="!attack"
class="mx-2"
>
{{ model.actionType }}
</div>
</div>
<div class="layout row align-center justify-space-around">
<v-btn
v-if="context.creature"
flat
outline
style="font-size: 18px;"
class="ma-2"
:color="model.color || 'primary'"
:icon="!rollBonusTooLong"
:loading="doActionLoading"
:disabled="model.insufficientResources || !context.editPermission"
@click.stop="doAction"
>
<template v-if="attack">
{{ rollBonus }}
</template>
<property-icon
v-else
:model="model"
/>
</v-btn>
<div
v-else-if="attack"
style="font-size: 18px;"
class="ma-2"
>
<code>{{ model.rollBonus }}</code>
<span
class="mx-1"
style="font-size: 14px"
>to hit</span>
</div>
<div v-if="model.uses">
<span
v-if="context.creature"
class="uses mx-2"
>
{{ usesLeft }}/{{ model.usesResult }} uses
</span>
<span v-else>
<code>{{ model.uses }}</code>
<span class="mx-1">
uses
</span>
</span>
<span
v-if="reset"
class="mx-2"
>
{{ reset }}
</span>
<v-btn
v-if="context.creature"
outline
color="primary"
:disabled="!model.usesUsed || !context.editPermission"
@click="resetUses"
>
Reset
</v-btn>
</div>
</div>
<v-subheader
v-if="model.resources.attributesConsumed.length ||
model.resources.itemsConsumed.length"
style="height: 32px"
>
<computed :value="model.uses"/>
</property-field>
<property-field
name="Uses used"
:value="model.usesUsed"
Resources
</v-subheader>
<attribute-consumed-view
v-for="attributeConsumed in model.resources.attributesConsumed"
:key="attributeConsumed._id"
class="action-child"
:model="attributeConsumed"
style="padding-left: 44px;"
/>
<property-field
name="Reset"
:value="reset"
<item-consumed-view
v-for="itemConsumed in model.resources.itemsConsumed"
:key="itemConsumed._id"
class="action-child"
:model="itemConsumed"
:action="model"
left-pad
/>
<property-description
v-if="model.description"
:value="model.description"
<v-divider
v-if="model.summary || model.description"
class="my-3"
/>
<template v-if="model.summary">
<property-description :value="model.summary" />
<v-divider
v-if="model.description"
class="my-3"
/>
</template>
<property-description :value="model.description" />
</div>
</template>
<script>
import propertyViewerMixin from '/imports/ui/properties/viewers/shared/propertyViewerMixin.js';
import ComputedForCreature from '/imports/ui/components/computation/ComputedForCreature.vue';
import numberToSignedString from '/imports/ui/utility/numberToSignedString.js';
import doAction from '/imports/api/creature/actions/doAction.js';
import AttributeConsumedView from '/imports/ui/properties/components/actions/AttributeConsumedView.vue';
import ItemConsumedView from '/imports/ui/properties/components/actions/ItemConsumedView.vue';
import PropertyIcon from '/imports/ui/properties/shared/PropertyIcon.vue';
import { updateProperty } from '/imports/api/creature/CreatureProperties.js';
export default {
mixins: [propertyViewerMixin],
components: {
Computed: ComputedForCreature,
AttributeConsumedView,
ItemConsumedView,
PropertyIcon,
},
mixins: [propertyViewerMixin],
props: {
attack: Boolean,
},
inject: {
context: {
default: {},
},
},
data(){return {
doActionLoading: false,
}},
computed: {
reset(){
let reset = this.model.reset
@@ -51,10 +148,52 @@ export default {
return 'Reset on a long rest';
}
return undefined;
}
},
rollBonus(){
if (!this.attack) return;
return numberToSignedString(this.model.rollBonusResult);
},
rollBonusTooLong(){
return this.rollBonus && this.rollBonus.length > 3;
},
totalUses(){
return Math.max(this.model.usesResult, 0);
},
usesLeft(){
return Math.max(this.model.usesResult - this.model.usesUsed, 0);
},
actionTypeIcon() {
return `$vuetify.icons.${this.model.actionType}`;
},
},
methods: {
doAction(){
this.doActionLoading = true;
doAction.call({actionId: this.model._id}, error => {
this.doActionLoading = false;
if (error){
console.error(error);
}
});
},
resetUses(){
updateProperty.call({
_id: this.model._id,
path: ['usesUsed'],
value: 0,
});
},
},
}
</script>
<style lang="css" scoped>
.action-sub-title {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.action-child {
height: 40px;
}
</style>

View File

@@ -1,37 +1,18 @@
<template lang="html">
<div class="attack-viewer">
<property-field name="Attack roll bonus">
<computed
signed
:value="model.rollBonus"
/>
</property-field>
<action-viewer :model="model" />
</div>
<action-viewer
:model="model"
attack
/>
</template>
<script>
import propertyViewerMixin from '/imports/ui/properties/viewers/shared/propertyViewerMixin.js';
import ComputedForCreature from '/imports/ui/components/computation/ComputedForCreature.vue';
import ActionViewer from '/imports/ui/properties/viewers/ActionViewer.vue';
export default {
components: {
ActionViewer,
Computed: ComputedForCreature,
},
mixins: [propertyViewerMixin],
computed: {
reset(){
let reset = this.model.reset
if (reset === 'shortRest'){
return 'Reset on a short rest';
} else if (reset === 'longRest'){
return 'Reset on a long rest';
}
return undefined;
}
},
}
</script>

View File

@@ -7,7 +7,7 @@
/>
{{ model.damageType }}
<span v-if="model.damageType !== 'healing'">
damage
&nbsp;damage
</span>
</div>
</template>

View File

@@ -3,10 +3,7 @@
<property-name :value="model.name" />
<property-description :value="model.summary" />
<v-divider class="mt-3 mb-3" />
<property-description
v-if="model.description"
:value="model.description"
/>
<property-description :value="model.description" />
</div>
</template>

View File

@@ -1,5 +1,6 @@
<template lang="html">
<computed
v-if="value"
class="property-description"
embedded
:value="value"

View File

@@ -1,7 +1,8 @@
<template lang="html">
<div
v-if="tagString"
class="tags ma-3 "
class="tags"
:class="{'ma-3': !noMargin}"
>
{{ tagString }}
</div>
@@ -13,7 +14,8 @@ export default {
tags: {
type: Array,
default: () => [],
}
},
noMargin: Boolean,
},
computed:{
tagString(){

24
app/package-lock.json generated
View File

@@ -142,6 +142,22 @@
"integrity": "sha512-+Ryf6g3BKoRc7jfp7ad8tM4TtMiaWvbF/1/sQcZPkkS7ag3D5nMBCe2UfOTONtAkaG0tO0ij3C5Lwmf1EiyjHg==",
"dev": true
},
"babel-runtime": {
"version": "6.26.0",
"resolved": "https://registry.npmjs.org/babel-runtime/-/babel-runtime-6.26.0.tgz",
"integrity": "sha1-llxwWGaOgrVde/4E/yM3vItWR/4=",
"requires": {
"core-js": "^2.4.0",
"regenerator-runtime": "^0.11.0"
},
"dependencies": {
"regenerator-runtime": {
"version": "0.11.1",
"resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.11.1.tgz",
"integrity": "sha512-MguG95oij0fC3QV3URf4V2SDYGJhJnJGqvIIgdECeODCT98wSWDAJ94SSuVpYQUoTcGUIL6L4yNB7j1DFFHSBg=="
}
}
},
"balanced-match": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz",
@@ -375,6 +391,14 @@
"resolved": "https://registry.npmjs.org/date-fns/-/date-fns-1.30.1.tgz",
"integrity": "sha512-hBSVCvSmWC+QypYObzwGOd9wqdDpOt+0wl0KbU+R+uuZBS1jN8VsD1ss3irQDknRj5NvxiTF6oj/nDRnN/UQNw=="
},
"ddp-rate-limiter-mixin": {
"version": "1.1.10",
"resolved": "https://registry.npmjs.org/ddp-rate-limiter-mixin/-/ddp-rate-limiter-mixin-1.1.10.tgz",
"integrity": "sha1-WIx5zw8RUrUKtbGHBkLKAcZy5uY=",
"requires": {
"babel-runtime": "6.x.x"
}
},
"debug": {
"version": "3.2.6",
"resolved": "https://registry.npmjs.org/debug/-/debug-3.2.6.tgz",

View File

@@ -24,6 +24,7 @@
"core-js": "^2.6.11",
"css-box-shadow": "^1.0.0-3",
"date-fns": "^1.30.1",
"ddp-rate-limiter-mixin": "^1.1.10",
"dompurify": "^2.0.10",
"lodash": "^4.17.15",
"marked": "^0.8.2",

View File

@@ -1,3 +1,4 @@
import '/imports/server/config/SimpleRestConfig.js';
import '/imports/server/publications/index.js';
import '/imports/server/config/simpleSchemaDebug.js';
import '/imports/server/cron/deleteSoftRemovedDocuments.js';