From 516fa59068acd884ef1ba4fa0f0357805380d935 Mon Sep 17 00:00:00 2001 From: FatBoy-DOTC Date: Fri, 4 Aug 2023 20:03:31 -0500 Subject: [PATCH] NPCs will now buy items based on how much durability is on the item --- src/engine/net/client/ClientMessagePump.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/engine/net/client/ClientMessagePump.java b/src/engine/net/client/ClientMessagePump.java index f274f185..34e738b2 100644 --- a/src/engine/net/client/ClientMessagePump.java +++ b/src/engine/net/client/ClientMessagePump.java @@ -1243,6 +1243,12 @@ public class ClientMessagePump implements NetMsgHandler { cost = sell.getBaseValue(); + + //apply damaged value reduction + float durabilityCurrent = sell.getDurabilityCurrent(); + float durabilityMax = sell.getDurabilityMax(); + float damagedModifier = durabilityCurrent / durabilityMax; + cost *= damagedModifier; float bargain = player.getBargain(); float profit = npc.getBuyPercent(player) + bargain;