k0s02

Untitled

Sep 9th, 2019
163
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.40 KB | None | 0 0
  1. //INSERT INTO spell_script_names VALUES (244550, 'freakz_aura_the_future_chromie');
  2. class freakz_aura_the_future_chromie : public SpellScriptLoader
  3. {
  4. public:
  5. freakz_aura_the_future_chromie() : SpellScriptLoader("freakz_aura_the_future_chromie") { }
  6.  
  7. class freakz_aura_the_future_chromie_AuraScript : public AuraScript
  8. {
  9. PrepareAuraScript(freakz_aura_the_future_chromie_AuraScript);
  10.  
  11. void OnPeriodic(AuraEffect const* aurEff)
  12. {
  13. Unit* caster = GetCaster();
  14.  
  15. if (!caster || !caster->IsPlayer())
  16. return;
  17.  
  18. uint32 itemLevel = FREAKZ::Utils::Players::GetItemLevelEquipped(caster);
  19. int32 amount = (990 - itemLevel);
  20.  
  21. if (amount > 100)
  22. amount = 100;
  23. else if (amount < 30)
  24. amount = 30;
  25.  
  26. AuraEffect* dmgEffect = aurEff->GetBase()->GetEffect(EFFECT_2);
  27. AuraEffect* healEffect = aurEff->GetBase()->GetEffect(EFFECT_3);
  28. AuraEffect* hpEffect = aurEff->GetBase()->GetEffect(EFFECT_4);
  29.  
  30. dmgEffect->ChangeAmount(amount);
  31. healEffect->ChangeAmount(amount);
  32. hpEffect->ChangeAmount(amount);
  33. }
  34.  
  35. void OnApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
  36. {
  37. Unit* caster = GetCaster();
  38.  
  39. if (!caster)
  40. return;
  41.  
  42. caster->SetUInt32Value(UNIT_FIELD_EFFECTIVE_LEVEL, 112);
  43. }
  44.  
  45. void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
  46. {
  47. Unit* caster = GetCaster();
  48.  
  49. if (!caster)
  50. return;
  51.  
  52. caster->SetUInt32Value(UNIT_FIELD_EFFECTIVE_LEVEL, 0);
  53. }
  54.  
  55. void Register() override
  56. {
  57. OnEffectPeriodic += AuraEffectPeriodicFn(freakz_aura_the_future_chromie_AuraScript::OnPeriodic, EFFECT_1, SPELL_AURA_PERIODIC_DUMMY);
  58. AfterEffectApply += AuraEffectApplyFn(freakz_aura_the_future_chromie_AuraScript::OnApply, EFFECT_5, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL);
  59. AfterEffectRemove += AuraEffectRemoveFn(freakz_aura_the_future_chromie_AuraScript::OnRemove, EFFECT_5, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL);
  60. }
  61. };
  62.  
  63. AuraScript* GetAuraScript() const override
  64. {
  65. return new freakz_aura_the_future_chromie_AuraScript();
  66. }
  67. };
Advertisement
Add Comment
Please, Sign In to add comment