diff --git a/app/imports/api/creature/creatures/Creatures.js b/app/imports/api/creature/creatures/Creatures.js index b94fe7e4..bd05254e 100644 --- a/app/imports/api/creature/creatures/Creatures.js +++ b/app/imports/api/creature/creatures/Creatures.js @@ -151,11 +151,6 @@ let CreatureSchema = new SimpleSchema({ blackbox: true, defaultValue: {} }, - variables: { - type: Object, - blackbox: true, - defaultValue: {} - }, computeErrors: { type: Array, optional: true, diff --git a/app/imports/api/engine/actions/applyPropertyByType/shared/applyEffectsToCalculationParseNode.js b/app/imports/api/engine/actions/applyPropertyByType/shared/applyEffectsToCalculationParseNode.js index 0ada4ea1..6ee0a765 100644 --- a/app/imports/api/engine/actions/applyPropertyByType/shared/applyEffectsToCalculationParseNode.js +++ b/app/imports/api/engine/actions/applyPropertyByType/shared/applyEffectsToCalculationParseNode.js @@ -2,9 +2,8 @@ import operator from '/imports/parser/parseTree/operator.js'; import { parse } from '/imports/parser/parser.js'; import logErrors from './logErrors.js'; -export default function applyEffectsToCalculationParseNode(calcObj, actionContext){ - if (!calcObj.effects) return; - calcObj.effects.forEach(effect => { +export default function applyEffectsToCalculationParseNode(calcObj, actionContext) { + calcObj.effects?.forEach(effect => { if (effect.operation !== 'add') return; if (!effect.amount) return; if (effect.amount.value === null) return; @@ -17,8 +16,31 @@ export default function applyEffectsToCalculationParseNode(calcObj, actionContex operator: '+', fn: 'add' }); - } catch (e){ + } catch (e) { logErrors([e], actionContext) } }); + // Add the highest proficiency as well + let highestProficiency; + calcObj.proficiencies?.forEach(proficiency => { + if ( + proficiency.value > highestProficiency + || (highestProficiency === undefined && Number.isFinite(proficiency.value)) + ) { + highestProficiency = proficiency.value; + } + }); + if (highestProficiency) { + try { + let profParseNode = parse(highestProficiency.toString()); + calcObj.parseNode = operator.create({ + left: calcObj.parseNode, + right: profParseNode, + operator: '+', + fn: 'add' + }); + } catch (e) { + logErrors([e], actionContext) + } + } } diff --git a/app/imports/api/engine/actions/applyPropertyByType/shared/recalculateCalculation.js b/app/imports/api/engine/actions/applyPropertyByType/shared/recalculateCalculation.js index 2f484567..16f2cfe3 100644 --- a/app/imports/api/engine/actions/applyPropertyByType/shared/recalculateCalculation.js +++ b/app/imports/api/engine/actions/applyPropertyByType/shared/recalculateCalculation.js @@ -2,7 +2,7 @@ import evaluateCalculation from '/imports/api/engine/computation/utility/evaluat import applyEffectsToCalculationParseNode from '/imports/api/engine/actions/applyPropertyByType/shared/applyEffectsToCalculationParseNode.js'; import logErrors from './logErrors.js'; -export default function recalculateCalculation(calc, actionContext, context){ +export default function recalculateCalculation(calc, actionContext, context) { if (!calc?.parseNode) return; calc._parseLevel = 'reduce'; applyEffectsToCalculationParseNode(calc, actionContext); diff --git a/app/imports/api/engine/computation/utility/evaluateCalculation.js b/app/imports/api/engine/computation/utility/evaluateCalculation.js index 580cafde..6d5f1f82 100644 --- a/app/imports/api/engine/computation/utility/evaluateCalculation.js +++ b/app/imports/api/engine/computation/utility/evaluateCalculation.js @@ -1,14 +1,14 @@ import resolve, { toString } from '/imports/parser/resolve.js'; -export default function evaluateCalculation(calculation, scope, givenContext){ +export default function evaluateCalculation(calculation, scope, givenContext) { const parseNode = calculation.parseNode; const fn = calculation._parseLevel; - const calculationScope = {...calculation._localScope, ...scope}; - const {result: resultNode, context} = resolve(fn, parseNode, calculationScope, givenContext); + const calculationScope = { ...calculation._localScope, ...scope }; + const { result: resultNode, context } = resolve(fn, parseNode, calculationScope, givenContext); calculation.errors = context.errors; - if (resultNode?.parseType === 'constant'){ + if (resultNode?.parseType === 'constant') { calculation.value = resultNode.value; - } else if (resultNode?.parseType === 'error'){ + } else if (resultNode?.parseType === 'error') { calculation.value = null; } else { calculation.value = toString(resultNode); diff --git a/app/imports/api/library/methods/duplicateLibraryNode.js b/app/imports/api/library/methods/duplicateLibraryNode.js index 83f20106..43aa0a8a 100644 --- a/app/imports/api/library/methods/duplicateLibraryNode.js +++ b/app/imports/api/library/methods/duplicateLibraryNode.js @@ -28,8 +28,8 @@ const duplicateLibraryNode = new ValidatedMethod({ }).validator(), mixins: [RateLimiterMixin], rateLimit: { - numRequests: 1, - timeInterval: 5000, + numRequests: 4, + timeInterval: 6000, }, run({ _id }) { let libraryNode = LibraryNodes.findOne(_id); diff --git a/app/imports/client/ui/components/ColumnLayout.vue b/app/imports/client/ui/components/ColumnLayout.vue index 2d5341a5..69306c67 100644 --- a/app/imports/client/ui/components/ColumnLayout.vue +++ b/app/imports/client/ui/components/ColumnLayout.vue @@ -16,42 +16,27 @@ export default { wideColumns: Boolean, }, }; - -/* -Removed to improve chrome layout performance, put it back if there are rendering errors -.column-layout>span>div { - display: table; - table-layout: fixed; -} -*/ diff --git a/app/imports/client/ui/creature/character/printedCharacterSheet/PrintedStats.vue b/app/imports/client/ui/creature/character/printedCharacterSheet/PrintedStats.vue index 039209e2..f6e2ecf3 100644 --- a/app/imports/client/ui/creature/character/printedCharacterSheet/PrintedStats.vue +++ b/app/imports/client/ui/creature/character/printedCharacterSheet/PrintedStats.vue @@ -596,7 +596,6 @@ export default { margin-top: 4px; margin-left: -30px; padding-left: 34px; - z-index: -1; } .number-label .number { diff --git a/app/imports/client/ui/properties/components/folders/folderGroupComponents/AttributeGroupComponent.vue b/app/imports/client/ui/properties/components/folders/folderGroupComponents/AttributeGroupComponent.vue index 2b485e3b..72020377 100644 --- a/app/imports/client/ui/properties/components/folders/folderGroupComponents/AttributeGroupComponent.vue +++ b/app/imports/client/ui/properties/components/folders/folderGroupComponents/AttributeGroupComponent.vue @@ -30,7 +30,7 @@ v-else-if="model.attributeType === 'resource'" :model="model" @click="$emit('click')" - @change="({ type, value }) => damageProperty({type, value: -value})" + @change="({ type, value, ack }) => damageProperty({type, value: -value, ack})" @mouseover="hover = true" @mouseleave="hover = false" /> @@ -96,6 +96,9 @@ export default { _id: this.model._id, operation: change.type, value: change.value + }, e => { + console.log(change); + change.ack?.(e); }); }, log({_id}) { diff --git a/app/imports/server/publications/slotFillers.js b/app/imports/server/publications/slotFillers.js index fba54ca6..207ba336 100644 --- a/app/imports/server/publications/slotFillers.js +++ b/app/imports/server/publications/slotFillers.js @@ -41,16 +41,21 @@ Meteor.publish('slotFillers', function (slotId, searchTerm, isDummySlot) { sort: { name: 1 } }); - // Build a filter for nodes in those libraries that match the slot - let filter = getSlotFillFilter({ slot, libraryIds }); this.autorun(function () { + // Build a filter for nodes in those libraries that match the slot + let filter = getSlotFillFilter({ slot, libraryIds }); // Get the limit of the documents the user can fetch var limit = self.data('limit') || 50; check(limit, Number); let options = undefined; if (searchTerm) { - filter.name = { $regex: escapeRegex(searchTerm), '$options': 'i' }; + filter.$and.push({ + $or: [ + { name: { $regex: escapeRegex(searchTerm), '$options': 'i' } }, + { libraryTags: searchTerm } + ] + }); //filter.$text = { $search: searchTerm }; options = { // relevant documents have a higher score.