Changed the way Repair hands out XP

Closes #373
This commit is contained in:
TfT_02
2013-08-15 20:50:19 +02:00
parent 3ddd8d2056
commit 36f1a2d78a
5 changed files with 23 additions and 2 deletions

View File

@ -155,7 +155,7 @@ public class RepairManager extends SkillManager {
Repair.removeOneFrom(inventory, repairItemLocation);
// Give out XP like candy
applyXpGain((int) ((startDurability - newDurability) * repairable.getXpMultiplier()) * 10);
applyXpGain((float) ((getPercentageRepaired(startDurability, newDurability, repairable.getMaximumDurability()) * repairable.getXpMultiplier()) * Config.getInstance().getRepairXPBase() * Config.getInstance().getRepairXP(repairable.getRepairMaterialType())));
// BWONG BWONG BWONG
player.playSound(player.getLocation(), Sound.ANVIL_USE, Misc.ANVIL_USE_VOLUME, Misc.ANVIL_USE_PITCH);
@ -164,6 +164,10 @@ public class RepairManager extends SkillManager {
item.setDurability(newDurability);
}
private float getPercentageRepaired(short startDurability, short newDurability, short totalDurability) {
return ((startDurability - newDurability) / (float) totalDurability);
}
public void handleSalvage(Location location, ItemStack item) {
Player player = getPlayer();

View File

@ -53,7 +53,7 @@ public interface Repairable {
public short getMaximumDurability();
/**
* Gets the base repair durability on which to calcuate bonuses.
* Gets the base repair durability on which to calculate bonuses.
*
* This is actually the maximum durability divided by the minimum quantity
*