From c7cf9f8c6c59f7fcc61d5f18a4c53302fb450bbd Mon Sep 17 00:00:00 2001 From: Ovah Date: Thu, 9 Jul 2020 20:03:40 +0200 Subject: Core/Spells: Expose corpseTarget to spell scripts with SpellScript::GetHitCorpse() (#24981) Closes #24945 (cherry picked from commit 94a4404e7e0667eab5d79c01444855966c41ad56) --- src/server/game/Spells/SpellScript.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/server/game/Spells/SpellScript.cpp') diff --git a/src/server/game/Spells/SpellScript.cpp b/src/server/game/Spells/SpellScript.cpp index 69e7da62a73..8a02fd2d974 100644 --- a/src/server/game/Spells/SpellScript.cpp +++ b/src/server/game/Spells/SpellScript.cpp @@ -626,6 +626,16 @@ GameObject* SpellScript::GetHitGObj() const return m_spell->gameObjTarget; } +Corpse* SpellScript::GetHitCorpse() const +{ + if (!IsInTargetHook()) + { + TC_LOG_ERROR("scripts", "Script: `%s` Spell: `%u`: function SpellScript::GetHitCorpse was called, but function has no effect in current hook!", m_scriptName->c_str(), m_scriptSpellId); + return nullptr; + } + return m_spell->corpseTarget; +} + WorldLocation* SpellScript::GetHitDest() const { if (!IsInEffectHook()) -- cgit v1.2.3