Advertisement
Guest User

Untitled

a guest
Jul 15th, 2019
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.89 KB | None | 0 0
  1. // 53651 - Light's Beacon - Beacon of Light
  2. class spell_pal_light_s_beacon : public SpellScriptLoader
  3. {
  4. public:
  5. spell_pal_light_s_beacon() : SpellScriptLoader("spell_pal_light_s_beacon") { }
  6.  
  7. class spell_pal_light_s_beacon_AuraScript : public AuraScript
  8. {
  9. PrepareAuraScript(spell_pal_light_s_beacon_AuraScript);
  10.  
  11. bool Validate(SpellInfo const* /*spellInfo*/) override
  12. {
  13. if (!sSpellMgr->GetSpellInfo(SPELL_PALADIN_BEACON_OF_LIGHT)
  14. || !sSpellMgr->GetSpellInfo(SPELL_PALADIN_BEACON_OF_LIGHT_HEAL_1)
  15. || !sSpellMgr->GetSpellInfo(SPELL_PALADIN_BEACON_OF_LIGHT_HEAL_2)
  16. || !sSpellMgr->GetSpellInfo(SPELL_PALADIN_BEACON_OF_LIGHT_HEAL_3)
  17. || !sSpellMgr->GetSpellInfo(SPELL_PALADIN_HOLY_LIGHT))
  18. return false;
  19. return true;
  20. }
  21.  
  22. bool CheckProc(ProcEventInfo& eventInfo)
  23. {
  24. if (GetTarget()->HasAura(SPELL_PALADIN_BEACON_OF_LIGHT, eventInfo.GetActor()->GetGUID()))
  25. return false;
  26. return true;
  27. }
  28.  
  29. void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
  30. {
  31. PreventDefaultAction();
  32.  
  33. SpellInfo const* procSpell = eventInfo.GetSpellInfo();
  34. if (!procSpell)
  35. return;
  36.  
  37. HealInfo* healInfo = eventInfo.GetHealInfo();
  38. if (!healInfo || !healInfo->GetHeal())
  39. return;
  40.  
  41. uint32 healSpellId = procSpell->IsRankOf(sSpellMgr->AssertSpellInfo(SPELL_PALADIN_HOLY_LIGHT)) ? SPELL_PALADIN_BEACON_OF_LIGHT_HEAL_1 : SPELL_PALADIN_BEACON_OF_LIGHT_HEAL_3;
  42. uint32 heal = CalculatePct(healInfo->GetHeal(), aurEff->GetAmount());
  43.  
  44. Unit* beaconTarget = GetCaster();
  45. if (!beaconTarget || !beaconTarget->HasAura(SPELL_PALADIN_BEACON_OF_LIGHT, eventInfo.GetActor()->GetGUID()))
  46. return;
  47.  
  48. /// @todo: caster must be the healed unit to perform distance checks correctly
  49. /// but that will break animation on clientside
  50. /// caster in spell packets must be the healing unit
  51. eventInfo.GetActor()->CastCustomSpell(healSpellId, SPELLVALUE_BASE_POINT0, heal, beaconTarget, true, nullptr, aurEff);
  52. }
  53.  
  54. void Register() override
  55. {
  56. DoCheckProc += AuraCheckProcFn(spell_pal_light_s_beacon_AuraScript::CheckProc);
  57. OnEffectProc += AuraEffectProcFn(spell_pal_light_s_beacon_AuraScript::HandleProc, EFFECT_0, SPELL_AURA_DUMMY);
  58. }
  59. };
  60.  
  61. AuraScript* GetAuraScript() const override
  62. {
  63. return new spell_pal_light_s_beacon_AuraScript();
  64. }
  65. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement