From 689fc142d00e331c5397843055fe041c9ee903bc Mon Sep 17 00:00:00 2001 From: MagicBot Date: Wed, 17 Apr 2024 13:46:10 -0400 Subject: [PATCH] Persisted items belong in vendor inventory not virtual ones. --- src/engine/gameManager/ForgeManager.java | 11 ++++++++--- .../net/client/handlers/ItemProductionMsgHandler.java | 5 ++--- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/engine/gameManager/ForgeManager.java b/src/engine/gameManager/ForgeManager.java index f98c7565..d7c455fc 100644 --- a/src/engine/gameManager/ForgeManager.java +++ b/src/engine/gameManager/ForgeManager.java @@ -311,12 +311,17 @@ public enum ForgeManager implements Runnable { 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 outMsg1 = new ItemProductionMsg(workOrder.vendor.building, workOrder.vendor, workOrderItem, mbEnums.ProductionActionType.CONFIRM_DEPOSIT, true); - DispatchMessage.dispatchMsgToInterestArea(workOrder.vendor, outMsg1, mbEnums.DispatchChannel.SECONDARY, 700, false, false); + + Item completedItem = DbManager.ItemQueries.PERSIST(workOrderItem); // add to the vendor inventory - workOrder.vendor.charItemManager.addItemToInventory(workOrderItem); + workOrder.vendor.charItemManager.addItemToInventory(completedItem); + + ItemProductionMsg outMsg1 = new ItemProductionMsg(workOrder.vendor.building, workOrder.vendor, completedItem, mbEnums.ProductionActionType.DEPOSIT, true); + DispatchMessage.dispatchMsgToInterestArea(workOrder.vendor, outMsg1, mbEnums.DispatchChannel.SECONDARY, 700, false, false); + ItemProductionMsg outMsg2 = new ItemProductionMsg(workOrder.vendor.building, workOrder.vendor, completedItem, mbEnums.ProductionActionType.CONFIRM_DEPOSIT, true); + DispatchMessage.dispatchMsgToInterestArea(workOrder.vendor, outMsg2, mbEnums.DispatchChannel.SECONDARY, 700, false, false); toRemove.add(workOrderItem); } diff --git a/src/engine/net/client/handlers/ItemProductionMsgHandler.java b/src/engine/net/client/handlers/ItemProductionMsgHandler.java index e475e8e1..28d31f08 100644 --- a/src/engine/net/client/handlers/ItemProductionMsgHandler.java +++ b/src/engine/net/client/handlers/ItemProductionMsgHandler.java @@ -136,20 +136,19 @@ public class ItemProductionMsgHandler extends AbstractClientMsgHandler { ItemProductionMsg outMsg = new ItemProductionMsg(vendor.building, vendor, virtualItem, mbEnums.ProductionActionType.SETPRICE, true); DispatchMessage.dispatchMsgToInterestArea(vendor, outMsg, mbEnums.DispatchChannel.SECONDARY, 700, false, false); - ItemProductionMsg outMsg1 = new ItemProductionMsg(vendor.building, vendor, virtualItem, mbEnums.ProductionActionType.CONFIRM_DEPOSIT, true); - DispatchMessage.dispatchMsgToInterestArea(vendor, outMsg1, mbEnums.DispatchChannel.SECONDARY, 700, false, false); // Add to NPC inventory vendor.charItemManager.addItemToInventory(virtualItem); // Remove from collections + WorkOrder workOrder = ForgeManager.itemWorkOrderLookup.get(virtualItem); workOrder.cooking.remove(virtualItem); - ForgeManager.vendorItemLookup.get(vendor).remove(virtualItem); ForgeManager.itemWorkOrderLookup.remove(virtualItem); + } private static void setItemPrice(int itemType, int itemUUID, int itemPrice, NPC vendor, ClientConnection origin) {