From 197df90a21257379459d3a114ba2f5442094b1d1 Mon Sep 17 00:00:00 2001 From: MagicBot Date: Tue, 16 Apr 2024 15:33:39 -0400 Subject: [PATCH] Comment cleanup --- src/engine/gameManager/ForgeManager.java | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/src/engine/gameManager/ForgeManager.java b/src/engine/gameManager/ForgeManager.java index e81276f5..859fd580 100644 --- a/src/engine/gameManager/ForgeManager.java +++ b/src/engine/gameManager/ForgeManager.java @@ -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 { 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 { Item forged_item = forgeItem(workOrder); - // Add item to in-memory caches + // Add virtual item to in-memory caches workOrder.cooking.add(forged_item);