Fix repair logic

This commit is contained in:
nossr50 2019-06-16 01:13:39 -07:00
parent 3cde1400d1
commit 278efc8e37
14 changed files with 114 additions and 215 deletions

View File

@ -1,7 +1,9 @@
package com.gmail.nossr50.config.hocon.skills.axes; package com.gmail.nossr50.config.hocon.skills.axes;
import com.gmail.nossr50.config.ConfigConstants; import com.gmail.nossr50.config.ConfigConstants;
import com.gmail.nossr50.datatypes.skills.properties.*; import com.gmail.nossr50.datatypes.skills.properties.AbstractDamageProperty;
import com.gmail.nossr50.datatypes.skills.properties.AbstractMaxBonusLevel;
import com.gmail.nossr50.datatypes.skills.properties.DamageProperty;
import ninja.leaping.configurate.objectmapping.Setting; import ninja.leaping.configurate.objectmapping.Setting;
import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable; import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable;

View File

@ -0,0 +1,16 @@
package com.gmail.nossr50.config.hocon.skills.mining;
import com.gmail.nossr50.config.ConfigConstants;
import com.gmail.nossr50.datatypes.skills.properties.AbstractMaxBonusLevel;
import com.gmail.nossr50.datatypes.skills.properties.MaxBonusLevel;
import ninja.leaping.configurate.objectmapping.Setting;
import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable;
@ConfigSerializable
public class ConfigMiningDoubleDrops {
@Setting(value = ConfigConstants.MAX_CHANCE_FIELD_NAME, comment = ConfigConstants.MAX_CHANCE_FIELD_DESCRIPTION)
private double maxChance = 100.0;
@Setting(value = ConfigConstants.MAX_BONUS_LEVEL_FIELD_NAME)
private MaxBonusLevel maxBonusLevel = new AbstractMaxBonusLevel(100);
}

View File

@ -7,9 +7,16 @@ import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable;
public class ConfigMiningSubskills { public class ConfigMiningSubskills {
@Setting(value = "Blast-Mining", comment = "Settings for Blast Mining") @Setting(value = "Blast-Mining", comment = "Settings for Blast Mining")
public ConfigMiningBlastMining blastMining = new ConfigMiningBlastMining(); private ConfigMiningBlastMining blastMining = new ConfigMiningBlastMining();
@Setting(value = "Double-Drops")
private ConfigMiningDoubleDrops doubleDrops = new ConfigMiningDoubleDrops();
public ConfigMiningBlastMining getBlastMining() { public ConfigMiningBlastMining getBlastMining() {
return blastMining; return blastMining;
} }
public ConfigMiningDoubleDrops getDoubleDrops() {
return doubleDrops;
}
} }

View File

@ -2,7 +2,7 @@ package com.gmail.nossr50.config.hocon.skills.repair;
import com.gmail.nossr50.config.ConfigConstants; import com.gmail.nossr50.config.ConfigConstants;
import com.gmail.nossr50.config.hocon.skills.repair.general.ConfigRepairGeneral; import com.gmail.nossr50.config.hocon.skills.repair.general.ConfigRepairGeneral;
import com.gmail.nossr50.config.hocon.skills.repair.repairmastery.ConfigRepairMastery; import com.gmail.nossr50.config.hocon.skills.repair.repairmastery.ConfigRepairRepairMastery;
import com.gmail.nossr50.config.hocon.skills.repair.subskills.ConfigRepairSubSkills; import com.gmail.nossr50.config.hocon.skills.repair.subskills.ConfigRepairSubSkills;
import com.gmail.nossr50.skills.repair.repairables.Repairable; import com.gmail.nossr50.skills.repair.repairables.Repairable;
import ninja.leaping.configurate.objectmapping.Setting; import ninja.leaping.configurate.objectmapping.Setting;
@ -98,7 +98,7 @@ public class ConfigRepair {
return repairSubSkills; return repairSubSkills;
} }
public ConfigRepairMastery getRepairMastery() { public ConfigRepairRepairMastery getRepairMastery() {
return repairSubSkills.getRepairMastery(); return repairSubSkills.getRepairMastery();
} }

