|
|
@ -62,25 +62,40 @@ public enum ForgeManager implements Runnable { |
|
|
|
if (workOrder.runCanceled || workOrder.runCompleted) |
|
|
|
if (workOrder.runCanceled || workOrder.runCompleted) |
|
|
|
continue; |
|
|
|
continue; |
|
|
|
|
|
|
|
|
|
|
|
// Create in memory items to add to collections
|
|
|
|
// Persist current items that are currently cooking for this
|
|
|
|
|
|
|
|
// workOrder
|
|
|
|
|
|
|
|
|
|
|
|
forgeItems(workOrder); |
|
|
|
ArrayList<Item> toRemove = new ArrayList<>(); |
|
|
|
|
|
|
|
|
|
|
|
Logger.info("item forged:" + workOrder.workOrderID + " (" + workOrder.total_produced + "/" + workOrder.total_to_produce + ")"); |
|
|
|
for (Item cooked_item : workOrder.cooking) { |
|
|
|
|
|
|
|
toRemove.add(cooked_item); |
|
|
|
|
|
|
|
cooked_item.containerType = mbEnums.ItemContainerType.INVENTORY; |
|
|
|
|
|
|
|
Item completed_item = DbManager.ItemQueries.PERSIST(cooked_item); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
workOrder.vendor.charItemManager.addItemToInventory(completed_item); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (workOrder.total_produced >= workOrder.total_to_produce) { |
|
|
|
// Remove the fake negativeID item from all collections.
|
|
|
|
|
|
|
|
|
|
|
|
Logger.info("workOrder has completed: " + workOrder.workOrderID); |
|
|
|
for (Item memoryItem : toRemove) { |
|
|
|
|
|
|
|
workOrder.cooking.remove(memoryItem); |
|
|
|
|
|
|
|
inMemoryItemLookup.remove(memoryItem.objectUUID); |
|
|
|
|
|
|
|
vendorItemLookup.get(workOrder.vendor).remove(memoryItem); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Logger.info("item forged:" + workOrder.workOrderID + " (" + workOrder.total_produced + "/" + workOrder.total_to_produce + ")"); |
|
|
|
|
|
|
|
|
|
|
|
// Persist current items that are currently building for this
|
|
|
|
|
|
|
|
// worker after first removing the negative id item from all
|
|
|
|
|
|
|
|
// collections.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (workOrder.total_produced >= workOrder.total_to_produce) { |
|
|
|
|
|
|
|
Logger.info("workOrder has completed: " + workOrder.workOrderID); |
|
|
|
workOrder.runCompleted = true; |
|
|
|
workOrder.runCompleted = true; |
|
|
|
continue; |
|
|
|
continue; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Create new set in memory items
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
forgeItems(workOrder); |
|
|
|
|
|
|
|
|
|
|
|
// enQueue this workOrder again; back into the oven
|
|
|
|
// enQueue this workOrder again; back into the oven
|
|
|
|
// until all items for this workOrder are completed.
|
|
|
|
// until all items for this workOrder are completed.
|
|
|
|
|
|
|
|
|
|
|
@ -296,13 +311,13 @@ public enum ForgeManager implements Runnable { |
|
|
|
|
|
|
|
|
|
|
|
// Add item to in-memory caches
|
|
|
|
// Add item to in-memory caches
|
|
|
|
|
|
|
|
|
|
|
|
ForgeManager.inMemoryItemLookup.put(forged_item.objectUUID, forged_item); |
|
|
|
workOrder.cooking.add(forged_item); |
|
|
|
|
|
|
|
|
|
|
|
ForgeManager.vendorItemLookup.computeIfAbsent(workOrder.vendor, k -> new ArrayList<>()); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ForgeManager.vendorItemLookup.get(workOrder.vendor).add(forged_item); |
|
|
|
inMemoryItemLookup.put(forged_item.objectUUID, forged_item); |
|
|
|
|
|
|
|
vendorItemLookup.computeIfAbsent(workOrder.vendor, k -> new ArrayList<>()); |
|
|
|
|
|
|
|
vendorItemLookup.get(workOrder.vendor).add(forged_item); |
|
|
|
vendorItemLookup.get(workOrder.vendor).add(forged_item); |
|
|
|
vendorItemLookup.get(workOrder.vendor).add(forged_item); |
|
|
|
ForgeManager.vendorWorkOrderLookup.get(workOrder.vendor).add(workOrder); |
|
|
|
vendorWorkOrderLookup.get(workOrder.vendor).add(workOrder); |
|
|
|
|
|
|
|
|
|
|
|
// Update NPC window
|
|
|
|
// Update NPC window
|
|
|
|
|
|
|
|
|
|
|
|