/// <summary> /// Stops the timers for this effect /// </summary> protected virtual void StopTimers() { if (m_timer != null) { m_timer.Stop(); m_timer = null; } }
/// <summary> /// Starts the timers for this effect /// </summary> protected virtual void StartTimers() { StopTimers(); if (m_duration > 0 || m_pulseFreq > 0) { // 0 = endless until explicit stop m_timer = new PulsingEffectTimer(this); m_timer.Interval = m_pulseFreq; m_timer.Start(m_pulseFreq == 0 ? m_duration : m_pulseFreq); } }
/// <summary> /// Starts the timers for this effect /// </summary> protected virtual void StartTimers() { StopTimers(); // Duration => 0 = endless until explicit stop if (Duration > 0 || PulseFreq > 0) { m_timer = new PulsingEffectTimer(this); m_timer.Interval = PulseFreq; m_timer.Start(PulseFreq == 0 ? Duration : PulseFreq); } }
/// <summary> /// Cancels the effect /// </summary> /// <param name="playerCanceled">true if canceled by the player</param> public override void Cancel(bool playerCanceled) { if (m_owner == null) { return; } if (playerCanceled) { if (Owner is GamePlayer) { ((GamePlayer)Owner).Out.SendMessage(LanguageMgr.GetTranslation(((GamePlayer)Owner).Client, "Effects.CantRemoveThis"), eChatType.CT_System, eChatLoc.CL_SystemWindow); } return; } lock (m_owner.EffectList) // Mannen 10:56 PM 10/30/2006 - Fixing every lock(this) { if (m_expired) { // do not allow removing immunity on alive living if (!m_owner.IsAlive) { m_owner.EffectList.Remove(this); } return; } StopTimers(); m_expired = true; int duration = m_handler.OnEffectExpires(this, false); if (duration > 0) { m_duration = duration; m_timer = new PulsingEffectTimer(this); m_timer.Interval = 0; m_timer.Start(duration); m_owner.EffectList.OnEffectsChanged(this); } else { m_owner.EffectList.Remove(this); } } }
/// <summary> /// Cancels the effect /// </summary> /// <param name="playerCanceled">true if canceled by the player</param> public override void Cancel(bool playerCanceled) { if (m_owner == null) return; if (playerCanceled) { if (Owner is GamePlayer) ((GamePlayer)Owner).Out.SendMessage("You can't remove this effect!", eChatType.CT_System, eChatLoc.CL_SystemWindow); return; } lock (m_owner.EffectList) // Mannen 10:56 PM 10/30/2006 - Fixing every lock(this) { if (m_expired) { // do not allow removing immunity on alive living if (!m_owner.IsAlive) m_owner.EffectList.Remove(this); return; } StopTimers(); m_expired = true; int duration = m_handler.OnEffectExpires(this, false); if (duration > 0) { m_duration = duration; m_timer = new PulsingEffectTimer(this); m_timer.Interval = 0; m_timer.Start(duration); m_owner.EffectList.OnEffectsChanged(this); } else { m_owner.EffectList.Remove(this); } } }