|
|
|
@ -1260,12 +1260,15 @@ public class CharacterItemManager {
@@ -1260,12 +1260,15 @@ public class CharacterItemManager {
|
|
|
|
|
} |
|
|
|
|
if (i.getItemBase().getType().equals(ItemType.RESOURCE) && this.getOwner().getObjectType().equals(GameObjectType.PlayerCharacter)) { |
|
|
|
|
boolean added = false; |
|
|
|
|
for(Item item : this.getInventory()){ |
|
|
|
|
ArrayList<Item> purge = new ArrayList<>(); |
|
|
|
|
int count = i.getNumOfItems(); |
|
|
|
|
for(Item item : this.inventory){ |
|
|
|
|
if(item.getItemBaseID() == i.getItemBaseID()){ |
|
|
|
|
if(item.getNumOfItems() + i.getNumOfItems() <= Warehouse.getMaxResources().get(item.getItemBaseID())) { |
|
|
|
|
item.setNumOfItems(item.getNumOfItems() + i.getNumOfItems()); |
|
|
|
|
updateInventory(); |
|
|
|
|
purge.add(item); |
|
|
|
|
if(count + item.getNumOfItems() <= Warehouse.maxResources.get(i.getItemBaseID())) { |
|
|
|
|
count += item.getNumOfItems(); |
|
|
|
|
added = true; |
|
|
|
|
purge.add(item); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -1276,7 +1279,12 @@ public class CharacterItemManager {
@@ -1276,7 +1279,12 @@ public class CharacterItemManager {
|
|
|
|
|
ItemBase ib = i.getItemBase(); |
|
|
|
|
if (ib != null) |
|
|
|
|
this.inventoryWeight += ib.getWeight(); |
|
|
|
|
} else{ |
|
|
|
|
this.inventory.removeAll(purge); |
|
|
|
|
i.setNumOfItems(count); |
|
|
|
|
this.inventory.add(i); |
|
|
|
|
} |
|
|
|
|
this.updateInventory(); |
|
|
|
|
}else { |
|
|
|
|
this.inventory.add(i); |
|
|
|
|
this.itemIDtoType.put(i.getObjectUUID(), i.getObjectType().ordinal()); |
|
|
|
|