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:
Shauren
2020-05-19 00:04:23 +02:00
parent 7a68001452
commit 4acae3992b
3 changed files with 13 additions and 9 deletions

View File

@@ -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

View File

@@ -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;
}

View File

@@ -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;