using System; using System.Collections; using System.Collections.Generic; using Server.Commands; using Server.Network; using Server.Targeting; namespace Server.Items { public class CustomFrontDoor : StrongWoodDoor { public override void Use( Mobile from ) { Item item = from.Backpack.FindItemByType(typeof(CustomFrontDoorKey ) ); if ( item != null ) { if ( item != this ) { Locked = false; from.SendMessage( "You have unlocked the front door." ); from.PlaySound( 0x1FF ); } else { Locked = true; return; } if ( m_Message != null && m_Message.Length > 0 ) from.SendMessage( m_Message ); base.Use( from ); } } [Constructable] public CustomFrontDoor( DoorFacing facing ) : base( facing ) { Name = "a front door - Requires Front Door Key"; } private DateTime m_Unlocked; [ CommandProperty( AccessLevel.GameMaster ) ] public DateTime Unlocked { get { return m_Unlocked; } set { m_Unlocked = value; } } private string m_Message = null; [CommandProperty( AccessLevel.GameMaster )] public string Message { get{ return m_Message; } set{ m_Message = value; } } // determines how long the door remains unlocked private TimeSpan m_RelockTime = TimeSpan.FromMinutes( 30.0 ); [ CommandProperty( AccessLevel.GameMaster ) ] public TimeSpan RelockTime { get { return m_RelockTime; } set { m_RelockTime = value; } } public CustomFrontDoor( Serial serial ) : base( serial ) { } public override void Serialize( GenericWriter writer ) { base.Serialize( writer ); writer.Write( (int) 0 ); writer.Write( m_Unlocked ); writer.Write( m_RelockTime ); writer.Write( m_Message ); } public override void Deserialize( GenericReader reader ) { base.Deserialize( reader ); int version = reader.ReadInt(); m_Unlocked = reader.ReadDateTime(); m_RelockTime = reader.ReadTimeSpan(); m_Message = reader.ReadString(); } } }