Skip to content

Commit

Permalink
handling on ui
Browse files Browse the repository at this point in the history
  • Loading branch information
Alivemonstor authored Jan 24, 2025
1 parent 674c9cb commit 43813e2
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions html/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -467,6 +467,18 @@ const InventoryContainer = Vue.createApp({
const targetItem = targetInventory[targetSlotNumber];

if (targetItem) {
if (this.dragStartInventoryType == "other") {
const totalWeightAfterTransfer = (this.otherInventoryWeight-sourceItem.weight * amountToTransfer) + targetItem.weight * targetItem.amount;
if (totalWeightAfterTransfer > this.otherInventoryMaxWeight) {
throw new Error("Insufficient weight capacity in target inventory");
}
}
else if (this.dragStartInventoryType == "player") {
const totalWeightAfterTransfer = (this.playerWeight-sourceItem.weight * amountToTransfer) + targetItem.weight * targetItem.amount;
if (totalWeightAfterTransfer > this.maxWeight) {
throw new Error("Insufficient weight capacity in player inventory");
}
}
if (sourceItem.name === targetItem.name && targetItem.unique) {
this.inventoryError(this.currentlyDraggingSlot);
return;
Expand Down

0 comments on commit 43813e2

Please sign in to comment.