From 1c09fa5377ae815702c78a095302f48576b7951e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=83=91=E4=BD=A9=E8=8C=B9?= Date: Fri, 7 Oct 2022 12:27:41 -0600 Subject: [PATCH] Do not whisper unreachable players --- src/PlayerbotAI.cpp | 2 +- src/strategy/actions/SayAction.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/PlayerbotAI.cpp b/src/PlayerbotAI.cpp index 5eee9bc0..39f946b7 100644 --- a/src/PlayerbotAI.cpp +++ b/src/PlayerbotAI.cpp @@ -3620,5 +3620,5 @@ bool PlayerbotAI::IsInRealGuild() void PlayerbotAI::QueueChatResponse(uint8 msgtype, ObjectGuid guid1, ObjectGuid guid2, std::string message, std::string chanName, std::string name) { - chatReplies.push(ChatQueuedReply(msgtype, guid1.GetCounter(), guid2.GetCounter(), message, chanName, name, time(0) + urand(inCombat ? 10 : 5, inCombat ? 25 : 15))); + chatReplies.push(ChatQueuedReply(msgtype, guid1.GetCounter(), guid2.GetCounter(), message, chanName, name, time(nullptr) + urand(inCombat ? 10 : 5, inCombat ? 25 : 15))); } \ No newline at end of file diff --git a/src/strategy/actions/SayAction.cpp b/src/strategy/actions/SayAction.cpp index ba601e86..074b4e22 100644 --- a/src/strategy/actions/SayAction.cpp +++ b/src/strategy/actions/SayAction.cpp @@ -600,7 +600,7 @@ void ChatReplyAction::ChatReplyDo(Player* bot, uint32 type, uint32 guid1, uint32 if (type == CHAT_MSG_WHISPER) { ObjectGuid receiver = sCharacterCache->GetCharacterGuidByName(name); - if (!receiver.IsPlayer()) + if (!receiver || !receiver.IsPlayer() || !ObjectAccessor::FindPlayer(receiver)) { return; }