View File

@ -1,30 +0,0 @@
/*
package com.gmail.nossr50.config.hocon.skills.repair.repairables;
import com.gmail.nossr50.datatypes.skills.ItemType;
import ninja.leaping.configurate.objectmapping.Setting;
import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable;
import org.bukkit.Material;
@ConfigSerializable
public class ConfigRepairables {
@Setting(value = "Item-Material")
private Material itemMaterial;
@Setting(value = "Item-Used-To-Repair")
private Material repairMaterial;
@Setting(value = "Minimum-Quantity-Required-For-Repair")
private int minimumQuantity;
@Setting(value = "Minimum-Level-Required-For-Repair")
private int minimumLevel;
@Setting(value = "Repair-Item-Category")
private ItemType repairItemType;
@Setting(value = "XP-Multiplier")
private double xpMultiplier;
}*/

View File

@ -1,15 +0,0 @@
package com.gmail.nossr50.config.hocon.skills.repair.repairmastery;
import ninja.leaping.configurate.objectmapping.Setting;
import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable;
@ConfigSerializable
public class ConfigRepairMastery {
@Setting(value = "Settings")
private RepairMasterySettings settings = new RepairMasterySettings();
public RepairMasterySettings getSettings() {
return settings;
}
}

View File

@ -0,0 +1,25 @@
package com.gmail.nossr50.config.hocon.skills.repair.repairmastery;
import com.gmail.nossr50.config.ConfigConstants;
import com.gmail.nossr50.datatypes.skills.properties.AbstractMaxBonusLevel;
import com.gmail.nossr50.datatypes.skills.properties.MaxBonusLevel;
import ninja.leaping.configurate.objectmapping.Setting;
import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable;
@ConfigSerializable
public class ConfigRepairRepairMastery {
@Setting(value = ConfigConstants.MAX_BONUS_PERCENTAGE_FIELD_NAME)
private double maxBonusPercentage = 200.0D;
@Setting(value = ConfigConstants.MAX_BONUS_LEVEL_FIELD_NAME, comment = ConfigConstants.MAX_BONUS_LEVEL_DESCRIPTION)
private MaxBonusLevel maxBonusLevel = new AbstractMaxBonusLevel(100);
public double getMaxBonusPercentage() {
return maxBonusPercentage;
}
public MaxBonusLevel getMaxBonusLevel() {
return maxBonusLevel;
}
}

View File

@ -1,38 +0,0 @@
package com.gmail.nossr50.config.hocon.skills.repair.repairmastery;
import ninja.leaping.configurate.objectmapping.Setting;
import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable;
@ConfigSerializable
public class RepairMasteryRetro {
public static final int MAX_BONUS_LEVEL_DEFAULT = 1000;
public static final double MAX_BONUS_PERCENTAGE = 200.0D;
public static final String PLAYER_LEVEL_FIFTY_PERCENT_EXAMPLE = "500";
public static final String MAX_BONUS_LEVEL_EXAMPLE = "1000";
public static final String BONUS_PERCENTAGE_EXAMPLE = "100%";
@Setting(value = "Max-Bonus-Level", comment = "At the max bonus level a player will have full benefits from this scaling skill." +
"\nSkills dynamically adjust their rewards to match the max bonus level, you can think of it as a curve that calculates what bonuses " +
"\n a player should have based on how far they are from the max bonus level value, and the other parameters used for the scaling of the sub-skill." +
"\n-- NOTE: This setting is only valid for retro level scaling. --" +
"\nDefault value: " + MAX_BONUS_LEVEL_DEFAULT)
private int maxBonusLevel = MAX_BONUS_LEVEL_DEFAULT;
@Setting(value = "Max-Bonus-Percentage", comment = "This is the maximum benefit for additional repair amount from this skill when the player reaches \"Max-Bonus-Level\"." +
"\nRepair Mastery's bonus to repair is dynamically adjusted based on the players level difference from the \"Max-Bonus-Level\", you can think of it as a curve where reaching \"Max-Bonus-Level\" is the peak." +
"\nAs an example, imagine \"Standard-Mode-Max-Bonus-Percentage\" was set to " + MAX_BONUS_PERCENTAGE + " and the \"Max-Bonus-Level\" was " + MAX_BONUS_LEVEL_EXAMPLE + "," +
"\n and the player was level " + PLAYER_LEVEL_FIFTY_PERCENT_EXAMPLE + " for this skill, that would give the player " + BONUS_PERCENTAGE_EXAMPLE + "% added to the repair amount on the item before other bonuses." +
"\n-- NOTE: This setting is only valid for retro level scaling. --" +
"\nDefault value: " + MAX_BONUS_PERCENTAGE)
private double maxBonusPercentage = MAX_BONUS_PERCENTAGE;
public int getMaxBonusLevel() {
return maxBonusLevel;
}
public double getMaxBonusPercentage() {
return maxBonusPercentage;
}
}

