aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/Entities/Unit
diff options
context:
space:
mode:
authorShauren <shauren.trinity@gmail.com>2019-12-01 00:13:51 +0100
committerShauren <shauren.trinity@gmail.com>2019-12-01 00:13:51 +0100
commitbec4ed0f16d100f74c76e4aca06ed9ea42e21ec4 (patch)
tree106e8ea0a527eb89fa343e9e66ae3f42d38b9486 /src/server/game/Entities/Unit
parent123858331211db6fe6745f0886c1499f8e598443 (diff)
Core/Items: Fixed crash in selecting azerite essences
* Also fixed OVERRIDE_SPELLS auras for SPELLFAMILY_GENERIC
Diffstat (limited to 'src/server/game/Entities/Unit')
-rw-r--r--src/server/game/Entities/Unit/Unit.cpp27
1 files changed, 17 insertions, 10 deletions
diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp
index 2d6146da676..994ef60685b 100644
--- a/src/server/game/Entities/Unit/Unit.cpp
+++ b/src/server/game/Entities/Unit/Unit.cpp
@@ -14304,17 +14304,24 @@ void Unit::Whisper(uint32 textId, Player* target, bool isBossWhisper /*= false*/
SpellInfo const* Unit::GetCastSpellInfo(SpellInfo const* spellInfo) const
{
- Unit::AuraEffectList swaps = GetAuraEffectsByType(SPELL_AURA_OVERRIDE_ACTIONBAR_SPELLS);
- Unit::AuraEffectList const& swaps2 = GetAuraEffectsByType(SPELL_AURA_OVERRIDE_ACTIONBAR_SPELLS_TRIGGERED);
- if (!swaps2.empty())
- swaps.insert(swaps.end(), swaps2.begin(), swaps2.end());
-
- for (AuraEffect const* auraEffect : swaps)
+ auto findMatchingAuraEffectIn = [this, spellInfo](AuraType type) -> SpellInfo const*
{
- if (uint32(auraEffect->GetMiscValue()) == spellInfo->Id || auraEffect->IsAffectingSpell(spellInfo))
- if (SpellInfo const* newInfo = sSpellMgr->GetSpellInfo(auraEffect->GetAmount()))
- return newInfo;
- }
+ for (AuraEffect const* auraEffect : GetAuraEffectsByType(type))
+ {
+ bool matches = auraEffect->GetMiscValue() ? uint32(auraEffect->GetMiscValue()) == spellInfo->Id : auraEffect->IsAffectingSpell(spellInfo);
+ if (matches)
+ if (SpellInfo const* newInfo = sSpellMgr->GetSpellInfo(auraEffect->GetAmount()))
+ return newInfo;
+ }
+
+ return nullptr;
+ };
+
+ if (SpellInfo const* newInfo = findMatchingAuraEffectIn(SPELL_AURA_OVERRIDE_ACTIONBAR_SPELLS))
+ return newInfo;
+
+ if (SpellInfo const* newInfo = findMatchingAuraEffectIn(SPELL_AURA_OVERRIDE_ACTIONBAR_SPELLS_TRIGGERED))
+ return newInfo;
return spellInfo;
}