diff options
author | Pitcrawler <pitcrawler@server.fake> | 2013-04-02 01:06:19 +0200 |
---|---|---|
committer | Pitcrawler <pitcrawler@server.fake> | 2013-04-02 01:06:19 +0200 |
commit | 294fac60a03a69d6f618c9d0e163615f379a9d33 (patch) | |
tree | d7653a08cb15bdc91240768e99186bb437d660af /src | |
parent | d89626f767d1a2fd57f83bb682b866c818c480c2 (diff) |
DB/Quests: Fix It Was The Orcs, Honest! Closes #2037
Diffstat (limited to 'src')
-rw-r--r-- | src/server/scripts/Spells/spell_generic.cpp | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/src/server/scripts/Spells/spell_generic.cpp b/src/server/scripts/Spells/spell_generic.cpp index 00b504d2403..8c25fa1e24f 100644 --- a/src/server/scripts/Spells/spell_generic.cpp +++ b/src/server/scripts/Spells/spell_generic.cpp @@ -3513,6 +3513,55 @@ class spell_gen_aura_service_uniform : public SpellScriptLoader } }; +enum OrcDisguiseSpells +{ + SPELL_ORC_DISGUISE_TRIGGER = 45759, + SPELL_ORC_DISGUISE_MALE = 45760, + SPELL_ORC_DISGUISE_FEMALE = 45762, +}; + +class spell_gen_orc_disguise : public SpellScriptLoader +{ + public: + spell_gen_orc_disguise() : SpellScriptLoader("spell_gen_orc_disguise") { } + + class spell_gen_orc_disguise_SpellScript : public SpellScript + { + PrepareSpellScript(spell_gen_orc_disguise_SpellScript); + + bool Validate(SpellInfo const* /*spell*/) + { + if (!sSpellMgr->GetSpellInfo(SPELL_ORC_DISGUISE_TRIGGER) || !sSpellMgr->GetSpellInfo(SPELL_ORC_DISGUISE_MALE) || + !sSpellMgr->GetSpellInfo(SPELL_ORC_DISGUISE_FEMALE)) + return false; + return true; + } + + void HandleScript(SpellEffIndex /*effIndex*/) + { + Unit* caster = GetCaster(); + if (Player* target = GetHitPlayer()) + { + uint8 gender = target->getGender(); + if (!gender) + caster->CastSpell(target, SPELL_ORC_DISGUISE_MALE, true); + else + caster->CastSpell(target, SPELL_ORC_DISGUISE_FEMALE, true); + } + } + + void Register() + { + OnEffectHitTarget += SpellEffectFn(spell_gen_orc_disguise_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); + } + }; + + SpellScript* GetSpellScript() const + { + return new spell_gen_orc_disguise_SpellScript(); + } +}; + void AddSC_generic_spell_scripts() { new spell_gen_absorb0_hitlimit1(); @@ -3592,4 +3641,5 @@ void AddSC_generic_spell_scripts() new spell_gen_gift_of_naaru(); new spell_gen_replenishment(); new spell_gen_aura_service_uniform(); + new spell_gen_orc_disguise(); } |