Browse Source

Minor class cleanup

combat-2
MagicBot 9 months ago
parent
commit
4a3a8d4b65
  1. 27
      src/engine/net/client/handlers/ItemProductionMsgHandler.java

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

@ -218,16 +218,10 @@ public class ItemProductionMsgHandler extends AbstractClientMsgHandler { @@ -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 { @@ -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 { @@ -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 { @@ -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 { @@ -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<Integer, Integer> 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 { @@ -341,7 +319,6 @@ public class ItemProductionMsgHandler extends AbstractClientMsgHandler {
return;
player.charItemManager.buyFromNPC(targetItem, vendor);
}
player.charItemManager.updateInventory();

Loading…
Cancel
Save