feat(Core/ChatHandler): Add SendErrorMessage helper (#17919)

* feat(Core/Chat): Add SendErrorMessage helper

* lost boy
This commit is contained in:
Kitzunu
2023-12-02 19:25:32 +01:00
committed by GitHub
parent 5bfeabde81
commit db4b0b0d3d
40 changed files with 503 additions and 946 deletions

View File

@@ -121,8 +121,7 @@ public:
if (!normalizePlayerName(name))
{
handler->SendSysMessage(LANG_PLAYER_NOT_FOUND);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_PLAYER_NOT_FOUND);
return false;
}
@@ -142,8 +141,7 @@ public:
break;
case BAN_NOTFOUND:
{
handler->PSendSysMessage(LANG_BAN_NOTFOUND, "character", name.c_str());
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_BAN_NOTFOUND, "character", name.c_str());
return false;
}
default:
@@ -187,16 +185,14 @@ public:
case BAN_ACCOUNT:
if (!Utf8ToUpperOnlyLatin(nameOrIP))
{
handler->PSendSysMessage(LANG_ACCOUNT_NOT_EXIST, nameOrIP.c_str());
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_ACCOUNT_NOT_EXIST, nameOrIP.c_str());
return false;
}
break;
case BAN_CHARACTER:
if (!normalizePlayerName(nameOrIP))
{
handler->SendSysMessage(LANG_PLAYER_NOT_FOUND);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_PLAYER_NOT_FOUND);
return false;
}
break;
@@ -242,16 +238,15 @@ public:
switch (mode)
{
default:
handler->PSendSysMessage(LANG_BAN_NOTFOUND, "account", nameOrIP.c_str());
handler->SendErrorMessage(LANG_BAN_NOTFOUND, "account", nameOrIP.c_str());
break;
case BAN_CHARACTER:
handler->PSendSysMessage(LANG_BAN_NOTFOUND, "character", nameOrIP.c_str());
handler->SendErrorMessage(LANG_BAN_NOTFOUND, "character", nameOrIP.c_str());
break;
case BAN_IP:
handler->PSendSysMessage(LANG_BAN_NOTFOUND, "ip", nameOrIP.c_str());
handler->SendErrorMessage(LANG_BAN_NOTFOUND, "ip", nameOrIP.c_str());
break;
}
handler->SetSentErrorMessage(true);
return false;
case BAN_LONGER_EXISTS:
handler->PSendSysMessage("Unsuccessful! A longer ban is already present on this account!");
@@ -275,8 +270,7 @@ public:
std::string accountName = nameStr;
if (!Utf8ToUpperOnlyLatin(accountName))
{
handler->PSendSysMessage(LANG_ACCOUNT_NOT_EXIST, accountName.c_str());
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_ACCOUNT_NOT_EXIST, accountName.c_str());
return false;
}
@@ -681,15 +675,13 @@ public:
if (!normalizePlayerName(CharacterName))
{
handler->SendSysMessage(LANG_PLAYER_NOT_FOUND);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_PLAYER_NOT_FOUND);
return false;
}
if (!sBan->RemoveBanCharacter(CharacterName))
{
handler->SendSysMessage(LANG_PLAYER_NOT_FOUND);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_PLAYER_NOT_FOUND);
return false;
}
@@ -722,16 +714,14 @@ public:
case BAN_ACCOUNT:
if (!Utf8ToUpperOnlyLatin(nameOrIP))
{
handler->PSendSysMessage(LANG_ACCOUNT_NOT_EXIST, nameOrIP.c_str());
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_ACCOUNT_NOT_EXIST, nameOrIP.c_str());
return false;
}
break;
case BAN_CHARACTER:
if (!normalizePlayerName(nameOrIP))
{
handler->SendSysMessage(LANG_PLAYER_NOT_FOUND);
handler->SetSentErrorMessage(true);
handler->SendErrorMessage(LANG_PLAYER_NOT_FOUND);
return false;
}
break;