private void UpdateSpells(ref WS_Base.BaseUnit objCharacter) { if (objCharacter is WS_Totems.TotemObject @object) { @object.Update(); return; } checked { for (int i = 0; i <= WorldServiceLocator._Global_Constants.MAX_AURA_EFFECTs - 1; i++) { if (objCharacter.ActiveSpells[i] == null) { continue; } if (objCharacter.ActiveSpells[i].SpellDuration != WorldServiceLocator._Global_Constants.SPELL_DURATION_INFINITE) { objCharacter.ActiveSpells[i].SpellDuration -= 1000; byte j = 0; do { if (objCharacter.ActiveSpells[i] != null && objCharacter.ActiveSpells[i].Aura[j] != null && objCharacter.ActiveSpells[i].Aura_Info[j] != null && objCharacter.ActiveSpells[i].Aura_Info[j].Amplitude != 0 && checked (objCharacter.ActiveSpells[i].GetSpellInfo.GetDuration - objCharacter.ActiveSpells[i].SpellDuration) % objCharacter.ActiveSpells[i].Aura_Info[j].Amplitude == 0) { ref WS_Base.BaseUnit spellCaster = ref objCharacter.ActiveSpells[i].SpellCaster; WS_Base.BaseObject Caster = spellCaster; objCharacter.ActiveSpells[i].Aura[j](ref objCharacter, ref Caster, ref objCharacter.ActiveSpells[i].Aura_Info[j], objCharacter.ActiveSpells[i].SpellID, objCharacter.ActiveSpells[i].StackCount + 1, AuraAction.AURA_UPDATE); ref WS_Base.BaseUnit reference = ref spellCaster; reference = (WS_Base.BaseUnit)Caster; } j = (byte)unchecked ((uint)(j + 1)); }while (j <= 2u); if (objCharacter.ActiveSpells[i] != null && objCharacter.ActiveSpells[i].SpellDuration <= 0 && objCharacter.ActiveSpells[i].SpellDuration != WorldServiceLocator._Global_Constants.SPELL_DURATION_INFINITE) { objCharacter.RemoveAura(i, ref objCharacter.ActiveSpells[i].SpellCaster, RemovedByDuration: true); } } byte k = 0; do { if (objCharacter.ActiveSpells[i] != null && objCharacter.ActiveSpells[i].Aura_Info[k] != null && objCharacter.ActiveSpells[i].Aura_Info[k].ID == SpellEffects_Names.SPELL_EFFECT_APPLY_AREA_AURA) { if (objCharacter.ActiveSpells[i].SpellCaster == objCharacter) { List <WS_Base.BaseUnit> Targets = new List <WS_Base.BaseUnit>(); switch (objCharacter) { case WS_PlayerData.CharacterObject _: { WS_Spells wS_Spells = WorldServiceLocator._WS_Spells; WS_PlayerData.CharacterObject objCharacter2 = (WS_PlayerData.CharacterObject)objCharacter; Targets = wS_Spells.GetPartyMembersAroundMe(ref objCharacter2, objCharacter.ActiveSpells[i].Aura_Info[k].GetRadius); break; } case WS_Totems.TotemObject _ when((WS_Totems.TotemObject) objCharacter).Caster != null && ((WS_Totems.TotemObject)objCharacter).Caster is WS_PlayerData.CharacterObject: { WS_Spells wS_Spells2 = WorldServiceLocator._WS_Spells; ref WS_Base.BaseUnit caster2 = ref ((WS_Totems.TotemObject)objCharacter).Caster; ref WS_Base.BaseUnit reference = ref caster2; WS_PlayerData.CharacterObject objCharacter2 = (WS_PlayerData.CharacterObject)caster2; List <WS_Base.BaseUnit> partyMembersAtPoint = wS_Spells2.GetPartyMembersAtPoint(ref objCharacter2, objCharacter.ActiveSpells[i].Aura_Info[k].GetRadius, objCharacter.positionX, objCharacter.positionY, objCharacter.positionZ); reference = objCharacter2; Targets = partyMembersAtPoint; break; } } foreach (WS_Base.BaseUnit item in Targets) { WS_Base.BaseUnit Unit = item; if (!Unit.HaveAura(objCharacter.ActiveSpells[i].SpellID)) { WS_Spells wS_Spells3 = WorldServiceLocator._WS_Spells; WS_Base.BaseObject Caster = objCharacter; wS_Spells3.ApplyAura(ref Unit, ref Caster, ref objCharacter.ActiveSpells[i].Aura_Info[k], objCharacter.ActiveSpells[i].SpellID); objCharacter = (WS_Base.BaseUnit)Caster; } } } else if (objCharacter.ActiveSpells[i].SpellCaster != null && objCharacter.ActiveSpells[i].SpellCaster.Exist) { WS_PlayerData.CharacterObject caster = null; switch (objCharacter.ActiveSpells[i].SpellCaster) { case WS_PlayerData.CharacterObject _: caster = (WS_PlayerData.CharacterObject)objCharacter.ActiveSpells[i].SpellCaster; break; case WS_Totems.TotemObject _ when((WS_Totems.TotemObject) objCharacter.ActiveSpells[i].SpellCaster).Caster != null && ((WS_Totems.TotemObject)objCharacter.ActiveSpells[i].SpellCaster).Caster is WS_PlayerData.CharacterObject object1: caster = object1; break; } if (caster == null || caster.Group == null || !caster.Group.LocalMembers.Contains(objCharacter.GUID)) { objCharacter.RemoveAura(i, ref objCharacter.ActiveSpells[i].SpellCaster); } else if (!objCharacter.ActiveSpells[i].SpellCaster.HaveAura(objCharacter.ActiveSpells[i].SpellID)) { objCharacter.RemoveAura(i, ref objCharacter.ActiveSpells[i].SpellCaster); } else if (WorldServiceLocator._WS_Combat.GetDistance(objCharacter, objCharacter.ActiveSpells[i].SpellCaster) > objCharacter.ActiveSpells[i].Aura_Info[k].GetRadius) { objCharacter.RemoveAura(i, ref objCharacter.ActiveSpells[i].SpellCaster); } } else { objCharacter.RemoveAura(i, ref objCharacter.ActiveSpells[i].SpellCaster); } }
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); } }