|
|
@ -1241,7 +1241,7 @@ public class CharacterItemManager { |
|
|
|
|
|
|
|
|
|
|
|
// This adds item to inventory for loot. Validity checks already handled
|
|
|
|
// This adds item to inventory for loot. Validity checks already handled
|
|
|
|
public synchronized boolean addItemToInventory(Item i) { |
|
|
|
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.absCharacter.getObjectType() == GameObjectType.Mob) { |
|
|
|
if (this.goldInventory == null) |
|
|
|
if (this.goldInventory == null) |
|
|
|
loadGoldItems(); |
|
|
|
loadGoldItems(); |
|
|
@ -1252,13 +1252,22 @@ public class CharacterItemManager { |
|
|
|
updateInventory(); |
|
|
|
updateInventory(); |
|
|
|
return true; |
|
|
|
return true; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return false; |
|
|
|
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.inventory.add(i); |
|
|
|
this.itemIDtoType.put(i.getObjectUUID(), i.getObjectType().ordinal()); |
|
|
|
this.itemIDtoType.put(i.getObjectUUID(), i.getObjectType().ordinal()); |
|
|
|
|
|
|
|
|
|
|
|
return true; |
|
|
|
return true; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|