mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-17 19:05:42 +00:00
feat(Core/ChatHandler): Add SendErrorMessage helper (#17919)
* feat(Core/Chat): Add SendErrorMessage helper * lost boy
This commit is contained in:
@@ -62,8 +62,7 @@ bool ChatHandler::HasLowerSecurity(Player* target, ObjectGuid guid, bool strong)
|
||||
|
||||
if (!target_session && !target_account)
|
||||
{
|
||||
SendSysMessage(LANG_PLAYER_NOT_FOUND);
|
||||
SetSentErrorMessage(true);
|
||||
SendErrorMessage(LANG_PLAYER_NOT_FOUND);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -92,8 +91,7 @@ bool ChatHandler::HasLowerSecurityAccount(WorldSession* target, uint32 target_ac
|
||||
AccountTypes target_ac_sec = AccountTypes(target_sec);
|
||||
if (m_session->GetSecurity() < target_ac_sec || (strong && m_session->GetSecurity() <= target_ac_sec))
|
||||
{
|
||||
SendSysMessage(LANG_YOURS_SECURITY_IS_LOW);
|
||||
SetSentErrorMessage(true);
|
||||
SendErrorMessage(LANG_YOURS_SECURITY_IS_LOW);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -151,6 +149,18 @@ void ChatHandler::SendSysMessage(uint32 entry)
|
||||
SendSysMessage(GetAcoreString(entry));
|
||||
}
|
||||
|
||||
void ChatHandler::SendErrorMessage(uint32 entry)
|
||||
{
|
||||
SendSysMessage(entry);
|
||||
SetSentErrorMessage(true);
|
||||
}
|
||||
|
||||
void ChatHandler::SendErrorMessage(std::string_view str, bool escapeCharacters)
|
||||
{
|
||||
SendSysMessage(str, escapeCharacters);
|
||||
SetSentErrorMessage(true);
|
||||
}
|
||||
|
||||
bool ChatHandler::_ParseCommands(std::string_view text)
|
||||
{
|
||||
if (Acore::ChatCommands::TryExecuteCommand(*this, text))
|
||||
@@ -161,8 +171,7 @@ bool ChatHandler::_ParseCommands(std::string_view text)
|
||||
return false;
|
||||
|
||||
// Send error message for GMs
|
||||
PSendSysMessage(LANG_CMD_INVALID, STRING_VIEW_FMT_ARG(text));
|
||||
SetSentErrorMessage(true);
|
||||
SendErrorMessage(LANG_CMD_INVALID, STRING_VIEW_FMT_ARG(text));
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -682,8 +691,7 @@ bool ChatHandler::extractPlayerTarget(char* args, Player** player, ObjectGuid* p
|
||||
std::string name = extractPlayerNameFromLink(args);
|
||||
if (name.empty())
|
||||
{
|
||||
SendSysMessage(LANG_PLAYER_NOT_FOUND);
|
||||
SetSentErrorMessage(true);
|
||||
SendErrorMessage(LANG_PLAYER_NOT_FOUND);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -725,8 +733,7 @@ bool ChatHandler::extractPlayerTarget(char* args, Player** player, ObjectGuid* p
|
||||
// some from req. data must be provided (note: name is empty if player not exist)
|
||||
if ((!player || !*player) && (!player_guid || !*player_guid) && (!player_name || player_name->empty()))
|
||||
{
|
||||
SendSysMessage(LANG_PLAYER_NOT_FOUND);
|
||||
SetSentErrorMessage(true);
|
||||
SendErrorMessage(LANG_PLAYER_NOT_FOUND);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -839,8 +846,7 @@ bool ChatHandler::GetPlayerGroupAndGUIDByName(const char* cname, Player*& player
|
||||
{
|
||||
if (!normalizePlayerName(name))
|
||||
{
|
||||
PSendSysMessage(LANG_PLAYER_NOT_FOUND);
|
||||
SetSentErrorMessage(true);
|
||||
SendErrorMessage(LANG_PLAYER_NOT_FOUND);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user