mirror of
https://github.com/mod-playerbots/mod-playerbots
synced 2025-11-29 15:58:20 +08:00
fix crash caused by bot logout (maybe)
This commit is contained in:
@@ -202,15 +202,15 @@ void PlayerbotAI::UpdateAI(uint32 elapsed, bool minimal)
|
||||
if (!bot->GetSession()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (bot->GetSession()->isLogingOut())
|
||||
{
|
||||
if (bot->IsInCombat() || (master && master->IsInCombat() && sServerFacade->GetDistance2d(bot, master) < 30.0f))
|
||||
{
|
||||
WorldPackets::Character::LogoutCancel data = WorldPacket(CMSG_LOGOUT_CANCEL);
|
||||
bot->GetSession()->HandleLogoutCancelOpcode(data);
|
||||
TellMaster("Logout cancelled!");
|
||||
}
|
||||
// if (bot->IsInCombat() || (master && master->IsInCombat() && sServerFacade->GetDistance2d(bot, master) < 30.0f))
|
||||
// {
|
||||
// WorldPackets::Character::LogoutCancel data = WorldPacket(CMSG_LOGOUT_CANCEL);
|
||||
// bot->GetSession()->HandleLogoutCancelOpcode(data);
|
||||
// TellMaster("Logout cancelled!");
|
||||
// }
|
||||
return;
|
||||
}
|
||||
// if (bot->HasUnitMovementFlag(MOVEMENTFLAG_FALLING)) {
|
||||
// bot->Say("Falling!", LANG_UNIVERSAL);
|
||||
|
||||
@@ -231,6 +231,9 @@ void PlayerbotHolder::LogoutPlayerBot(ObjectGuid guid)
|
||||
WorldSession* botWorldSessionPtr = bot->GetSession();
|
||||
WorldSession* masterWorldSessionPtr = nullptr;
|
||||
|
||||
if (botWorldSessionPtr->isLogingOut())
|
||||
return;
|
||||
|
||||
Player* master = botAI->GetMaster();
|
||||
if (master)
|
||||
masterWorldSessionPtr = master->GetSession();
|
||||
|
||||
Reference in New Issue
Block a user