|
|
|
@ -58,7 +58,7 @@ public class Warehouse {
@@ -58,7 +58,7 @@ public class Warehouse {
|
|
|
|
|
|
|
|
|
|
for (String key : resources.keySet()) { |
|
|
|
|
mbEnums.ResourceType resourceType = mbEnums.ResourceType.valueOf(key); |
|
|
|
|
int value = ((Long) resources.get(key)).intValue(); |
|
|
|
|
int value = resources.getInt(key); |
|
|
|
|
this.resources.put(resourceType, value); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -70,22 +70,6 @@ public class Warehouse {
@@ -70,22 +70,6 @@ public class Warehouse {
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public static HashMap<mbEnums.ResourceType, Integer> |
|
|
|
|
calculateWarehouseOverdraft(Warehouse warehouse, HashMap<mbEnums.ResourceType, Integer> costMap) { |
|
|
|
|
|
|
|
|
|
HashMap<mbEnums.ResourceType, Integer> overdraft = new HashMap<>(); |
|
|
|
|
|
|
|
|
|
for (mbEnums.ResourceType resourceType : costMap.keySet()) { |
|
|
|
|
|
|
|
|
|
int cost = costMap.get(resourceType); |
|
|
|
|
|
|
|
|
|
if (cost > warehouse.resources.get(resourceType)) |
|
|
|
|
overdraft.put(resourceType, cost - warehouse.resources.get(resourceType)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return overdraft; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public static void warehouseDeposit(MerchantMsg msg, PlayerCharacter player, NPC npc) { |
|
|
|
|
|
|
|
|
|
Building warehouseBuilding; |
|
|
|
|