Method to load workorders on bootstrap

This commit is contained in:
2024-04-22 16:02:22 -04:00
parent 7300af9073
commit 73e30062ea
2 changed files with 23 additions and 1 deletions
+13 -1
View File
@@ -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
}
}
+10
View File
@@ -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) {