From f73ed17c0526d482e92d4d685b7f3c5c4c216f93 Mon Sep 17 00:00:00 2001 From: FatBoy-DOTC Date: Sun, 5 Jan 2025 19:24:05 -0600 Subject: [PATCH] repair cost formula --- src/engine/net/client/ClientMessagePump.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/engine/net/client/ClientMessagePump.java b/src/engine/net/client/ClientMessagePump.java index 860be8b4..3ef37e3d 100644 --- a/src/engine/net/client/ClientMessagePump.java +++ b/src/engine/net/client/ClientMessagePump.java @@ -1681,7 +1681,15 @@ public class ClientMessagePump implements NetMsgHandler { return; } - int cost = ((int)((toRepair.getMagicValue()/max*(max - dur)) + (npc.getSpecialPrice() * npc.buyPercent))) + (int)(npc.getSpecialPrice() * (max - dur)); + //int cost = ((int)((toRepair.getMagicValue()/max*(max - dur)) + (npc.getSpecialPrice() * npc.buyPercent))) + (int)(npc.getSpecialPrice() * (max - dur)); + double repairRate = 0.067; // A proportional repair rate based on example + int maxRepairCost = (int)(toRepair.getMagicValue() * repairRate); + + // Calculate the percentage of the durability that is damaged + double damageRatio = (double)(toRepair.getDurabilityMax() - toRepair.getDurabilityCurrent()) / toRepair.getDurabilityMax(); + + // Calculate the repair cost based on the damage ratio and item value + int cost = (int)(maxRepairCost * damageRatio); //int pointsToRepair = max - dur; //int magicValue = toRepair.getMagicValue();