From 96eb9a3ad0c9500be91ff4734c424c43db59d8ff Mon Sep 17 00:00:00 2001 From: FatBoy-DOTC Date: Mon, 9 Sep 2024 21:06:03 -0500 Subject: [PATCH] builders sell things at proper ranks --- src/engine/net/client/ClientMessagePump.java | 5 ++++- src/engine/net/client/msg/BuyFromNPCWindowMsg.java | 6 ++++++ src/engine/objects/NPC.java | 11 +++++++++++ 3 files changed, 21 insertions(+), 1 deletion(-) diff --git a/src/engine/net/client/ClientMessagePump.java b/src/engine/net/client/ClientMessagePump.java index 9d73ae98..35668ff4 100644 --- a/src/engine/net/client/ClientMessagePump.java +++ b/src/engine/net/client/ClientMessagePump.java @@ -1402,9 +1402,12 @@ public class ClientMessagePump implements NetMsgHandler { Item buy = null; if (msg.getItemType() == GameObjectType.MobEquipment.ordinal()) { ArrayList sellInventory = npc.getContract().getSellInventory(); - if(npc.contract.getName().toLowerCase().equals("steward")){ + if(npc.contract.getObjectUUID() == 890){ // default steward sellInventory = npc.getSellInventorySteward(); } + if(npc.contract.getObjectUUID() == 889){ // default builder + sellInventory = npc.getSellInventoryBuilder(); + } if (sellInventory == null) { return; } diff --git a/src/engine/net/client/msg/BuyFromNPCWindowMsg.java b/src/engine/net/client/msg/BuyFromNPCWindowMsg.java index 673d22d8..97cf1d81 100644 --- a/src/engine/net/client/msg/BuyFromNPCWindowMsg.java +++ b/src/engine/net/client/msg/BuyFromNPCWindowMsg.java @@ -112,6 +112,12 @@ public class BuyFromNPCWindowMsg extends ClientNetMsg { if (contract != null) sellInventory = contract.getSellInventory(); + if(npc.contract.getObjectUUID() == 890){ // default steward + sellInventory = npc.getSellInventorySteward(); + } + if(npc.contract.getObjectUUID() == 889){ // default builder + sellInventory = npc.getSellInventoryBuilder(); + } } if (man != null) diff --git a/src/engine/objects/NPC.java b/src/engine/objects/NPC.java index 4ce4c1ff..926eea25 100644 --- a/src/engine/objects/NPC.java +++ b/src/engine/objects/NPC.java @@ -1426,4 +1426,15 @@ public class NPC extends AbstractCharacter { return smallList; } + public ArrayList getSellInventoryBuilder() { + + ArrayList smallList = new ArrayList<>(); + int maxValue = this.getRank() * 2 * 100000; + for(MobEquipment me : this.contract.getSellInventory()){ + if(me.getItemBase().getBaseValue() <= maxValue) + smallList.add(me); + } + return smallList; + } + }