Skip to content

Commit

Permalink
Always bot: Enabling/disabling alwaysbot for a real player now proper…
Browse files Browse the repository at this point in the history
…ly enables/disables the ai.
  • Loading branch information
mostlikely4r committed Nov 13, 2024
1 parent f46a978 commit c6f2c42
Showing 1 changed file with 17 additions and 5 deletions.
22 changes: 17 additions & 5 deletions playerbot/PlayerbotMgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -849,20 +849,32 @@ std::list<std::string> PlayerbotHolder::HandlePlayerbotCommand(char const* args,
master->GetSession()->GetAccountId(),
master->GetGuildId());
}
else
{
Player* player = sObjectMgr.GetPlayer(guid, false);

if(player)
OnBotLogin(player);
}
}
}
else
{
sRandomPlayerbotMgr.SetValue(guid.GetCounter(), "always", (uint32)BotAlwaysOnline::DISABLED_BY_COMMAND);
messages.push_back("Disable offline player ai for " + alwaysName);

if (guid != master->GetObjectGuid())
{
Player* bot = sRandomPlayerbotMgr.GetPlayerBot(guid);
Player* bot = sObjectMgr.GetPlayer(guid, false);

if (bot && bot->GetPlayerbotAI() && !bot->GetPlayerbotAI()->GetMaster() && sPlayerbotAIConfig.IsFreeAltBot(bot))
if (bot && bot->GetPlayerbotAI())
{
if (guid != master->GetObjectGuid() && !bot->isRealPlayer())
{
if (sPlayerbotAIConfig.IsFreeAltBot(bot))
sRandomPlayerbotMgr.LogoutPlayerBot(guid);
}
else
{
sRandomPlayerbotMgr.LogoutPlayerBot(guid);
DisablePlayerBot(guid);
}
}

Expand Down

0 comments on commit c6f2c42

Please sign in to comment.