diff --git a/src/main/java/com/gmail/nossr50/config/ConfigManager.java b/src/main/java/com/gmail/nossr50/config/ConfigManager.java index e1242ab0b..62f5d8af6 100644 --- a/src/main/java/com/gmail/nossr50/config/ConfigManager.java +++ b/src/main/java/com/gmail/nossr50/config/ConfigManager.java @@ -32,6 +32,7 @@ import com.gmail.nossr50.config.hocon.skills.excavation.ConfigExcavation; import com.gmail.nossr50.config.hocon.skills.fishing.ConfigFishing; import com.gmail.nossr50.config.hocon.skills.herbalism.ConfigHerbalism; import com.gmail.nossr50.config.hocon.skills.mining.ConfigMining; +import com.gmail.nossr50.config.hocon.skills.ranks.ConfigRanks; import com.gmail.nossr50.config.hocon.skills.repair.ConfigRepair; import com.gmail.nossr50.config.hocon.skills.salvage.ConfigSalvage; import com.gmail.nossr50.config.hocon.skills.smelting.ConfigSmelting; @@ -99,6 +100,7 @@ public final class ConfigManager { private SerializedConfigLoader configExperience; private SerializedConfigLoader configCoreSkills; private SerializedConfigLoader configEvent; + private SerializedConfigLoader configRanks; private SerializedConfigLoader configDefaultExamples; private ConfigAcrobatics configAcrobatics; @@ -184,6 +186,7 @@ public final class ConfigManager { configExperience = new SerializedConfigLoader<>(ConfigExperience.class, "experience.conf", "Experience", null); configCoreSkills = new SerializedConfigLoader<>(ConfigCoreSkills.class, "core_skills.conf", "Core-Skills", null); configEvent = new SerializedConfigLoader<>(ConfigEvent.class, "events.conf", "Events", null); + configRanks = new SerializedConfigLoader<>(ConfigRanks.class, "ranks.conf", "Skill-Ranks", null); configDefaultExamples = new SerializedConfigLoader<>(ConfigNameRegisterDefaults.class, "minecraft_item_block_name_examples.conf", "Minecraft", null); initSerializedSkillConfigs(); @@ -487,6 +490,10 @@ public final class ConfigManager { return configEvent.getConfig(); } + public ConfigRanks getConfigRanks() { + return configRanks.getConfig(); + } + /** * Checks if this plugin is using retro mode * Retro mode is a 0-1000 skill system diff --git a/src/main/java/com/gmail/nossr50/config/hocon/skills/ranks/ConfigRanks.java b/src/main/java/com/gmail/nossr50/config/hocon/skills/ranks/ConfigRanks.java new file mode 100644 index 000000000..0e800ffef --- /dev/null +++ b/src/main/java/com/gmail/nossr50/config/hocon/skills/ranks/ConfigRanks.java @@ -0,0 +1,20 @@ +package com.gmail.nossr50.config.hocon.skills.ranks; + +import ninja.leaping.configurate.objectmapping.Setting; +import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable; + +@ConfigSerializable +public class ConfigRanks { + + @Setting(value = "Acrobatics", comment = "Configure when sub-skills unlock for Acrobatics here.") + private ConfigRanksAcrobatics acrobatics = new ConfigRanksAcrobatics(); + + @Setting(value = "Alchemy", comment = "Configure when sub-skills unlock for Alchemy here.") + private ConfigRanksAlchemy alchemy = new ConfigRanksAlchemy(); + + @Setting(value = "Archery", comment = "Configure when sub-skills unlock for Archery here.") + private ConfigRanksArchery archery = new ConfigRanksArchery(); + + @Setting(value = "Axes", comment = "Configure when sub-skills unlock for Axes here.") + private ConfigRanksAxes axes = new ConfigRanksAxes(); +} diff --git a/src/main/java/com/gmail/nossr50/config/hocon/skills/ranks/ConfigRanksAcrobatics.java b/src/main/java/com/gmail/nossr50/config/hocon/skills/ranks/ConfigRanksAcrobatics.java new file mode 100644 index 000000000..dbf3bee5b --- /dev/null +++ b/src/main/java/com/gmail/nossr50/config/hocon/skills/ranks/ConfigRanksAcrobatics.java @@ -0,0 +1,15 @@ +package com.gmail.nossr50.config.hocon.skills.ranks; + +import ninja.leaping.configurate.objectmapping.Setting; +import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable; + +@ConfigSerializable +public class ConfigRanksAcrobatics { + + @Setting(value = "Dodge") + private SkillRankProperty dodgeRanks = new SkillRankProperty(2); + + public SkillRankProperty getDodgeRanks() { + return dodgeRanks; + } +} diff --git a/src/main/java/com/gmail/nossr50/config/hocon/skills/ranks/ConfigRanksAlchemy.java b/src/main/java/com/gmail/nossr50/config/hocon/skills/ranks/ConfigRanksAlchemy.java new file mode 100644 index 000000000..78c17843c --- /dev/null +++ b/src/main/java/com/gmail/nossr50/config/hocon/skills/ranks/ConfigRanksAlchemy.java @@ -0,0 +1,8 @@ +package com.gmail.nossr50.config.hocon.skills.ranks; + +import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable; + +@ConfigSerializable +public class ConfigRanksAlchemy { + +} diff --git a/src/main/java/com/gmail/nossr50/config/hocon/skills/ranks/ConfigRanksArchery.java b/src/main/java/com/gmail/nossr50/config/hocon/skills/ranks/ConfigRanksArchery.java new file mode 100644 index 000000000..ba7b9dd4c --- /dev/null +++ b/src/main/java/com/gmail/nossr50/config/hocon/skills/ranks/ConfigRanksArchery.java @@ -0,0 +1,29 @@ +package com.gmail.nossr50.config.hocon.skills.ranks; + +import ninja.leaping.configurate.objectmapping.Setting; +import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable; + +@ConfigSerializable +public class ConfigRanksArchery { + + @Setting(value = "Limit-Break") + private SkillRankProperty limitBreak = new SkillRankProperty(10, 20, 30, 40, 50, 60, 70, 80, 90, 100); + + @Setting(value = "Arrow-Retrieval") + private SkillRankProperty arrowRetrieval = new SkillRankProperty(2); + + @Setting(value = "Skill-Shot") + private SkillRankProperty skillShot = new SkillRankProperty(5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75, 80, 85, 90, 95, 100); + + public SkillRankProperty getLimitBreak() { + return limitBreak; + } + + public SkillRankProperty getArrowRetrieval() { + return arrowRetrieval; + } + + public SkillRankProperty getSkillShot() { + return skillShot; + } +} diff --git a/src/main/java/com/gmail/nossr50/config/hocon/skills/ranks/ConfigRanksAxes.java b/src/main/java/com/gmail/nossr50/config/hocon/skills/ranks/ConfigRanksAxes.java new file mode 100644 index 000000000..cff5c18fa --- /dev/null +++ b/src/main/java/com/gmail/nossr50/config/hocon/skills/ranks/ConfigRanksAxes.java @@ -0,0 +1,50 @@ +package com.gmail.nossr50.config.hocon.skills.ranks; + +import ninja.leaping.configurate.objectmapping.Setting; +import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable; + +@ConfigSerializable +public class ConfigRanksAxes { + + @Setting(value = "Limit-Break") + private SkillRankProperty limitBreak = new SkillRankProperty(10, 20, 30, 40, 50, 60, 70, 80, 90, 100); + + @Setting(value = "Skull-Splitter") + private SkillRankProperty skullSplitter = new SkillRankProperty(5); + + @Setting(value = "Critical-Strikes") + private SkillRankProperty criticalStrikes = new SkillRankProperty(2); + + @Setting(value = "Greater-Impact") + private SkillRankProperty greaterImpact = new SkillRankProperty(25); + + @Setting(value = "Armor-Impact") + private SkillRankProperty armorImpact = new SkillRankProperty(5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75, 80, 85, 90, 95, 100); + + @Setting(value = "Axe-Mastery") + private SkillRankProperty axeMastery = new SkillRankProperty(5, 10, 15, 20); + + public SkillRankProperty getLimitBreak() { + return limitBreak; + } + + public SkillRankProperty getSkullSplitter() { + return skullSplitter; + } + + public SkillRankProperty getCriticalStrikes() { + return criticalStrikes; + } + + public SkillRankProperty getGreaterImpact() { + return greaterImpact; + } + + public SkillRankProperty getArmorImpact() { + return armorImpact; + } + + public SkillRankProperty getAxeMastery() { + return axeMastery; + } +} diff --git a/src/main/java/com/gmail/nossr50/config/hocon/skills/ranks/SkillRankProperty.java b/src/main/java/com/gmail/nossr50/config/hocon/skills/ranks/SkillRankProperty.java new file mode 100644 index 000000000..8220227d6 --- /dev/null +++ b/src/main/java/com/gmail/nossr50/config/hocon/skills/ranks/SkillRankProperty.java @@ -0,0 +1,54 @@ +package com.gmail.nossr50.config.hocon.skills.ranks; + +import com.gmail.nossr50.datatypes.skills.properties.SkillProperty; + +import java.util.HashMap; + +public class SkillRankProperty implements SkillProperty { + + private HashMap standardRanks; + private HashMap retroRanks; + + public SkillRankProperty(Integer... rankDefinitions) { + initRankMaps(); + + for(int x = 0; x < rankDefinitions.length; x++) { + int curRank = x+1; + + //Avoid negative numbers + if(rankDefinitions[x] < 0) { + standardRanks.put(curRank, 0); + } else { + standardRanks.put(curRank, rankDefinitions[x]); + } + } + } + + public SkillRankProperty(HashMap standardRanks, HashMap retroRanks) { + this.standardRanks = standardRanks; + this.retroRanks = retroRanks; + } + + /** + * Convenience method to add Standard and Retro at the same time, shouldn't be used for anything other than the default values since admins may only edit Retro values and not touch Standard ones + * @param curRank + * @param rankUnlockLevel + */ + private void addStandardAndRetroRank(int curRank, int rankUnlockLevel) { + standardRanks.put(curRank, rankUnlockLevel); + retroRanks.put(curRank, rankUnlockLevel * 10); + } + + private void initRankMaps() { + standardRanks = new HashMap<>(); + retroRanks = new HashMap<>(); + } + + public void setStandardRanks(HashMap standardRanks) { + this.standardRanks = standardRanks; + } + + public void setRetroRanks(HashMap retroRanks) { + this.retroRanks = retroRanks; + } +}