From 2222a335a19ea64bd9453f52d6347f7e60b97099 Mon Sep 17 00:00:00 2001 From: FatBoy-DOTC Date: Sun, 18 Feb 2024 18:12:09 -0600 Subject: [PATCH] resource merchant work --- src/engine/net/client/ClientMessagePump.java | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/src/engine/net/client/ClientMessagePump.java b/src/engine/net/client/ClientMessagePump.java index bcffbd21..0cd796cd 100644 --- a/src/engine/net/client/ClientMessagePump.java +++ b/src/engine/net/client/ClientMessagePump.java @@ -1389,7 +1389,15 @@ public class ClientMessagePump implements NetMsgHandler { return; Item buy = null; - + if(npc.getName().equals("Resource Merchant")) { + MobLoot resource = new MobLoot(npc, ItemBase.getItemBase(msg.getItemID()), 1, true); + resource.setValue(Warehouse.getCostForResource(msg.getItemID())); + npc.getCharItemManager().addItemToInventory(resource); + npc.getCharItemManager().updateInventory(resource, true); + Dispatch dispatch = Dispatch.borrow(sourcePlayer, msg); + DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY); + itemMan.updateInventory(); + } if (msg.getItemType() == GameObjectType.MobEquipment.ordinal()) { ArrayList sellInventory = npc.getContract().getSellInventory(); if (sellInventory == null) @@ -1583,15 +1591,9 @@ public class ClientMessagePump implements NetMsgHandler { // msg.setItemID(buy.getObjectUUID()); Dispatch dispatch = Dispatch.borrow(sourcePlayer, msg); DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY); - - itemMan.updateInventory(); - } - if(npc.getName().equals("Resource Merchant")) { - MobLoot resource = new MobLoot(npc, ItemBase.getItemBase(buy.getItemBaseID()), 1, true); - resource.setValue(Warehouse.getCostForResource(buy.getItemBaseID())); - npc.getCharItemManager().addItemToInventory(resource); - npc.getCharItemManager().updateInventory(resource, true); + itemMan.updateInventory(); } + } finally { origin.buyLock.unlock(); }