From 5a62361edd3f16352d7f949155cbd5f2dfce0912 Mon Sep 17 00:00:00 2001 From: MagicBot Date: Mon, 22 Apr 2024 00:10:32 -0400 Subject: [PATCH] Slot tracking update --- .../handlers/ItemProductionMsgHandler.java | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/src/engine/net/client/handlers/ItemProductionMsgHandler.java b/src/engine/net/client/handlers/ItemProductionMsgHandler.java index 3ea16423..59d840df 100644 --- a/src/engine/net/client/handlers/ItemProductionMsgHandler.java +++ b/src/engine/net/client/handlers/ItemProductionMsgHandler.java @@ -356,11 +356,11 @@ public class ItemProductionMsgHandler extends AbstractClientMsgHandler { private static void junkItem(int itemUUID, NPC vendor, ClientConnection origin) { - Item targetItem; + Item virtualItem; ManageNPCMsg outMsg; Dispatch dispatch; - targetItem = Item.getFromCache(itemUUID); + virtualItem = Item.getFromCache(itemUUID); PlayerCharacter player = origin.getPlayerCharacter(); @@ -369,7 +369,7 @@ public class ItemProductionMsgHandler extends AbstractClientMsgHandler { // junk nothing? - if (targetItem == null) + if (virtualItem == null) return; // Cannot junk items without a forge! @@ -377,20 +377,16 @@ public class ItemProductionMsgHandler extends AbstractClientMsgHandler { if (vendor.getBuilding() == null) return; - WorkOrder workOrder = ForgeManager.itemWorkOrderLookup.get(targetItem); + WorkOrder workOrder = ForgeManager.itemWorkOrderLookup.get(virtualItem); City city = workOrder.vendor.building.getCity(); city.transactionLock.writeLock().lock(); try { - workOrder.cooking.remove(targetItem); - DbManager.removeFromCache(targetItem); - - // WorkOrder exists until all items are completed or junked - // this is to hold a reference to the virtual item for serialization (NPCMsgHandler) - - workOrder.slots_used = workOrder.slots_used - 1; + workOrder.cooking.remove(virtualItem); + DbManager.removeFromCache(virtualItem); + ForgeManager.itemWorkOrderLookup.remove(virtualItem); // Refresh vendor's inventory to client