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

@ -21,6 +21,7 @@ Version 1.4.07-dev
= Fixed a bug where LevelUpEvent would be called for an offline player.
= Fixed a bug where teleport location was never reset if warmup was set to 0 for Chimaera Wing.
= Fixed a bug where the Dodge DamageModifier wasn't being read from advanced.yml
! Changed the way Repair hands out XP, also added config options to control Repair XP
! Improved profile saving
! Updated localization files
! Party item share category states are now saved when the server shuts down.

View File

@ -12,6 +12,7 @@ import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.datatypes.MobHealthbarType;
import com.gmail.nossr50.datatypes.skills.AbilityType;
import com.gmail.nossr50.datatypes.skills.SkillType;
import com.gmail.nossr50.skills.repair.RepairMaterialType;
import com.gmail.nossr50.util.Misc;
import com.gmail.nossr50.util.StringUtils;
@ -403,6 +404,11 @@ public class Config extends AutoUpdateConfigLoader {
public int getDetonatorItemID() { return config.getInt("Skills.Mining.Detonator_ID", 259); }
/* Repair */
public double getRepairXPBase() { return config.getDouble("Experience.Repair.Base", 1000.0); }
public double getRepairXP(RepairMaterialType repairMaterialType) {
return config.getDouble("Experience.Repair." + StringUtils.getCapitalized(repairMaterialType.toString()));
}
public boolean getRepairAnvilMessagesEnabled() { return config.getBoolean("Skills.Repair.Anvil_Messages", true); }
public int getRepairAnvilId() { return config.getInt("Skills.Repair.Anvil_ID", 42); }
public int getSalvageAnvilId() { return config.getInt("Skills.Repair.Salvage_Anvil_ID", 41); }

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
*

View File

@ -366,6 +366,16 @@ Experience:
Redstone_Ore: 150
Sandstone: 30
Stone: 30
Repair:
Base: 1000.0
Wood: 0.6
Stone: 1.3
Iron: 2.5
Gold: 0.3
Diamond: 5.0
Leather: 1.6
String: 1.8
Other: 1.5
Smelting:
Coal_Ore: 10
Diamond_Ore: 75