|
|
@ -46,7 +46,7 @@ public class ItemProductionMsgHandler extends AbstractClientMsgHandler { |
|
|
|
// Member variable declaration
|
|
|
|
// Member variable declaration
|
|
|
|
|
|
|
|
|
|
|
|
PlayerCharacter player; |
|
|
|
PlayerCharacter player; |
|
|
|
NPC vendorNPC; |
|
|
|
NPC vendor; |
|
|
|
ItemProductionMsg msg; |
|
|
|
ItemProductionMsg msg; |
|
|
|
Dispatch dispatch; |
|
|
|
Dispatch dispatch; |
|
|
|
|
|
|
|
|
|
|
@ -60,11 +60,11 @@ public class ItemProductionMsgHandler extends AbstractClientMsgHandler { |
|
|
|
|
|
|
|
|
|
|
|
// Grab reference to vendor we are interacting with
|
|
|
|
// 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?
|
|
|
|
// Oops?
|
|
|
|
|
|
|
|
|
|
|
|
if (vendorNPC == null) |
|
|
|
if (vendor == null) |
|
|
|
return true; |
|
|
|
return true; |
|
|
|
|
|
|
|
|
|
|
|
// Process Request
|
|
|
|
// Process Request
|
|
|
@ -77,7 +77,7 @@ public class ItemProductionMsgHandler extends AbstractClientMsgHandler { |
|
|
|
|
|
|
|
|
|
|
|
WorkOrder workOrder = new WorkOrder(); |
|
|
|
WorkOrder workOrder = new WorkOrder(); |
|
|
|
workOrder.total_to_produce = msg.total_to_produce; |
|
|
|
workOrder.total_to_produce = msg.total_to_produce; |
|
|
|
workOrder.vendor = vendorNPC; |
|
|
|
workOrder.vendor = vendor; |
|
|
|
workOrder.templateID = msg.itemUUID; |
|
|
|
workOrder.templateID = msg.itemUUID; |
|
|
|
workOrder.prefixToken = msg.pToken; |
|
|
|
workOrder.prefixToken = msg.pToken; |
|
|
|
workOrder.suffixToken = msg.sToken; |
|
|
|
workOrder.suffixToken = msg.sToken; |
|
|
@ -98,25 +98,42 @@ public class ItemProductionMsgHandler extends AbstractClientMsgHandler { |
|
|
|
|
|
|
|
|
|
|
|
break; |
|
|
|
break; |
|
|
|
case JUNK: |
|
|
|
case JUNK: |
|
|
|
junkItem(msg.itemUUID, vendorNPC, origin); |
|
|
|
junkItem(msg.itemUUID, vendor, origin); |
|
|
|
break; |
|
|
|
break; |
|
|
|
case RECYCLE: |
|
|
|
case RECYCLE: |
|
|
|
recycleItem(msg.items, vendorNPC, origin); |
|
|
|
recycleItem(msg.items, vendor, origin); |
|
|
|
msg.actionType = mbEnums.ProductionActionType.TAKE; |
|
|
|
msg.actionType = mbEnums.ProductionActionType.TAKE; |
|
|
|
dispatch = Dispatch.borrow(player, msg); |
|
|
|
dispatch = Dispatch.borrow(player, msg); |
|
|
|
DispatchMessage.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.SECONDARY); |
|
|
|
DispatchMessage.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.SECONDARY); |
|
|
|
break; |
|
|
|
break; |
|
|
|
case COMPLETE: |
|
|
|
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; |
|
|
|
break; |
|
|
|
case DEPOSIT: |
|
|
|
case DEPOSIT: |
|
|
|
depositItem(msg.itemUUID, vendorNPC, origin); |
|
|
|
depositItem(msg.itemUUID, vendor, origin); |
|
|
|
break; |
|
|
|
break; |
|
|
|
case SETPRICE: |
|
|
|
case SETPRICE: |
|
|
|
setItemPrice(msg.itemType, msg.itemUUID, msg.itemPrice, vendorNPC, origin); |
|
|
|
setItemPrice(msg.itemType, msg.itemUUID, msg.itemPrice, vendor, origin); |
|
|
|
break; |
|
|
|
break; |
|
|
|
case TAKE: |
|
|
|
case TAKE: |
|
|
|
takeItem(msg.items, vendorNPC, origin); |
|
|
|
takeItem(msg.items, vendor, origin); |
|
|
|
dispatch = Dispatch.borrow(player, msg); |
|
|
|
dispatch = Dispatch.borrow(player, msg); |
|
|
|
DispatchMessage.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.SECONDARY); |
|
|
|
DispatchMessage.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.SECONDARY); |
|
|
|
break; |
|
|
|
break; |
|
|
|