From df8b5d62ebd5acaa796be88a909ba42b9be5cdbd Mon Sep 17 00:00:00 2001 From: Niam5 Date: Sat, 28 Oct 2023 19:17:23 -0500 Subject: [PATCH] Fix crash when pets with Eluna AI enter combat but the controller does not --- src/game/Entities/Unit.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/game/Entities/Unit.cpp b/src/game/Entities/Unit.cpp index 38ced1e1ad5..d1b8ac6f3e6 100644 --- a/src/game/Entities/Unit.cpp +++ b/src/game/Entities/Unit.cpp @@ -8531,6 +8531,13 @@ void Unit::SetInCombatState(bool PvP, Unit* enemy) if (PvP || creatureNotInCombat) enemy->GetCombatManager().TriggerCombatTimer(controller); } +#ifdef BUILD_ELUNA + else if (elunaEvents) + { + controller->SetInCombatWith(enemy); // player needs to enter combat with summoned Eluna pet + enemy->AddThreat(controller); + } +#endif else { MANGOS_ASSERT(controller->AI()); // a player without UNIT_FLAG_PLAYER_CONTROLLED should always have AI