From 8b7f3e5245324cde8a002102a9c8d3f678a6fb1f Mon Sep 17 00:00:00 2001 From: Schmoozerd Date: Sun, 18 Sep 2011 13:21:19 +0200 Subject: [PATCH] [11799] Add HasAuraOfDifficulty to support difficulty spells for HasAura Signed-off-by: Schmoozerd --- src/game/Unit.cpp | 10 ++++++++++ src/game/Unit.h | 1 + src/shared/revision_nr.h | 2 +- 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index f0c3ed7fa..dcba26390 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -4849,6 +4849,16 @@ bool Unit::HasAura(uint32 spellId, SpellEffectIndex effIndex) const return false; } +bool Unit::HasAuraOfDifficulty(uint32 spellId) const +{ + SpellEntry const* spellEntry = sSpellStore.LookupEntry(spellId); + if (spellEntry && spellEntry->SpellDifficultyId && IsInWorld() && GetMap()->IsDungeon()) + if (SpellEntry const* spellDiffEntry = GetSpellEntryByDifficulty(spellEntry->SpellDifficultyId, GetMap()->GetDifficulty(), GetMap()->IsRaid())) + spellId = spellDiffEntry->Id; + + return m_spellAuraHolders.find(spellId) != m_spellAuraHolders.end(); +} + void Unit::AddDynObject(DynamicObject* dynObj) { m_dynObjGUIDs.push_back(dynObj->GetObjectGuid()); diff --git a/src/game/Unit.h b/src/game/Unit.h index 570dba58c..855dd55c6 100644 --- a/src/game/Unit.h +++ b/src/game/Unit.h @@ -1421,6 +1421,7 @@ class MANGOS_DLL_SPEC Unit : public WorldObject { return m_spellAuraHolders.find(spellId) != m_spellAuraHolders.end(); } + bool HasAuraOfDifficulty(uint32 spellId) const; bool virtual HasSpell(uint32 /*spellID*/) const { return false; } diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index a6ac0908a..11797474f 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "11798" + #define REVISION_NR "11799" #endif // __REVISION_NR_H__