From e16313c5b2617b364224b1fb82e5399cb32c0af1 Mon Sep 17 00:00:00 2001 From: H0zen Date: Mon, 15 Feb 2016 13:16:38 +0200 Subject: [PATCH] Fix displaying the right ranks of spells in spellbook - Fixes displaying the Seal of Righteousness (SoR) ranks - Fixes the "double spell listing" of non-stackable spells after the learning, both in chat and in spellbook (applies to all classes) - This fix is paired with 2 database updates, one for world and one for characters - After applying the fixes, all paladin characters must visit their trainer to relearn the "Judgement" spell --- src/game/Object/Player.cpp | 6 ++++-- src/game/Object/SpellMgr.cpp | 3 +++ src/game/WorldHandlers/SpellEffects.cpp | 5 +++++ src/game/WorldHandlers/UnitAuraProcHandler.cpp | 1 + 4 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/game/Object/Player.cpp b/src/game/Object/Player.cpp index e3da2bde..987dabd1 100644 --- a/src/game/Object/Player.cpp +++ b/src/game/Object/Player.cpp @@ -2983,8 +2983,10 @@ bool Player::addSpell(uint32 spell_id, bool active, bool learning, bool dependen m_spells[spell_id] = newspell; - // return false if spell disabled - if (newspell.disabled) + // return false if spell disabled or spell is non-stackable with lower-ranks + if (newspell.disabled || + (sSpellMgr.IsRankedSpellNonStackableInSpellBook(spellInfo) && + (sSpellMgr.GetFirstSpellInChain(spell_id) != spell_id))) { return false; } } diff --git a/src/game/Object/SpellMgr.cpp b/src/game/Object/SpellMgr.cpp index 8ebc8713..25af2c87 100644 --- a/src/game/Object/SpellMgr.cpp +++ b/src/game/Object/SpellMgr.cpp @@ -1964,6 +1964,9 @@ bool SpellMgr::canStackSpellRanksInSpellBook(SpellEntry const* spellInfo) const switch (spellInfo->SpellFamilyName) { case SPELLFAMILY_PALADIN: + // Paladin SoR spell, Judgement version + if (spellInfo->Id == 21084 || spellInfo->Id == 20154) + { return false; } // Paladin aura Spell if (spellInfo->Effect[i] == SPELL_EFFECT_APPLY_AREA_AURA_PARTY) { return false; } diff --git a/src/game/WorldHandlers/SpellEffects.cpp b/src/game/WorldHandlers/SpellEffects.cpp index 4df441ac..8f5718ca 100644 --- a/src/game/WorldHandlers/SpellEffects.cpp +++ b/src/game/WorldHandlers/SpellEffects.cpp @@ -2276,6 +2276,11 @@ void Spell::EffectLearnSpell(SpellEffectIndex eff_idx) Player* player = (Player*)unitTarget; uint32 spellToLearn = m_spellInfo->EffectTriggerSpell[eff_idx]; + + // special case for paladin SoR 20154 (non-judgement version) + if (m_spellInfo->Id == 10321) + { player->removeSpell(20154, true, false); } + player->learnSpell(spellToLearn, false); if (WorldObject const* caster = GetCastingObject()) diff --git a/src/game/WorldHandlers/UnitAuraProcHandler.cpp b/src/game/WorldHandlers/UnitAuraProcHandler.cpp index bcdbf964..ce6346e8 100644 --- a/src/game/WorldHandlers/UnitAuraProcHandler.cpp +++ b/src/game/WorldHandlers/UnitAuraProcHandler.cpp @@ -706,6 +706,7 @@ SpellAuraProcResult Unit::HandleDummyAuraProc(Unit* pVictim, uint32 damage, Aura uint32 spellId; switch (triggeredByAura->GetId()) { + case 20154: case 21084: spellId = 25742; break; // Rank 1 case 20287: spellId = 25740; break; // Rank 2 case 20288: spellId = 25739; break; // Rank 3