From 6e83763f22988cb1f77fd30bab6a193723e51c5e Mon Sep 17 00:00:00 2001 From: nossr50 Date: Fri, 22 Mar 2019 17:09:22 -0700 Subject: [PATCH] Finishing touches on Repair Config --- .../config/hocon/RepairableSerializer.java | 2 +- .../ConfigScalingSubSkillPercentage.java | 2 +- .../skills/ConfigScalingSubSkillRetro.java | 8 ++--- .../skills/ConfigScalingSubSkillStandard.java | 10 +++--- .../skills/ConfigSubSkillScalingRNG.java | 6 ++-- .../hocon/skills/repair/ConfigRepair.java | 36 +++++++++++-------- .../subskills/ConfigRepairSubSkills.java | 32 +++++++++++++++++ 7 files changed, 67 insertions(+), 29 deletions(-) create mode 100644 src/main/java/com/gmail/nossr50/config/hocon/skills/repair/subskills/ConfigRepairSubSkills.java diff --git a/src/main/java/com/gmail/nossr50/config/hocon/RepairableSerializer.java b/src/main/java/com/gmail/nossr50/config/hocon/RepairableSerializer.java index 7c74e80cf..e12c84901 100644 --- a/src/main/java/com/gmail/nossr50/config/hocon/RepairableSerializer.java +++ b/src/main/java/com/gmail/nossr50/config/hocon/RepairableSerializer.java @@ -51,7 +51,7 @@ public class RepairableSerializer implements TypeSerializer { Material repairItem = (Material) getEnum(repairConstant, TypeToken.of(Material.class));*/ int minimumQuantity = value.getNode("Minimum-Quantity-Used-To-Repair").getValue(TypeToken.of(Integer.class)); - int minimumLevel = value.getNode("Skill-Level-Required-To-Repair").getValue(TypeToken.of(Integer.class)); + int minimumLevel = value.getNode("Override-Level-Requirement").getValue(TypeToken.of(Integer.class)); double xpMultiplier = value.getNode("XP-Multiplier").getValue(TypeToken.of(Double.class)); return new SimpleRepairable(item, repairItems, minimumQuantity, minimumLevel, xpMultiplier); diff --git a/src/main/java/com/gmail/nossr50/config/hocon/skills/ConfigScalingSubSkillPercentage.java b/src/main/java/com/gmail/nossr50/config/hocon/skills/ConfigScalingSubSkillPercentage.java index 5724512e3..57a0cb392 100644 --- a/src/main/java/com/gmail/nossr50/config/hocon/skills/ConfigScalingSubSkillPercentage.java +++ b/src/main/java/com/gmail/nossr50/config/hocon/skills/ConfigScalingSubSkillPercentage.java @@ -16,7 +16,7 @@ public class ConfigScalingSubSkillPercentage { @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." + + "\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.") diff --git a/src/main/java/com/gmail/nossr50/config/hocon/skills/ConfigScalingSubSkillRetro.java b/src/main/java/com/gmail/nossr50/config/hocon/skills/ConfigScalingSubSkillRetro.java index cf2580a91..c17033106 100644 --- a/src/main/java/com/gmail/nossr50/config/hocon/skills/ConfigScalingSubSkillRetro.java +++ b/src/main/java/com/gmail/nossr50/config/hocon/skills/ConfigScalingSubSkillRetro.java @@ -14,8 +14,8 @@ public class ConfigScalingSubSkillRetro { @Setting(value = "Max-Bonus-Level", comment = "Max bonus level is the level a player needs to reach in this skill to receive maximum benefits, such as better RNG odds or otherwise." + "\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." + - "\nNote: This is the setting for RETRO MODE!" + + "\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\nNote: This is the setting for RETRO MODE!" + "\nDefault value: "+MAX_BONUS_LEVEL_DEFAULT) private int maxBonusLevel = MAX_BONUS_LEVEL_DEFAULT; @@ -24,8 +24,8 @@ public class ConfigScalingSubSkillRetro { "\nPlayers only have Max-Success-Chance when their skill level has reached the maximum bonus level." + "\nMax skill chance 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 \"Max-Success-Chance\" was set to " + FIFTY_PERCENT_EXAMPLE + " and the \"Max-Bonus-Level\" was " + MAX_BONUS_LEVEL_EXAMPLE + "," + - "\n and the player was level " + FIFTY_PERCENT_EXAMPLE + " for this skill, that would give the player " + ODDS_PERCENTAGE_EXAMPLE + " odds to succeed with this skill." + - "\nNote: This is the setting for RETRO MODE!" + + "\n and the player was level " + FIFTY_PERCENT_EXAMPLE + " for this skill, that would give the player " + ODDS_PERCENTAGE_EXAMPLE + " odds to succeed with this skill." + + "\n\nNote: This is the setting for RETRO MODE!" + "\nDefault value: "+CHANCE_AT_MAX_SKILL_DEFAULT) private double chanceAtMaxSkill = CHANCE_AT_MAX_SKILL_DEFAULT; diff --git a/src/main/java/com/gmail/nossr50/config/hocon/skills/ConfigScalingSubSkillStandard.java b/src/main/java/com/gmail/nossr50/config/hocon/skills/ConfigScalingSubSkillStandard.java index a99f69b8d..6f39788d1 100644 --- a/src/main/java/com/gmail/nossr50/config/hocon/skills/ConfigScalingSubSkillStandard.java +++ b/src/main/java/com/gmail/nossr50/config/hocon/skills/ConfigScalingSubSkillStandard.java @@ -14,18 +14,18 @@ public class ConfigScalingSubSkillStandard { @Setting(value = "Max-Bonus-Level", comment = "Max bonus level is the level a player needs to reach in this skill to receive maximum benefits, such as better RNG odds or otherwise." + "\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." + - "\nNote: This is the setting for STANDARD MODE!" + + "\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\nNote: This is the setting for STANDARD MODE!" + "\nDefault value: "+MAX_BONUS_LEVEL_DEFAULT) private int maxBonusLevel = MAX_BONUS_LEVEL_DEFAULT; @Setting(value = "Max-Success-Chance", comment = "The maximum success chance for this Sub-Skill." + - "\nA value of 100.0 would be equivalent to 100% chance of success." + + "\nA value of 100.0 would be equivalent to 100% chance of success." + "\nPlayers only have Max-Success-Chance when their skill level has reached the maximum bonus level." + "\nMax skill chance 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 \"Max-Success-Chance\" was set to " + FIFTY_PERCENT_EXAMPLE + " and the \"Max-Bonus-Level\" was " + MAX_BONUS_LEVEL_EXAMPLE + "," + - "\n and the player was level " + FIFTY_PERCENT_EXAMPLE + " for this skill, that would give the player " + ODDS_PERCENTAGE_EXAMPLE + " odds to succeed with this skill." + - "\nNote: This is the setting for STANDARD MODE!" + + "\n and the player was level " + FIFTY_PERCENT_EXAMPLE + " for this skill, that would give the player " + ODDS_PERCENTAGE_EXAMPLE + " odds to succeed with this skill." + + "\n\nNote: This is the setting for STANDARD MODE!" + "\nDefault value: "+CHANCE_AT_MAX_SKILL_DEFAULT) private double chanceAtMaxSkill = CHANCE_AT_MAX_SKILL_DEFAULT; diff --git a/src/main/java/com/gmail/nossr50/config/hocon/skills/ConfigSubSkillScalingRNG.java b/src/main/java/com/gmail/nossr50/config/hocon/skills/ConfigSubSkillScalingRNG.java index 0f400c8dd..1805cafd3 100644 --- a/src/main/java/com/gmail/nossr50/config/hocon/skills/ConfigSubSkillScalingRNG.java +++ b/src/main/java/com/gmail/nossr50/config/hocon/skills/ConfigSubSkillScalingRNG.java @@ -10,16 +10,16 @@ public class ConfigSubSkillScalingRNG { @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." + + "\n\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 ConfigScalingSubSkillStandard standardSettings = new ConfigScalingSubSkillStandard(); @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." + + "\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." + + "\n\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 ConfigScalingSubSkillRetro retroSettings = new ConfigScalingSubSkillRetro(); diff --git a/src/main/java/com/gmail/nossr50/config/hocon/skills/repair/ConfigRepair.java b/src/main/java/com/gmail/nossr50/config/hocon/skills/repair/ConfigRepair.java index 4f64b9676..2510e0397 100644 --- a/src/main/java/com/gmail/nossr50/config/hocon/skills/repair/ConfigRepair.java +++ b/src/main/java/com/gmail/nossr50/config/hocon/skills/repair/ConfigRepair.java @@ -2,6 +2,7 @@ package com.gmail.nossr50.config.hocon.skills.repair; 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.subskills.ConfigRepairSubSkills; import com.gmail.nossr50.skills.repair.repairables.SimpleRepairable; import ninja.leaping.configurate.objectmapping.Setting; import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable; @@ -70,37 +71,42 @@ public class ConfigRepair { } - - - @Setting(value = "Repair-Mastery", comment = "Settings related to the repair mastery subskill") - private ConfigRepairMastery repairMastery = new ConfigRepairMastery(); - - @Setting(value = "Super-Repair", comment = "Settings related to the super repair subskill") - private ConfigRepairSuperRepair superRepair = new ConfigRepairSuperRepair(); - - @Setting(value = "Arcane-Forging", comment = "Settings related to the arcane forging subskill") - private ConfigRepairArcaneForging arcaneForging = new ConfigRepairArcaneForging(); - @Setting(value = "General") private ConfigRepairGeneral repairGeneral = new ConfigRepairGeneral(); - @Setting(value = "Repairables") + @Setting(value = "SubSkills", comment = "Settings for subskills stemming from Repair") + private ConfigRepairSubSkills repairSubSkills = new ConfigRepairSubSkills(); + + @Setting(value = "Z-Repairables", comment = "This is the list of what can be repaired in mcMMO by Anvils and their properties." + + "\nThe \"Z\" in this config keys name is literally just to place this at the bottom of the config since the serializer uses alphabetical sorting." + + "\n\n -- Explanation for Parameters --" + + "\nItem: The name of the item, this has to be equivalent to the internal registry key (Name ID) Minecraft uses for this item" + + "\nItems-Used-To-Repair: The name of the item consumed as part of repairing, this has to be equivalent to the internal registry key (Name ID) Minecraft uses for this item" + + "\nMinimum-Quantity-Used-To-Repair: The amount of this item that is required to repair this item at a minimum." + + "\nOverride-Level-Requirement: If you would like to specify a specific skill level required to repair an item, do it here. It should be noted that a lot of items will be given automatic level requirements if you leave this at zero." + + "\nXP-Multiplier: When calculating how much XP to give the player for the repair, the end result will be multiplied by this value." + + "\n\nName ID List: https://minecraft.gamepedia.com/Java_Edition_data_values" + + "\nTIP: You can omit \"minecraft:\" from the Name ID if you want to, for example you can write \"red_wool\" instead of \"minecraft:red_wool\"") private ArrayList configRepairablesList = CONFIG_REPAIRABLES_DEFAULTS; public ConfigRepairGeneral getRepairGeneral() { return repairGeneral; } + public ConfigRepairSubSkills getRepairSubSkills() { + return repairSubSkills; + } + public ConfigRepairMastery getRepairMastery() { - return repairMastery; + return repairSubSkills.getRepairMastery(); } public ConfigRepairSuperRepair getSuperRepair() { - return superRepair; + return repairSubSkills.getSuperRepair(); } public ConfigRepairArcaneForging getArcaneForging() { - return arcaneForging; + return repairSubSkills.getArcaneForging(); } public ArrayList getConfigRepairablesList() { diff --git a/src/main/java/com/gmail/nossr50/config/hocon/skills/repair/subskills/ConfigRepairSubSkills.java b/src/main/java/com/gmail/nossr50/config/hocon/skills/repair/subskills/ConfigRepairSubSkills.java new file mode 100644 index 000000000..b9869c159 --- /dev/null +++ b/src/main/java/com/gmail/nossr50/config/hocon/skills/repair/subskills/ConfigRepairSubSkills.java @@ -0,0 +1,32 @@ +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.ConfigRepairSuperRepair; +import com.gmail.nossr50.config.hocon.skills.repair.repairmastery.ConfigRepairMastery; +import ninja.leaping.configurate.objectmapping.Setting; +import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable; + +@ConfigSerializable +public class ConfigRepairSubSkills { + + @Setting(value = "Repair-Mastery", comment = "Settings related to the repair mastery subskill") + private ConfigRepairMastery repairMastery = new ConfigRepairMastery(); + + @Setting(value = "Super-Repair", comment = "Settings related to the super repair subskill") + private ConfigRepairSuperRepair superRepair = new ConfigRepairSuperRepair(); + + @Setting(value = "Arcane-Forging", comment = "Settings related to the arcane forging subskill") + private ConfigRepairArcaneForging arcaneForging = new ConfigRepairArcaneForging(); + + public ConfigRepairMastery getRepairMastery() { + return repairMastery; + } + + public ConfigRepairSuperRepair getSuperRepair() { + return superRepair; + } + + public ConfigRepairArcaneForging getArcaneForging() { + return arcaneForging; + } +} \ No newline at end of file