Browse Source

Minor cleanup

combat-2
MagicBot 7 months ago
parent
commit
01f0e25e08
  1. 20
      src/engine/net/client/handlers/ItemProductionMsgHandler.java

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

@ -130,6 +130,11 @@ public class ItemProductionMsgHandler extends AbstractClientMsgHandler {
WorkOrder workOrder = ForgeManager.itemWorkOrderLookup.get(virtualItem); WorkOrder workOrder = ForgeManager.itemWorkOrderLookup.get(virtualItem);
City city = workOrder.vendor.building.getCity(); City city = workOrder.vendor.building.getCity();
if (city == null)
return;
;
city.transactionLock.writeLock().lock(); city.transactionLock.writeLock().lock();
try { try {
@ -286,7 +291,7 @@ public class ItemProductionMsgHandler extends AbstractClientMsgHandler {
} }
// Method completes an item that has been previously rolled // Method completes an item that has been previously rolled
// adding it to the NPC's inventory // adding it to the Vendor inventory
private static void recycleItem(HashMap<Integer, Integer> itemList, NPC vendor, ClientConnection origin) { private static void recycleItem(HashMap<Integer, Integer> itemList, NPC vendor, ClientConnection origin) {
@ -398,9 +403,8 @@ public class ItemProductionMsgHandler extends AbstractClientMsgHandler {
if (workOrder == null) if (workOrder == null)
return; return;
if (workOrder.cooking.contains(virtualItem) == false) if (!workOrder.cooking.contains(virtualItem))
return; return;
;
City city = workOrder.vendor.building.getCity(); City city = workOrder.vendor.building.getCity();
@ -418,11 +422,11 @@ public class ItemProductionMsgHandler extends AbstractClientMsgHandler {
// Update total_to_produce accounting for the slot being // Update total_to_produce accounting for the slot being
// removed while workOrder is not completed. // removed while workOrder is not completed.
if (workOrder.runCompleted == false) if (!workOrder.runCompleted)
if (workOrder.multiple_slot_request && workOrder.slots_used > 1) { if (workOrder.multiple_slot_request && workOrder.slots_used > 1) {
int itemsPerSlot = workOrder.total_to_produce / workOrder.slots_used; int itemsPerSlot = workOrder.total_to_produce / workOrder.slots_used;
workOrder.total_to_produce = workOrder.total_to_produce - itemsPerSlot; workOrder.total_to_produce = workOrder.total_to_produce - itemsPerSlot;
} }
// Slot is no longer allocated to this workOrder. // Slot is no longer allocated to this workOrder.
@ -476,9 +480,7 @@ public class ItemProductionMsgHandler extends AbstractClientMsgHandler {
player.charItemManager.buyFromNPC(targetItem, vendor); player.charItemManager.buyFromNPC(targetItem, vendor);
} }
player.charItemManager.updateInventory(); player.charItemManager.updateInventory();
} }
} }

Loading…
Cancel
Save