aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/Spells/Spell.cpp
diff options
context:
space:
mode:
authorWyrserth <43747507+Wyrserth@users.noreply.github.com>2019-05-30 20:07:46 +0200
committerShauren <shauren.trinity@gmail.com>2021-12-09 00:13:59 +0100
commit9d865f7536ae6feda6fba77785e4548f95ca5d03 (patch)
treee6ab18f07f552669b6b10418a2122b0795241b20 /src/server/game/Spells/Spell.cpp
parent049606e31edefd175030996b1504bcc4eef1a2f5 (diff)
Core/Misc: don't allow players to use/activate/loot non-allowed gameobjects while under the effect of a damage immunity aura (#23319)
* Core/Misc: don't allow players to use/activate/loot non-allowed gameobjects while under the effect of a damage immunity aura. * Forgot to change this in last-second rename. * Apply suggested changes, thanks Shauren! (cherry picked from commit 8bc5451864570c07eff6d427846335044f85a509)
Diffstat (limited to 'src/server/game/Spells/Spell.cpp')
-rw-r--r--src/server/game/Spells/Spell.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp
index bd520ec8b02..0526c512dc1 100644
--- a/src/server/game/Spells/Spell.cpp
+++ b/src/server/game/Spells/Spell.cpp
@@ -5132,6 +5132,13 @@ SpellCastResult Spell::CheckCast(bool strict, int32* param1 /*= nullptr*/, int32
if (m_caster->ToUnit() && !m_caster->ToUnit()->IsAlive() && !m_spellInfo->IsPassive() && !(m_spellInfo->HasAttribute(SPELL_ATTR0_CASTABLE_WHILE_DEAD) || (IsTriggered() && !m_triggeredByAuraSpell)))
return SPELL_FAILED_CASTER_DEAD;
+ // Prevent cheating in case the player has an immunity effect and tries to interact with a non-allowed gameobject. The error message is handled by the client so we don't report anything here
+ if (m_caster->ToPlayer() && m_targets.GetGOTarget())
+ {
+ if (m_targets.GetGOTarget()->GetGOInfo()->GetNoDamageImmune() && m_caster->ToUnit()->HasUnitFlag(UNIT_FLAG_IMMUNE))
+ return SPELL_FAILED_DONT_REPORT;
+ }
+
// check cooldowns to prevent cheating
if (!m_spellInfo->IsPassive())
{