Browse Source

Complete is complete

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

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

@ -46,7 +46,7 @@ public class ItemProductionMsgHandler extends AbstractClientMsgHandler { @@ -46,7 +46,7 @@ public class ItemProductionMsgHandler extends AbstractClientMsgHandler {
// Member variable declaration
PlayerCharacter player;
NPC vendorNPC;
NPC vendor;
ItemProductionMsg msg;
Dispatch dispatch;
@ -60,11 +60,11 @@ public class ItemProductionMsgHandler extends AbstractClientMsgHandler { @@ -60,11 +60,11 @@ public class ItemProductionMsgHandler extends AbstractClientMsgHandler {
// Grab reference to vendor we are interacting with
vendorNPC = (NPC) DbManager.getObject(mbEnums.GameObjectType.NPC, msg.npcUUID);
vendor = (NPC) DbManager.getObject(mbEnums.GameObjectType.NPC, msg.npcUUID);
// Oops?
if (vendorNPC == null)
if (vendor == null)
return true;
// Process Request
@ -77,7 +77,7 @@ public class ItemProductionMsgHandler extends AbstractClientMsgHandler { @@ -77,7 +77,7 @@ public class ItemProductionMsgHandler extends AbstractClientMsgHandler {
WorkOrder workOrder = new WorkOrder();
workOrder.total_to_produce = msg.total_to_produce;
workOrder.vendor = vendorNPC;
workOrder.vendor = vendor;
workOrder.templateID = msg.itemUUID;
workOrder.prefixToken = msg.pToken;
workOrder.suffixToken = msg.sToken;
@ -98,25 +98,42 @@ public class ItemProductionMsgHandler extends AbstractClientMsgHandler { @@ -98,25 +98,42 @@ public class ItemProductionMsgHandler extends AbstractClientMsgHandler {
break;
case JUNK:
junkItem(msg.itemUUID, vendorNPC, origin);
junkItem(msg.itemUUID, vendor, origin);
break;
case RECYCLE:
recycleItem(msg.items, vendorNPC, origin);
recycleItem(msg.items, vendor, origin);
msg.actionType = mbEnums.ProductionActionType.TAKE;
dispatch = Dispatch.borrow(player, msg);
DispatchMessage.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.SECONDARY);
break;
case COMPLETE:
// todo fix vendorNPC.completeItem(msg.itemUUID);
Item virtualItem = ForgeManager.inMemoryItemLookup.get(msg.itemUUID);
if (virtualItem == null)
return true;
//remove from client forge window
ItemProductionMsg outMsg1 = new ItemProductionMsg(vendor.building, vendor, virtualItem, mbEnums.ProductionActionType.SETPRICE, true);
DispatchMessage.dispatchMsgToInterestArea(vendor, outMsg1, mbEnums.DispatchChannel.SECONDARY, 700, false, false);
ItemProductionMsg outMsg = new ItemProductionMsg(vendor.building, vendor, virtualItem, mbEnums.ProductionActionType.CONFIRM_DEPOSIT, true);
DispatchMessage.dispatchMsgToInterestArea(vendor, outMsg, mbEnums.DispatchChannel.SECONDARY, 700, false, false);
Item completedItem = DbManager.ItemQueries.PERSIST(virtualItem);
vendor.charItemManager.addItemToInventory(completedItem);
ForgeManager.inMemoryItemLookup.remove(virtualItem.objectUUID);
ForgeManager.vendorItemLookup.get(vendor).remove(virtualItem);
ForgeManager.itemWorkOrderLookup.remove(virtualItem);
break;
case DEPOSIT:
depositItem(msg.itemUUID, vendorNPC, origin);
depositItem(msg.itemUUID, vendor, origin);
break;
case SETPRICE:
setItemPrice(msg.itemType, msg.itemUUID, msg.itemPrice, vendorNPC, origin);
setItemPrice(msg.itemType, msg.itemUUID, msg.itemPrice, vendor, origin);
break;
case TAKE:
takeItem(msg.items, vendorNPC, origin);
takeItem(msg.items, vendor, origin);
dispatch = Dispatch.borrow(player, msg);
DispatchMessage.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.SECONDARY);
break;

Loading…
Cancel
Save