Browse Source

resource stacking bug

lakebane-master
FatBoy-DOTC 9 months ago
parent
commit
912ebd4742
  1. 17
      src/engine/objects/CharacterItemManager.java

17
src/engine/objects/CharacterItemManager.java

@ -1241,7 +1241,7 @@ public class CharacterItemManager { @@ -1241,7 +1241,7 @@ public class CharacterItemManager {
// This adds item to inventory for loot. Validity checks already handled
public synchronized boolean addItemToInventory(Item i) {
if (i.getItemBase().getType().equals(ItemType.GOLD))
if (i.getItemBase().getType().equals(ItemType.GOLD)) {
if (this.absCharacter.getObjectType() == GameObjectType.Mob) {
if (this.goldInventory == null)
loadGoldItems();
@ -1252,13 +1252,22 @@ public class CharacterItemManager { @@ -1252,13 +1252,22 @@ public class CharacterItemManager {
updateInventory();
return true;
}
return false;
}
}
if(ItemBase.getItemBase(i.getItemBaseID()).getType().ordinal() == Enum.ItemType.RESOURCE.ordinal()) {
int count = i.getNumOfItems();
for(Item item : this.inventory){
if(item.getItemBaseID() == i.getItemBaseID()){
if(item.getNumOfItems() + count <= Warehouse.getMaxResources().get(i.getItemBaseID())){
this.junk(item);
count += item.getNumOfItems();
}
}
}
}
this.inventory.add(i);
this.itemIDtoType.put(i.getObjectUUID(), i.getObjectType().ordinal());
return true;
}

Loading…
Cancel
Save