From 273b9e01187905bed60a99b630f0ae0a77b7d7c5 Mon Sep 17 00:00:00 2001 From: thepaperpilot Date: Sat, 26 Jun 2021 01:45:05 -0500 Subject: [PATCH] Fix respecing buyables --- src/components/features/Buyables.vue | 7 +------ src/components/features/RespecButton.vue | 8 ++------ src/components/fields/DangerButton.vue | 7 ++++++- src/data/layers/aca/c.js | 2 +- src/store/layers.js | 3 +++ 5 files changed, 13 insertions(+), 14 deletions(-) diff --git a/src/components/features/Buyables.vue b/src/components/features/Buyables.vue index 26312a0..00802f0 100644 --- a/src/components/features/Buyables.vue +++ b/src/components/features/Buyables.vue @@ -53,12 +53,7 @@ export default { } }, respec() { - // If they're controlling confirmRespec, assume they're also controlling what's being respecced - if (this.confirmRespec != undefined) { - this.$emit("respec"); - } else { - layers[this.layer || this.tab.layer].buyables.respec(); - } + layers[this.layer || this.tab.layer].buyables.respec?.(); } } }; diff --git a/src/components/features/RespecButton.vue b/src/components/features/RespecButton.vue index cba4570..4d495ae 100644 --- a/src/components/features/RespecButton.vue +++ b/src/components/features/RespecButton.vue @@ -17,12 +17,8 @@
diff --git a/src/components/fields/DangerButton.vue b/src/components/fields/DangerButton.vue index 8447b1c..b8c87b1 100644 --- a/src/components/fields/DangerButton.vue +++ b/src/components/fields/DangerButton.vue @@ -18,7 +18,8 @@ export default { } }, props: { - disabled: Boolean + disabled: Boolean, + skipConfirm: Boolean }, watch: { confirming(newValue) { @@ -27,6 +28,10 @@ export default { }, methods: { click() { + if (this.skipConfirm) { + this.$emit('click'); + return; + } if (this.confirming) { this.$emit('click'); } diff --git a/src/data/layers/aca/c.js b/src/data/layers/aca/c.js index a7079a9..063928b 100644 --- a/src/data/layers/aca/c.js +++ b/src/data/layers/aca/c.js @@ -160,7 +160,7 @@ export default { }, buyables: { showRespec: true, - reset() { // Optional, reset things and give back your currency. Having this function makes a respec button appear + respec() { // Optional, reset things and give back your currency. Having this function makes a respec button appear player[this.layer].points = player[this.layer].points.add(player[this.layer].spentOnBuyables) // A built-in thing to keep track of this but only keeps a single value this.reset(); resetLayer(this.layer, true) // Force a reset diff --git a/src/store/layers.js b/src/store/layers.js index 143f59e..e9869d4 100644 --- a/src/store/layers.js +++ b/src/store/layers.js @@ -242,6 +242,9 @@ export function addLayer(layer, player = null) { } else { layer.buyables.reset.forceCached = false; } + if (layer.buyables.respec != undefined) { + layer.buyables.respec.forceCached = false; + } for (let id in layer.buyables) { if (isPlainObject(layer.buyables[id])) { layer.buyables[id].amount = function() {