From c1440f8f9e3cdd585c58ed82217ecc50dccb8467 Mon Sep 17 00:00:00 2001 From: FatBoy-DOTC Date: Sat, 9 Mar 2024 19:52:52 -0600 Subject: [PATCH] resource stacking bug --- src/engine/objects/CharacterItemManager.java | 38 ++------------------ 1 file changed, 2 insertions(+), 36 deletions(-) diff --git a/src/engine/objects/CharacterItemManager.java b/src/engine/objects/CharacterItemManager.java index 9e0bc7ad..8c346166 100644 --- a/src/engine/objects/CharacterItemManager.java +++ b/src/engine/objects/CharacterItemManager.java @@ -640,7 +640,6 @@ public class CharacterItemManager { dispatch = Dispatch.borrow(other, utwm); DispatchMessage.dispatchMsgDispatch(dispatch, Enum.DispatchChannel.PRIMARY); stripTempEnchants(i); - this.updateInventory(); return true; } @@ -1057,7 +1056,6 @@ public class CharacterItemManager { calculateWeights(); stripTempEnchants(i); - this.updateInventory(); return true; } @@ -1203,7 +1201,6 @@ public class CharacterItemManager { calculateWeights(); stripTempEnchants(i); - this.updateInventory(); return true; } @@ -1258,40 +1255,10 @@ public class CharacterItemManager { return false; } - if (i.getItemBase().getType().equals(ItemType.RESOURCE) && this.getOwner().getObjectType().equals(GameObjectType.PlayerCharacter)) { - boolean added = false; - ArrayList purge = new ArrayList<>(); - int count = i.getNumOfItems(); - for(Item item : this.inventory){ - if(item.getItemBaseID() == i.getItemBaseID()){ - purge.add(item); - if(count + item.getNumOfItems() <= Warehouse.maxResources.get(i.getItemBaseID())) { - count += item.getNumOfItems(); - added = true; - purge.add(item); - } - } - } - if(!added){ - this.inventory.add(i); - this.itemIDtoType.put(i.getObjectUUID(), i.getObjectType().ordinal()); - ItemBase ib = i.getItemBase(); - if (ib != null) - this.inventoryWeight += ib.getWeight(); - } else{ - i.setNumOfItems(count); - for(Item item : purge){ - this.removeItemFromInventory(item); - } - } - this.inventory.add(i); - this.itemIDtoType.put(i.getObjectUUID(), i.getObjectType().ordinal()); + this.inventory.add(i); + this.itemIDtoType.put(i.getObjectUUID(), i.getObjectType().ordinal()); - ItemBase ib = i.getItemBase(); - if (ib != null) - this.inventoryWeight += ib.getWeight(); - } return true; } @@ -2466,7 +2433,6 @@ public class CharacterItemManager { calculateWeights(); stripTempEnchants(i); - this.updateInventory(); return true; }