Browse Source

forged items are persisted

combat-2
MagicBot 8 months ago
parent
commit
8b4b3b971a
  1. 9
      src/engine/gameManager/ForgeManager.java

9
src/engine/gameManager/ForgeManager.java

@ -61,11 +61,12 @@ public enum ForgeManager implements Runnable {
// workOrder // workOrder
ArrayList<Item> toRemove = new ArrayList<>(); ArrayList<Item> toRemove = new ArrayList<>();
Item completed_item = null;
for (Item cooked_item : workOrder.cooking) { for (Item cooked_item : workOrder.cooking) {
toRemove.add(cooked_item); toRemove.add(cooked_item);
cooked_item.containerType = mbEnums.ItemContainerType.INVENTORY; cooked_item.containerType = mbEnums.ItemContainerType.INVENTORY;
Item completed_item = DbManager.ItemQueries.PERSIST(cooked_item); completed_item = DbManager.ItemQueries.PERSIST(cooked_item);
workOrder.vendor.charItemManager.addItemToInventory(completed_item); workOrder.vendor.charItemManager.addItemToInventory(completed_item);
} }
@ -78,8 +79,12 @@ public enum ForgeManager implements Runnable {
vendorItemLookup.get(workOrder.vendor).remove(memoryItem); vendorItemLookup.get(workOrder.vendor).remove(memoryItem);
} }
Logger.info("item forged:" + workOrder.workOrderID + " (" + workOrder.total_produced + "/" + workOrder.total_to_produce + ")"); // Update vendor window
ItemProductionMsg outMsg = new ItemProductionMsg(workOrder.vendor.building, workOrder.vendor, completed_item, 8, true);
DispatchMessage.dispatchMsgToInterestArea(workOrder.vendor, outMsg, mbEnums.DispatchChannel.SECONDARY, 700, false, false);
Logger.info("item forged:" + workOrder.workOrderID + " (" + workOrder.total_produced + "/" + workOrder.total_to_produce + ")");
if (workOrder.total_produced >= workOrder.total_to_produce) { if (workOrder.total_produced >= workOrder.total_to_produce) {
Logger.info("workOrder has completed: " + workOrder.workOrderID); Logger.info("workOrder has completed: " + workOrder.workOrderID);

Loading…
Cancel
Save