From 7072e9ba971be5fdbb308b4336982827a6d22d32 Mon Sep 17 00:00:00 2001 From: Stefan Zermatten Date: Wed, 19 Jul 2023 18:49:18 +0200 Subject: [PATCH 1/6] Fixed searching by tag in slot fillers --- app/imports/server/publications/slotFillers.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) 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. From 25e2523d5117d31caa71749ed709dca70583f332 Mon Sep 17 00:00:00 2001 From: Stefan Zermatten Date: Wed, 19 Jul 2023 18:57:06 +0200 Subject: [PATCH 2/6] Fixed resources in folder increment button loading forever --- .../folderGroupComponents/AttributeGroupComponent.vue | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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}) { From 2b1a6de1e57737f919a9ed4f013255a464c954ce Mon Sep 17 00:00:00 2001 From: Stefan Zermatten Date: Wed, 19 Jul 2023 19:03:36 +0200 Subject: [PATCH 3/6] Relaxed rate limiting on duplicating library props --- app/imports/api/library/methods/duplicateLibraryNode.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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); From 4133a0f78c0e8b2e5c6380bf920fe07991dbc041 Mon Sep 17 00:00:00 2001 From: Stefan Zermatten Date: Wed, 19 Jul 2023 19:40:59 +0200 Subject: [PATCH 4/6] Fixed proficiency bonus not applying in actions --- .../applyEffectsToCalculationParseNode.js | 30 ++++++++++++++++--- .../shared/recalculateCalculation.js | 2 +- .../utility/evaluateCalculation.js | 10 +++---- 3 files changed, 32 insertions(+), 10 deletions(-) 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); From 30fabce7f16805221db8223a6cfbb95b0ceae6c2 Mon Sep 17 00:00:00 2001 From: Stefan Zermatten Date: Thu, 20 Jul 2023 11:13:57 +0200 Subject: [PATCH 5/6] Removed variables object from creature docs --- app/imports/api/creature/creatures/Creatures.js | 5 ----- 1 file changed, 5 deletions(-) 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, From b0afc86ad40f84ed3ae85a1c7074065f024d9634 Mon Sep 17 00:00:00 2001 From: Stefan Zermatten Date: Fri, 21 Jul 2023 16:12:50 +0200 Subject: [PATCH 6/6] "fixed" column layout again As yet untested on Safari --- .../client/ui/components/ColumnLayout.vue | 29 +++++-------------- .../printedCharacterSheet/PrintedStats.vue | 1 - 2 files changed, 7 insertions(+), 23 deletions(-) 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 {