|
|
|
@ -25,6 +25,7 @@ import org.pmw.tinylog.Logger;
@@ -25,6 +25,7 @@ import org.pmw.tinylog.Logger;
|
|
|
|
|
import java.sql.SQLException; |
|
|
|
|
import java.util.ArrayList; |
|
|
|
|
import java.util.EnumSet; |
|
|
|
|
import java.util.HashMap; |
|
|
|
|
import java.util.concurrent.ConcurrentHashMap; |
|
|
|
|
|
|
|
|
|
public class Warehouse { |
|
|
|
@ -68,6 +69,20 @@ public class Warehouse {
@@ -68,6 +69,20 @@ public class Warehouse {
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public static HashMap<Enum.ResourceType, Integer> calculateWarehouseOverdraft(Warehouse warehouse, HashMap<Enum.ResourceType, Integer> costMap) { |
|
|
|
|
HashMap<Enum.ResourceType, Integer> overdraft = new HashMap<>(); |
|
|
|
|
|
|
|
|
|
for (Enum.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; |
|
|
|
|