Core/Spells: clean up some code and move to spell script. Closes #7195

This commit is contained in:
Vincent-Michael authored and Kandera committed 2012-09-06 11:00:37 -04:00
1 parent ca440756a8
commit 5954011a90
3 files changed
+26 -14

No files matched your search

@@ -907,9 +907,22 @@ class spell_gen_profession_research : public SpellScriptLoader
return SPELL_CAST_OK;
}
void HandleScript(SpellEffIndex /*effIndex*/)
{
Player* caster = GetCaster()->ToPlayer();
uint32 spellId = GetSpellInfo()->Id;
// learn random explicit discovery recipe (if any)
if (uint32 discoveredSpellId = GetExplicitDiscoverySpell(spellId, caster->ToPlayer()))
caster->learnSpell(discoveredSpellId, false);
caster->UpdateCraftSkill(spellId);
}
void Register()
{
OnCheckCast += SpellCheckCastFn(spell_gen_profession_research_SpellScript::CheckRequirement);
OnEffectHitTarget += SpellEffectFn(spell_gen_profession_research_SpellScript::HandleScript, EFFECT_1, SPELL_EFFECT_SCRIPT_EFFECT);
}
};