Advertisement
Guest User

Untitled

a guest
Jun 30th, 2015
220
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.79 KB | None | 0 0
  1. // -31571 - Arcane Potency
  2. class spell_mage_arcane_potency : public SpellScriptLoader
  3. {
  4.     public:
  5.         spell_mage_arcane_potency () : SpellScriptLoader("spell_mage_arcane_potency") { }
  6.  
  7.         class spell_mage_arcane_potency_AuraScript : public AuraScript
  8.         {
  9.             PrepareAuraScript(spell_mage_arcane_potency_AuraScript);
  10.  
  11.             bool Validate(SpellInfo const* /*spellInfo*/) override
  12.             {
  13.                 if (!sSpellMgr->GetSpellInfo(SPELL_ARCANCE_POTENCY_RANK_1) ||
  14.                     !sSpellMgr->GetSpellInfo(SPELL_ARCANCE_POTENCY_RANK_2) ||
  15.                     !sSpellMgr->GetSpellInfo(SPELL_ARCANCE_POTENCY_TRIGGER_RANK_1) ||
  16.                     !sSpellMgr->GetSpellInfo(SPELL_ARCANCE_POTENCY_TRIGGER_RANK_2))
  17.                     return false;
  18.                 return true;
  19.             }
  20.  
  21.             void HandleProc(AuraEffect const* aurEff, ProcEventInfo& /*eventInfo*/)
  22.             {
  23.                 PreventDefaultAction();
  24.                 uint32 spellId = 0;
  25.  
  26.                 if (GetSpellInfo()->Id == SPELL_ARCANCE_POTENCY_RANK_1)
  27.                     spellId = SPELL_ARCANCE_POTENCY_TRIGGER_RANK_1;
  28.                 else if (GetSpellInfo()->Id == SPELL_ARCANCE_POTENCY_RANK_2)
  29.                     spellId = SPELL_ARCANCE_POTENCY_TRIGGER_RANK_2;
  30.                 if (!spellId)
  31.                     return;
  32.  
  33.                 GetTarget()->CastSpell(GetTarget(), spellId, true, NULL, aurEff);
  34.  
  35.             }
  36.  
  37.             void Register() override
  38.             {
  39.                 OnEffectProc += AuraEffectProcFn(spell_mage_arcane_potency_AuraScript::HandleProc, EFFECT_0, SPELL_AURA_DUMMY);
  40.             }
  41.         };
  42.  
  43.         AuraScript* GetAuraScript() const override
  44.         {
  45.             return new spell_mage_arcane_potency_AuraScript();
  46.         }
  47. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement