refactor(Core/Chat): Move SendWorldText(optional) to ChatHandler and … (#19501)

* refactor(Core/Chat): Move SendWorldText(optional) to ChatHandler and allow `fmt`

* Update src/server/game/Battlegrounds/BattlegroundQueue.cpp

* Update src/server/game/Battlegrounds/BattlegroundQueue.cpp

* Update src/server/game/Misc/BanMgr.cpp

* Update src/server/game/Misc/BanMgr.cpp

* Update src/server/game/Misc/BanMgr.cpp

* Update src/server/game/Misc/BanMgr.cpp

* Update src/server/game/Misc/BanMgr.cpp

* Update src/server/game/Misc/BanMgr.cpp

* Update src/server/game/Misc/BanMgr.cpp

* Update src/server/game/Misc/BanMgr.cpp
This commit is contained in:
Kitzunu
2024-07-29 19:44:13 +02:00
committed by GitHub
parent d5c472b25d
commit 87f4adf634
18 changed files with 119 additions and 94 deletions

View File

@@ -17,6 +17,7 @@
#include "BanMgr.h"
#include "AccountMgr.h"
#include "Chat.h"
#include "DatabaseEnv.h"
#include "GameTime.h"
#include "Language.h"
@@ -86,9 +87,9 @@ BanReturn BanMgr::BanAccount(std::string const& AccountName, std::string const&
IsPermanetly = false;
if (!IsPermanetly)
sWorld->SendWorldText(LANG_BAN_ACCOUNT_YOUBANNEDMESSAGE_WORLD, Author.c_str(), AccountName.c_str(), secsToTimeString(TimeStringToSecs(Duration), true).c_str(), Reason.c_str());
ChatHandler(nullptr).SendWorldText(LANG_BAN_ACCOUNT_YOUBANNEDMESSAGE_WORLD, Author, AccountName, secsToTimeString(TimeStringToSecs(Duration), true), Reason);
else
sWorld->SendWorldText(LANG_BAN_ACCOUNT_YOUPERMBANNEDMESSAGE_WORLD, Author.c_str(), AccountName.c_str(), Reason.c_str());
ChatHandler(nullptr).SendWorldText(LANG_BAN_ACCOUNT_YOUPERMBANNEDMESSAGE_WORLD, Author, AccountName, Reason);
}
return BAN_SUCCESS;
@@ -152,9 +153,9 @@ BanReturn BanMgr::BanAccountByPlayerName(std::string const& CharacterName, std::
AccountMgr::GetName(AccountID, AccountName);
if (!IsPermanetly)
sWorld->SendWorldText(LANG_BAN_ACCOUNT_YOUBANNEDMESSAGE_WORLD, Author.c_str(), AccountName.c_str(), secsToTimeString(TimeStringToSecs(Duration), true).c_str(), Reason.c_str());
ChatHandler(nullptr).SendWorldText(LANG_BAN_ACCOUNT_YOUBANNEDMESSAGE_WORLD, Author, AccountName, secsToTimeString(TimeStringToSecs(Duration), true), Reason);
else
sWorld->SendWorldText(LANG_BAN_ACCOUNT_YOUPERMBANNEDMESSAGE_WORLD, Author.c_str(), AccountName.c_str(), Reason.c_str());
ChatHandler(nullptr).SendWorldText(LANG_BAN_ACCOUNT_YOUPERMBANNEDMESSAGE_WORLD, Author, AccountName, Reason);
}
return BAN_SUCCESS;
@@ -188,9 +189,9 @@ BanReturn BanMgr::BanIP(std::string const& IP, std::string const& Duration, std:
IsPermanetly = false;
if (IsPermanetly)
sWorld->SendWorldText(LANG_BAN_IP_YOUPERMBANNEDMESSAGE_WORLD, Author.c_str(), IP.c_str(), Reason.c_str());
ChatHandler(nullptr).SendWorldText(LANG_BAN_IP_YOUPERMBANNEDMESSAGE_WORLD, Author, IP, Reason);
else
sWorld->SendWorldText(LANG_BAN_IP_YOUBANNEDMESSAGE_WORLD, Author.c_str(), IP.c_str(), secsToTimeString(TimeStringToSecs(Duration), true).c_str(), Reason.c_str());
ChatHandler(nullptr).SendWorldText(LANG_BAN_IP_YOUBANNEDMESSAGE_WORLD, Author, IP, secsToTimeString(TimeStringToSecs(Duration), true), Reason);
}
if (!resultAccounts)
@@ -258,9 +259,9 @@ BanReturn BanMgr::BanCharacter(std::string const& CharacterName, std::string con
IsPermanetly = false;
if (!IsPermanetly)
sWorld->SendWorldText(LANG_BAN_CHARACTER_YOUBANNEDMESSAGE_WORLD, Author.c_str(), CharacterName.c_str(), secsToTimeString(TimeStringToSecs(Duration), true).c_str(), Reason.c_str());
ChatHandler(nullptr).SendWorldText(LANG_BAN_CHARACTER_YOUBANNEDMESSAGE_WORLD, Author, CharacterName, secsToTimeString(TimeStringToSecs(Duration), true), Reason);
else
sWorld->SendWorldText(LANG_BAN_CHARACTER_YOUPERMBANNEDMESSAGE_WORLD, Author.c_str(), CharacterName.c_str(), Reason.c_str());
ChatHandler(nullptr).SendWorldText(LANG_BAN_CHARACTER_YOUPERMBANNEDMESSAGE_WORLD, Author, CharacterName, Reason);
}
return BAN_SUCCESS;