From 0d02da65f98ab837b16a242de9c928b39cc9fe31 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A4=A9=E9=B9=BF?= Date: Thu, 8 Jul 2021 21:41:06 +0800 Subject: [PATCH] fix(Core/Player): Paladin's Seal of Righteousness (#6727) --- src/server/game/Entities/Player/Player.cpp | 31 ++++++++++++++++++---- 1 file changed, 26 insertions(+), 5 deletions(-) diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index c3a456b3c..b82ba54a4 100644 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -24158,13 +24158,34 @@ void Player::learnSkillRewardedSpells(uint32 skill_id, uint32 skill_value) removeSpell(pAbility->Spell, GetActiveSpec(), true); } // need learn - else if (!IsInWorld()) - { - addSpell(pAbility->Spell, SPEC_MASK_ALL, true, true, false); - } else { - learnSpell(pAbility->Spell); + //used to avoid double Seal of Righteousness on paladins, it's the only player spell which has both spell and forward spell in auto learn + if (pAbility->AcquireMethod == SKILL_LINE_ABILITY_LEARNED_ON_SKILL_LEARN && pAbility->SupercededBySpell) + { + bool skipCurrent = false; + auto bounds = sSpellMgr->GetSkillLineAbilityMapBounds(pAbility->SupercededBySpell); + for (auto itr = bounds.first; itr != bounds.second; ++itr) + { + if (itr->second->AcquireMethod == SKILL_LINE_ABILITY_LEARNED_ON_SKILL_LEARN && skill_value >= itr->second->MinSkillLineRank) + { + skipCurrent = true; + break; + } + } + if (skipCurrent) + { + continue; + } + } + if (!IsInWorld()) + { + addSpell(pAbility->Spell, SPEC_MASK_ALL, true, true, false); + } + else + { + learnSpell(pAbility->Spell); + } } } }