diff --git a/src/engine/net/client/handlers/ItemProductionMsgHandler.java b/src/engine/net/client/handlers/ItemProductionMsgHandler.java index b64e1d94..734dbd6f 100644 --- a/src/engine/net/client/handlers/ItemProductionMsgHandler.java +++ b/src/engine/net/client/handlers/ItemProductionMsgHandler.java @@ -107,24 +107,7 @@ public class ItemProductionMsgHandler extends AbstractClientMsgHandler { DispatchMessage.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.SECONDARY); break; case COMPLETE: - Item virtualItem = ForgeManager.inMemoryItemLookup.get(msg.itemUUID); - - if (virtualItem == null) - return true; - - //remove from client forge window - - 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); - - ForgeManager.vendorItemLookup.get(vendor).remove(virtualItem); - ForgeManager.itemWorkOrderLookup.remove(virtualItem); + completeItem(msg.itemUUID, vendor, origin); break; case DEPOSIT: depositItem(msg.itemUUID, vendor, origin); @@ -141,6 +124,29 @@ public class ItemProductionMsgHandler extends AbstractClientMsgHandler { return true; } + private static void completeItem(int itemUUID, NPC vendor, ClientConnection origin) { + + + Item virtualItem = ForgeManager.inMemoryItemLookup.get(itemUUID); + + if (virtualItem == null) + return; + + //remove from client forge window + + 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); + + ForgeManager.vendorItemLookup.get(vendor).remove(virtualItem); + ForgeManager.itemWorkOrderLookup.remove(virtualItem); + } + private static void setItemPrice(int itemType, int itemUUID, int itemPrice, NPC vendor, ClientConnection origin) { Item targetItem;