rework commands

This commit is contained in:
luis
2026-05-01 08:59:35 -03:00
parent 94bae5266f
commit 74f9dabe6b
@@ -420,27 +420,23 @@ namespace Playerbot
{
std::vector<Player*> 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)