|
|
|
@ -265,12 +265,22 @@ public enum ForgeManager implements Runnable {
@@ -265,12 +265,22 @@ public enum ForgeManager implements Runnable {
|
|
|
|
|
|
|
|
|
|
public static Item forgeItem(WorkOrder workOrder) { |
|
|
|
|
|
|
|
|
|
ItemTemplate template = ItemTemplate.templates.get(workOrder.templateID); |
|
|
|
|
// Create new item from specified template
|
|
|
|
|
|
|
|
|
|
ItemTemplate template = ItemTemplate.templates.get(workOrder.templateID); |
|
|
|
|
Item forgedItem = new Item(workOrder.templateID); |
|
|
|
|
|
|
|
|
|
// Item gets a negative id; a virtual in-memory only item
|
|
|
|
|
// which is not persisted or added to the game cache.
|
|
|
|
|
|
|
|
|
|
forgedItem.objectUUID = MobLoot.lastNegativeID.getAndDecrement(); |
|
|
|
|
|
|
|
|
|
forgedItem.containerType = mbEnums.ItemContainerType.FORGE; |
|
|
|
|
forgedItem.ownerID = workOrder.vendor.getObjectUUID(); |
|
|
|
|
|
|
|
|
|
// The UpgradeDate for the item is serialized for the
|
|
|
|
|
// vendor forge window
|
|
|
|
|
|
|
|
|
|
forgedItem.setDateToUpgrade(workOrder.completionTime); |
|
|
|
|
|
|
|
|
|
// Give prefix and suffix to this item if random rolled
|
|
|
|
@ -302,17 +312,19 @@ public enum ForgeManager implements Runnable {
@@ -302,17 +312,19 @@ public enum ForgeManager implements Runnable {
|
|
|
|
|
|
|
|
|
|
toRemove.add(workOrderItem); |
|
|
|
|
|
|
|
|
|
// Remove the virtual items from the forge window
|
|
|
|
|
|
|
|
|
|
ItemProductionMsg outMsg = new ItemProductionMsg(workOrder.vendor.building, workOrder.vendor, workOrderItem, mbEnums.ProductionActionType.CONFIRM_SETPRICE, true); |
|
|
|
|
DispatchMessage.dispatchMsgToInterestArea(workOrder.vendor, outMsg, mbEnums.DispatchChannel.SECONDARY, 700, false, false); |
|
|
|
|
ItemProductionMsg outMsg2 = new ItemProductionMsg(workOrder.vendor.building, workOrder.vendor, workOrderItem, mbEnums.ProductionActionType.CONFIRM_DEPOSIT, true); |
|
|
|
|
DispatchMessage.dispatchMsgToInterestArea(workOrder.vendor, outMsg2, mbEnums.DispatchChannel.SECONDARY, 700, false, false); |
|
|
|
|
|
|
|
|
|
completed_item = DbManager.ItemQueries.PERSIST(workOrderItem); |
|
|
|
|
// Turn the virtual item into a real one and add to the vendor inventory
|
|
|
|
|
|
|
|
|
|
completed_item = DbManager.ItemQueries.PERSIST(workOrderItem); |
|
|
|
|
workOrder.vendor.charItemManager.addItemToInventory(completed_item); |
|
|
|
|
} |
|
|
|
|
// Remove the fake negativeID item from all collections.
|
|
|
|
|
// set the items as 'completed'
|
|
|
|
|
// Remove the fake negativeID virtual item from all collections.
|
|
|
|
|
|
|
|
|
|
for (Item memoryItem : toRemove) { |
|
|
|
|
workOrder.cooking.remove(memoryItem); |
|
|
|
@ -328,7 +340,7 @@ public enum ForgeManager implements Runnable {
@@ -328,7 +340,7 @@ public enum ForgeManager implements Runnable {
|
|
|
|
|
|
|
|
|
|
Item forged_item = forgeItem(workOrder); |
|
|
|
|
|
|
|
|
|
// Add item to in-memory caches
|
|
|
|
|
// Add virtual item to in-memory caches
|
|
|
|
|
|
|
|
|
|
workOrder.cooking.add(forged_item); |
|
|
|
|
|
|
|
|
|