Browse Source

Slot tracking update

combat-2
MagicBot 7 months ago
parent
commit
5a62361edd
  1. 18
      src/engine/net/client/handlers/ItemProductionMsgHandler.java

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

@ -356,11 +356,11 @@ public class ItemProductionMsgHandler extends AbstractClientMsgHandler { @@ -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 { @@ -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 { @@ -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

Loading…
Cancel
Save