|
|
@ -373,24 +373,34 @@ public class ItemProductionMsgHandler extends AbstractClientMsgHandler { |
|
|
|
ManageNPCMsg outMsg; |
|
|
|
ManageNPCMsg outMsg; |
|
|
|
Dispatch dispatch; |
|
|
|
Dispatch dispatch; |
|
|
|
|
|
|
|
|
|
|
|
virtualItem = Item.getFromCache(itemUUID); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
PlayerCharacter player = origin.getPlayerCharacter(); |
|
|
|
PlayerCharacter player = origin.getPlayerCharacter(); |
|
|
|
|
|
|
|
|
|
|
|
if (player == null) |
|
|
|
if (player == null) |
|
|
|
return; |
|
|
|
return; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Cannot junk items without a forge!
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (vendor.getBuilding() == null) |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
|
|
|
|
// junk nothing?
|
|
|
|
// junk nothing?
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
virtualItem = Item.getFromCache(itemUUID); |
|
|
|
|
|
|
|
|
|
|
|
if (virtualItem == null) |
|
|
|
if (virtualItem == null) |
|
|
|
return; |
|
|
|
return; |
|
|
|
|
|
|
|
|
|
|
|
// Cannot junk items without a forge!
|
|
|
|
WorkOrder workOrder = ForgeManager.itemWorkOrderLookup.get(virtualItem); |
|
|
|
|
|
|
|
|
|
|
|
if (vendor.getBuilding() == null) |
|
|
|
// If this virtual item was already processed then
|
|
|
|
|
|
|
|
// it will have been removed from the workOrder.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (workOrder == null) |
|
|
|
return; |
|
|
|
return; |
|
|
|
|
|
|
|
|
|
|
|
WorkOrder workOrder = ForgeManager.itemWorkOrderLookup.get(virtualItem); |
|
|
|
if (workOrder.cooking.contains(virtualItem) == false) |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
; |
|
|
|
|
|
|
|
|
|
|
|
City city = workOrder.vendor.building.getCity(); |
|
|
|
City city = workOrder.vendor.building.getCity(); |
|
|
|
|
|
|
|
|
|
|
@ -405,6 +415,16 @@ public class ItemProductionMsgHandler extends AbstractClientMsgHandler { |
|
|
|
DbManager.removeFromCache(virtualItem); |
|
|
|
DbManager.removeFromCache(virtualItem); |
|
|
|
ForgeManager.itemWorkOrderLookup.remove(virtualItem); |
|
|
|
ForgeManager.itemWorkOrderLookup.remove(virtualItem); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Update total_to_produce accounting for the slot being
|
|
|
|
|
|
|
|
// removed while workOrder is not completed.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (workOrder.runCompleted == false) { |
|
|
|
|
|
|
|
int itemsPerSlot = workOrder.total_to_produce / workOrder.slots_used; |
|
|
|
|
|
|
|
workOrder.total_to_produce = workOrder.total_to_produce - itemsPerSlot; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Slot is no longer allocated to this workOrder.
|
|
|
|
|
|
|
|
|
|
|
|
workOrder.slots_used = workOrder.slots_used - 1; |
|
|
|
workOrder.slots_used = workOrder.slots_used - 1; |
|
|
|
|
|
|
|
|
|
|
|
// Update workOrder on disk
|
|
|
|
// Update workOrder on disk
|
|
|
|