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

Loading…
Cancel
Save