Skip to content

Commit

Permalink
-Disabled bots fix: Stop some botcode being called when bots are disa…
Browse files Browse the repository at this point in the history
…bled.
  • Loading branch information
mostlikely4r committed Nov 8, 2024
1 parent 16fa0ee commit a22f001
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 deletions.
16 changes: 11 additions & 5 deletions playerbot/PlayerbotMgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,9 @@ void PlayerbotHolder::JoinChatChannels(Player* bot)

void PlayerbotHolder::OnBotLogin(Player * const bot)
{
if (!sPlayerbotAIConfig.enabled)
return;

PlayerbotAI* ai = bot->GetPlayerbotAI();
if (!ai)
{
Expand Down Expand Up @@ -1302,6 +1305,14 @@ void PlayerbotMgr::OnBotLoginInternal(Player * const bot)

void PlayerbotMgr::OnPlayerLogin(Player* player)
{
if (player->GetSession() != player->GetPlayerMenu()->GetGossipMenu().GetMenuSession())
{
player->GetPlayerMenu()->GetGossipMenu() = GossipMenu(player->GetSession());
}

if (!sPlayerbotAIConfig.enabled)
return;

// set locale priority for bot texts
sPlayerbotTextMgr.AddLocalePriority(player->GetSession()->GetSessionDbLocaleIndex());
sLog.outBasic("Player %s logged in, localeDbc %i, localeDb %i", player->GetName(), (uint32)(player->GetSession()->GetSessionDbcLocale()), player->GetSession()->GetSessionDbLocaleIndex());
Expand All @@ -1312,11 +1323,6 @@ void PlayerbotMgr::OnPlayerLogin(Player* player)
HandlePlayerbotCommand("self", player);
}

if (player->GetSession() != player->GetPlayerMenu()->GetGossipMenu().GetMenuSession())
{
player->GetPlayerMenu()->GetGossipMenu() = GossipMenu(player->GetSession());
}

if (sPlayerbotAIConfig.botAutologin == BotAutoLogin::DISABLED)
return;

Expand Down
6 changes: 5 additions & 1 deletion playerbot/RandomPlayerbotMgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1840,6 +1840,9 @@ bool RandomPlayerbotMgr::AddRandomBot(uint32 bot)

void RandomPlayerbotMgr::MovePlayerBot(uint32 guid, PlayerbotHolder* newHolder)
{
if (!sPlayerbotAIConfig.enabled)
return;

players[guid] = this->GetPlayerBot(guid);
PlayerbotHolder::MovePlayerBot(guid, newHolder);
}
Expand Down Expand Up @@ -3260,7 +3263,8 @@ void RandomPlayerbotMgr::OnBotLoginInternal(Player * const bot)

void RandomPlayerbotMgr::OnPlayerLogin(Player* player)
{
uint32 botsNearby = 0;
if (!sPlayerbotAIConfig.enabled)
return;

ForEachPlayerbot([&](Player* bot)
{
Expand Down

0 comments on commit a22f001

Please sign in to comment.