Browse Source

drop rates calculated via magicbane.conf on server boot

master
FatBoy-DOTC 2 years ago
parent
commit
82249a6d6d
  1. 13
      src/engine/gameManager/ConfigManager.java
  2. 9
      src/engine/server/world/WorldServer.java

13
src/engine/gameManager/ConfigManager.java

@ -14,6 +14,7 @@ package engine.gameManager; @@ -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 { @@ -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 { @@ -93,8 +96,13 @@ public enum ConfigManager {
public static LoginServer loginServer;
public static Map<ConfigManager, Pattern> 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 { @@ -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;
}

9
src/engine/server/world/WorldServer.java

@ -482,6 +482,15 @@ public class WorldServer { @@ -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;
}

Loading…
Cancel
Save