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