mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-25 06:36:45 +01:00
Add linear/exponential formula config options to defaults
This commit is contained in:
parent
9d9b5464c3
commit
9fcedcad76
@ -8,7 +8,7 @@ public class SkillConfigFactory {
|
|||||||
|
|
||||||
protected static SerializedConfigLoader initSkillConfig(PrimarySkillType primarySkillType, Class<?> clazz)
|
protected static SerializedConfigLoader initSkillConfig(PrimarySkillType primarySkillType, Class<?> clazz)
|
||||||
{
|
{
|
||||||
return new SerializedConfigLoader<>(clazz,
|
return new SerializedConfigLoader(clazz,
|
||||||
primarySkillType.toString().toLowerCase() + ".conf",
|
primarySkillType.toString().toLowerCase() + ".conf",
|
||||||
StringUtils.getCapitalized(primarySkillType.toString()),
|
StringUtils.getCapitalized(primarySkillType.toString()),
|
||||||
null);
|
null);
|
||||||
|
@ -0,0 +1,53 @@
|
|||||||
|
package com.gmail.nossr50.config.hocon.playerleveling;
|
||||||
|
|
||||||
|
import com.gmail.nossr50.datatypes.experience.FormulaType;
|
||||||
|
import ninja.leaping.configurate.objectmapping.Setting;
|
||||||
|
import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable;
|
||||||
|
|
||||||
|
@ConfigSerializable
|
||||||
|
public class ConfigExperienceFormula {
|
||||||
|
|
||||||
|
@Setting(value = "Player-XP-Formula-Type", comment = "Determines which formula is used to determine XP needed to level" +
|
||||||
|
"\nDefault value: LINEAR")
|
||||||
|
private FormulaType formulaType = FormulaType.LINEAR;
|
||||||
|
|
||||||
|
@Setting(value = "Linear-Formula-Settings", comment = "These settings are only used if you have your formula type set to Linear" +
|
||||||
|
"LINEAR Formula: base + (level * multiplier)")
|
||||||
|
private ConfigExperienceFormulaLinear configExperienceFormulaLinear = new ConfigExperienceFormulaLinear();
|
||||||
|
|
||||||
|
@Setting(value = "Exponential-Formula-Settings", comment = "These settings are only used if you have your formula type set to Exponential" +
|
||||||
|
"\nEXPONENTIAL Formula: multiplier * level ^ exponent + base")
|
||||||
|
private ConfigExperienceFormulaExponential configExperienceFormulaExponential = new ConfigExperienceFormulaExponential();
|
||||||
|
|
||||||
|
public FormulaType getFormulaType() {
|
||||||
|
return formulaType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ConfigExperienceFormulaLinear getConfigExperienceFormulaLinear() {
|
||||||
|
return configExperienceFormulaLinear;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ConfigExperienceFormulaExponential getConfigExperienceFormulaExponential() {
|
||||||
|
return configExperienceFormulaExponential;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getExponentialBaseModifier() {
|
||||||
|
return configExperienceFormulaExponential.getExponentialBaseModifier();
|
||||||
|
}
|
||||||
|
|
||||||
|
public double getExponentialMultiplier() {
|
||||||
|
return configExperienceFormulaExponential.getExponentialMultiplier();
|
||||||
|
}
|
||||||
|
|
||||||
|
public double getExponentialExponent() {
|
||||||
|
return configExperienceFormulaExponential.getExponentialExponent();
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getLinearBaseModifier() {
|
||||||
|
return configExperienceFormulaLinear.getLinearBaseModifier();
|
||||||
|
}
|
||||||
|
|
||||||
|
public double getLinearMultiplier() {
|
||||||
|
return configExperienceFormulaLinear.getLinearMultiplier();
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,36 @@
|
|||||||
|
package com.gmail.nossr50.config.hocon.playerleveling;
|
||||||
|
|
||||||
|
import ninja.leaping.configurate.objectmapping.Setting;
|
||||||
|
import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable;
|
||||||
|
|
||||||
|
@ConfigSerializable
|
||||||
|
public class ConfigExperienceFormulaExponential {
|
||||||
|
|
||||||
|
private static final int BASE_DEFAULT = 2000;
|
||||||
|
private static final double MULTIPLIER_DEFAULT = 0.1;
|
||||||
|
private static final double EXPONENT_DEFAULT = 1.80;
|
||||||
|
|
||||||
|
@Setting(value = "Base-Amount", comment = "" +
|
||||||
|
"\nDefault value: "+BASE_DEFAULT)
|
||||||
|
private int baseModifier = BASE_DEFAULT;
|
||||||
|
|
||||||
|
@Setting(value = "Multiplier", comment = "" +
|
||||||
|
"\nDefault value: "+MULTIPLIER_DEFAULT)
|
||||||
|
private double multiplier = MULTIPLIER_DEFAULT;
|
||||||
|
|
||||||
|
@Setting(value = "Exponent", comment = "" +
|
||||||
|
"\nDefault value: "+EXPONENT_DEFAULT)
|
||||||
|
private double exponent = EXPONENT_DEFAULT;
|
||||||
|
|
||||||
|
public int getExponentialBaseModifier() {
|
||||||
|
return baseModifier;
|
||||||
|
}
|
||||||
|
|
||||||
|
public double getExponentialMultiplier() {
|
||||||
|
return multiplier;
|
||||||
|
}
|
||||||
|
|
||||||
|
public double getExponentialExponent() {
|
||||||
|
return exponent;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,28 @@
|
|||||||
|
package com.gmail.nossr50.config.hocon.playerleveling;
|
||||||
|
|
||||||
|
import ninja.leaping.configurate.objectmapping.Setting;
|
||||||
|
import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable;
|
||||||
|
|
||||||
|
@ConfigSerializable
|
||||||
|
public class ConfigExperienceFormulaLinear {
|
||||||
|
|
||||||
|
private static final int BASE_DEFAULT = 1020;
|
||||||
|
private static final double MULTIPLIER_DEFAULT = 20.0D;
|
||||||
|
|
||||||
|
@Setting(value = "Base-Amount", comment = "The formula for Linear adds the base amount without any modifications to the level requirement for every level." +
|
||||||
|
"\nDefault value: "+BASE_DEFAULT)
|
||||||
|
private int baseModifier = BASE_DEFAULT;
|
||||||
|
|
||||||
|
@Setting(value = "Multiplier", comment = "The multiplier is multiplied against the players level and then added to the base amount to determine the amount of XP to the next level" +
|
||||||
|
"\nDefault value: "+MULTIPLIER_DEFAULT)
|
||||||
|
private double multiplier = MULTIPLIER_DEFAULT;
|
||||||
|
|
||||||
|
public int getLinearBaseModifier() {
|
||||||
|
return baseModifier;
|
||||||
|
}
|
||||||
|
|
||||||
|
public double getLinearMultiplier() {
|
||||||
|
return multiplier;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -20,6 +20,9 @@ public class ConfigLeveling {
|
|||||||
@Setting(value = "General", comment = "Settings for player leveling that don't fall into other categories")
|
@Setting(value = "General", comment = "Settings for player leveling that don't fall into other categories")
|
||||||
private ConfigSectionLevelingGeneral configSectionLevelingGeneral = new ConfigSectionLevelingGeneral();
|
private ConfigSectionLevelingGeneral configSectionLevelingGeneral = new ConfigSectionLevelingGeneral();
|
||||||
|
|
||||||
|
@Setting(value = "Experience-Formula")
|
||||||
|
private ConfigExperienceFormula configExperienceFormula = new ConfigExperienceFormula();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* GETTER BOILERPLATE
|
* GETTER BOILERPLATE
|
||||||
*/
|
*/
|
||||||
@ -41,13 +44,41 @@ public class ConfigLeveling {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public FormulaType getFormulaType() {
|
public FormulaType getFormulaType() {
|
||||||
return configSectionLevelingGeneral.getFormulaType();
|
return configExperienceFormula.getFormulaType();
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isRetroModeEnabled() {
|
public boolean isRetroModeEnabled() {
|
||||||
return getConfigSectionLevelScaling().isRetroModeEnabled();
|
return getConfigSectionLevelScaling().isRetroModeEnabled();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ConfigExperienceFormulaLinear getConfigExperienceFormulaLinear() {
|
||||||
|
return configExperienceFormula.getConfigExperienceFormulaLinear();
|
||||||
|
}
|
||||||
|
|
||||||
|
public ConfigExperienceFormulaExponential getConfigExperienceFormulaExponential() {
|
||||||
|
return configExperienceFormula.getConfigExperienceFormulaExponential();
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getExponentialBaseModifier() {
|
||||||
|
return configExperienceFormula.getExponentialBaseModifier();
|
||||||
|
}
|
||||||
|
|
||||||
|
public double getExponentialMultiplier() {
|
||||||
|
return configExperienceFormula.getExponentialMultiplier();
|
||||||
|
}
|
||||||
|
|
||||||
|
public double getExponentialExponent() {
|
||||||
|
return configExperienceFormula.getExponentialExponent();
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getLinearBaseModifier() {
|
||||||
|
return configExperienceFormula.getLinearBaseModifier();
|
||||||
|
}
|
||||||
|
|
||||||
|
public double getLinearMultiplier() {
|
||||||
|
return configExperienceFormula.getLinearMultiplier();
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* HELPER METHODS
|
* HELPER METHODS
|
||||||
*/
|
*/
|
||||||
|
@ -34,10 +34,6 @@ public class ConfigSectionLevelingGeneral {
|
|||||||
"\nDefault value: "+STARTING_LEVEL_DEFAULT)
|
"\nDefault value: "+STARTING_LEVEL_DEFAULT)
|
||||||
private int startingLevel = STARTING_LEVEL_DEFAULT;
|
private int startingLevel = STARTING_LEVEL_DEFAULT;
|
||||||
|
|
||||||
@Setting(value = "Player-XP-Formula", comment = "Determines which formula is used to determine XP needed to level" +
|
|
||||||
"\nDefault value: LINEAR")
|
|
||||||
private FormulaType formulaType = FormulaType.LINEAR;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* GETTER BOILERPLATE
|
* GETTER BOILERPLATE
|
||||||
*/
|
*/
|
||||||
@ -49,8 +45,4 @@ public class ConfigSectionLevelingGeneral {
|
|||||||
public ConfigSectionLevelScaling getConfigSectionLevelScaling() {
|
public ConfigSectionLevelScaling getConfigSectionLevelScaling() {
|
||||||
return configSectionLevelScaling;
|
return configSectionLevelScaling;
|
||||||
}
|
}
|
||||||
|
|
||||||
public FormulaType getFormulaType() {
|
|
||||||
return formulaType;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user