From d03efd02d18be1af53c3c873b9e69e6371d101de Mon Sep 17 00:00:00 2001 From: Barbz Date: Wed, 18 Apr 2018 19:55:21 +0200 Subject: [PATCH] CONFIG - Fixed The config should now be read and the module working. --- src/mod_congratsonlevel.cpp | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/src/mod_congratsonlevel.cpp b/src/mod_congratsonlevel.cpp index df7f57b..9122eb6 100644 --- a/src/mod_congratsonlevel.cpp +++ b/src/mod_congratsonlevel.cpp @@ -262,7 +262,29 @@ public: } }; +class CongratsOnLevelWorld : public WorldScript +{ +public: + CongratsOnLevelWorld() : WorldScript("CongratsOnLevelWorld") { } + + void OnBeforeConfigLoad(bool reload) override + { + if (!reload) { + std::string conf_path = _CONF_DIR; + std::string cfg_file = conf_path + "/mod_congratsonlevel.conf"; +#ifdef WIN32 + cfg_file = "mod_congratsonlevel.conf"; +#endif + std::string cfg_def_file = cfg_file + ".dist"; + sConfigMgr->LoadMore(cfg_def_file.c_str()); + + sConfigMgr->LoadMore(cfg_file.c_str()); + } + } +}; + void AddCongratsOnLevelScripts() { + new CongratsOnLevelWorld(); new CongratsOnLevel(); -} \ No newline at end of file +}