|
|
@ -1681,23 +1681,12 @@ public class ClientMessagePump implements NetMsgHandler { |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//int cost = ((int)((toRepair.getMagicValue()/max*(max - dur)) + (npc.getSpecialPrice() * npc.buyPercent))) + (int)(npc.getSpecialPrice() * (max - dur));
|
|
|
|
int pointsToRepair = max - dur; |
|
|
|
double repairRate = 0.067; // A proportional repair rate based on example
|
|
|
|
double damageRatio = (double)1.0d - (toRepair.getDurabilityMax() - toRepair.getDurabilityCurrent()) / toRepair.getDurabilityMax(); |
|
|
|
int maxRepairCost = (int)(toRepair.getMagicValue() * repairRate); |
|
|
|
int modifiedValue = (int)(damageRatio * toRepair.getMagicValue()); |
|
|
|
|
|
|
|
int costPerPoint = modifiedValue / toRepair.getDurabilityMax(); |
|
|
|
// Calculate the percentage of the durability that is damaged
|
|
|
|
int modifiedRepairCost = (int)(pointsToRepair * costPerPoint)+ npc.getSpecialPrice(); |
|
|
|
double damageRatio = (double)(toRepair.getDurabilityMax() - toRepair.getDurabilityCurrent()) / toRepair.getDurabilityMax(); |
|
|
|
int cost = (int)(modifiedRepairCost * 1 + npc.buyPercent) + npc.getSpecialPrice(); |
|
|
|
|
|
|
|
|
|
|
|
// 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();
|
|
|
|
|
|
|
|
//if(magicValue == 0)
|
|
|
|
|
|
|
|
// magicValue = 1;
|
|
|
|
|
|
|
|
//int calculatedValue = toRepair.getDurabilityMax() * magicValue;
|
|
|
|
|
|
|
|
//float costPerPoint = (magicValue / max) * ( 1 + npc.buyPercent);
|
|
|
|
|
|
|
|
//cost = (int)(pointsToRepair * costPerPoint) + npc.getSpecialPrice();
|
|
|
|
|
|
|
|
Building b = (!npc.isStatic()) ? npc.getBuilding() : null; |
|
|
|
Building b = (!npc.isStatic()) ? npc.getBuilding() : null; |
|
|
|
|
|
|
|
|
|
|
|
if (b != null) |
|
|
|
if (b != null) |
|
|
|