|
|
@ -354,24 +354,24 @@ public class Warehouse extends AbstractWorldObject { |
|
|
|
|
|
|
|
|
|
|
|
public static synchronized boolean depositFromMine(Mine mine, ItemBase resource, int amount, Warehouse warehouse) { |
|
|
|
public static synchronized boolean depositFromMine(Mine mine, ItemBase resource, int amount, Warehouse warehouse) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int oldAmount = warehouse.resources.get(resource); |
|
|
|
int oldAmount = warehouse.resources.get(resource); |
|
|
|
int newAmount = oldAmount + amount; |
|
|
|
int newAmount = oldAmount + amount; |
|
|
|
|
|
|
|
|
|
|
|
if (newAmount > getMaxResources().get(resource.getUUID())) |
|
|
|
if (newAmount > getMaxResources().get(resource.getUUID())) |
|
|
|
return false; |
|
|
|
return false; |
|
|
|
|
|
|
|
|
|
|
|
if (!DepositApproved(resource,amount,warehouse)) |
|
|
|
if (!DepositApproved(resource, amount, warehouse)) |
|
|
|
return false; |
|
|
|
return false; |
|
|
|
|
|
|
|
|
|
|
|
warehouse.resources.put(resource, newAmount); |
|
|
|
warehouse.resources.put(resource, newAmount); |
|
|
|
Resource resourceType; |
|
|
|
Resource resourceType; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ItemTemplate template = ItemTemplate.itemTemplates.get(resource.getUUID()); |
|
|
|
|
|
|
|
|
|
|
|
if (resource.getUUID() == 7) |
|
|
|
if (resource.getUUID() == 7) |
|
|
|
resourceType = Resource.GOLD; |
|
|
|
resourceType = Resource.GOLD; |
|
|
|
else |
|
|
|
else |
|
|
|
resourceType = Resource.valueOf(resource.getName().toUpperCase()); |
|
|
|
resourceType = Resource.valueOf(template.item_base_name.toUpperCase()); |
|
|
|
|
|
|
|
|
|
|
|
if (mine != null) |
|
|
|
if (mine != null) |
|
|
|
AddTransactionToWarehouse(warehouse, Enum.GameObjectType.Building, mine.getBuildingID(), Enum.TransactionType.MINE, resourceType, amount); |
|
|
|
AddTransactionToWarehouse(warehouse, Enum.GameObjectType.Building, mine.getBuildingID(), Enum.TransactionType.MINE, resourceType, amount); |
|
|
|