Example #1
0
 void HandleCancelGrowthAura(CancelGrowthAura cancelGrowthAura)
 {
     GetPlayer().RemoveAurasByType(AuraType.ModScale, aurApp =>
     {
         SpellInfo spellInfo = aurApp.GetBase().GetSpellInfo();
         return(!spellInfo.HasAttribute(SpellAttr0.CantCancel) && spellInfo.IsPositive() && !spellInfo.IsPassive());
     });
 }
Example #2
0
 void HandleCancelMountAura(CancelMountAura packet)
 {
     GetPlayer().RemoveAurasByType(AuraType.Mounted, aurApp =>
     {
         SpellInfo spellInfo = aurApp.GetBase().GetSpellInfo();
         return(!spellInfo.HasAttribute(SpellAttr0.CantCancel) && spellInfo.IsPositive() && !spellInfo.IsPassive());
     });
 }
Example #3
0
        void HandleCancelAura(CancelAura cancelAura)
        {
            SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(cancelAura.SpellID);

            if (spellInfo == null)
            {
                return;
            }

            // not allow remove spells with attr SPELL_ATTR0_CANT_CANCEL
            if (spellInfo.HasAttribute(SpellAttr0.CantCancel))
            {
                return;
            }

            // channeled spell case (it currently casted then)
            if (spellInfo.IsChanneled())
            {
                Spell curSpell = GetPlayer().GetCurrentSpell(CurrentSpellTypes.Channeled);
                if (curSpell != null)
                {
                    if (curSpell.GetSpellInfo().Id == cancelAura.SpellID)
                    {
                        GetPlayer().InterruptSpell(CurrentSpellTypes.Channeled);
                    }
                }
                return;
            }

            // non channeled case:
            // don't allow remove non positive spells
            // don't allow cancelling passive auras (some of them are visible)
            if (!spellInfo.IsPositive() || spellInfo.IsPassive())
            {
                return;
            }

            GetPlayer().RemoveOwnedAura(cancelAura.SpellID, cancelAura.CasterGUID, 0, AuraRemoveMode.Cancel);
        }