From 8f0e19a10c7e91a71c1bfc73aece60e6379bdbb3 Mon Sep 17 00:00:00 2001 From: FatBoy-DOTC Date: Sun, 18 Feb 2024 18:17:38 -0600 Subject: [PATCH] resource merchant work --- src/engine/net/client/ClientMessagePump.java | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/src/engine/net/client/ClientMessagePump.java b/src/engine/net/client/ClientMessagePump.java index 0cd796cd..bc5b33ef 100644 --- a/src/engine/net/client/ClientMessagePump.java +++ b/src/engine/net/client/ClientMessagePump.java @@ -1389,15 +1389,7 @@ 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) @@ -1413,8 +1405,6 @@ public class ClientMessagePump implements NetMsgHandler { return; int cost = me.getMagicValue(); - if(me.getItemBase().isStatRune()) - cost = 10000000; float bargain = sourcePlayer.getBargain(); @@ -1426,6 +1416,7 @@ public class ClientMessagePump implements NetMsgHandler { cost *= profit; + if (gold.getNumOfItems() - cost < 0) { //dont' have enough goldItem exit! // chatMan.chatSystemInfo(pc, "" + "You dont have enough gold."); @@ -1585,6 +1576,7 @@ public class ClientMessagePump implements NetMsgHandler { return; if (buy != null) { + msg.setItem(buy); //send the buy message back to update player // msg.setItemType(buy.getObjectType().ordinal()); @@ -1600,6 +1592,7 @@ public class ClientMessagePump implements NetMsgHandler { } else { ErrorPopupMsg.sendErrorPopup(origin.getPlayerCharacter(), 12); // All production slots taken } + } private static void Repair(RepairMsg msg, ClientConnection origin) {