Beispiel #1
0
        /// <summary>
        /// Removes all of this Aura's occupied fields
        /// </summary>
        protected void RemoveFromClient()
        {
            if (!IsVisible)
            {
                return;
            }

            AuraHandler.SendRemoveAura(m_auras.Owner, this);
        }
Beispiel #2
0
 public void RemoveSpellModifierFlat(AddModifierEffectHandler modifier)
 {
     if (modifier.Charges > 0)
     {
         --ModifierWithChargesCount;
     }
     OnModifierChange(modifier);
     AuraHandler.SendModifierUpdate((Character)m_owner, modifier.SpellEffect, false);
     SpellModifiersFlat.Remove(modifier);
 }
Beispiel #3
0
 public void AddSpellModifierFlat(AddModifierEffectHandler modifier)
 {
     if (modifier.Charges > 0)
     {
         ++ModifierWithChargesCount;
     }
     SpellModifiersFlat.Add(modifier);
     OnModifierChange(modifier);
     AuraHandler.SendModifierUpdate((Character)m_owner, modifier.SpellEffect, false);
 }
 public void RemoveSpellModifierPercent(AddModifierEffectHandler modifier)
 {
     if (modifier.Charges > 0)
     {
         ModifierWithChargesCount--;
     }
     OnModifierChange(modifier);
     AuraHandler.SendModifierUpdate((Character)m_owner, modifier.SpellEffect, true);
     SpellModifiersPct.Remove(modifier);
 }
Beispiel #5
0
 public void AddSpellModifierPercent(AddModifierEffectHandler modifier)
 {
     if (modifier.Charges > 0)
     {
         ++this.ModifierWithChargesCount;
     }
     this.SpellModifiersPct.Add(modifier);
     this.OnModifierChange(modifier);
     AuraHandler.SendModifierUpdate((Character)this.m_owner, modifier.SpellEffect, true);
 }
Beispiel #6
0
        /// <summary>Defines a set of Auras that are mutually exclusive</summary>
        public static uint AddAuraGroup(IEnumerable <Spell> auras)
        {
            uint nextAuraUid = AuraHandler.GetNextAuraUID();

            foreach (Spell aura in auras)
            {
                aura.AuraUID = nextAuraUid;
            }
            return(nextAuraUid);
        }
Beispiel #7
0
        protected internal void SendToClient()
        {
            if (!IsVisible)
            {
                return;
            }

#if DEBUG
            //log.Info("Sending Aura: " + this);
#endif

            //AuraHandler.SendAuraInfo(m_auras.Owner, (byte)m_index, m_spell.Id, (uint)m_duration, (uint)m_duration);
            AuraHandler.SendAuraUpdate(m_auras.Owner, this);
        }
Beispiel #8
0
        public static RealmPacketOut CreateAllAuraPacket(Unit owner)
        {
            RealmPacketOut realmPacketOut = new RealmPacketOut(RealmServerOpCode.SMSG_AURA_UPDATE_ALL);

            owner.EntityId.WritePacked((BinaryWriter)realmPacketOut);
            foreach (Aura aura in owner.Auras)
            {
                if (aura.IsVisible)
                {
                    AuraHandler.WriteAura(aura, (BinaryWriter)realmPacketOut);
                }
            }

            return(realmPacketOut);
        }
Beispiel #9
0
        /// <summary>Defines a set of Auras that are mutually exclusive</summary>
        public static uint AddAuraGroup(params SpellLineId[] auraLines)
        {
            uint nextAuraUid = AuraHandler.GetNextAuraUID();

            foreach (SpellLineId auraLine in auraLines)
            {
                SpellLine line = auraLine.GetLine();
                line.AuraUID = nextAuraUid;
                foreach (Spell spell in line)
                {
                    spell.AuraUID = nextAuraUid;
                }
            }

            return(nextAuraUid);
        }
Beispiel #10
0
        /// <summary>Defines a set of Auras that are mutually exclusive</summary>
        public static uint AddAuraGroup(params SpellId[] auras)
        {
            uint nextAuraUid = AuraHandler.GetNextAuraUID();

            foreach (SpellId aura in auras)
            {
                Spell spell = SpellHandler.Get(aura);
                if (spell == null)
                {
                    throw new ArgumentException("Invalid SpellId: " + (object)aura);
                }
                spell.AuraUID = nextAuraUid;
            }

            return(nextAuraUid);
        }
Beispiel #11
0
        public void TriggerProc(Unit triggerer, IUnitAction action)
        {
            var proced = false;

            var hasProcEffects = m_spell.ProcTriggerEffects != null;

            if (hasProcEffects)
            {
                foreach (var handler in m_handlers)
                {
                    if (handler.SpellEffect.IsProc)
                    {
                        // only trigger proc effects or all effects, if there arent any proc-specific effects
                        if (handler.CanProcBeTriggeredBy(action) &&
                            handler.SpellEffect.CanProcBeTriggeredBy(action.Spell))
                        {
                            // only trigger if no AffectMask or spell, or the trigger spell matches the affect mask
                            handler.OnProc(triggerer, action);
                            proced = true;
                        }
                    }
                }
            }
            else
            {
                // Simply reduce stack count and remove aura eventually
                proced = true;
            }

            if (proced && m_spell.ProcCharges > 0)
            {
                // consume a charge
                m_stackCount--;
                if (m_stackCount == 0)
                {
                    Remove(false);
                }
                else
                {
                    AuraHandler.SendAuraUpdate(m_auras.Owner, this);
                }
            }
        }
Beispiel #12
0
        /// <summary>
        /// Refreshes this aura.
        /// If this Aura is stackable, will also increase the StackCount by one.
        /// </summary>
        public void Refresh(ObjectReference caster)
        {
            if (IsAdded)
            {
                // remove non-periodic effects:
                RemoveNonPeriodicEffects();

                m_CasterReference = caster;

                if (m_spell.InitialStackCount > 1)
                {
                    m_stackCount = (byte)m_spell.InitialStackCount;
                }
                else if (m_stackCount < m_spell.MaxStackCount)
                {
                    m_stackCount++;
                }

                // update effect values
                foreach (var handler in m_handlers)
                {
                    handler.UpdateEffectValue();
                }

                // re-apply non-periodic effects:
                ApplyNonPeriodicEffects();

                // reset timer:
                TimeLeft = m_spell.GetDuration(caster, m_auras.Owner);

                if (IsVisible)
                {
                    AuraHandler.SendAuraUpdate(m_auras.Owner, this);
                }
            }
        }
Beispiel #13
0
 internal static void RegisterAuraUIDEvaluators()
 {
     AuraHandler.AddAuraGroupEvaluator(new AuraIdEvaluator(AuraHandler.IsTransform));
     AuraHandler.AddAuraGroupEvaluator(new AuraIdEvaluator(AuraHandler.IsStealth));
     AuraHandler.AddAuraGroupEvaluator(new AuraIdEvaluator(AuraHandler.IsTracker));
 }