Add ConfigRanks WIP (axes, acrobatics, archery so far)

This commit is contained in:
nossr50 2019-06-03 04:17:23 -07:00
parent e05078b280
commit 5ca027650e
7 changed files with 183 additions and 0 deletions

View File

@ -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> configExperience;
private SerializedConfigLoader<ConfigCoreSkills> configCoreSkills;
private SerializedConfigLoader<ConfigEvent> configEvent;
private SerializedConfigLoader<ConfigRanks> configRanks;
private SerializedConfigLoader<ConfigNameRegisterDefaults> 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

View File

@ -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();
}

View File

@ -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;
}
}

View File

@ -0,0 +1,8 @@
package com.gmail.nossr50.config.hocon.skills.ranks;
import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable;
@ConfigSerializable
public class ConfigRanksAlchemy {
}

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -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<Integer, Integer> standardRanks;
private HashMap<Integer, Integer> 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<Integer, Integer> standardRanks, HashMap<Integer, Integer> 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<Integer, Integer> standardRanks) {
this.standardRanks = standardRanks;
}
public void setRetroRanks(HashMap<Integer, Integer> retroRanks) {
this.retroRanks = retroRanks;
}
}