diff --git a/conf/mod_starterguild.conf.dist b/conf/mod_starterguild.conf.dist index ea15fb7..b6887d8 100644 --- a/conf/mod_starterguild.conf.dist +++ b/conf/mod_starterguild.conf.dist @@ -45,9 +45,9 @@ StarterGuild.Level = 0 # StarterGuild.HordeWelcomeText # StarterGuild.AllianceWelcomeText # Description: Welcome text sent to the player in chat when he is added to the guild. Can be set to not notify, by setting this config to an empty string. -# Default HordeWelcomeText: "Lok’tar ogar! Welcome to the horde starter guild ." -# Default AllianceWelcomeText: "Welcome to the alliance starter guild . For the Alliance!" -# Value: Any String, using either or in your string will cause them to be replaced with the starter guilds name or characters name respectivly. +# Default HordeWelcomeText: "Lok’tar ogar! Welcome to the horde starter guild {GUILD} {PLAYER}." +# Default AllianceWelcomeText: "Welcome to the alliance starter guild {GUILD} {PLAYER}. For the Alliance!" +# Value: Any String, using either {GUILD} or {PLAYER} in your string will cause them to be replaced with the starter guilds name or characters name respectivly. # -StarterGuild.HordeWelcomeText = "Lok’tar ogar! Welcome to the horde starter guild ." -StarterGuild.AllianceWelcomeText = "Welcome to the alliance starter guild . For the Alliance!" \ No newline at end of file +StarterGuild.HordeWelcomeText = "Lok’tar ogar! Welcome to the horde starter guild {GUILD} {PLAYER}." +StarterGuild.AllianceWelcomeText = "Welcome to the alliance starter guild {GUILD} {PLAYER}. For the Alliance!" diff --git a/src/mod_starterguild.cpp b/src/mod_starterguild.cpp index c01a89c..10f8895 100644 --- a/src/mod_starterguild.cpp +++ b/src/mod_starterguild.cpp @@ -1,5 +1,5 @@ #include "mod_starterguild.h" -#include +#include void StarterGuild::OnPlayerLogin(Player* player) { @@ -30,8 +30,8 @@ void StarterGuild::addPlayerToGuild(Player* player) const uint32 GUILD_ID_HORDE = sConfigMgr->GetOption("StarterGuild.Horde", 1); const uint32 GUILD_ID_ALLIANCE = sConfigMgr->GetOption("StarterGuild.Alliance", 2); - const std::string GUILD_WELCOME_TEXT_HORDE = sConfigMgr->GetOption("StarterGuild.HordeWelcomeText", "Lok’tar ogar! Welcome to the horde starter guild ."); - const std::string GUILD_WELCOME_TEXT_ALLIANCE = sConfigMgr->GetOption("StarterGuild.AllianceWelcomeText", "Welcome to the alliance starter guild . For the Alliance!"); + const std::string GUILD_WELCOME_TEXT_HORDE = sConfigMgr->GetOption("StarterGuild.HordeWelcomeText", "Lok’tar ogar! Welcome to the horde starter guild {GUILD} {PLAYER}."); + const std::string GUILD_WELCOME_TEXT_ALLIANCE = sConfigMgr->GetOption("StarterGuild.AllianceWelcomeText", "Welcome to the alliance starter guild {GUILD} {PLAYER}. For the Alliance!"); Guild* guild = sGuildMgr->GetGuildById(player->GetTeamId() == TEAM_ALLIANCE ? GUILD_ID_ALLIANCE : GUILD_ID_HORDE); @@ -45,10 +45,13 @@ void StarterGuild::addPlayerToGuild(Player* player) // Inform the player they have joined the guild std::string welcome_text = player->GetTeamId() == TEAM_ALLIANCE ? GUILD_WELCOME_TEXT_ALLIANCE : GUILD_WELCOME_TEXT_HORDE; - welcome_text = std::regex_replace(welcome_text, std::regex(""), player->GetGuildName()); - welcome_text = std::regex_replace(welcome_text, std::regex(""), player->GetName()); + welcome_text = fmt::format( + fmt::runtime(welcome_text), + fmt::arg("GUILD", player->GetGuildName()), + fmt::arg("PLAYER", player->GetPlayerName()) + ); - ChatHandler(player->GetSession()).SendSysMessage(welcome_text.c_str()); + ChatHandler(player->GetSession()).SendSysMessage(welcome_text); } else ChatHandler(player->GetSession()).SendSysMessage("The brotherhood has exceeded its membership limit.");