Core/Spell: Add Dual Wield skill dependency to Dual Wield effect, should remove the skill properly when unlearning spell.

Closes #17196

(cherry picked from commit 405167dafd)
This commit is contained in:
ariel-
2016-10-02 15:49:29 -03:00
committed by joschiwald
parent bbdf89e694
commit 062ca4ac69
2 changed files with 27 additions and 15 deletions

View File

@@ -1401,29 +1401,41 @@ void SpellMgr::LoadSpellLearnSkills()
// search auto-learned skills and add its to map also for use in unlearn spells/talents
uint32 dbc_count = 0;
for (uint32 spell = 0; spell < GetSpellInfoStoreSize(); ++spell)
for (SpellInfo const* entry : mSpellInfoMap)
{
SpellInfo const* entry = GetSpellInfo(spell);
if (!entry)
continue;
for (SpellEffectInfo const* effect : entry->GetEffectsForDifficulty(DIFFICULTY_NONE))
{
if (effect && effect->Effect == SPELL_EFFECT_SKILL)
if (!effect)
continue;
SpellLearnSkillNode dbc_node;
switch (effect->Effect)
{
SpellLearnSkillNode dbc_node;
dbc_node.skill = uint16(effect->MiscValue);
dbc_node.step = uint16(effect->CalcValue());
if (dbc_node.skill != SKILL_RIDING)
case SPELL_EFFECT_SKILL:
dbc_node.skill = uint16(effect->MiscValue);
dbc_node.step = uint16(effect->CalcValue());
if (dbc_node.skill != SKILL_RIDING)
dbc_node.value = 1;
else
dbc_node.value = dbc_node.step * 75;
dbc_node.maxvalue = dbc_node.step * 75;
break;
case SPELL_EFFECT_DUAL_WIELD:
dbc_node.skill = SKILL_DUAL_WIELD;
dbc_node.step = 1;
dbc_node.value = 1;
else
dbc_node.value = dbc_node.step * 75;
dbc_node.maxvalue = dbc_node.step * 75;
mSpellLearnSkills[spell] = dbc_node;
++dbc_count;
break;
dbc_node.maxvalue = 1;
break;
default:
continue;
}
mSpellLearnSkills[entry->Id] = dbc_node;
++dbc_count;
break;
}
}

View File

@@ -552,7 +552,7 @@ struct SpellLearnSkillNode
uint16 maxvalue; // 0 - max skill value for player level
};
typedef std::map<uint32, SpellLearnSkillNode> SpellLearnSkillMap;
typedef std::unordered_map<uint32, SpellLearnSkillNode> SpellLearnSkillMap;
struct SpellLearnSpellNode
{