diff --git a/src/engine/gameManager/ConfigManager.java b/src/engine/gameManager/ConfigManager.java index ec745dd7..833fdeec 100644 --- a/src/engine/gameManager/ConfigManager.java +++ b/src/engine/gameManager/ConfigManager.java @@ -14,6 +14,7 @@ package engine.gameManager; import engine.Enum; import engine.net.NetMsgHandler; +import engine.server.MBServerStatics; import engine.server.login.LoginServer; import engine.server.world.WorldServer; import org.pmw.tinylog.Logger; @@ -80,8 +81,10 @@ public enum ConfigManager { MB_MAGICBOT_RECRUIT, MB_MAGICBOT_ADMINLOG, MB_MAGICBOT_BOTVERSION, - MB_MAGICBOT_GAMEVERSION; - + MB_MAGICBOT_GAMEVERSION, + //drop rates + MB_STUFF_ACQUIRED_NORMALLY, + MB_STUFF_ACQUIRED_FROM_HOTZONE; // Map to hold our config pulled in from the environment // We also use the config to point to the current message pump // and determine the server type at runtime. @@ -93,8 +96,13 @@ public enum ConfigManager { public static LoginServer loginServer; public static Map regex = new HashMap<>(); + //drop rates pulled form config file + + public float amountOfStuffYouGetInHotzones; + // Called at bootstrap: ensures that all config values are loaded. + public static boolean init() { Logger.info("ConfigManager: init()"); @@ -112,7 +120,6 @@ public enum ConfigManager { // compile regex here regex.put(MB_LOGIN_FNAME_REGEX, Pattern.compile(MB_LOGIN_FNAME_REGEX.getValue())); - return true; } diff --git a/src/engine/server/world/WorldServer.java b/src/engine/server/world/WorldServer.java index 0e663827..1eaa33e8 100644 --- a/src/engine/server/world/WorldServer.java +++ b/src/engine/server/world/WorldServer.java @@ -482,6 +482,15 @@ public class WorldServer { Logger.info("Running garbage collection..."); System.gc(); + + //set rates from config file + Logger.info("Setting rates based on conf file..."); + MBServerStatics.EXP_RATE_MOD = Float.parseFloat(ConfigManager.MB_STUFF_ACQUIRED_NORMALLY.getValue()); + MBServerStatics.GOLD_RATE_MOD = Float.parseFloat(ConfigManager.MB_STUFF_ACQUIRED_NORMALLY.getValue()); + MBServerStatics.DROP_RATE_MOD = Float.parseFloat(ConfigManager.MB_STUFF_ACQUIRED_NORMALLY.getValue()); + MBServerStatics.HOT_EXP_RATE_MOD = Float.parseFloat(ConfigManager.MB_STUFF_ACQUIRED_FROM_HOTZONE.getValue()); + MBServerStatics.HOT_GOLD_RATE_MOD = Float.parseFloat(ConfigManager.MB_STUFF_ACQUIRED_FROM_HOTZONE.getValue()); + MBServerStatics.HOT_DROP_RATE_MOD = Float.parseFloat(ConfigManager.MB_STUFF_ACQUIRED_FROM_HOTZONE.getValue()); return true; }