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()) {
|
if (!bot->GetSession()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bot->GetSession()->isLogingOut())
|
if (bot->GetSession()->isLogingOut())
|
||||||
{
|
{
|
||||||
if (bot->IsInCombat() || (master && master->IsInCombat() && sServerFacade->GetDistance2d(bot, master) < 30.0f))
|
// if (bot->IsInCombat() || (master && master->IsInCombat() && sServerFacade->GetDistance2d(bot, master) < 30.0f))
|
||||||
{
|
// {
|
||||||
WorldPackets::Character::LogoutCancel data = WorldPacket(CMSG_LOGOUT_CANCEL);
|
// WorldPackets::Character::LogoutCancel data = WorldPacket(CMSG_LOGOUT_CANCEL);
|
||||||
bot->GetSession()->HandleLogoutCancelOpcode(data);
|
// bot->GetSession()->HandleLogoutCancelOpcode(data);
|
||||||
TellMaster("Logout cancelled!");
|
// TellMaster("Logout cancelled!");
|
||||||
}
|
// }
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
// if (bot->HasUnitMovementFlag(MOVEMENTFLAG_FALLING)) {
|
// if (bot->HasUnitMovementFlag(MOVEMENTFLAG_FALLING)) {
|
||||||
// bot->Say("Falling!", LANG_UNIVERSAL);
|
// bot->Say("Falling!", LANG_UNIVERSAL);
|
||||||
|
|||||||
@@ -231,6 +231,9 @@ void PlayerbotHolder::LogoutPlayerBot(ObjectGuid guid)
|
|||||||
WorldSession* botWorldSessionPtr = bot->GetSession();
|
WorldSession* botWorldSessionPtr = bot->GetSession();
|
||||||
WorldSession* masterWorldSessionPtr = nullptr;
|
WorldSession* masterWorldSessionPtr = nullptr;
|
||||||
|
|
||||||
|
if (botWorldSessionPtr->isLogingOut())
|
||||||
|
return;
|
||||||
|
|
||||||
Player* master = botAI->GetMaster();
|
Player* master = botAI->GetMaster();
|
||||||
if (master)
|
if (master)
|
||||||
masterWorldSessionPtr = master->GetSession();
|
masterWorldSessionPtr = master->GetSession();
|
||||||
|
|||||||
Reference in New Issue
Block a user