Do not whisper unreachable players

This commit is contained in:
郑佩茹
2022-10-07 12:27:41 -06:00
parent 5d0aa407d6
commit 1c09fa5377
2 changed files with 2 additions and 2 deletions

View File

@@ -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)));
}

View File

@@ -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;
}