diff --git a/zone/bot.cpp b/zone/bot.cpp index 5678a62d0..c66fdeb56 100644 --- a/zone/bot.cpp +++ b/zone/bot.cpp @@ -2995,7 +2995,8 @@ void Bot::LoadAndSpawnAllZonedBots(Client* botOwner) { if(g) { uint32 TempGroupId = g->GetID(); std::list ActiveBots; - if (!botdb.LoadGroupedBotsByGroupID(TempGroupId, ActiveBots)) { + // Modified LoadGroupedBotsByGroupID to require a CharacterID + if (!botdb.LoadGroupedBotsByGroupID(botOwner->CharacterID(), TempGroupId, ActiveBots)) { botOwner->Message(13, "%s", BotDatabase::fail::LoadGroupedBotsByGroupID()); return; } @@ -3007,8 +3008,9 @@ void Bot::LoadAndSpawnAllZonedBots(Client* botOwner) { if(activeBot) { activeBot->Spawn(botOwner); g->UpdatePlayer(activeBot); - if(g->GetLeader()) - activeBot->SetFollowID(g->GetLeader()->GetID()); + // follow the bot owner, not the group leader we just zoned with our owner. + if(g->IsGroupMember(botOwner) && g->IsGroupMember(activeBot)) + activeBot->SetFollowID(botOwner->GetID()); } if(activeBot && !botOwner->HasGroup()) @@ -7297,10 +7299,11 @@ void Bot::ProcessClientZoneChange(Client* botOwner) { if(tempBot) { if(tempBot->HasGroup()) { Group* g = tempBot->GetGroup(); - if(g && g->GetLeader()) { - Mob* tempGroupLeader = tempBot->GetGroup()->GetLeader(); - if(tempGroupLeader && tempGroupLeader->IsClient()) { - if(tempBot->GetBotOwnerCharacterID() == tempGroupLeader->CastToClient()->CharacterID()) + if(g && g->IsGroupMember(botOwner)) { + if(botOwner && botOwner->IsClient()) { + // Modified to not only zone bots if you're the leader. + // Also zone bots of the non-leader when they change zone. + if(tempBot->GetBotOwnerCharacterID() == botOwner->CharacterID() && g->IsGroupMember(botOwner)) tempBot->Zone(); else tempBot->Camp(); diff --git a/zone/bot_database.cpp b/zone/bot_database.cpp index 033984a93..d8511c54c 100644 --- a/zone/bot_database.cpp +++ b/zone/bot_database.cpp @@ -2459,9 +2459,10 @@ bool BotDatabase::LoadBotGroupsListByOwnerID(const uint32 owner_id, std::list& group_list) +// added owner ID to this function to fix groups with mulitple players grouped with bots. +bool BotDatabase::LoadGroupedBotsByGroupID(const uint32 owner_id, const uint32 group_id, std::list& group_list) { - if (!group_id) + if (!group_id || !owner_id) return false; query = StringFormat( @@ -2471,18 +2472,10 @@ bool BotDatabase::LoadGroupedBotsByGroupID(const uint32 group_id, std::list& group_list); + bool LoadGroupedBotsByGroupID(const uint32 owner_id, const uint32 group_id, std::list& group_list); /* Bot heal rotation functions */