diff --git a/src/engine/db/handlers/dbWarehouseHandler.java b/src/engine/db/handlers/dbWarehouseHandler.java index 49ec1e8b..f353a046 100644 --- a/src/engine/db/handlers/dbWarehouseHandler.java +++ b/src/engine/db/handlers/dbWarehouseHandler.java @@ -10,6 +10,7 @@ package engine.db.handlers; import engine.gameManager.DbManager; +import engine.gameManager.ForgeManager; import engine.loot.WorkOrder; import engine.mbEnums; import engine.mbEnums.GameObjectType; @@ -201,12 +202,23 @@ public class dbWarehouseHandler extends dbHandlerBase { Logger.error(e); } - // Delete the old records + // Process workOrder records for (WorkOrder workOrder : submitList) DbManager.WarehouseQueries.DELETE_WORKORDER(workOrder); + for (WorkOrder workOrder : submitList) { + + // WorkOrder needs a new ID + + workOrder.workOrderID = ForgeManager.wordOrderCounter.incrementAndGet(); + + // Reconstruct cooking items + + + } // Pass the new workOrders to the ForgeManager + } } diff --git a/src/engine/loot/WorkOrder.java b/src/engine/loot/WorkOrder.java index f1fc288f..59eec45f 100644 --- a/src/engine/loot/WorkOrder.java +++ b/src/engine/loot/WorkOrder.java @@ -11,6 +11,7 @@ package engine.loot; import engine.mbEnums; import engine.objects.Item; import engine.objects.NPC; +import org.json.JSONArray; import org.json.JSONObject; import java.time.Duration; @@ -79,6 +80,15 @@ public class WorkOrder implements Delayed { int value = productionTotalCostMap.getInt(key); this.production_cost_total.put(resourceType, value); } + + // Reconstruct cooking items + + JSONArray tokenList = jsonWorkOrder.getJSONArray("cookingTokens"); + + for (Object o : tokenList) { + int prefix = tokenList.getInt(0); + int suffix = tokenList.getInt(1); + } } public static JSONObject toJson(WorkOrder workOrder) {