public void EffectExpired(Boolean silent) { if (m_Timer != null) { m_Timer.Stop(); m_Timer = null; } if (m_FoodEffect != null) { if (LinkedMobile != null) { LinkedMobile.RemoveStatMod("Food-StrBonus"); LinkedMobile.RemoveStatMod("Food-DexBonus"); LinkedMobile.RemoveStatMod("Food-IntBonus"); if (m_BuffInfo != null) { BuffInfo.RemoveBuff(LinkedMobile, m_BuffInfo); } if (!silent) { LinkedMobile.PlaySound(0x1E6); LinkedMobile.SendMessage(12, "Your food effect has worn off"); } if (m_FoodEffect != null) { FoodEffectsCore.InvokeOnEffectExpired(LinkedMobile, m_FoodEffect); } } m_FoodEffect = null; } }
public void ApplyEffect(FoodEffect effect, Boolean silent) { if (FoodEffectsCore.Core == null || !FoodEffectsCore.Core.Enabled || !Core.AOS) { EffectExpired(true); return; } if (LinkedMobile != null) { if (m_Timer != null) { m_Timer.Stop(); m_Timer = null; } LinkedMobile.RemoveStatMod("Food-StrBonus"); LinkedMobile.RemoveStatMod("Food-DexBonus"); LinkedMobile.RemoveStatMod("Food-IntBonus"); if (m_BuffInfo != null) { BuffInfo.RemoveBuff(LinkedMobile, m_BuffInfo); } if (m_FoodEffect != null) { FoodEffectsCore.InvokeOnEffectCanceled(LinkedMobile, m_FoodEffect); } m_FoodEffect = new FoodEffect(effect.RegenHits, effect.RegenStam, effect.RegenMana, effect.StrBonus, effect.DexBonus, effect.IntBonus, effect.Duration); if (m_FoodEffect.StrBonus != 0) { LinkedMobile.AddStatMod(new StatMod(StatType.Str, "Food-StrBonus", m_FoodEffect.StrBonus, m_FoodEffect.EffectTimeSpan)); } if (m_FoodEffect.DexBonus != 0) { LinkedMobile.AddStatMod(new StatMod(StatType.Dex, "Food-DexBonus", m_FoodEffect.DexBonus, m_FoodEffect.EffectTimeSpan)); } if (m_FoodEffect.IntBonus != 0) { LinkedMobile.AddStatMod(new StatMod(StatType.Int, "Food-IntBonus", m_FoodEffect.IntBonus, m_FoodEffect.EffectTimeSpan)); } if (!silent) { LinkedMobile.FixedEffect(0x375A, 10, 15); LinkedMobile.PlaySound(0x1EE); LinkedMobile.SendMessage(12, "The food you ate is now affecting your performance..."); } m_Timer = new EffectTimer(this); FoodEffectsCore.InvokeOnEffectActivated(LinkedMobile, m_FoodEffect); m_BuffInfo = new BuffInfo(BuffIcon.ActiveMeditation, 1074240, 1114057, m_FoodEffect.EffectTimeSpan, LinkedMobile, m_FoodEffect.GetBuffInfoText()); BuffInfo.AddBuff(LinkedMobile, m_BuffInfo); } }