View File

@ -1,32 +0,0 @@
package com.gmail.nossr50.config.hocon.skills.repair.repairmastery;
import ninja.leaping.configurate.objectmapping.Setting;
import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable;
@ConfigSerializable
public class RepairMasterySettings {
@Setting(value = "Standard-Mode-Scaling-Settings", comment = "Standard mode is the new default level scaling for mcMMO" +
"\nMost skills in standard mode scale from 1-100, maxing out at 100." +
"\nStandard scaling is fairly new, and it replaced the previous scaling method which is now known as RetroMode scaling." +
"\nYou are either using Standard or Retro mode on your server, which one you are using is setup in the leveling config file." +
"\nSettings from here are only applied when using Standard mode scaling.")
private RepairMasteryStandard standard = new RepairMasteryStandard();
@Setting(value = "Retro-Mode-Scaling-Settings", comment = "Retro mode is the optional level scaling for mcMMO, which was replaced by Standard scaling." +
"\nMost skills in retro mode scale from 1-1000, maxing out at 1000." +
"\nRetro scaling was the main method of scaling in mcMMO for almost 8 years," +
"\n and it was replaced in 2.1 with the new 1-100 scaling method which is known as Standard mode scaling." +
"\nYou can still use Retro Mode scaling, it will never be removed from mcMMO so do not worry about using it!" +
"\nYou are either using Standard or Retro mode on your server, which one you are using is setup in the leveling config file." +
"\nSettings from here are only applied when using Retro mode scaling.")
private RepairMasteryRetro retro = new RepairMasteryRetro();
public RepairMasteryStandard getStandard() {
return standard;
}
public RepairMasteryRetro getRetro() {
return retro;
}
}

View File

