Browse Source

More completion work

combat-2
MagicBot 7 months ago
parent
commit
f9825900cc
  1. 42
      src/engine/net/client/handlers/ItemProductionMsgHandler.java

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

@ -107,24 +107,7 @@ public class ItemProductionMsgHandler extends AbstractClientMsgHandler { @@ -107,24 +107,7 @@ public class ItemProductionMsgHandler extends AbstractClientMsgHandler {
DispatchMessage.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.SECONDARY);
break;
case COMPLETE:
Item virtualItem = ForgeManager.inMemoryItemLookup.get(msg.itemUUID);
if (virtualItem == null)
return true;
//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);
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);
ForgeManager.vendorItemLookup.get(vendor).remove(virtualItem);
ForgeManager.itemWorkOrderLookup.remove(virtualItem);
completeItem(msg.itemUUID, vendor, origin);
break;
case DEPOSIT:
depositItem(msg.itemUUID, vendor, origin);
@ -141,6 +124,29 @@ public class ItemProductionMsgHandler extends AbstractClientMsgHandler { @@ -141,6 +124,29 @@ public class ItemProductionMsgHandler extends AbstractClientMsgHandler {
return true;
}
private static void completeItem(int itemUUID, NPC vendor, ClientConnection origin) {
Item virtualItem = ForgeManager.inMemoryItemLookup.get(itemUUID);
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);
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);
ForgeManager.vendorItemLookup.get(vendor).remove(virtualItem);
ForgeManager.itemWorkOrderLookup.remove(virtualItem);
}
private static void setItemPrice(int itemType, int itemUUID, int itemPrice, NPC vendor, ClientConnection origin) {
Item targetItem;

Loading…
Cancel
Save