боты русифицированы
This commit is contained in:
@@ -12,6 +12,7 @@
|
||||
#include "Event.h"
|
||||
#include "PlayerbotTextMgr.h"
|
||||
#include "Playerbots.h"
|
||||
#include "Util.h"
|
||||
|
||||
static const std::unordered_set<std::string> noReplyMsgs = {
|
||||
"join",
|
||||
@@ -52,6 +53,18 @@ static const std::unordered_set<std::string> noReplyMsgParts = {
|
||||
"+", "-", "@", "follow target", "focus heal", "cast ", "accept [", "e [", "destroy [", "go zone"};
|
||||
static const std::unordered_set<std::string> noReplyMsgStarts = {"e ", "accept ", "cast ", "destroy "};
|
||||
|
||||
static std::string Utf8Lowercase(std::string const& value)
|
||||
{
|
||||
std::wstring wide;
|
||||
if (!Utf8toWStr(value, wide))
|
||||
return value;
|
||||
|
||||
wstrToLower(wide);
|
||||
std::string lowered;
|
||||
WStrToUtf8(wide, lowered);
|
||||
return lowered;
|
||||
}
|
||||
|
||||
SayAction::SayAction(PlayerbotAI* botAI) : Action(botAI, "say"), Qualified() {}
|
||||
|
||||
bool SayAction::Execute(Event /*event*/)
|
||||
@@ -578,6 +591,40 @@ std::string ChatReplyAction::GenerateReplyMessage(Player* bot, std::string& inco
|
||||
|
||||
std::string respondsText = "";
|
||||
|
||||
// The legacy free-chat parser below is English-specific and constructs
|
||||
// several responses directly in English. For ruRU, classify the small
|
||||
// static reply set locally and let PlayerbotTextMgr select text_loc8.
|
||||
if (PlayerbotTextMgr::instance().GetLocalePriority() == LOCALE_ruRU)
|
||||
{
|
||||
std::string const message = Utf8Lowercase(incomingMessage);
|
||||
std::string const botName = Utf8Lowercase(bot->GetName());
|
||||
|
||||
if (Player* player = ObjectAccessor::FindPlayer(ObjectGuid(HighGuid::Player, guid1));
|
||||
player && player->isGMChat())
|
||||
{
|
||||
replyType = REPLY_ADMIN_ABUSE;
|
||||
}
|
||||
else if (message.find("привет") != std::string::npos || message.find("здравств") != std::string::npos ||
|
||||
message.find("добрый день") != std::string::npos || message.find("добрый вечер") != std::string::npos)
|
||||
{
|
||||
replyType = REPLY_HELLO;
|
||||
}
|
||||
else if (message.find("нуб") != std::string::npos || message.find("дурак") != std::string::npos ||
|
||||
message.find("идиот") != std::string::npos || message.find("заткнись") != std::string::npos)
|
||||
{
|
||||
replyType = REPLY_GRUDGE;
|
||||
}
|
||||
else if (message.find(botName) != std::string::npos)
|
||||
{
|
||||
replyType = REPLY_NAME;
|
||||
}
|
||||
|
||||
respondsText = PlayerbotTextMgr::instance().GetBotText(replyType, name);
|
||||
if (respondsText.size() > 255)
|
||||
respondsText.resize(255);
|
||||
return respondsText;
|
||||
}
|
||||
|
||||
// Chat Logic
|
||||
int32 verb_pos = -1;
|
||||
int32 verb_type = -1;
|
||||
|
||||
Reference in New Issue
Block a user