From 4a3a8d4b65d88b4cc2ab5b160f8d4d343fe7d07b Mon Sep 17 00:00:00 2001 From: MagicBot Date: Sun, 7 Apr 2024 13:10:58 -0400 Subject: [PATCH] Minor class cleanup --- .../handlers/ItemProductionMsgHandler.java | 27 ++----------------- 1 file changed, 2 insertions(+), 25 deletions(-) diff --git a/src/engine/net/client/handlers/ItemProductionMsgHandler.java b/src/engine/net/client/handlers/ItemProductionMsgHandler.java index 7a0dce43..b998f858 100644 --- a/src/engine/net/client/handlers/ItemProductionMsgHandler.java +++ b/src/engine/net/client/handlers/ItemProductionMsgHandler.java @@ -218,16 +218,10 @@ public class ItemProductionMsgHandler extends AbstractClientMsgHandler { case REALMCHARTER: case SCROLL: case POTION: - itemValue = 0; continue; } totalValue += itemValue; - long start = System.currentTimeMillis(); vendor.charItemManager.recycle(targetItem); - long end = System.currentTimeMillis(); - long timetook = end - start; - - // ChatManager.chatSystemInfo(player, "Took " + timetook + " ms to finish"); outMsg = new ItemProductionMsg(vendor.getBuilding(), vendor, targetItem, mbEnums.ProductionActionType.TAKE.ordinal(), true); @@ -240,18 +234,12 @@ public class ItemProductionMsgHandler extends AbstractClientMsgHandler { if (!vendor.getBuilding().transferGold(totalValue, false)) return; - } catch (Exception e) { Logger.error(e); } finally { - origin.sellLock.unlock(); } - } - - // Refresh vendor's inventory to client - } // Method handles recycling of an item @@ -271,12 +259,11 @@ public class ItemProductionMsgHandler extends AbstractClientMsgHandler { if (player == null) return; - // Can't junk nothing! + // junk nothing? if (targetItem == null) return; - if (!vendor.charItemManager.forgeContains(targetItem, vendor)) return; @@ -296,7 +283,6 @@ public class ItemProductionMsgHandler extends AbstractClientMsgHandler { outMsg.setMessageType(1); dispatch = Dispatch.borrow(player, outMsg); DispatchMessage.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.SECONDARY); - ; } finally { origin.sellLock.unlock(); } @@ -304,34 +290,26 @@ public class ItemProductionMsgHandler extends AbstractClientMsgHandler { } - // Method junks an item that has been rolled but not completed - private static void takeItem(HashMap itemList, NPC vendor, ClientConnection origin) { Item targetItem; - - PlayerCharacter player = origin.getPlayerCharacter(); if (player == null) return; - for (int itemUUID : itemList.keySet()) { int type = itemList.get(itemUUID); if (type == GameObjectType.Item.ordinal()) { targetItem = Item.getFromCache(itemUUID); - } else { + } else targetItem = MobLoot.getFromCache(itemUUID); - } - if (targetItem == null) return; - if (targetItem.template.item_type.equals(ItemType.GOLD)) return; if (vendor.charItemManager.inventoryContains(targetItem) == false) @@ -341,7 +319,6 @@ public class ItemProductionMsgHandler extends AbstractClientMsgHandler { return; player.charItemManager.buyFromNPC(targetItem, vendor); - } player.charItemManager.updateInventory();