From f088d2aa72b398da3edf610ab0c3af18184a092e Mon Sep 17 00:00:00 2001 From: MagicBot Date: Mon, 8 Apr 2024 13:06:22 -0400 Subject: [PATCH] More WorkOrder work --- src/engine/gameManager/ForgeManager.java | 14 ++++++++++++-- src/engine/loot/WorkOrder.java | 5 +++-- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/src/engine/gameManager/ForgeManager.java b/src/engine/gameManager/ForgeManager.java index 347fe11d..814bba45 100644 --- a/src/engine/gameManager/ForgeManager.java +++ b/src/engine/gameManager/ForgeManager.java @@ -46,13 +46,13 @@ public enum ForgeManager implements Runnable { // otherwise roll what was asked for } - if (workOrder.total_to_produce == 0) { + if (workOrder.total_produced >= workOrder.total_to_produce) { workOrder.runCompleted = true; workOrder.vendor.workOrders.remove(workOrder); Logger.info("Workorder has completed: " + workOrder.workOrderID); - // Remove this workOrder from any slots on vendor + workOrder.vendor.workOrders.remove(workOrder); continue; } @@ -114,4 +114,14 @@ public enum ForgeManager implements Runnable { rollingDuration = (long) (baseTime * Float.parseFloat(ConfigManager.MB_PRODUCTION_RATE.getValue())); return rollingDuration; } + + public static int getAvailableSlots(WorkOrder workOrder) { + + int availableSlots = workOrder.vendor.getRank(); + + for (WorkOrder npcWorkOrder : workOrder.vendor.workOrders) { + + } + return availableSlots; + } } diff --git a/src/engine/loot/WorkOrder.java b/src/engine/loot/WorkOrder.java index 6905789b..49fbb2d1 100644 --- a/src/engine/loot/WorkOrder.java +++ b/src/engine/loot/WorkOrder.java @@ -24,14 +24,15 @@ public class WorkOrder implements Delayed { public NPC vendor; public int slotCount; public int total_to_produce; + public int total_produced; public int templateID; public String itemName; public int prefixToken; public int suffixToken; public long rollingDuration; public long completionTime; - public boolean runCompleted; - public boolean runCanceled; + public boolean runCompleted = false; + public boolean runCanceled = false; public ArrayList cooking = new ArrayList<>();