update add announcer and config

This commit is contained in:
Micrah
2020-01-06 06:30:43 +11:00
committed by BarbzYHOOL
parent 24200cd692
commit 833269f67a

View File

@@ -3,7 +3,6 @@
** AzerothCore 2019 http://www.azerothcore.org/
** Conan513 https://github.com/conan513
** Made into a module by Micrah https://github.com/milestorme/
** Updated to work with AzerothCore Docker Installations by Artanisx https://github.com/Artanisx/
*/
#include "ScriptMgr.h"
@@ -14,11 +13,28 @@
#include "Chat.h"
#include "Opcodes.h"
class lfg_solo_announce : public PlayerScript
{
public:
lfg_solo_announce() : PlayerScript("lfg_solo_announce") {}
void OnLogin(Player* player)
{
// Announce Module
if (sConfigMgr->GetBoolDefault("SoloLFG.Announce", true))
{
ChatHandler(player->GetSession()).SendSysMessage("This server is running the |cff4CFF00Solo Dungeon Finder |rmodule.");
}
}
};
class lfg_solo : public PlayerScript
{
public:
lfg_solo() : PlayerScript("lfg_solo") { }
// Docker Installation prevents warnings. In order to avoid the issue, we need to add __attribute__ ((unused))
// to the player variable to tell the compiler it is fine not to use it.
void OnLogin(Player* player)
@@ -33,8 +49,27 @@ public:
}
};
class lfg_solo_config : public WorldScript
{
public:
lfg_solo_config() : WorldScript("lfg_solo_config") { }
void OnBeforeConfigLoad(bool reload) override
{
if (!reload) {
std::string conf_path = _CONF_DIR;
std::string cfg_file = conf_path + "/SoloLfg.conf";
std::string cfg_def_file = cfg_file + ".dist";
sConfigMgr->LoadMore(cfg_def_file.c_str());
sConfigMgr->LoadMore(cfg_file.c_str());
}
}
};
void AddLfgSoloScripts()
{
new lfg_solo_announce();
new lfg_solo();
new lfg_solo_config();
}