mirror of
https://github.com/mod-playerbots/mod-playerbots.git
synced 2026-02-08 05:01:09 +00:00
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:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user