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 {
private static void junkItem(int itemUUID, NPC vendor, ClientConnection origin) { private static void junkItem(int itemUUID, NPC vendor, ClientConnection origin) {
Item targetItem; Item virtualItem;
ManageNPCMsg outMsg; ManageNPCMsg outMsg;
Dispatch dispatch; Dispatch dispatch;
targetItem = Item.getFromCache(itemUUID); virtualItem = Item.getFromCache(itemUUID);
PlayerCharacter player = origin.getPlayerCharacter(); PlayerCharacter player = origin.getPlayerCharacter();
@ -369,7 +369,7 @@ public class ItemProductionMsgHandler extends AbstractClientMsgHandler {
// junk nothing? // junk nothing?
if (targetItem == null) if (virtualItem == null)
return; return;
// Cannot junk items without a forge! // Cannot junk items without a forge!
@ -377,20 +377,16 @@ public class ItemProductionMsgHandler extends AbstractClientMsgHandler {
if (vendor.getBuilding() == null) if (vendor.getBuilding() == null)
return; return;
WorkOrder workOrder = ForgeManager.itemWorkOrderLookup.get(targetItem); WorkOrder workOrder = ForgeManager.itemWorkOrderLookup.get(virtualItem);
City city = workOrder.vendor.building.getCity(); City city = workOrder.vendor.building.getCity();
city.transactionLock.writeLock().lock(); city.transactionLock.writeLock().lock();
try { try {
workOrder.cooking.remove(targetItem); workOrder.cooking.remove(virtualItem);
DbManager.removeFromCache(targetItem); DbManager.removeFromCache(virtualItem);
ForgeManager.itemWorkOrderLookup.remove(virtualItem);
// 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;
// Refresh vendor's inventory to client // Refresh vendor's inventory to client

Loading…
Cancel
Save