@ -1,29 +0,0 @@
package com.gmail.nossr50.config.hocon.skills.repair.repairmastery;
import ninja.leaping.configurate.objectmapping.Setting;
import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable;
@ConfigSerializable
public class RepairMasteryStandard {
public static final int MAX_BONUS_LEVEL_DEFAULT = 100;
public static final double MAX_BONUS_PERCENTAGE = 200.0D;
public static final String PLAYER_LEVEL_FIFTY_PERCENT_EXAMPLE = "50";
public static final String MAX_BONUS_LEVEL_EXAMPLE = "100";
public static final String BONUS_PERCENTAGE_EXAMPLE = "100%";
@Setting(value = "Max-Bonus-Level", comment = "At the max bonus level a player will have full benefits from this scaling skill." +
"\nSkills dynamically adjust their rewards to match the max bonus level, you can think of it as a curve that calculates what bonuses " +
"\n a player should have based on how far they are from the max bonus level value, and the other parameters used for the scaling of the sub-skill." +
"\n-- NOTE: This setting is only valid for standard level scaling. --" +
"\nDefault value: " + MAX_BONUS_LEVEL_DEFAULT)
public int maxBonusLevel = MAX_BONUS_LEVEL_DEFAULT;
@Setting(value = "Max-Bonus-Percentage", comment = "This is the maximum benefit for additional repair amount from this skill when the player reaches \"Max-Bonus-Level\"." +
"\nRepair Mastery's bonus to repair is dynamically adjusted based on the players level difference from the \"Max-Bonus-Level\", you can think of it as a curve where reaching \"Max-Bonus-Level\" is the peak." +
"\nAs an example, imagine \"Standard-Mode-Max-Bonus-Percentage\" was set to " + MAX_BONUS_PERCENTAGE + " and the \"Max-Bonus-Level\" was " + MAX_BONUS_LEVEL_EXAMPLE + "," +
"\n and the player was level " + PLAYER_LEVEL_FIFTY_PERCENT_EXAMPLE + " for this skill, that would give the player " + BONUS_PERCENTAGE_EXAMPLE + "% added to the repair amount on the item before other bonuses." +
"\n-- NOTE: This setting is only valid for standard level scaling. --" +
"\nDefault value: " + MAX_BONUS_PERCENTAGE)
public double maxBonusPercentage = MAX_BONUS_PERCENTAGE;
}

View File

