|
|
@ -640,7 +640,6 @@ public class CharacterItemManager { |
|
|
|
dispatch = Dispatch.borrow(other, utwm); |
|
|
|
dispatch = Dispatch.borrow(other, utwm); |
|
|
|
DispatchMessage.dispatchMsgDispatch(dispatch, Enum.DispatchChannel.PRIMARY); |
|
|
|
DispatchMessage.dispatchMsgDispatch(dispatch, Enum.DispatchChannel.PRIMARY); |
|
|
|
stripTempEnchants(i); |
|
|
|
stripTempEnchants(i); |
|
|
|
this.updateInventory(); |
|
|
|
|
|
|
|
return true; |
|
|
|
return true; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -1057,7 +1056,6 @@ public class CharacterItemManager { |
|
|
|
|
|
|
|
|
|
|
|
calculateWeights(); |
|
|
|
calculateWeights(); |
|
|
|
stripTempEnchants(i); |
|
|
|
stripTempEnchants(i); |
|
|
|
this.updateInventory(); |
|
|
|
|
|
|
|
return true; |
|
|
|
return true; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -1203,7 +1201,6 @@ public class CharacterItemManager { |
|
|
|
|
|
|
|
|
|
|
|
calculateWeights(); |
|
|
|
calculateWeights(); |
|
|
|
stripTempEnchants(i); |
|
|
|
stripTempEnchants(i); |
|
|
|
this.updateInventory(); |
|
|
|
|
|
|
|
return true; |
|
|
|
return true; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -1258,40 +1255,10 @@ public class CharacterItemManager { |
|
|
|
|
|
|
|
|
|
|
|
return false; |
|
|
|
return false; |
|
|
|
} |
|
|
|
} |
|
|
|
if (i.getItemBase().getType().equals(ItemType.RESOURCE) && this.getOwner().getObjectType().equals(GameObjectType.PlayerCharacter)) { |
|
|
|
|
|
|
|
boolean added = false; |
|
|
|
|
|
|
|
ArrayList<Item> 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(); |
|
|
|
this.inventory.add(i); |
|
|
|
if (ib != null) |
|
|
|
this.itemIDtoType.put(i.getObjectUUID(), i.getObjectType().ordinal()); |
|
|
|
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()); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ItemBase ib = i.getItemBase(); |
|
|
|
|
|
|
|
if (ib != null) |
|
|
|
|
|
|
|
this.inventoryWeight += ib.getWeight(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return true; |
|
|
|
return true; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -2466,7 +2433,6 @@ public class CharacterItemManager { |
|
|
|
|
|
|
|
|
|
|
|
calculateWeights(); |
|
|
|
calculateWeights(); |
|
|
|
stripTempEnchants(i); |
|
|
|
stripTempEnchants(i); |
|
|
|
this.updateInventory(); |
|
|
|
|
|
|
|
return true; |
|
|
|
return true; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|