diff --git a/src/modules/Playerbot/Commands/PlayerbotCommands.cpp b/src/modules/Playerbot/Commands/PlayerbotCommands.cpp index 7c1b13827..8013e05c9 100644 --- a/src/modules/Playerbot/Commands/PlayerbotCommands.cpp +++ b/src/modules/Playerbot/Commands/PlayerbotCommands.cpp @@ -420,27 +420,23 @@ namespace Playerbot { std::vector bots; - // Collect all active bots + // Collect all active bots - properly filter using session->IsBot() SessionMap const& sessions = sWorld->GetAllSessions(); for (auto const& [accountId, session] : sessions) { - if (Player* player = session->GetPlayer()) - { - // Check if this is a bot (implement proper bot detection) - // For now, check if session has special bot flag - - bots.push_back(player); - + // PROPER BOT DETECTION: Check if session is marked as bot + if (session->IsBot()) + { + bots.push_back(player); + } } } if (bots.empty()) { - handler->SendSysMessage("No active bots found."); - return true; } @@ -524,23 +520,21 @@ namespace Playerbot uint32 summonedCount = 0; - // Summon all bots in group + // Summon all bots in group (only actual bots, not real players) for (GroupReference const& itr : group->GetMembers()) { - Player* member = itr.GetSource(); if (!member || member == player) - continue; - // Check if member is a bot (implement proper bot detection) - - member->TeleportTo(player->GetMapId(), player->GetPositionX(), player->GetPositionY(), - - player->GetPositionZ(), player->GetOrientation()); - - summonedCount++; + // PROPER BOT DETECTION: Only summon actual bots + if (member->GetSession() && member->GetSession()->IsBot()) + { + member->TeleportTo(player->GetMapId(), player->GetPositionX(), player->GetPositionY(), + player->GetPositionZ(), player->GetOrientation()); + summonedCount++; + } } handler->PSendSysMessage("Summoned %u bots to your location.", summonedCount); @@ -1036,7 +1030,15 @@ namespace Playerbot Player* PlayerbotCommandScript::FindBotByName(std::string const& name) { - return ObjectAccessor::FindPlayerByName(name); + Player* player = ObjectAccessor::FindPlayerByName(name); + if (!player) + return nullptr; + + // Verify this is actually a bot session, not a real player + if (player->GetSession() && player->GetSession()->IsBot()) + return player; + + return nullptr; // Not a bot } bool PlayerbotCommandScript::ValidateRaceClass(uint8 race, uint8 classId, ChatHandler* handler)