public void ApplySelfTeleportEnablerEffect(TimeSpan duration) { var effect = EffectHandler.GetEffectsByType(EffectType.effect_teleport_self_enabler).FirstOrDefault(); if (effect != null) { EffectHandler.Remove(effect); } var builder = NewEffectBuilder().SetType(EffectType.effect_teleport_self_enabler).WithDuration(duration); ApplyEffect(builder); }
public override void OnUpdateToDb() { try { if (!IsRepackaged) { DynamicProperties.Update(k.armor, Armor.Ratio(ArmorMax)); DynamicProperties.Update(k.currentCore, Core); } var zone = Zone; if (zone == null || States.Dead) { return; } var character = Character; character.ZoneId = zone.Id; character.ZonePosition = CurrentPosition; var p = DynamicProperties.GetProperty <int>(k.pvpRemaining); var pvpEffect = EffectHandler.GetEffectsByType(EffectType.effect_pvp).FirstOrDefault(); if (pvpEffect == null) { p.Clear(); return; } var effectTimer = pvpEffect.Timer; if (effectTimer != null) { p.Value = (int)effectTimer.Remaining.TotalMilliseconds; } } finally { base.OnUpdateToDb(); } }