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 { @@ -130,6 +130,11 @@ public class ItemProductionMsgHandler extends AbstractClientMsgHandler {
WorkOrder workOrder = ForgeManager.itemWorkOrderLookup.get(virtualItem);
City city = workOrder.vendor.building.getCity();
if (city == null)
return;
;
city.transactionLock.writeLock().lock();
try {
@ -286,7 +291,7 @@ public class ItemProductionMsgHandler extends AbstractClientMsgHandler { @@ -286,7 +291,7 @@ public class ItemProductionMsgHandler extends AbstractClientMsgHandler {
}
// 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) {
@ -398,9 +403,8 @@ public class ItemProductionMsgHandler extends AbstractClientMsgHandler { @@ -398,9 +403,8 @@ public class ItemProductionMsgHandler extends AbstractClientMsgHandler {
if (workOrder == null)
return;
if (workOrder.cooking.contains(virtualItem) == false)
if (!workOrder.cooking.contains(virtualItem))
return;
;
City city = workOrder.vendor.building.getCity();
@ -418,11 +422,11 @@ public class ItemProductionMsgHandler extends AbstractClientMsgHandler { @@ -418,11 +422,11 @@ public class ItemProductionMsgHandler extends AbstractClientMsgHandler {
// Update total_to_produce accounting for the slot being
// removed while workOrder is not completed.
if (workOrder.runCompleted == false)
if (!workOrder.runCompleted)
if (workOrder.multiple_slot_request && workOrder.slots_used > 1) {
int itemsPerSlot = workOrder.total_to_produce / workOrder.slots_used;
workOrder.total_to_produce = workOrder.total_to_produce - itemsPerSlot;
}
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.
@ -476,9 +480,7 @@ public class ItemProductionMsgHandler extends AbstractClientMsgHandler { @@ -476,9 +480,7 @@ public class ItemProductionMsgHandler extends AbstractClientMsgHandler {
player.charItemManager.buyFromNPC(targetItem, vendor);
}
player.charItemManager.updateInventory();
}
}

Loading…
Cancel
Save