mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-16 07:30:42 +01:00
Core/Players: Only restore spells learned as quest rewards if they have the right AcquireMethod in SkillLineAbility.db2
Closes #24645
This commit is contained in:
@@ -955,7 +955,8 @@ enum MapFlags
|
||||
enum AbilytyLearnType
|
||||
{
|
||||
SKILL_LINE_ABILITY_LEARNED_ON_SKILL_VALUE = 1, // Spell state will update depending on skill value
|
||||
SKILL_LINE_ABILITY_LEARNED_ON_SKILL_LEARN = 2 // Spell will be learned/removed together with entire skill
|
||||
SKILL_LINE_ABILITY_LEARNED_ON_SKILL_LEARN = 2, // Spell will be learned/removed together with entire skill
|
||||
SKILL_LINE_ABILITY_REWARDED_FROM_QUEST = 4 // Learned as quest reward, also re-learned if missing
|
||||
};
|
||||
|
||||
enum GlyphSlotType
|
||||
|
||||
@@ -24499,12 +24499,18 @@ void Player::LearnQuestRewardedSpells(Quest const* quest)
|
||||
uint32 learned_0 = effect->TriggerSpell;
|
||||
if (!HasSpell(learned_0))
|
||||
{
|
||||
SpellInfo const* learnedInfo = sSpellMgr->GetSpellInfo(learned_0);
|
||||
if (!learnedInfo)
|
||||
return;
|
||||
found = false;
|
||||
SkillLineAbilityMapBounds skills = sSpellMgr->GetSkillLineAbilityMapBounds(learned_0);
|
||||
for (auto skillItr = skills.first; skillItr != skills.second; ++skillItr)
|
||||
{
|
||||
if (skillItr->second->AcquireMethod == SKILL_LINE_ABILITY_REWARDED_FROM_QUEST)
|
||||
{
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// profession specialization can be re-learned from npc
|
||||
if (learnedInfo->GetEffect(EFFECT_0)->Effect == SPELL_EFFECT_TRADE_SKILL && learnedInfo->GetEffect(EFFECT_1)->Effect == 0 && !learnedInfo->SpellLevel)
|
||||
if (!found)
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -5169,9 +5169,6 @@ SpellCastResult Spell::CheckCast(bool strict, uint32* param1 /*= nullptr*/, uint
|
||||
}
|
||||
case SPELL_EFFECT_LEARN_SPELL:
|
||||
{
|
||||
if (m_caster->GetTypeId() != TYPEID_PLAYER)
|
||||
return SPELL_FAILED_BAD_TARGETS;
|
||||
|
||||
if (effect->TargetA.GetTarget() != TARGET_UNIT_PET)
|
||||
break;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user