public static void ReplaceBalmOrLotion(Mobile m, BalmOrLotion newBalm) { if (m_Table.ContainsKey(m)) { BalmOrLotionContext oldBalmContext = m_Table[m]; oldBalmContext.Item.RemoveBuff(m); oldBalmContext.ExpireTimer.Stop(); } newBalm.Use(m); }
public void Use(Mobile from) { from.PlaySound(0x1ED); from.SendLocalizedMessage(ApplyMessage); Effects.SendPacket(from, from.Map, new GraphicalEffect(Network.EffectType.FixedFrom, from.Serial, Serial.Zero, 0x375A, from.Location, from.Location, 9, 20, true, false)); AddBuff(from); Timer expireTimer = Timer.DelayCall(Duration, new TimerStateCallback <Mobile>(RemoveBuffCallback), from); BalmOrLotionContext context = new BalmOrLotionContext(expireTimer, this); m_Table[from] = context; Delete(); }
public static bool IncreaseDuration(Mobile from) { if (m_Table.ContainsKey(from)) { BalmOrLotionContext context = m_Table[from]; if (context.Item is BalmOfStrength || context.Item is BalmOfSwiftness || context.Item is BalmOfSwiftness) { TimeSpan left = context.ExpireTimer.Next - DateTime.Now; context.ExpireTimer.Stop(); context.ExpireTimer = Timer.DelayCall(left + TimeSpan.FromHours(1.0), new TimerStateCallback <Mobile>(context.Item.RemoveBuffCallback), from); context.ExpireTimer.Start(); context.Item.RemoveBuff(from); context.Item.AddBuff(from); return(true); } } return(false); }
public void Use( Mobile from ) { from.PlaySound( 0x1ED ); from.SendLocalizedMessage( ApplyMessage ); Effects.SendPacket( from, from.Map, new GraphicalEffect( Network.EffectType.FixedFrom, from.Serial, Serial.Zero, 0x375A, from.Location, from.Location, 9, 20, true, false ) ); AddBuff( from ); Timer expireTimer = Timer.DelayCall( Duration, new TimerStateCallback<Mobile>( RemoveBuffCallback ), from ); BalmOrLotionContext context = new BalmOrLotionContext( expireTimer, this ); m_Table[from] = context; Delete(); }