MichaelCrow

Remove remaining cooldown effect function

Dec 25th, 2023
1,673
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.26 KB | None | 0 0
  1.  
  2. void Spell::EffectRemoveCurrentSpellCooldown(SpellEffIndex effIndex)
  3. {
  4.     if (effectHandleMode != SPELL_EFFECT_HANDLE_HIT)
  5.         return;
  6.  
  7.     if (m_caster->GetTypeId() != TYPEID_PLAYER)
  8.         return;
  9.  
  10.     SpellInfo const* spellInfo = GetSpellInfo();
  11.     flag96 spellMask = spellInfo->Effects[effIndex].SpellClassMask;
  12.     int32 ignoreSpellMask = spellInfo->Effects[effIndex].MiscValue;
  13.     int32 ignoreSpellFamily = spellInfo->Effects[effIndex].MiscValueB;
  14.     Player* player = m_caster->ToPlayer();
  15.     SpellCooldowns const spellCDs = player->GetSpellCooldowns();
  16.  
  17.     for (SpellCooldowns::const_iterator itr = spellCDs.begin(); itr != spellCDs.end(); ++itr)
  18.     {
  19.         SpellInfo const* cdSpell = sSpellMgr->GetSpellInfo(itr->first);
  20.         if (cdSpell && cdSpell->SpellFamilyName == spellInfo->SpellFamilyName && (cdSpell->SpellFamilyFlags & spellMask) && !ignoreSpellMask && !ignoreSpellFamily)
  21.             player->RemoveSpellCooldown(cdSpell->Id, true);
  22.         else if (cdSpell && cdSpell->SpellFamilyName == spellInfo->SpellFamilyName && ignoreSpellMask && !ignoreSpellFamily)
  23.             player->RemoveSpellCooldown(cdSpell->Id, true);
  24.         else if (cdSpell && ignoreSpellFamily)
  25.             player->RemoveSpellCooldown(cdSpell->Id, true);
  26.     }
  27. }
Advertisement
Add Comment
Please, Sign In to add comment