Browse Source

Workokrders updates as they cycle

combat-2
MagicBot 8 months ago
parent
commit
7b7492b5cc
  1. 12
      src/engine/db/handlers/dbWarehouseHandler.java
  2. 9
      src/engine/gameManager/ForgeManager.java

12
src/engine/db/handlers/dbWarehouseHandler.java

@ -171,4 +171,16 @@ public class dbWarehouseHandler extends dbHandlerBase {
} }
return false; return false;
} }
public void DELETE_WORKORDER(WorkOrder workOrder) {
try (Connection connection = DbManager.getConnection();
PreparedStatement preparedStatement = connection.prepareStatement("DELETE FROM `dyn_workorders` WHERE `workorderID` = ?;")) {
preparedStatement.setInt(1, workOrder.workOrderID);
preparedStatement.executeUpdate();
} catch (SQLException e) {
Logger.error(e);
}
}
} }

9
src/engine/gameManager/ForgeManager.java

@ -57,6 +57,10 @@ public enum ForgeManager implements Runnable {
} }
workOrder.runCompleted = true; workOrder.runCompleted = true;
// Update workorder to disk
DbManager.WarehouseQueries.UPDATE_WORKORDER(workOrder);
} }
if (workOrder.runCompleted) if (workOrder.runCompleted)
@ -328,6 +332,11 @@ public enum ForgeManager implements Runnable {
DispatchMessage.dispatchMsgToInterestArea(workOrder.vendor, outMsg, mbEnums.DispatchChannel.SECONDARY, 700, false, false); DispatchMessage.dispatchMsgToInterestArea(workOrder.vendor, outMsg, mbEnums.DispatchChannel.SECONDARY, 700, false, false);
workOrder.total_produced = workOrder.total_produced + 1; workOrder.total_produced = workOrder.total_produced + 1;
} }
// Save updated status to disk
DbManager.WarehouseQueries.UPDATE_WORKORDER(workOrder);
} }
public static int calcRandomMod(NPC vendor, mbEnums.ItemModType itemModType, int modTable) { public static int calcRandomMod(NPC vendor, mbEnums.ItemModType itemModType, int modTable) {

Loading…
Cancel
Save