Browse Source

Warehouse updated for org.json

combat-2
MagicBot 7 months ago
parent
commit
19c6cd76a9
  1. 2
      src/engine/gameManager/ForgeManager.java
  2. 18
      src/engine/objects/Warehouse.java

2
src/engine/gameManager/ForgeManager.java

@ -144,8 +144,6 @@ public enum ForgeManager implements Runnable {
forge.add(workOrder); forge.add(workOrder);
JSONObject jsonWorkOrder = WorkOrder.toJson(workOrder); JSONObject jsonWorkOrder = WorkOrder.toJson(workOrder);
String stringOrder = jsonWorkOrder.toString();
stringOrder = stringOrder.trim();
} catch (Exception e) { } catch (Exception e) {
Logger.error(e); Logger.error(e);

18
src/engine/objects/Warehouse.java

@ -58,7 +58,7 @@ public class Warehouse {
for (String key : resources.keySet()) { for (String key : resources.keySet()) {
mbEnums.ResourceType resourceType = mbEnums.ResourceType.valueOf(key); mbEnums.ResourceType resourceType = mbEnums.ResourceType.valueOf(key);
int value = ((Long) resources.get(key)).intValue(); int value = resources.getInt(key);
this.resources.put(resourceType, value); this.resources.put(resourceType, value);
} }
@ -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) { public static void warehouseDeposit(MerchantMsg msg, PlayerCharacter player, NPC npc) {
Building warehouseBuilding; Building warehouseBuilding;

Loading…
Cancel
Save