Ejemplo n.º 1
0
            public bool Update()
            {
                if (Caster == null)
                {
                    return(true);
                }
                bool DeleteThis = false;

                checked
                {
                    if (Duration > 1000)
                    {
                        Duration -= 1000;
                    }
                    else
                    {
                        DeleteThis = true;
                    }
                }
                foreach (WS_Spells.SpellEffect effect in Effects)
                {
                    WS_Spells.SpellEffect Effect = effect;
                    if (Effect.GetRadius == 0f)
                    {
                        if (Effect.Amplitude == 0 || checked (WorldServiceLocator._WS_Spells.SPELLs[SpellID].GetDuration - Duration) % Effect.Amplitude == 0)
                        {
                            WS_Spells.ApplyAuraHandler obj        = WorldServiceLocator._WS_Spells.AURAs[Effect.ApplyAuraIndex];
                            ref WS_Base.BaseUnit       caster     = ref Caster;
                            WS_Base.BaseObject         baseObject = this;
                            obj(ref caster, ref baseObject, ref Effect, SpellID, 1, AuraAction.AURA_UPDATE);
                        }
                        continue;
                    }
                    List <WS_Base.BaseUnit> Targets = WorldServiceLocator._WS_Spells.GetEnemyAtPoint(ref Caster, positionX, positionY, positionZ, Effect.GetRadius);
                    foreach (WS_Base.BaseUnit item in Targets)
                    {
                        WS_Base.BaseUnit Target = item;
                        if (Effect.Amplitude == 0 || checked (WorldServiceLocator._WS_Spells.SPELLs[SpellID].GetDuration - Duration) % Effect.Amplitude == 0)
                        {
                            WS_Spells.ApplyAuraHandler obj2       = WorldServiceLocator._WS_Spells.AURAs[Effect.ApplyAuraIndex];
                            WS_Base.BaseObject         baseObject = this;
                            obj2(ref Target, ref baseObject, ref Effect, SpellID, 1, AuraAction.AURA_UPDATE);
                        }
                    }
                }
Ejemplo n.º 2
0
            public void Update()
            {
                checked
                {
                    int num = WorldServiceLocator._Global_Constants.MAX_AURA_EFFECTs - 1;
                    for (int i = 0; i <= num; i++)
                    {
                        if (ActiveSpells[i] == null)
                        {
                            continue;
                        }
                        if (ActiveSpells[i].SpellDuration == WorldServiceLocator._Global_Constants.SPELL_DURATION_INFINITE)
                        {
                            ActiveSpells[i].SpellDuration = Duration;
                        }
                        if (ActiveSpells[i].SpellDuration != WorldServiceLocator._Global_Constants.SPELL_DURATION_INFINITE)
                        {
                            ActiveSpells[i].SpellDuration -= 1000;
                            byte k = 0;
                            do
                            {
                                if (ActiveSpells[i] != null && ActiveSpells[i].Aura[k] != null && ActiveSpells[i].Aura_Info[k].Amplitude != 0 && checked (Duration - ActiveSpells[i].SpellDuration) % ActiveSpells[i].Aura_Info[k].Amplitude == 0)
                                {
                                    WS_Spells.ApplyAuraHandler obj         = ActiveSpells[i].Aura[k];
                                    WS_Base.BaseUnit           Target      = this;
                                    ref WS_Base.BaseUnit       spellCaster = ref ActiveSpells[i].SpellCaster;
                                    WS_Base.BaseObject         baseObject  = spellCaster;
                                    obj(ref Target, ref baseObject, ref ActiveSpells[i].Aura_Info[k], ActiveSpells[i].SpellID, ActiveSpells[i].StackCount + 1, AuraAction.AURA_UPDATE);
                                    spellCaster = (WS_Base.BaseUnit)baseObject;
                                }
                                k = (byte)unchecked ((uint)(k + 1));
                            }while (k <= 2u);
                            if (ActiveSpells[i] != null && ActiveSpells[i].SpellDuration <= 0 && ActiveSpells[i].SpellDuration != WorldServiceLocator._Global_Constants.SPELL_DURATION_INFINITE)
                            {
                                RemoveAura(i, ref ActiveSpells[i].SpellCaster, RemovedByDuration: true);
                            }
                        }
                        byte j = 0;
                        do
                        {
                            if (ActiveSpells[i] != null && ActiveSpells[i].Aura_Info[j] != null && ActiveSpells[i].Aura_Info[j].ID == SpellEffects_Names.SPELL_EFFECT_APPLY_AREA_AURA)
                            {
                                List <WS_Base.BaseUnit> Targets = new();
                                switch (Caster)
                                {
                                case WS_PlayerData.CharacterObject _:
                                {
                                    WS_Spells wS_Spells = WorldServiceLocator._WS_Spells;
                                    WS_PlayerData.CharacterObject objCharacter = (WS_PlayerData.CharacterObject)Caster;
                                    Targets = wS_Spells.GetPartyMembersAtPoint(ref objCharacter, ActiveSpells[i].Aura_Info[j].GetRadius, positionX, positionY, positionZ);
                                    break;
                                }

                                default:
                                {
                                    WS_Spells        wS_Spells2 = WorldServiceLocator._WS_Spells;
                                    WS_Base.BaseUnit Target     = this;
                                    Targets = wS_Spells2.GetFriendAroundMe(ref Target, ActiveSpells[i].Aura_Info[j].GetRadius);
                                    break;
                                }
                                }
                                foreach (WS_Base.BaseUnit item in new List <WS_Base.BaseUnit>())
                                {
                                    WS_Base.BaseUnit Unit = item;
                                    if (!Unit.HaveAura(ActiveSpells[i].SpellID))
                                    {
                                        WS_Spells          wS_Spells3 = WorldServiceLocator._WS_Spells;
                                        WS_Base.BaseObject baseObject = this;
                                        wS_Spells3.ApplyAura(ref Unit, ref baseObject, ref ActiveSpells[i].Aura_Info[j], ActiveSpells[i].SpellID);
                                    }
                                }
                            }
                            j = (byte)unchecked ((uint)(j + 1));
                        }while (j <= 2u);
                    }
                }