Browse Source

Update to completion

combat-2
MagicBot 7 months ago
parent
commit
8d1561cd29
  1. 24
      src/engine/net/client/handlers/ItemProductionMsgHandler.java

24
src/engine/net/client/handlers/ItemProductionMsgHandler.java

@ -126,26 +126,26 @@ public class ItemProductionMsgHandler extends AbstractClientMsgHandler { @@ -126,26 +126,26 @@ public class ItemProductionMsgHandler extends AbstractClientMsgHandler {
private static void completeItem(int itemUUID, NPC vendor) {
Item virtualItem = ForgeManager.inMemoryItemLookup.get(itemUUID);
WorkOrder workOrder = ForgeManager.itemWorkOrderLookup.get(virtualItem);
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);
// Add to NPC inventory
// Persist item and add to vendor inventory
Item completedItem = DbManager.ItemQueries.PERSIST(virtualItem);
vendor.charItemManager.addItemToInventory(virtualItem);
ItemProductionMsg outMsg1 = new ItemProductionMsg(vendor.building, vendor, completedItem, mbEnums.ProductionActionType.DEPOSIT, true);
DispatchMessage.dispatchMsgToInterestArea(vendor, outMsg1, mbEnums.DispatchChannel.SECONDARY, 700, false, false);
ItemProductionMsg outMsg2 = new ItemProductionMsg(vendor.building, vendor, completedItem, mbEnums.ProductionActionType.CONFIRM_DEPOSIT, true);
DispatchMessage.dispatchMsgToInterestArea(vendor, outMsg2, mbEnums.DispatchChannel.SECONDARY, 700, false, false);
// Remove from collections
WorkOrder workOrder = ForgeManager.itemWorkOrderLookup.get(virtualItem);
ItemProductionMsg outMsg = new ItemProductionMsg(vendor.building, vendor, virtualItem, mbEnums.ProductionActionType.CONFIRM_SETPRICE, true);
DispatchMessage.dispatchMsgToInterestArea(vendor, outMsg, mbEnums.DispatchChannel.SECONDARY, 700, false, false);
workOrder.cooking.remove(virtualItem);
ForgeManager.vendorItemLookup.get(vendor).remove(virtualItem);
ForgeManager.vendorItemLookup.get(workOrder.vendor).remove(virtualItem);
ForgeManager.itemWorkOrderLookup.remove(virtualItem);

Loading…
Cancel
Save