Skip to content

Commit ee02bf4

Browse files
authored
Merge pull request #568 from adhershmnair/main
Fixed swapping in same inventory checking total weight.
2 parents 19197a2 + eb5eab4 commit ee02bf4

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

html/app.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -447,21 +447,21 @@ const InventoryContainer = Vue.createApp({
447447
if (sourceItem.amount < amountToTransfer) {
448448
throw new Error("Insufficient amount of item in source inventory");
449449
}
450-
451-
if (targetInventoryType == "other")
452-
{
450+
451+
if (targetInventoryType !== this.dragStartInventoryType) {
452+
if (targetInventoryType == "other") {
453453
const totalWeightAfterTransfer = this.otherInventoryWeight + sourceItem.weight * amountToTransfer;
454454
if (totalWeightAfterTransfer > this.otherInventoryMaxWeight) {
455455
throw new Error("Insufficient weight capacity in target inventory");
456456
}
457457
}
458-
else if (targetInventoryType == "player")
459-
{
458+
else if (targetInventoryType == "player") {
460459
const totalWeightAfterTransfer = this.playerWeight + sourceItem.weight * amountToTransfer;
461460
if (totalWeightAfterTransfer > this.maxWeight) {
462461
throw new Error("Insufficient weight capacity in player inventory");
463462
}
464463
}
464+
}
465465

466466
const targetItem = targetInventory[targetSlotNumber];
467467

0 commit comments

Comments
 (0)