Browse Source

Persisted items belong in vendor inventory not virtual ones.

combat-2
MagicBot 7 months ago
parent
commit
689fc142d0
  1. 11
      src/engine/gameManager/ForgeManager.java
  2. 5
      src/engine/net/client/handlers/ItemProductionMsgHandler.java

11
src/engine/gameManager/ForgeManager.java

@ -311,12 +311,17 @@ public enum ForgeManager implements Runnable { @@ -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);
}

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

@ -136,20 +136,19 @@ public class ItemProductionMsgHandler extends AbstractClientMsgHandler { @@ -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) {

Loading…
Cancel
Save