@ -2,7 +2,7 @@ package com.gmail.nossr50.config.hocon.skills.repair.subskills;
import com.gmail.nossr50.config.hocon.skills.repair.ConfigRepairArcaneForging; import com.gmail.nossr50.config.hocon.skills.repair.ConfigRepairArcaneForging;
import com.gmail.nossr50.config.hocon.skills.repair.ConfigRepairSuperRepair; import com.gmail.nossr50.config.hocon.skills.repair.ConfigRepairSuperRepair;
import com.gmail.nossr50.config.hocon.skills.repair.repairmastery.ConfigRepairMastery; import com.gmail.nossr50.config.hocon.skills.repair.repairmastery.ConfigRepairRepairMastery;
import ninja.leaping.configurate.objectmapping.Setting; import ninja.leaping.configurate.objectmapping.Setting;
import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable; import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable;
@ -10,7 +10,7 @@ import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable;
public class ConfigRepairSubSkills { public class ConfigRepairSubSkills {
@Setting(value = "Repair-Mastery", comment = "Settings related to the repair mastery subskill") @Setting(value = "Repair-Mastery", comment = "Settings related to the repair mastery subskill")
private ConfigRepairMastery repairMastery = new ConfigRepairMastery(); private ConfigRepairRepairMastery repairMastery = new ConfigRepairRepairMastery();
@Setting(value = "Super-Repair", comment = "Settings related to the super repair subskill") @Setting(value = "Super-Repair", comment = "Settings related to the super repair subskill")
private ConfigRepairSuperRepair superRepair = new ConfigRepairSuperRepair(); private ConfigRepairSuperRepair superRepair = new ConfigRepairSuperRepair();
@ -18,7 +18,7 @@ public class ConfigRepairSubSkills {
@Setting(value = "Arcane-Forging", comment = "Settings related to the arcane forging subskill") @Setting(value = "Arcane-Forging", comment = "Settings related to the arcane forging subskill")
private ConfigRepairArcaneForging arcaneForging = new ConfigRepairArcaneForging(); private ConfigRepairArcaneForging arcaneForging = new ConfigRepairArcaneForging();
public ConfigRepairMastery getRepairMastery() { public ConfigRepairRepairMastery getRepairMastery() {
return repairMastery; return repairMastery;
} }

View File

@ -20,12 +20,12 @@ public class SkillPropertiesManager {
private HashMap<SubSkillType, Double> maxChanceMap; private HashMap<SubSkillType, Double> maxChanceMap;
private HashMap<SubSkillType, Double> staticActivationChanceMap; private HashMap<SubSkillType, Double> staticActivationChanceMap;
private HashMap<SubSkillType, Integer> maxBonusLevelMap; private HashMap<SubSkillType, Integer> maxBonusLevelMap;
private HashMap<SubSkillType, Double> maxBonusPercentage; private HashMap<SubSkillType, Double> maxBonusMap;
public SkillPropertiesManager() { public SkillPropertiesManager() {
maxChanceMap = new HashMap<>(); maxChanceMap = new HashMap<>();
maxBonusLevelMap = new HashMap<>(); maxBonusLevelMap = new HashMap<>();
maxBonusPercentage = new HashMap<>(); maxBonusMap = new HashMap<>();
staticActivationChanceMap = new HashMap<>(); staticActivationChanceMap = new HashMap<>();
} }
@ -33,14 +33,30 @@ public class SkillPropertiesManager {
maxBonusLevelMap.put(subSkillType, mcMMO.isRetroModeEnabled() ? maxBonusLevel.getRetroScaleValue() : maxBonusLevel.getStandardScaleValue()); maxBonusLevelMap.put(subSkillType, mcMMO.isRetroModeEnabled() ? maxBonusLevel.getRetroScaleValue() : maxBonusLevel.getStandardScaleValue());
} }
public void registerMaxBonus(SubSkillType subSkillType, double maxBonus) {
this.maxBonusMap.put(subSkillType, maxBonus);
}
public void registerMaxChance(SubSkillType subSkillType, double maxChance) { public void registerMaxChance(SubSkillType subSkillType, double maxChance) {
maxChanceMap.put(subSkillType, maxChance); maxChanceMap.put(subSkillType, maxChance);
} }
public void registerStaticChance(SubSkillType subSkillType, double staticChance) {
maxChanceMap.put(subSkillType, staticChance);
}
public double getMaxChance(SubSkillType subSkillType) { public double getMaxChance(SubSkillType subSkillType) {
return maxChanceMap.get(subSkillType); return maxChanceMap.get(subSkillType);
} }
public double getStaticChance(SubSkillType subSkillType) {
return staticActivationChanceMap.get(subSkillType);
}
public double getMaxBonus(SubSkillType subSkillType) {
return maxBonusMap.get(subSkillType);
}
public double getMaxBonusLevel(SubSkillType subSkillType) { public double getMaxBonusLevel(SubSkillType subSkillType) {
return maxBonusLevelMap.get(subSkillType); return maxBonusLevelMap.get(subSkillType);
} }
@ -135,12 +151,24 @@ public class SkillPropertiesManager {
} }
private void attemptRegisterStaticChance(SubSkillType subSkillType, CommentedConfigurationNode childNode) { private void attemptRegisterStaticChance(SubSkillType subSkillType, CommentedConfigurationNode childNode) {
try {
mcMMO.p.getLogger().info("Registering Static Chance for "+subSkillType.toString());
Double staticChance = childNode.getValue(TypeToken.of(Double.class));
registerStaticChance(subSkillType, staticChance);
} catch (ObjectMappingException e) {
} }
}
private void attemptRegisterMaxBonusPercentage(SubSkillType subSkillType, CommentedConfigurationNode childNode) { private void attemptRegisterMaxBonusPercentage(SubSkillType subSkillType, CommentedConfigurationNode childNode) {
try {
mcMMO.p.getLogger().info("Registering MaxBonus for "+subSkillType.toString());
Double maxChance = childNode.getValue(TypeToken.of(Double.class));
registerMaxBonus(subSkillType, maxChance);
} catch (ObjectMappingException e) {
} }
}
public double getStaticChanceProperty(SubSkillType subSkillType) throws InvalidStaticChance { public double getStaticChanceProperty(SubSkillType subSkillType) throws InvalidStaticChance {
if(staticActivationChanceMap.get(subSkillType) == null) if(staticActivationChanceMap.get(subSkillType) == null)

View File

@ -6,20 +6,9 @@ import org.bukkit.Material;
public class Repair { public class Repair {
private static Repair instance; private static Repair instance;
private Material anvilMaterial; private Material anvilMaterial;
private double repairMasteryMaxBonus;
private double repairMasteryMaxBonusLevel;
public Repair() { public Repair() {
anvilMaterial = mcMMO.getConfigManager().getConfigRepair().getRepairGeneral().getRepairAnvilMaterial(); anvilMaterial = mcMMO.getConfigManager().getConfigRepair().getRepairGeneral().getRepairAnvilMaterial();
//TODO: Replace this horrid shit
if (mcMMO.isRetroModeEnabled()) {
repairMasteryMaxBonus = mcMMO.getConfigManager().getConfigRepair().getRepairSubSkills().getRepairMastery().getSettings().getRetro().getMaxBonusPercentage();
repairMasteryMaxBonusLevel = mcMMO.getConfigManager().getConfigRepair().getRepairSubSkills().getRepairMastery().getSettings().getRetro().getMaxBonusLevel();
} else {
repairMasteryMaxBonus = mcMMO.getConfigManager().getConfigRepair().getRepairSubSkills().getRepairMastery().getSettings().getStandard().maxBonusPercentage;
repairMasteryMaxBonusLevel = mcMMO.getConfigManager().getConfigRepair().getRepairSubSkills().getRepairMastery().getSettings().getStandard().maxBonusLevel;
}
} }
public static Repair getInstance() { public static Repair getInstance() {
@ -32,12 +21,4 @@ public class Repair {
public Material getAnvilMaterial() { public Material getAnvilMaterial() {
return anvilMaterial; return anvilMaterial;
} }
public double getRepairMasteryMaxBonus() {
return repairMasteryMaxBonus;
}
public double getRepairMasteryMaxBonusLevel() {
return repairMasteryMaxBonusLevel;
}
} }

View File

@ -1,6 +1,5 @@
package com.gmail.nossr50.skills.repair; package com.gmail.nossr50.skills.repair;
import com.gmail.nossr50.config.AdvancedConfig;
import com.gmail.nossr50.datatypes.experience.XPGainReason; import com.gmail.nossr50.datatypes.experience.XPGainReason;
import com.gmail.nossr50.datatypes.interactions.NotificationType; import com.gmail.nossr50.datatypes.interactions.NotificationType;
import com.gmail.nossr50.datatypes.player.McMMOPlayer; import com.gmail.nossr50.datatypes.player.McMMOPlayer;
@ -64,7 +63,7 @@ public class RepairManager extends SkillManager {
Player player = getPlayer(); Player player = getPlayer();
Repairable repairable = mcMMO.getRepairableManager().getRepairable(item.getType()); Repairable repairable = mcMMO.getRepairableManager().getRepairable(item.getType());
if (item.getItemMeta().isUnbreakable()) { if(item.getItemMeta() != null && item.getItemMeta().isUnbreakable()) {
mcMMO.getNotificationManager().sendPlayerInformation(player, NotificationType.SUBSKILL_MESSAGE_FAILED, "Anvil.Unbreakable"); mcMMO.getNotificationManager().sendPlayerInformation(player, NotificationType.SUBSKILL_MESSAGE_FAILED, "Anvil.Unbreakable");
return; return;
} }
@ -96,13 +95,32 @@ public class RepairManager extends SkillManager {
//Find the first compatible repair material //Find the first compatible repair material
for (Material repairMaterialCandidate : repairable.getRepairMaterials()) { for (Material repairMaterialCandidate : repairable.getRepairMaterials()) {
for (ItemStack is : player.getInventory().getContents()) { for (ItemStack is : player.getInventory().getContents()) {
if(is == null)
continue; //Ignore IntelliJ this can be null
//Match to repair material
if (is.getType() == repairMaterialCandidate) { if (is.getType() == repairMaterialCandidate) {
if (is.getItemMeta().getLore().isEmpty()) { //Check for item meta
if(is.getItemMeta() != null) {
//Check for lore
if(is.getItemMeta().getLore() != null) {
if(is.getItemMeta().getLore().isEmpty()) {
//Lore is empty so this item is fine
repairMaterial = repairMaterialCandidate; repairMaterial = repairMaterialCandidate;
break; break;
} else { } else {
foundNonBasicMaterial = true; foundNonBasicMaterial = true;
} }
} else {
//No lore so this item is fine
repairMaterial = repairMaterialCandidate;
break;
}
} else {
//No Item Meta so this item is fine
repairMaterial = repairMaterialCandidate;
break;
}
} }
} }
} }
@ -203,7 +221,7 @@ public class RepairManager extends SkillManager {
* @return The chance of keeping the enchantment * @return The chance of keeping the enchantment
*/ */
public double getKeepEnchantChance() { public double getKeepEnchantChance() {
return AdvancedConfig.getInstance().getArcaneForgingKeepEnchantsChance(getArcaneForgingRank()); return mcMMO.getConfigManager().getConfigRepair().getArcaneForging().getKeepEnchantChanceMap().get(getArcaneForgingRank());
} }
/** /**
@ -212,43 +230,9 @@ public class RepairManager extends SkillManager {
* @return The chance of the enchantment being downgraded * @return The chance of the enchantment being downgraded
*/ */
public double getDowngradeEnchantChance() { public double getDowngradeEnchantChance() {
return AdvancedConfig.getInstance().getArcaneForgingDowngradeChance(getArcaneForgingRank()); return mcMMO.getConfigManager().getConfigRepair().getArcaneForging().getDowngradeChanceMap().get(getArcaneForgingRank());
} }
/**
* Gets chance of keeping enchantment during repair.
*
* @return The chance of keeping the enchantment
*/
/*public double getKeepEnchantChance() {
int skillLevel = getSkillLevel();
for (Tier tier : Tier.values()) {
if (skillLevel >= tier.getLevel()) {
return tier.getKeepEnchantChance();
}
}
return 0;
}*/
/**
* Gets chance of enchantment being downgraded during repair.
*
* @return The chance of the enchantment being downgraded
*/
/*public double getDowngradeEnchantChance() {
int skillLevel = getSkillLevel();
for (Tier tier : Tier.values()) {
if (skillLevel >= tier.getLevel()) {
return tier.getDowngradeEnchantChance();
}
}
return 100;
}*/
/** /**
* Computes repair bonuses. * Computes repair bonuses.
* *
@ -262,8 +246,8 @@ public class RepairManager extends SkillManager {
if (Permissions.isSubSkillEnabled(player, SubSkillType.REPAIR_REPAIR_MASTERY) if (Permissions.isSubSkillEnabled(player, SubSkillType.REPAIR_REPAIR_MASTERY)
&& RankUtils.hasUnlockedSubskill(getPlayer(), SubSkillType.REPAIR_REPAIR_MASTERY)) { && RankUtils.hasUnlockedSubskill(getPlayer(), SubSkillType.REPAIR_REPAIR_MASTERY)) {
double maxBonusCalc = Repair.getInstance().getRepairMasteryMaxBonus() / 100.0D; double maxBonusCalc = mcMMO.getDynamicSettingsManager().getSkillPropertiesManager().getMaxBonus(SubSkillType.REPAIR_REPAIR_MASTERY) / 100.0D;
double skillLevelBonusCalc = (Repair.getInstance().getRepairMasteryMaxBonus() / Repair.getInstance().getRepairMasteryMaxBonusLevel()) * (getSkillLevel() / 100.0D); double skillLevelBonusCalc = (maxBonusCalc / mcMMO.getDynamicSettingsManager().getSkillPropertiesManager().getMaxBonusLevel(SubSkillType.REPAIR_REPAIR_MASTERY)) * (getSkillLevel() / 100.0D);
double bonus = repairAmount * Math.min(skillLevelBonusCalc, maxBonusCalc); double bonus = repairAmount * Math.min(skillLevelBonusCalc, maxBonusCalc);
repairAmount += bonus; repairAmount += bonus;