|
|
|
@ -25,9 +25,9 @@ public enum ForgeManager implements Runnable {
@@ -25,9 +25,9 @@ public enum ForgeManager implements Runnable {
|
|
|
|
|
|
|
|
|
|
FORGE_MANAGER; |
|
|
|
|
|
|
|
|
|
private static final BlockingQueue<WorkOrder> workOrders = new DelayQueue(); |
|
|
|
|
private static final BlockingQueue<WorkOrder> oven = new DelayQueue<>(); |
|
|
|
|
public static final AtomicInteger wordOrderCounter = new AtomicInteger(0); |
|
|
|
|
public static HashMap<Item, WorkOrder> oven = new HashMap<Item, WorkOrder>(); |
|
|
|
|
public static final HashMap<Item, WorkOrder> workOrderMap = new HashMap<Item, WorkOrder>(); |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public void run() { |
|
|
|
@ -35,7 +35,7 @@ public enum ForgeManager implements Runnable {
@@ -35,7 +35,7 @@ public enum ForgeManager implements Runnable {
|
|
|
|
|
while (true) { |
|
|
|
|
|
|
|
|
|
try { |
|
|
|
|
WorkOrder workOrder = workOrders.take(); |
|
|
|
|
WorkOrder workOrder = oven.take(); |
|
|
|
|
|
|
|
|
|
// Completed or canceled work orders are not re-enqueued
|
|
|
|
|
|
|
|
|
@ -67,7 +67,7 @@ public enum ForgeManager implements Runnable {
@@ -67,7 +67,7 @@ public enum ForgeManager implements Runnable {
|
|
|
|
|
// until all items for this workOrder are completed.
|
|
|
|
|
|
|
|
|
|
workOrder.completionTime = System.currentTimeMillis() + workOrder.rollingDuration; |
|
|
|
|
workOrders.add(workOrder); |
|
|
|
|
oven.add(workOrder); |
|
|
|
|
Logger.info(workOrder.toString()); |
|
|
|
|
|
|
|
|
|
} catch (InterruptedException e) { |
|
|
|
@ -109,7 +109,7 @@ public enum ForgeManager implements Runnable {
@@ -109,7 +109,7 @@ public enum ForgeManager implements Runnable {
|
|
|
|
|
|
|
|
|
|
Logger.info(workOrder.toString()); |
|
|
|
|
workOrder.vendor.workOrders.add(workOrder); |
|
|
|
|
workOrders.add(workOrder); |
|
|
|
|
oven.add(workOrder); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public static boolean validate(PlayerCharacter playerCharacter, WorkOrder workOrder) { |
|
|
|
@ -268,7 +268,7 @@ public enum ForgeManager implements Runnable {
@@ -268,7 +268,7 @@ public enum ForgeManager implements Runnable {
|
|
|
|
|
for (int i = 0; i < workOrder.slots_used; ++i) { |
|
|
|
|
|
|
|
|
|
Item forged_item = forgeItem(workOrder); |
|
|
|
|
ForgeManager.oven.put(forged_item, workOrder); |
|
|
|
|
ForgeManager.workOrderMap.put(forged_item, workOrder); |
|
|
|
|
|
|
|
|
|
workOrder.cooking.add(forged_item); |
|
|
|
|
|
|
|
|
|