Compare commits
10 Commits
2.0-beta.3
...
2.0-beta.3
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fd79bc2bb3 | ||
|
|
1050442606 | ||
|
|
53ed271ea2 | ||
|
|
6ccbf204eb | ||
|
|
d44d4e0315 | ||
|
|
2b8f7e4927 | ||
|
|
65e7ce6dce | ||
|
|
24cc87d6f7 | ||
|
|
03578b2066 | ||
|
|
6ea882a053 |
@@ -24,7 +24,9 @@ export default function getSlotFillFilter({slot, libraryIds}){
|
|||||||
slotFillerType: 'classLevel',
|
slotFillerType: 'classLevel',
|
||||||
}]
|
}]
|
||||||
});
|
});
|
||||||
filter.variableName = slot.variableName;
|
if (slot.variableName) {
|
||||||
|
filter.variableName = slot.variableName;
|
||||||
|
}
|
||||||
|
|
||||||
// Only search for levels the class needs
|
// Only search for levels the class needs
|
||||||
if (slot.missingLevels && slot.missingLevels.length) {
|
if (slot.missingLevels && slot.missingLevels.length) {
|
||||||
|
|||||||
@@ -38,6 +38,11 @@ let CreatureSettingsSchema = new SimpleSchema({
|
|||||||
type: Boolean,
|
type: Boolean,
|
||||||
optional: true,
|
optional: true,
|
||||||
},
|
},
|
||||||
|
// Hide calculation errors
|
||||||
|
hideCalculationErrors: {
|
||||||
|
type: Boolean,
|
||||||
|
optional: true,
|
||||||
|
},
|
||||||
// How much each hitDice resets on a long rest
|
// How much each hitDice resets on a long rest
|
||||||
hitDiceResetMultiplier: {
|
hitDiceResetMultiplier: {
|
||||||
type: Number,
|
type: Number,
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import { ValidatedMethod } from 'meteor/mdg:validated-method';
|
|||||||
import { RateLimiterMixin } from 'ddp-rate-limiter-mixin';
|
import { RateLimiterMixin } from 'ddp-rate-limiter-mixin';
|
||||||
import CreatureProperties from '/imports/api/creature/creatureProperties/CreatureProperties.js';
|
import CreatureProperties from '/imports/api/creature/creatureProperties/CreatureProperties.js';
|
||||||
import { assertEditPermission } from '/imports/api/creature/creatures/creaturePermissions.js';
|
import { assertEditPermission } from '/imports/api/creature/creatures/creaturePermissions.js';
|
||||||
import { groupBy, remove, rest, union } from 'lodash';
|
import { groupBy, remove, union } from 'lodash';
|
||||||
import {
|
import {
|
||||||
getCreature, getVariables, getPropertiesOfType
|
getCreature, getVariables, getPropertiesOfType
|
||||||
} from '/imports/api/engine/loadCreatures.js';
|
} from '/imports/api/engine/loadCreatures.js';
|
||||||
|
|||||||
@@ -11,15 +11,9 @@ export default function applyTriggers(node, { creature, targets, scope, log }, t
|
|||||||
const type = prop.type;
|
const type = prop.type;
|
||||||
if (creature.triggers?.[type]?.[timing]) {
|
if (creature.triggers?.[type]?.[timing]) {
|
||||||
creature.triggers[type][timing].forEach(trigger => {
|
creature.triggers[type][timing].forEach(trigger => {
|
||||||
// Tags
|
if (triggerMatchTags(trigger, prop)) {
|
||||||
if (!triggerMatchTags(trigger, prop)) return;
|
applyTrigger(trigger, { creature, targets, scope, log });
|
||||||
// Condition
|
|
||||||
if (trigger.condition?.parseNode) {
|
|
||||||
recalculateCalculation(trigger.condition, scope, log);
|
|
||||||
if (!trigger.condition.value) return;
|
|
||||||
}
|
}
|
||||||
// Apply
|
|
||||||
applyTrigger(trigger, { creature, targets, scope, log });
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -57,6 +51,13 @@ function triggerMatchTags(trigger, prop) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function applyTrigger(trigger, { creature, targets, scope, log }) {
|
export function applyTrigger(trigger, { creature, targets, scope, log }) {
|
||||||
|
// Prevent triggers from firing if their condition is false
|
||||||
|
if (trigger.condition?.parseNode) {
|
||||||
|
recalculateCalculation(trigger.condition, scope, log);
|
||||||
|
if (!trigger.condition.value) return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Prevent triggers from firing themselves in a loop
|
||||||
if (trigger.firing) {
|
if (trigger.firing) {
|
||||||
/*
|
/*
|
||||||
log.content.push({
|
log.content.push({
|
||||||
|
|||||||
@@ -31,9 +31,10 @@ function childrenActive(prop){
|
|||||||
switch (prop.type){
|
switch (prop.type){
|
||||||
// Only equipped items have active children
|
// Only equipped items have active children
|
||||||
case 'item': return !!prop.equipped;
|
case 'item': return !!prop.equipped;
|
||||||
// The children of actions are always inactive
|
// The children of actions, spells, and triggers are always inactive
|
||||||
case 'action': return false;
|
case 'action': return false;
|
||||||
case 'spell': return false;
|
case 'spell': return false;
|
||||||
|
case 'trigger': return false;
|
||||||
// The children of notes are always inactive
|
// The children of notes are always inactive
|
||||||
case 'note': return false;
|
case 'note': return false;
|
||||||
// Other children are active
|
// Other children are active
|
||||||
|
|||||||
@@ -56,12 +56,14 @@ function pushDependenciesToStack(nodeId, graph, stack, computation){
|
|||||||
oriented: true
|
oriented: true
|
||||||
});
|
});
|
||||||
const loop = pather.find(nodeId, nodeId);
|
const loop = pather.find(nodeId, nodeId);
|
||||||
computation.errors.push({
|
if (loop.length) {
|
||||||
type: 'dependencyLoop',
|
computation.errors.push({
|
||||||
details: {
|
type: 'dependencyLoop',
|
||||||
nodes: loop.map(node => node.id)
|
details: {
|
||||||
},
|
nodes: loop.map(node => node.id)
|
||||||
});
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
stack.push(linkedNode);
|
stack.push(linkedNode);
|
||||||
}, true);
|
}, true);
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
// https://github.com/VeliovGroup/Meteor-Files/blob/master/docs/aws-s3-integration.md
|
// https://github.com/VeliovGroup/Meteor-Files/blob/master/docs/aws-s3-integration.md
|
||||||
|
|
||||||
import { Meteor } from 'meteor/meteor';
|
import { Meteor } from 'meteor/meteor';
|
||||||
import { each, clone } from 'lodash';
|
import { each, clone } from 'lodash';
|
||||||
import { Random } from 'meteor/random';
|
import { Random } from 'meteor/random';
|
||||||
@@ -37,8 +36,9 @@ if (Meteor.isServer && Meteor.settings.useS3) {
|
|||||||
secretAccessKey: s3Conf.secret,
|
secretAccessKey: s3Conf.secret,
|
||||||
endpoint: s3Conf.endpoint,
|
endpoint: s3Conf.endpoint,
|
||||||
sslEnabled: true, // optional
|
sslEnabled: true, // optional
|
||||||
|
maxRetries: 10,
|
||||||
httpOptions: {
|
httpOptions: {
|
||||||
timeout: 6000,
|
timeout: 12000,
|
||||||
agent: false
|
agent: false
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -48,7 +48,7 @@ if (Meteor.isServer && Meteor.settings.useS3) {
|
|||||||
storagePath,
|
storagePath,
|
||||||
onBeforeUpload,
|
onBeforeUpload,
|
||||||
onAfterUpload,
|
onAfterUpload,
|
||||||
debug = Meteor.isProduction,
|
debug = !Meteor.isProduction,
|
||||||
allowClientCode = false,
|
allowClientCode = false,
|
||||||
}){
|
}){
|
||||||
const collection = new FilesCollection({
|
const collection = new FilesCollection({
|
||||||
@@ -222,7 +222,7 @@ if (Meteor.isServer && Meteor.settings.useS3) {
|
|||||||
storagePath,
|
storagePath,
|
||||||
onBeforeUpload,
|
onBeforeUpload,
|
||||||
onAfterUpload,
|
onAfterUpload,
|
||||||
debug = Meteor.isProduction,
|
debug = !Meteor.isProduction,
|
||||||
allowClientCode = false,
|
allowClientCode = false,
|
||||||
}){
|
}){
|
||||||
const collection = new FilesCollection({
|
const collection = new FilesCollection({
|
||||||
|
|||||||
@@ -16,8 +16,11 @@ const LIBRARY_NODE_TREE_FIELDS = {
|
|||||||
ancestors: 1,
|
ancestors: 1,
|
||||||
tags: 1,
|
tags: 1,
|
||||||
slotFillerCondition: 1,
|
slotFillerCondition: 1,
|
||||||
|
removed: 1,
|
||||||
|
removedAt: 1,
|
||||||
// SlotFillers
|
// SlotFillers
|
||||||
slotQuantityFilled: 1,
|
slotQuantityFilled: 1,
|
||||||
|
slotFillerType: 1,
|
||||||
// Effect
|
// Effect
|
||||||
operation: 1,
|
operation: 1,
|
||||||
targetTags: 1,
|
targetTags: 1,
|
||||||
|
|||||||
@@ -1,5 +1,13 @@
|
|||||||
<template lang="html">
|
<template lang="html">
|
||||||
<v-container fluid>
|
<v-container fluid>
|
||||||
|
<v-row dense>
|
||||||
|
<v-col cols="12">
|
||||||
|
<character-errors
|
||||||
|
class="mt-4"
|
||||||
|
:creature-id="creatureId"
|
||||||
|
/>
|
||||||
|
</v-col>
|
||||||
|
</v-row>
|
||||||
<v-row dense>
|
<v-row dense>
|
||||||
<v-col cols="12">
|
<v-col cols="12">
|
||||||
<slot-cards-to-fill :creature-id="creatureId" />
|
<slot-cards-to-fill :creature-id="creatureId" />
|
||||||
@@ -126,6 +134,7 @@ import BuildTreeNodeList from '/imports/ui/creature/buildTree/BuildTreeNodeList.
|
|||||||
import SlotCardsToFill from '/imports/ui/creature/slots/SlotCardsToFill.vue';
|
import SlotCardsToFill from '/imports/ui/creature/slots/SlotCardsToFill.vue';
|
||||||
import CreatureVariables from '../../../../api/creature/creatures/CreatureVariables';
|
import CreatureVariables from '../../../../api/creature/creatures/CreatureVariables';
|
||||||
import insertPropertyFromLibraryNode from '/imports/api/creature/creatureProperties/methods/insertPropertyFromLibraryNode.js';
|
import insertPropertyFromLibraryNode from '/imports/api/creature/creatureProperties/methods/insertPropertyFromLibraryNode.js';
|
||||||
|
import CharacterErrors from '/imports/ui/creature/character/errors/CharacterErrors.vue';
|
||||||
|
|
||||||
function traverse(tree, callback, parents = []){
|
function traverse(tree, callback, parents = []){
|
||||||
tree.forEach(node => {
|
tree.forEach(node => {
|
||||||
@@ -136,6 +145,7 @@ function traverse(tree, callback, parents = []){
|
|||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
|
CharacterErrors,
|
||||||
BuildTreeNodeList,
|
BuildTreeNodeList,
|
||||||
SlotCardsToFill,
|
SlotCardsToFill,
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -2,11 +2,6 @@
|
|||||||
<div
|
<div
|
||||||
class="stats-tab ma-2"
|
class="stats-tab ma-2"
|
||||||
>
|
>
|
||||||
<character-errors
|
|
||||||
class="mx-2 mt-4"
|
|
||||||
:creature-id="creatureId"
|
|
||||||
/>
|
|
||||||
|
|
||||||
<health-bar-card-container :creature-id="creatureId" />
|
<health-bar-card-container :creature-id="creatureId" />
|
||||||
|
|
||||||
<column-layout>
|
<column-layout>
|
||||||
@@ -374,7 +369,6 @@
|
|||||||
import ToggleCard from '/imports/ui/properties/components/toggles/ToggleCard.vue';
|
import ToggleCard from '/imports/ui/properties/components/toggles/ToggleCard.vue';
|
||||||
import doCastSpell from '/imports/api/engine/actions/doCastSpell.js';
|
import doCastSpell from '/imports/api/engine/actions/doCastSpell.js';
|
||||||
import {snackbar} from '/imports/ui/components/snackbars/SnackbarQueue.js';
|
import {snackbar} from '/imports/ui/components/snackbars/SnackbarQueue.js';
|
||||||
import CharacterErrors from '/imports/ui/creature/character/errors/CharacterErrors.vue';
|
|
||||||
|
|
||||||
const getProperties = function(creature, filter, options = {
|
const getProperties = function(creature, filter, options = {
|
||||||
sort: {order: 1}
|
sort: {order: 1}
|
||||||
@@ -419,7 +413,6 @@
|
|||||||
SpellSlotListTile,
|
SpellSlotListTile,
|
||||||
ActionCard,
|
ActionCard,
|
||||||
ToggleCard,
|
ToggleCard,
|
||||||
CharacterErrors,
|
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
creatureId: {
|
creatureId: {
|
||||||
|
|||||||
@@ -1,57 +1,109 @@
|
|||||||
<template>
|
<template>
|
||||||
<div
|
<div v-if="creature && errors && errors.length">
|
||||||
v-if="creature && creature.computeErrors"
|
<v-btn
|
||||||
class="character-sheet-errors"
|
fab
|
||||||
>
|
small
|
||||||
<template v-for="(error, index) in creature.computeErrors">
|
absolute
|
||||||
<dependency-loop-error
|
right
|
||||||
v-if="error.type === 'dependencyLoop'"
|
color="warning"
|
||||||
:key="index + 'dependencyLoopError'"
|
class="mr-4"
|
||||||
:model="error"
|
style="margin-top: -20px;"
|
||||||
/>
|
@click="expanded = !expanded"
|
||||||
<v-alert
|
>
|
||||||
v-else
|
<v-icon
|
||||||
:key="index + 'otherError'"
|
v-if="expanded"
|
||||||
outlined
|
style="color: rgba(0,0,0,0.8);"
|
||||||
dense
|
|
||||||
type="error"
|
|
||||||
>
|
>
|
||||||
{{ error.type }}
|
mdi-close
|
||||||
</v-alert>
|
</v-icon>
|
||||||
</template>
|
<v-icon
|
||||||
|
v-else
|
||||||
|
style="color: rgba(0,0,0,0.8);"
|
||||||
|
>
|
||||||
|
mdi-alert-circle-outline
|
||||||
|
</v-icon>
|
||||||
|
</v-btn>
|
||||||
|
<v-slide-y-transition>
|
||||||
|
<div
|
||||||
|
v-if="expanded"
|
||||||
|
class="character-sheet-errors"
|
||||||
|
>
|
||||||
|
<template v-for="(error, index) in errors">
|
||||||
|
<dependency-loop-error
|
||||||
|
v-if="error.type === 'dependencyLoop'"
|
||||||
|
:key="index + 'dependencyLoopError'"
|
||||||
|
:model="error"
|
||||||
|
/>
|
||||||
|
<v-alert
|
||||||
|
v-else
|
||||||
|
:key="index + 'otherError'"
|
||||||
|
border="bottom"
|
||||||
|
colored-border
|
||||||
|
elevation="2"
|
||||||
|
type="error"
|
||||||
|
>
|
||||||
|
{{ error.type }}
|
||||||
|
</v-alert>
|
||||||
|
</template>
|
||||||
|
</div>
|
||||||
|
</v-slide-y-transition>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="js">
|
<script lang="js">
|
||||||
import Creatures from '/imports/api/creature/creatures/Creatures.js';
|
import Creatures from '/imports/api/creature/creatures/Creatures.js';
|
||||||
import DependencyLoopError from '/imports/ui/creature/character/errors/DependencyLoopError.vue';
|
import DependencyLoopError from '/imports/ui/creature/character/errors/DependencyLoopError.vue';
|
||||||
|
import updateCreature from '/imports/api/creature/creatures/methods/updateCreature.js';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
DependencyLoopError,
|
DependencyLoopError,
|
||||||
},
|
},
|
||||||
|
inject: {
|
||||||
|
context: { default: {} },
|
||||||
|
theme: {
|
||||||
|
default: {
|
||||||
|
isDark: false,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
props: {
|
props: {
|
||||||
creatureId: {
|
creatureId: {
|
||||||
type: String,
|
type: String,
|
||||||
default: undefined,
|
default: undefined,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
data() { return {
|
||||||
|
expanded: false,
|
||||||
|
}},
|
||||||
meteor: {
|
meteor: {
|
||||||
creature() {
|
creature() {
|
||||||
if (!this.creatureId) return;
|
if (!this.creatureId) return;
|
||||||
return Creatures.findOne(this.creatureId, {fields: {computeErrors: 1}});
|
return Creatures.findOne(this.creatureId, {fields: {computeErrors: 1, settings: 1}});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
errors() {
|
errors() {
|
||||||
if (!this.creature || !this.creature.computeErrors) return;
|
if (!this.creature || !this.creature.computeErrors) return [];
|
||||||
return this.creature.computeErrors.map(error => {
|
return this.creature.computeErrors;
|
||||||
error.text = error.type;
|
},
|
||||||
if (error.type === 'dependencyLoop') {
|
},
|
||||||
error.text = 'Dependency Loop Detected';
|
watch: {
|
||||||
|
expanded(value) {
|
||||||
|
if (this.context.editPermission === false) return;
|
||||||
|
updateCreature.call({
|
||||||
|
_id: this.creatureId,
|
||||||
|
path: ['settings', 'hideCalculationErrors'],
|
||||||
|
value: !value || null,
|
||||||
|
}, (error) => {
|
||||||
|
if (error){
|
||||||
|
console.error(error);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
|
},
|
||||||
|
mounted() {
|
||||||
|
this.expanded = !this.creature.settings.hideCalculationErrors;
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
<template>
|
<template>
|
||||||
<v-alert
|
<v-alert
|
||||||
v-if="model"
|
border="bottom"
|
||||||
outlined
|
colored-border
|
||||||
dense
|
elevation="2"
|
||||||
type="warning"
|
type="warning"
|
||||||
class="dependency-loop-error"
|
class="dependency-loop-error"
|
||||||
>
|
>
|
||||||
@@ -54,6 +54,13 @@ export default {
|
|||||||
components: {
|
components: {
|
||||||
TreeNodeView,
|
TreeNodeView,
|
||||||
},
|
},
|
||||||
|
inject: {
|
||||||
|
theme: {
|
||||||
|
default: {
|
||||||
|
isDark: false,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
props: {
|
props: {
|
||||||
model: {
|
model: {
|
||||||
type: Object,
|
type: Object,
|
||||||
@@ -86,7 +93,7 @@ export default {
|
|||||||
elementId: `breadcrumb-${id}`,
|
elementId: `breadcrumb-${id}`,
|
||||||
data: {_id: id},
|
data: {_id: id},
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
Reference in New Issue
Block a user