MichaelCrow

Untitled

Jul 21st, 2019
273
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.95 KB | None | 0 0
  1. class spell_mage_combustion : public SpellScriptLoader
  2. {
  3. public :
  4. spell_mage_combustion() : SpellScriptLoader("spell_mage_combustion")
  5. {
  6.  
  7. }
  8.  
  9. class spell_mage_combustion_SpellScript : public SpellScript
  10. {
  11. PrepareSpellScript(spell_mage_combustion_SpellScript);
  12.  
  13. bool Validate(SpellInfo const* spellInfo)
  14. {
  15. return true ;
  16. }
  17.  
  18. bool Load()
  19. {
  20. return true ;
  21. }
  22.  
  23. void handleResetInfernoBlastCooldownOnCast()
  24. {
  25. sLog->outDebug(LOG_FILTER_NETWORKIO, "Entering Combusion OnCast Handler");
  26. if(GetCaster())
  27. {
  28. sLog->outDebug(LOG_FILTER_NETWORKIO, "Combustion's Caster as unit is not null");
  29. if(Player* p = GetCaster()->ToPlayer())
  30. {
  31. sLog->outDebug(LOG_FILTER_NETWORKIO, "Combustion's Caster as player is not null ; resetting cooldown");
  32. SpellCooldowns cooldowns = p->GetSpellCooldownMap();
  33. for(SpellCooldowns::iterator iter = cooldowns.begin() ; iter != cooldowns.end() ; ++iter)
  34. {
  35. SpellInfo const* spell = sSpellMgr->GetSpellInfo(iter->first);
  36. if(!spell)
  37. continue ;
  38. sLog->outDebug(LOG_FILTER_NETWORKIO, "Player %s (guid : %u) has spell cooldown on spell %s (id : %u)", p->GetName().c_str(), p->GetGUIDLow(), spell->SpellName, spell->Id);
  39. }
  40. p->RemoveSpellCooldown(108853, true);
  41. /*p->RemoveAllSpellCooldown();*/ // This test has proved that event this way, the cooldown is not reset => WHY ?
  42. }
  43. }
  44. }
  45.  
  46. void handleMiscOnEffectScriptEffect(SpellEffIndex effectIndex)
  47. {
  48. sLog->outDebug(LOG_FILTER_NETWORKIO, "Entering Combusion OnEffectHitTarget Handler");
  49. if(Unit* target = GetExplTargetUnit())
  50. {
  51. // Combusion impact = stun
  52. if(GetCaster())
  53. {
  54. sLog->outDebug(LOG_FILTER_NETWORKIO, "Combustion's Target not null ; ready to impact");
  55. GetCaster()->CastSpell(target, SPELL_MAGE_COMBUSTION_IMPACT);
  56. }
  57.  
  58. // Periodic damages
  59. if(Aura* ignite = target->GetAura(SPELL_MAGE_IGNITE))
  60. {
  61. sLog->outDebug(LOG_FILTER_NETWORKIO, "Combustion's Target has Ignite aura ; ready to apply the dot");
  62. if(GetCaster() && target)
  63. {
  64. GetCaster()->CastSpell(target, SPELL_MAGE_COMBUSTION_DOT) ;
  65. Aura* combustionDot = target->GetAura(SPELL_MAGE_COMBUSTION_DOT) ;
  66. if(combustionDot && ignite)
  67. {
  68. sLog->outDebug(LOG_FILTER_NETWORKIO, "Applying the dot on Combusion target");
  69. combustionDot->GetEffect(0)->SetAmount(ignite->GetEffect(0)->GetAmount()) ;
  70. }
  71. }
  72. }
  73. }
  74. }
  75.  
  76. void Register()
  77. {
  78. OnCast += SpellCastFn(spell_mage_combustion_SpellScript::handleResetInfernoBlastCooldownOnCast);
  79. OnEffectHitTarget += SpellEffectFn(spell_mage_combustion_SpellScript::handleMiscOnEffectScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
  80. }
  81. };
  82.  
  83. SpellScript* GetSpellScript() const
  84. {
  85. return new spell_mage_combustion_SpellScript();
  86. }
  87. };
Advertisement
Add Comment
Please, Sign In to add comment