|
|
|
@ -34,7 +34,6 @@ public enum ForgeManager implements Runnable {
@@ -34,7 +34,6 @@ public enum ForgeManager implements Runnable {
|
|
|
|
|
while (true) { |
|
|
|
|
|
|
|
|
|
try { |
|
|
|
|
|
|
|
|
|
WorkOrder workOrder = workOrders.take(); |
|
|
|
|
|
|
|
|
|
// Completed or canceled work orders are not re-enqueued
|
|
|
|
@ -42,36 +41,29 @@ public enum ForgeManager implements Runnable {
@@ -42,36 +41,29 @@ public enum ForgeManager implements Runnable {
|
|
|
|
|
if (workOrder.runCanceled || workOrder.runCompleted) |
|
|
|
|
continue; |
|
|
|
|
|
|
|
|
|
// Create negative ID items to add to collections
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < workOrder.slots_used; ++i) { |
|
|
|
|
|
|
|
|
|
// Create workOrder items; one for each slot
|
|
|
|
|
// assigned to this workOrder.
|
|
|
|
|
|
|
|
|
|
// if Prefix and suffix are null random roll item
|
|
|
|
|
// otherwise roll what was asked for
|
|
|
|
|
|
|
|
|
|
workOrder.total_produced = workOrder.total_produced + 1; |
|
|
|
|
} |
|
|
|
|
// Create in memory items to add to collections
|
|
|
|
|
forgeItems(workOrder); |
|
|
|
|
|
|
|
|
|
Logger.info("item forged:" + workOrder.workOrderID + " (" + workOrder.total_produced + "/" + workOrder.total_to_produce + ")"); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (workOrder.total_produced >= workOrder.total_to_produce) { |
|
|
|
|
|
|
|
|
|
Logger.info("workOrder has completed: " + workOrder.workOrderID); |
|
|
|
|
|
|
|
|
|
// Persist current items that are cooking
|
|
|
|
|
// after removing the negative id item from all collections.
|
|
|
|
|
|
|
|
|
|
// Add new item to the vendors inventory
|
|
|
|
|
|
|
|
|
|
workOrder.runCompleted = true; |
|
|
|
|
workOrder.vendor.workOrders.remove(workOrder); |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// Persist current items that are cooking
|
|
|
|
|
// after removing the negative id item from all collections.
|
|
|
|
|
|
|
|
|
|
// Add new item to the vendors inventory
|
|
|
|
|
|
|
|
|
|
// Resubmit workOrder
|
|
|
|
|
// enQueue this workOrder again; back into the oven
|
|
|
|
|
// until all items for this workOrder are completed.
|
|
|
|
|
|
|
|
|
|
workOrder.completionTime = System.currentTimeMillis() + workOrder.rollingDuration; |
|
|
|
|
workOrders.add(workOrder); |
|
|
|
@ -263,6 +255,7 @@ public enum ForgeManager implements Runnable {
@@ -263,6 +255,7 @@ public enum ForgeManager implements Runnable {
|
|
|
|
|
forgedItem.objectUUID = MobLoot.lastNegativeID.getAndDecrement(); |
|
|
|
|
forgedItem.containerType = mbEnums.ItemContainerType.FORGE; |
|
|
|
|
forgedItem.ownerID = workOrder.vendor.getObjectUUID(); |
|
|
|
|
forgedItem.setDateToUpgrade(workOrder.completionTime); |
|
|
|
|
|
|
|
|
|
// Forged items are unidentified until completed
|
|
|
|
|
|
|
|
|
@ -277,10 +270,11 @@ public enum ForgeManager implements Runnable {
@@ -277,10 +270,11 @@ public enum ForgeManager implements Runnable {
|
|
|
|
|
|
|
|
|
|
Item forged_item = forgeItem(workOrder); |
|
|
|
|
ForgeManager.oven.put(forged_item, workOrder); |
|
|
|
|
|
|
|
|
|
workOrder.cooking.add(forged_item); |
|
|
|
|
|
|
|
|
|
workOrder.total_produced = workOrder.total_produced + 1; |
|
|
|
|
Logger.info("Forged item: " + forged_item.objectUUID + " of template " + forged_item.templateID); |
|
|
|
|
Logger.info("Forging item: " + forged_item.objectUUID + " of template " + forged_item.templateID); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|