Advertisement
Guest User

Untitled

a guest
Dec 27th, 2014
181
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.36 KB | None | 0 0
  1. //-774 Proc val'anyr (fix pro val'anyr récuperation))
  2. class spell_recup_anyr : public SpellScriptLoader
  3. {
  4. public:
  5. spell_recup_anyr() : SpellScriptLoader("spell_recup_anyr") {}
  6.  
  7. class spell_recup_anyr_SpellScript : public SpellScript
  8. {
  9. PrepareSpellScript(spell_recup_anyr_SpellScript);
  10.  
  11. void HandleScriptEffect (SpellEffIndex /*index*/)
  12. {
  13. Unit *caster = GetCaster();
  14.  
  15. if (!caster || caster->GetTypeId() != TYPEID_PLAYER)
  16. return;
  17. caster->ToPlayer()->AddItem(32837, 1);
  18. if (caster->HasAura(64415))
  19. {
  20. caster->ToPlayer()->AddItem(32525, 1);
  21. if (!(caster->ToPlayer()->HasSpellCooldown(64411)))
  22. if ((rand() % 101 <= 50))
  23. {
  24. caster->ToPlayer()->AddItem(32483, 1);
  25. caster->ToPlayer()->CastSpell(caster, 64411);
  26. caster->ToPlayer()->AddSpellCooldown(64411, 0, uint32(time(NULL) + 35));
  27. }
  28. }
  29.  
  30. if (caster->HasAura(64411))
  31. {
  32. if (!(caster->ToPlayer()->HasSpellCooldown(64413)))
  33. {
  34. caster->ToPlayer()->CastSpell(caster, 64413);
  35. }
  36. }
  37. }
  38.  
  39. void Register() override
  40. {
  41. OnEffectHitTarget += SpellEffectFn(spell_recup_anyr_SpellScript::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_APPLY_AURA); //SPELL_EFFECT_APPLY_AURA || SPELL_EFFECT_APPLY_AREA_AURA_FRIEND
  42. }
  43. };
  44. SpellScript* GetSpellScript() const override
  45. {
  46. return new spell_recup_anyr_SpellScript();
  47. }
  48. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement