diff --git a/conf/playerbots.conf.dist b/conf/playerbots.conf.dist index 23885bee3..886cc8cd5 100644 --- a/conf/playerbots.conf.dist +++ b/conf/playerbots.conf.dist @@ -750,6 +750,11 @@ AiPlayerbot.EnableRandomBotTrading = 1 # Configure message prefixes which will be excluded in analysis in trade action to open trade window AiPlayerbot.TradeActionExcludedPrefixes = "RPLL_H_,DBMv4,{звезда} Questie,{rt1} Questie" +# Allow bots to send mail. When disabled, bots will not mail items or money in +# response to chat commands ("send mail"). +# Default: 1 (enabled) +AiPlayerbot.BotSendMailEnabled = 1 + # # # diff --git a/data/sql/playerbots/updates/2026_05_22_00_ai_playerbot_send_mail_disabled_text.sql b/data/sql/playerbots/updates/2026_05_22_00_ai_playerbot_send_mail_disabled_text.sql new file mode 100644 index 000000000..9ed05e8b5 --- /dev/null +++ b/data/sql/playerbots/updates/2026_05_22_00_ai_playerbot_send_mail_disabled_text.sql @@ -0,0 +1,13 @@ +DELETE FROM ai_playerbot_texts WHERE name IN ( + 'send_mail_disabled' +); + +DELETE FROM ai_playerbot_texts_chance WHERE name IN ( + 'send_mail_disabled' +); + +INSERT INTO ai_playerbot_texts (id, name, text, say_type, reply_type, text_loc1, text_loc2, text_loc3, text_loc4, text_loc5, text_loc6, text_loc7, text_loc8) VALUES +(1899, 'send_mail_disabled', 'I cannot send mail', 0, 0, '우편을 보낼 수 없습니다', 'Je ne peux pas envoyer de courrier', 'Ich kann keine Post senden', '我不能寄送邮件', '我不能寄送郵件', 'No puedo enviar correo', 'No puedo enviar correo', 'Я не могу отправить почту'); + +INSERT INTO ai_playerbot_texts_chance (name, probability) VALUES +('send_mail_disabled', 100); diff --git a/src/Ai/Base/Actions/SendMailAction.cpp b/src/Ai/Base/Actions/SendMailAction.cpp index 549e6b716..b0966856b 100644 --- a/src/Ai/Base/Actions/SendMailAction.cpp +++ b/src/Ai/Base/Actions/SendMailAction.cpp @@ -34,24 +34,23 @@ bool SendMailAction::Execute(Event event) Player* receiver = GetMaster(); Player* tellTo = receiver; - std::vector ss = split(text, ' '); - if (ss.size() > 1) - { - if (Player* p = ObjectAccessor::FindPlayer(ObjectGuid(uint64(ss[ss.size() - 1].c_str())))) - receiver = p; - } - if (!receiver) receiver = event.getOwner(); if (!receiver || receiver == bot) - { return false; - } if (!tellTo) tellTo = receiver; + if (!sPlayerbotAIConfig.botSendMailEnabled) + { + bot->Whisper(PlayerbotTextMgr::instance().GetBotTextOrDefault( + "send_mail_disabled", "I cannot send mail", {}), + LANG_UNIVERSAL, tellTo); + return false; + } + if (!mailboxFound && !randomBot) { bot->Whisper(PlayerbotTextMgr::instance().GetBotTextOrDefault( diff --git a/src/PlayerbotAIConfig.cpp b/src/PlayerbotAIConfig.cpp index baaae8c3f..06e88a67b 100644 --- a/src/PlayerbotAIConfig.cpp +++ b/src/PlayerbotAIConfig.cpp @@ -559,6 +559,8 @@ bool PlayerbotAIConfig::Initialize() randomBotGuildSizeMax = sConfigMgr->GetOption("AiPlayerbot.RandomBotGuildSizeMax", 15); deleteRandomBotGuilds = sConfigMgr->GetOption("AiPlayerbot.DeleteRandomBotGuilds", false); + botSendMailEnabled = sConfigMgr->GetOption("AiPlayerbot.BotSendMailEnabled", true); + guildTaskEnabled = sConfigMgr->GetOption("AiPlayerbot.EnableGuildTasks", false); minGuildTaskChangeTime = sConfigMgr->GetOption("AiPlayerbot.MinGuildTaskChangeTime", 3 * 24 * 3600); maxGuildTaskChangeTime = sConfigMgr->GetOption("AiPlayerbot.MaxGuildTaskChangeTime", 4 * 24 * 3600); diff --git a/src/PlayerbotAIConfig.h b/src/PlayerbotAIConfig.h index 267042271..9dc1dcba1 100644 --- a/src/PlayerbotAIConfig.h +++ b/src/PlayerbotAIConfig.h @@ -298,6 +298,7 @@ public: float periodicOnlineOfflineRatio; bool gearscorecheck; bool randomBotPreQuests; + bool botSendMailEnabled; bool guildTaskEnabled; uint32 minGuildTaskChangeTime, maxGuildTaskChangeTime;