public WearOffTimer( OilAttachment owner ) : base(TimeSpan.FromSeconds( 5.0 ), TimeSpan.FromSeconds( 5.0 )) { m_Owner = owner; Priority = TimerPriority.FiveSeconds; }
protected override void OnTarget( Mobile from, object targ ) { if ( targ is BaseMeleeWeapon ) { BaseMeleeWeapon weapon = targ as BaseMeleeWeapon; OilAttachment attachment = XmlAttach.FindAttachment( weapon, typeof( OilAttachment ) ) as OilAttachment; if ( weapon.RootParent != from ) from.SendMessage( "The item must be in your pack." ); else if ( attachment != null ) from.SendMessage( "There's already oil present on that weapon. Remove it with an oil cloth first." ); else { attachment = new OilAttachment( m_Potion.Effects, m_Potion.Duration, m_Potion.Corrosivity ); XmlAttach.AttachTo( weapon, attachment ); from.PlaySound( 0x4F ); Bottle emptybottle = new Bottle(); from.AddToBackpack( emptybottle ); m_Potion.Consume( 1 ); from.SendMessage( "You apply the oil onto the weapon." ); } } else from.SendMessage( "You cannot apply oil to that." ); }