Correction after singleton PR (#2095)

# Pull Request

Some logic was changed but differs from the original code, certain edge
cases so not result in same behavior. This returns the original code
with only the singleton chances.

@Wishmaster117 Reviewed the hotfix and noticed the different code paths.

ps: reverted an removed placeholder since its ongoing issue/research.
This commit is contained in:
bashermens
2026-02-01 10:18:59 +01:00
committed by GitHub
parent 6ee1684e9b
commit 8529654f8f
2 changed files with 56 additions and 22 deletions

View File

@@ -479,35 +479,23 @@ public:
bool Execute() override
{
// find and verify bot still exists
Player* bot = ObjectAccessor::FindConnectedPlayer(this->m_botGuid);
Player* bot = ObjectAccessor::FindConnectedPlayer(m_botGuid);
if (!bot)
{
return false;
}
if (this->m_masterAccountId)
PlayerbotHolder* holder = &RandomPlayerbotMgr::instance();
if (m_masterAccountId)
{
WorldSession* masterSession = sWorldSessionMgr->FindSession(this->m_masterAccountId);
WorldSession* masterSession = sWorldSessionMgr->FindSession(m_masterAccountId);
Player* masterPlayer = masterSession ? masterSession->GetPlayer() : nullptr;
if (masterPlayer != nullptr)
{
PlayerbotMgr* manager = PlayerbotsMgr::instance().GetPlayerbotMgr(masterPlayer);
if (manager == nullptr)
{
return false;
}
manager->OnBotLogin(bot);
}
}
else
{
sRandomPlayerbotMgr.OnBotLogin(bot);
if (masterPlayer)
holder = PlayerbotsMgr::instance().GetPlayerbotMgr(masterPlayer);
}
if (!holder)
return false;
holder->OnBotLogin(bot);
return true;
}