From 39ce0b43cc0181e3ee77d632836cc24140bba726 Mon Sep 17 00:00:00 2001 From: Flekz Date: Tue, 13 Feb 2024 20:16:59 +0000 Subject: [PATCH] Add possible crash fix when summoning an invalid bot --- playerbot/strategy/actions/UseMeetingStoneAction.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/playerbot/strategy/actions/UseMeetingStoneAction.cpp b/playerbot/strategy/actions/UseMeetingStoneAction.cpp index 427d6f765..02fdac02c 100644 --- a/playerbot/strategy/actions/UseMeetingStoneAction.cpp +++ b/playerbot/strategy/actions/UseMeetingStoneAction.cpp @@ -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);