Skip to content

Commit

Permalink
Add possible crash fix when summoning an invalid bot
Browse files Browse the repository at this point in the history
  • Loading branch information
davidonete committed Feb 13, 2024
1 parent 360a82f commit 39ce0b4
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion playerbot/strategy/actions/UseMeetingStoneAction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -180,29 +180,36 @@ bool SummonAction::Teleport(Player* requester, Player *summoner, Player *player)
float y = summoner->GetPositionY() + sin(angle) * ai->GetRange("follow");
float z = summoner->GetPositionZ();
summoner->UpdateGroundPositionZ(x, y, z);

if (!summoner->IsWithinLOS(x, y, z + player->GetCollisionHeight(), true))
{
x = summoner->GetPositionX();
y = summoner->GetPositionY();
z = summoner->GetPositionZ();
}

if (summoner->IsWithinLOS(x, y, z + player->GetCollisionHeight(), true))
{
if (sServerFacade.UnitIsDead(player) && sServerFacade.IsAlive(summoner))
{
if (!ai->IsSafe(player) || !ai->IsSafe(summoner))
return false;

player->ResurrectPlayer(1.0f, false);
player->SpawnCorpseBones();
ai->TellPlayerNoFacing(requester, "I live, again!");
}
}

if (player->IsTaxiFlying())
{
player->TaxiFlightInterrupt();
player->GetMotionMaster()->MovementExpired();
}

player->GetMotionMaster()->Clear();
player->TeleportTo(mapId, x, y, z, 0);
player->SendHeartBeat();

if (summoner->GetTransport())
summoner->GetTransport()->AddPassenger(player, false);

Expand Down

0 comments on commit 39ce0b4

Please sign in to comment.