Reducing the amount of config confusion for retro mode

This is to avoid confusion, if you want this kind of customization I'll add it in but disassociate it with retro mode.
This commit is contained in:
nossr50 2019-01-14 22:48:37 -08:00
parent da6b6841b7
commit 4fcf0b0519
4 changed files with 26 additions and 24 deletions

View File

@ -246,13 +246,7 @@ public class Config extends AutoUpdateConfigLoader {
/* General Settings */ /* General Settings */
//Retro mode will default the value to true if the config file doesn't contain the entry (server is from a previous mcMMO install) //Retro mode will default the value to true if the config file doesn't contain the entry (server is from a previous mcMMO install)
public boolean getIsRetroMode() { return config.getBoolean("General.RetroMode", true); } public boolean getIsRetroMode() { return config.getBoolean("General.RetroMode.Enabled", true); }
//XP needed to level is multiplied by this when using classic mode
public int getClassicModeXPFormulaFactor() { return config.getInt("General.Skill_Scaling.RetroMode_XP_Formula_Factor", 1); }
//Level requirements for subskills is multiplied by this when using classic mode
public int getClassicModeLevelReqFactor() { return config.getInt("General.Skill_Scaling.RetroMode_LevelReq_Factor", 10); }
public String getLocale() { return config.getString("General.Locale", "en_us"); } public String getLocale() { return config.getString("General.Locale", "en_us"); }
public boolean getMOTDEnabled() { return config.getBoolean("General.MOTD_Enabled", true); } public boolean getMOTDEnabled() { return config.getBoolean("General.MOTD_Enabled", true); }

View File

@ -89,7 +89,7 @@ public class mcMMO extends JavaPlugin {
// XP Event Check // XP Event Check
private boolean xpEventEnabled; private boolean xpEventEnabled;
private boolean UseOldLevelScalingEnabled; private boolean isRetroModeEnabled;
/* Metadata Values */ /* Metadata Values */
public final static String entityMetadataKey = "mcMMO: Spawned Entity"; public final static String entityMetadataKey = "mcMMO: Spawned Entity";
@ -138,6 +138,9 @@ public class mcMMO extends JavaPlugin {
return; return;
} }
//Store this value so other plugins can check it
isRetroModeEnabled = Config.getInstance().getIsRetroMode();
if (getServer().getName().equals("Cauldron") || getServer().getName().equals("MCPC+")) { if (getServer().getName().equals("Cauldron") || getServer().getName().equals("MCPC+")) {
checkModConfigs(); checkModConfigs();
} }
@ -533,4 +536,14 @@ public class mcMMO extends JavaPlugin {
InputStream in = getResource(fileName); InputStream in = getResource(fileName);
return in == null ? null : new InputStreamReader(in, Charsets.UTF_8); return in == null ? null : new InputStreamReader(in, Charsets.UTF_8);
} }
/**
* Checks if this plugin is using retro mode
* Retro mode is a 0-1000 skill system
* Standard mode is scaled for 1-100
* @return true if retro mode is enabled
*/
public boolean isRetroModeEnabled() {
return isRetroModeEnabled;
}
} }

View File

@ -21,13 +21,11 @@ public class FormulaManager {
private FormulaType previousFormula; private FormulaType previousFormula;
//Used for XP formula scaling //Used for XP formula scaling
private boolean classicModeEnabled; private boolean retroModeEnabled;
private int classicModeXPFormulaFactor;
public FormulaManager() { public FormulaManager() {
/* Setting for Classic Mode (Scales a lot of stuff up by * 10) */ /* Setting for Classic Mode (Scales a lot of stuff up by * 10) */
classicModeEnabled = Config.getInstance().getIsRetroMode(); retroModeEnabled = Config.getInstance().getIsRetroMode();
classicModeXPFormulaFactor = Config.getInstance().getClassicModeXPFormulaFactor();
loadFormula(); loadFormula();
} }
@ -111,8 +109,11 @@ public class FormulaManager {
public int getCachedXpToLevel(int level, FormulaType formulaType) { public int getCachedXpToLevel(int level, FormulaType formulaType) {
int experience; int experience;
//If we're in classic we use the XP factor from config settings /**
int skillSystemMultiplier = classicModeEnabled ? classicModeXPFormulaFactor : 10; * Retro mode XP requirements are the default requirements
* Standard mode XP requirements are multiplied by a factor of 10
*/
int xpNeededMultiplier = retroModeEnabled ? 1 : 10;
if (formulaType == FormulaType.UNKNOWN) { if (formulaType == FormulaType.UNKNOWN) {
formulaType = FormulaType.LINEAR; formulaType = FormulaType.LINEAR;
@ -125,7 +126,7 @@ public class FormulaManager {
switch (formulaType) { switch (formulaType) {
case LINEAR: case LINEAR:
if (!experienceNeededLinear.containsKey(level)) { if (!experienceNeededLinear.containsKey(level)) {
experience = (int) Math.floor( skillSystemMultiplier * (base + level * multiplier)); experience = (int) Math.floor( xpNeededMultiplier * (base + level * multiplier));
experienceNeededLinear.put(level, experience); experienceNeededLinear.put(level, experience);
} }
@ -133,7 +134,7 @@ public class FormulaManager {
case EXPONENTIAL: case EXPONENTIAL:
if (!experienceNeededExponential.containsKey(level)) { if (!experienceNeededExponential.containsKey(level)) {
experience = (int) Math.floor( skillSystemMultiplier * (multiplier * Math.pow(level, exponent) + base)); experience = (int) Math.floor( xpNeededMultiplier * (multiplier * Math.pow(level, exponent) + base));
experienceNeededExponential.put(level, experience); experienceNeededExponential.put(level, experience);
} }

View File

@ -8,17 +8,11 @@
# Settings for mcMMO in general # Settings for mcMMO in general
### ###
General: General:
Skill_Scaling:
# Turning this on will scale mcMMO around 1-1000 with default scaling factor # Turning this on will scale mcMMO around 1-1000 with default scaling factor
# Everything in your config related to skill level requirements, skill level bonuses, etc will be multiplied by 10 when this mode is on # Everything in your config related to skill level requirements, skill level bonuses, etc will be multiplied by 10 when this mode is on
# This change is purely cosmetic, it retains the old feel of mcMMO where you could level up thousands of times # This change is purely cosmetic, it retains the old feel of mcMMO where you could level up thousands of times
RetroMode: true RetroMode:
Skill_Scaling: Enabled: true
# This is the value that is skill level requirements are multiplied by in Retro Mode (Default is 10)
RetroMode_LevelReq_Factor: 10
# This is the value that the xp required to level is multiplied by when in Retro mode
# Default is 1
RetroMode_XP_Formula_Factor: 1
Locale: en_US Locale: en_US
MOTD_Enabled: true MOTD_Enabled: true
# Send a message to the player when his profile was successfully loaded # Send a message to the player when his profile was successfully loaded