From ae31e4fd985ddff40d939ceba9fdc709c2e22657 Mon Sep 17 00:00:00 2001 From: Melledy <52122272+Melledy@users.noreply.github.com> Date: Tue, 3 May 2022 21:08:02 -0700 Subject: [PATCH] Weapons/artifacts should not have a count of more than 1 --- .../java/emu/grasscutter/game/inventory/Inventory.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/main/java/emu/grasscutter/game/inventory/Inventory.java b/src/main/java/emu/grasscutter/game/inventory/Inventory.java index e72bd3eed..14d1ae203 100644 --- a/src/main/java/emu/grasscutter/game/inventory/Inventory.java +++ b/src/main/java/emu/grasscutter/game/inventory/Inventory.java @@ -164,6 +164,9 @@ public class Inventory implements Iterable { if (tab.getSize() >= tab.getMaxCapacity()) { return null; } + // Duplicates cause problems + item.setCount(Math.max(item.getCount(), 1)); + // Adds to inventory putItem(item, tab); } else if (type == ItemType.ITEM_VIRTUAL) { // Handle @@ -288,7 +291,11 @@ public class Inventory implements Iterable { return false; } - item.setCount(item.getCount() - count); + if (item.getItemData().isEquip()) { + item.setCount(0); + } else { + item.setCount(item.getCount() - count); + } if (item.getCount() <= 0) { // Remove from inventory tab too