diff --git a/app/imports/api/engine/computation/buildComputation/linkTypeDependencies.js b/app/imports/api/engine/computation/buildComputation/linkTypeDependencies.js index c8799d4f..44fc93e9 100644 --- a/app/imports/api/engine/computation/buildComputation/linkTypeDependencies.js +++ b/app/imports/api/engine/computation/buildComputation/linkTypeDependencies.js @@ -247,6 +247,7 @@ function linkPointBuy(dependencyGraph, prop){ dependOnCalc({ dependencyGraph, prop, key: 'min' }); dependOnCalc({ dependencyGraph, prop, key: 'max' }); dependOnCalc({ dependencyGraph, prop, key: 'cost' }); + dependOnCalc({ dependencyGraph, prop, key: 'total' }); prop.values?.forEach(row => { // Wrap the document in a new object so we don't bash it unintentionally const pointBuyRow = { diff --git a/app/imports/api/engine/computation/computeComputation/computeByType/computePointBuy.js b/app/imports/api/engine/computation/computeComputation/computeByType/computePointBuy.js index fff558c0..c2cc7606 100644 --- a/app/imports/api/engine/computation/computeComputation/computeByType/computePointBuy.js +++ b/app/imports/api/engine/computation/computeComputation/computeByType/computePointBuy.js @@ -42,6 +42,7 @@ export default function computePointBuy(computation, node) { prop.spent += costFunction.value; } }); + prop.pointsLeft = (prop.total?.value || 0) - (prop.spent || 0); if (prop.spent > prop.total?.value) { prop.errors = prop.errors || []; prop.errors.push({ diff --git a/app/imports/api/properties/PointBuys.js b/app/imports/api/properties/PointBuys.js index d5fe983c..db20911a 100644 --- a/app/imports/api/properties/PointBuys.js +++ b/app/imports/api/properties/PointBuys.js @@ -137,6 +137,11 @@ const ComputedOnlyPointBuySchema = createPropertySchema({ optional: true, removeBeforeCompute: true, }, + pointsLeft: { + type: Number, + optional: true, + removeBeforeCompute: true, + }, errors: { type: Array, optional: true, diff --git a/app/imports/ui/creature/buildTree/BuildTreeNode.vue b/app/imports/ui/creature/buildTree/BuildTreeNode.vue index 8f49fb2d..ca359bf2 100644 --- a/app/imports/ui/creature/buildTree/BuildTreeNode.vue +++ b/app/imports/ui/creature/buildTree/BuildTreeNode.vue @@ -55,6 +55,7 @@ />
@@ -147,6 +149,10 @@ export default { type: Array, default: () => [], }, + parentSlotId: { + type: String, + default: undefined, + }, }, data(){return { expanded: false, @@ -197,6 +203,21 @@ export default { } return this.children; }, + computedSlotId() { + if (this.condenseChild) { + if (this.children[0].node.type === 'propertySlot') { + return this.children[0].node._id; + } else { + return undefined; + } + } else { + if (this.node.type === 'propertySlot') { + return this.node._id; + } else { + return undefined; + } + } + }, canExpand(){ return !!this.computedChildren.length || this.canFillWithMany; }, @@ -230,41 +251,41 @@ export default {