Added level thresholds to hardcore modes

Players will not lose stats when their level is below the
Level_Threshold.
This commit is contained in:
TfT_02 2013-12-15 23:25:17 +01:00
parent f99e5e015d
commit ea4c424e0f
4 changed files with 12 additions and 2 deletions

View File

@ -14,6 +14,7 @@ Version 1.4.08-dev
+ Smelting now works with custom ores - add smelting XP value to blocks.yml, or it will default to 1/10th of normal XP. + Smelting now works with custom ores - add smelting XP value to blocks.yml, or it will default to 1/10th of normal XP.
+ Added automatic cleanup of backups folder. + Added automatic cleanup of backups folder.
+ Added bypass permission for finding Fishing traps + Added bypass permission for finding Fishing traps
+ Added level threshold settings to hardcore modes. When a players skill level is below this threshold, they will not lose any stats
= Fixed bug where LeafBlower permissions were ignored = Fixed bug where LeafBlower permissions were ignored
= Fixed bug with toggle commands not properly displaying the success message. = Fixed bug with toggle commands not properly displaying the success message.
= Fixed IllegalArgumentException caused by an empty Fishing treasure category = Fixed IllegalArgumentException caused by an empty Fishing treasure category

View File

@ -302,12 +302,16 @@ public class Config extends AutoUpdateConfigLoader {
public double getHardcoreDeathStatPenaltyPercentage() { return config.getDouble("Hardcore.Death_Stat_Loss.Penalty_Percentage", 75.0D); } public double getHardcoreDeathStatPenaltyPercentage() { return config.getDouble("Hardcore.Death_Stat_Loss.Penalty_Percentage", 75.0D); }
public void setHardcoreDeathStatPenaltyPercentage(double value) { config.set("Hardcore.Death_Stat_Loss.Penalty_Percentage", value); } public void setHardcoreDeathStatPenaltyPercentage(double value) { config.set("Hardcore.Death_Stat_Loss.Penalty_Percentage", value); }
public int getHardcoreDeathStatPenaltyLevelThreshold() { return config.getInt("Hardcore.Death_Stat_Loss.Level_Threshold", 0); }
public boolean getHardcoreVampirismEnabled(SkillType skillType) { return config.getBoolean("Hardcore.Vampirism.Enabled." + StringUtils.getCapitalized(skillType.toString()), false); } public boolean getHardcoreVampirismEnabled(SkillType skillType) { return config.getBoolean("Hardcore.Vampirism.Enabled." + StringUtils.getCapitalized(skillType.toString()), false); }
public void setHardcoreVampirismEnabled(SkillType skillType, boolean enabled) { config.set("Hardcore.Vampirism.Enabled." + StringUtils.getCapitalized(skillType.toString()), enabled); } public void setHardcoreVampirismEnabled(SkillType skillType, boolean enabled) { config.set("Hardcore.Vampirism.Enabled." + StringUtils.getCapitalized(skillType.toString()), enabled); }
public double getHardcoreVampirismStatLeechPercentage() { return config.getDouble("Hardcore.Vampirism.Leech_Percentage", 5.0D); } public double getHardcoreVampirismStatLeechPercentage() { return config.getDouble("Hardcore.Vampirism.Leech_Percentage", 5.0D); }
public void setHardcoreVampirismStatLeechPercentage(double value) { config.set("Hardcore.Vampirism.Leech_Percentage", value); } public void setHardcoreVampirismStatLeechPercentage(double value) { config.set("Hardcore.Vampirism.Leech_Percentage", value); }
public int getHardcoreVampirismLevelThreshold() { return config.getInt("Hardcore.Vampirism.Level_Threshold", 0); }
/* SMP Mods */ /* SMP Mods */
public boolean getToolModsEnabled() { return config.getBoolean("Mods.Tool_Mods_Enabled", false); } public boolean getToolModsEnabled() { return config.getBoolean("Mods.Tool_Mods_Enabled", false); }
public boolean getArmorModsEnabled() { return config.getBoolean("Mods.Armor_Mods_Enabled", false); } public boolean getArmorModsEnabled() { return config.getBoolean("Mods.Armor_Mods_Enabled", false); }

View File

@ -14,6 +14,7 @@ public final class HardcoreManager {
public static void invokeStatPenalty(Player player) { public static void invokeStatPenalty(Player player) {
double statLossPercentage = Config.getInstance().getHardcoreDeathStatPenaltyPercentage(); double statLossPercentage = Config.getInstance().getHardcoreDeathStatPenaltyPercentage();
int levelThreshold = Config.getInstance().getHardcoreDeathStatPenaltyLevelThreshold();
PlayerProfile playerProfile = UserManager.getPlayer(player).getProfile(); PlayerProfile playerProfile = UserManager.getPlayer(player).getProfile();
int totalLevelsLost = 0; int totalLevelsLost = 0;
@ -26,7 +27,7 @@ public final class HardcoreManager {
int playerSkillLevel = playerProfile.getSkillLevel(skillType); int playerSkillLevel = playerProfile.getSkillLevel(skillType);
int playerSkillXpLevel = playerProfile.getSkillXpLevel(skillType); int playerSkillXpLevel = playerProfile.getSkillXpLevel(skillType);
if (playerSkillLevel <= 0) { if (playerSkillLevel <= 0 || playerSkillLevel <= levelThreshold) {
continue; continue;
} }
@ -53,6 +54,7 @@ public final class HardcoreManager {
public static void invokeVampirism(Player killer, Player victim) { public static void invokeVampirism(Player killer, Player victim) {
double vampirismStatLeechPercentage = Config.getInstance().getHardcoreVampirismStatLeechPercentage(); double vampirismStatLeechPercentage = Config.getInstance().getHardcoreVampirismStatLeechPercentage();
int levelThreshold = Config.getInstance().getHardcoreVampirismLevelThreshold();
McMMOPlayer killerPlayer = UserManager.getPlayer(killer); McMMOPlayer killerPlayer = UserManager.getPlayer(killer);
PlayerProfile killerProfile = killerPlayer.getProfile(); PlayerProfile killerProfile = killerPlayer.getProfile();
@ -67,7 +69,7 @@ public final class HardcoreManager {
int killerSkillLevel = killerProfile.getSkillLevel(skillType); int killerSkillLevel = killerProfile.getSkillLevel(skillType);
int victimSkillLevel = victimProfile.getSkillLevel(skillType); int victimSkillLevel = victimProfile.getSkillLevel(skillType);
if (victimSkillLevel <= 0 || victimSkillLevel < killerSkillLevel / 2) { if (victimSkillLevel <= 0 || victimSkillLevel < killerSkillLevel / 2 || victimSkillLevel <= levelThreshold) {
continue; continue;
} }

View File

@ -131,6 +131,8 @@ MySQL:
Hardcore: Hardcore:
Death_Stat_Loss: Death_Stat_Loss:
Penalty_Percentage: 75.0 Penalty_Percentage: 75.0
# Players will not lose stats when their level is below the Level_Threshold
Level_Threshold: 0
Enabled: Enabled:
Acrobatics: false Acrobatics: false
Archery: false Archery: false
@ -146,6 +148,7 @@ Hardcore:
Woodcutting: false Woodcutting: false
Vampirism: Vampirism:
Leech_Percentage: 5.0 Leech_Percentage: 5.0
Level_Threshold: 0
Enabled: Enabled:
Acrobatics: false Acrobatics: false
Archery: false Archery: false