mirror of
https://github.com/mod-playerbots/mod-playerbots
synced 2025-11-29 15:58:20 +08:00
[Crash fix] Fix summon to instance crash
This commit is contained in:
@@ -450,22 +450,24 @@ void PlayerbotAI::HandleTeleportAck()
|
|||||||
|
|
||||||
bot->GetMotionMaster()->Clear(true);
|
bot->GetMotionMaster()->Clear(true);
|
||||||
bot->StopMoving();
|
bot->StopMoving();
|
||||||
if (bot->IsBeingTeleportedNear())
|
if (bot->IsBeingTeleportedNear()) {
|
||||||
{
|
while (bot->IsInWorld() && bot->IsBeingTeleportedNear()) {
|
||||||
|
Player* plMover = bot->m_mover->ToPlayer();
|
||||||
|
if (!plMover)
|
||||||
|
return;
|
||||||
WorldPacket p = WorldPacket(MSG_MOVE_TELEPORT_ACK, 8 + 4 + 4);
|
WorldPacket p = WorldPacket(MSG_MOVE_TELEPORT_ACK, 8 + 4 + 4);
|
||||||
p << bot->GetGUID().WriteAsPacked();
|
p << plMover->GetPackGUID();
|
||||||
p << (uint32) 0; // supposed to be flags? not used currently
|
p << (uint32) 0; // supposed to be flags? not used currently
|
||||||
p << (uint32) time(nullptr); // time - not currently used
|
p << (uint32) 0; // time - not currently used
|
||||||
bot->GetSession()->HandleMoveTeleportAck(p);
|
bot->GetSession()->HandleMoveTeleportAck(p);
|
||||||
|
}
|
||||||
// add delay to simulate teleport delay
|
|
||||||
SetNextCheckDelay(urand(1000, 3000));
|
SetNextCheckDelay(urand(1000, 3000));
|
||||||
}
|
}
|
||||||
else if (bot->IsBeingTeleportedFar())
|
if (bot->IsBeingTeleportedFar())
|
||||||
{
|
{
|
||||||
|
while (bot->IsBeingTeleportedFar()) {
|
||||||
bot->GetSession()->HandleMoveWorldportAck();
|
bot->GetSession()->HandleMoveWorldportAck();
|
||||||
|
}
|
||||||
// add delay to simulate teleport delay
|
|
||||||
SetNextCheckDelay(urand(2000, 5000));
|
SetNextCheckDelay(urand(2000, 5000));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user