diff --git a/src/PlayerbotAI.cpp b/src/PlayerbotAI.cpp index acf13ba6..58979abc 100644 --- a/src/PlayerbotAI.cpp +++ b/src/PlayerbotAI.cpp @@ -5346,12 +5346,9 @@ bool PlayerbotAI::CanMove() return bot->GetMotionMaster()->GetCurrentMovementGeneratorType() != FLIGHT_MOTION_TYPE; } -bool PlayerbotAI::IsInRealGuild() +bool PlayerbotAI::IsRealGuild(uint32 guildId) { - if (!bot->GetGuildId()) - return false; - - Guild* guild = sGuildMgr->GetGuildById(bot->GetGuildId()); + Guild* guild = sGuildMgr->GetGuildById(guildId); if (!guild) { return false; @@ -5363,6 +5360,14 @@ bool PlayerbotAI::IsInRealGuild() return !(sPlayerbotAIConfig->IsInRandomAccountList(leaderAccount)); } +bool PlayerbotAI::IsInRealGuild() +{ + if (!bot->GetGuildId()) + return false; + + return IsRealGuild(bot->GetGuildId()); +} + void PlayerbotAI::QueueChatResponse(const ChatQueuedReply chatReply) { chatReplies.push_back(std::move(chatReply)); } bool PlayerbotAI::EqualLowercaseName(std::string s1, std::string s2) diff --git a/src/PlayerbotAI.h b/src/PlayerbotAI.h index d3e680cc..f9cfbadd 100644 --- a/src/PlayerbotAI.h +++ b/src/PlayerbotAI.h @@ -556,6 +556,7 @@ public: void ResetJumpDestination() { jumpDestination = Position(); } bool CanMove(); + static bool IsRealGuild(uint32 guildId); bool IsInRealGuild(); static std::vector dispel_whitelist; bool EqualLowercaseName(std::string s1, std::string s2); diff --git a/src/PlayerbotMgr.cpp b/src/PlayerbotMgr.cpp index 5f0b521c..8653c3d8 100644 --- a/src/PlayerbotMgr.cpp +++ b/src/PlayerbotMgr.cpp @@ -1055,7 +1055,8 @@ std::vector PlayerbotHolder::HandlePlayerbotCommand(char const* arg continue; if (ObjectAccessor::FindConnectedPlayer(guid)) continue; - if (sCharacterCache->GetCharacterGuildIdByGuid(guid)) + uint32 guildId = sCharacterCache->GetCharacterGuildIdByGuid(guid); + if (guildId && PlayerbotAI::IsRealGuild(guildId)) continue; AddPlayerBot(guid, master->GetSession()->GetAccountId()); messages.push_back("Add class " + std::string(charname));