diff options
author | Ovah <dreadkiller@gmx.de> | 2020-07-09 20:03:40 +0200 |
---|---|---|
committer | Shauren <shauren.trinity@gmail.com> | 2022-01-22 00:34:38 +0100 |
commit | c7cf9f8c6c59f7fcc61d5f18a4c53302fb450bbd (patch) | |
tree | 2905552b40fa6967095921b5bc7b7f4d797f6134 /src | |
parent | 77d76ecc1d13069fcff3fd1b609c924bca5ee965 (diff) |
Core/Spells: Expose corpseTarget to spell scripts with SpellScript::GetHitCorpse() (#24981)
Closes #24945
(cherry picked from commit 94a4404e7e0667eab5d79c01444855966c41ad56)
Diffstat (limited to 'src')
-rw-r--r-- | src/server/game/Spells/SpellScript.cpp | 10 | ||||
-rw-r--r-- | src/server/game/Spells/SpellScript.h | 3 |
2 files changed, 13 insertions, 0 deletions
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()) diff --git a/src/server/game/Spells/SpellScript.h b/src/server/game/Spells/SpellScript.h index 28d4e103a1d..5549eec2ca6 100644 --- a/src/server/game/Spells/SpellScript.h +++ b/src/server/game/Spells/SpellScript.h @@ -29,6 +29,7 @@ class Aura; class AuraApplication; class AuraEffect; class Creature; +class Corpse; class DamageInfo; class DispelInfo; class DynamicObject; @@ -499,6 +500,8 @@ class TC_GAME_API SpellScript : public _SpellScript Item* GetHitItem() const; // returns: target of current effect if it was GameObject otherwise NULL GameObject* GetHitGObj() const; + // returns: target of current effect if it was Corpse otherwise nullptr + Corpse* GetHitCorpse() const; // returns: destination of current effect WorldLocation* GetHitDest() const; // setter/getter for for damage done by spell to target of spell hit |