|
|
|
@ -25,7 +25,7 @@ public enum ForgeManager implements Runnable {
@@ -25,7 +25,7 @@ public enum ForgeManager implements Runnable {
|
|
|
|
|
|
|
|
|
|
FORGE_MANAGER; |
|
|
|
|
|
|
|
|
|
private static final BlockingQueue<WorkOrder> oven = new DelayQueue<>(); |
|
|
|
|
private static final BlockingQueue<WorkOrder> forge = new DelayQueue<>(); |
|
|
|
|
public static final AtomicInteger wordOrderCounter = new AtomicInteger(0); |
|
|
|
|
public static final HashMap<Item, WorkOrder> workOrderMap = new HashMap<Item, WorkOrder>(); |
|
|
|
|
|
|
|
|
@ -35,7 +35,7 @@ public enum ForgeManager implements Runnable {
@@ -35,7 +35,7 @@ public enum ForgeManager implements Runnable {
|
|
|
|
|
while (true) { |
|
|
|
|
|
|
|
|
|
try { |
|
|
|
|
WorkOrder workOrder = oven.take(); |
|
|
|
|
WorkOrder workOrder = forge.take(); |
|
|
|
|
|
|
|
|
|
// Completed or canceled work orders are not re-enqueued
|
|
|
|
|
|
|
|
|
@ -52,8 +52,9 @@ public enum ForgeManager implements Runnable {
@@ -52,8 +52,9 @@ public enum ForgeManager implements Runnable {
|
|
|
|
|
|
|
|
|
|
Logger.info("workOrder has completed: " + workOrder.workOrderID); |
|
|
|
|
|
|
|
|
|
// Persist current items that are cooking
|
|
|
|
|
// after removing the negative id item from all collections.
|
|
|
|
|
// Persist current items that are currently building for this
|
|
|
|
|
// worker after first removing the negative id item from all
|
|
|
|
|
// collections.
|
|
|
|
|
|
|
|
|
|
// Add new item to the vendors inventory
|
|
|
|
|
|
|
|
|
@ -67,7 +68,7 @@ public enum ForgeManager implements Runnable {
@@ -67,7 +68,7 @@ public enum ForgeManager implements Runnable {
|
|
|
|
|
// until all items for this workOrder are completed.
|
|
|
|
|
|
|
|
|
|
workOrder.completionTime = System.currentTimeMillis() + workOrder.rollingDuration; |
|
|
|
|
oven.add(workOrder); |
|
|
|
|
forge.add(workOrder); |
|
|
|
|
Logger.info(workOrder.toString()); |
|
|
|
|
|
|
|
|
|
} catch (InterruptedException e) { |
|
|
|
@ -109,7 +110,7 @@ public enum ForgeManager implements Runnable {
@@ -109,7 +110,7 @@ public enum ForgeManager implements Runnable {
|
|
|
|
|
|
|
|
|
|
Logger.info(workOrder.toString()); |
|
|
|
|
workOrder.vendor.workOrders.add(workOrder); |
|
|
|
|
oven.add(workOrder); |
|
|
|
|
forge.add(workOrder); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public static boolean validate(PlayerCharacter playerCharacter, WorkOrder workOrder) { |
|
|
|
|