From d5111cfe03e90d91e35d65b771ef1888c7fb75fd Mon Sep 17 00:00:00 2001 From: Adharsh M Date: Sat, 31 Aug 2024 00:26:21 +0530 Subject: [PATCH] Fixed swapping in same inventory checking total weight. --- html/app.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/html/app.js b/html/app.js index ff00bea8..e0d28019 100644 --- a/html/app.js +++ b/html/app.js @@ -447,21 +447,21 @@ const InventoryContainer = Vue.createApp({ if (sourceItem.amount < amountToTransfer) { throw new Error("Insufficient amount of item in source inventory"); } - - if (targetInventoryType == "other") - { + + if (targetInventoryType !== this.dragStartInventoryType) { + if (targetInventoryType == "other") { const totalWeightAfterTransfer = this.otherInventoryWeight + sourceItem.weight * amountToTransfer; if (totalWeightAfterTransfer > this.otherInventoryMaxWeight) { throw new Error("Insufficient weight capacity in target inventory"); } } - else if (targetInventoryType == "player") - { + else if (targetInventoryType == "player") { const totalWeightAfterTransfer = this.playerWeight + sourceItem.weight * amountToTransfer; if (totalWeightAfterTransfer > this.maxWeight) { throw new Error("Insufficient weight capacity in player inventory"); } } + } const targetItem = targetInventory[targetSlotNumber];