Server.Items.BaseDoor.Use C# (CSharp) Method

Use() public method

public Use ( Mobile from ) : void
from Mobile
return void
		public virtual void Use( Mobile from )
		{
			if ( m_Locked && !m_Open && UseLocks() )
			{
				if ( from.AccessLevel >= AccessLevel.GameMaster )
				{
					from.LocalOverheadMessage( MessageType.Regular, 0x3B2, 502502 ); // That is locked, but you open it with your godly powers.
					//from.Send( new MessageLocalized( Serial, ItemID, MessageType.Regular, 0x3B2, 3, 502502, "", "" ) ); // That is locked, but you open it with your godly powers.
				}
				else if ( Key.ContainsKey( from.Backpack, this.KeyValue ) )
				{
					from.LocalOverheadMessage( MessageType.Regular, 0x3B2, 501282 ); // You quickly unlock, open, and relock the door
				}
				else if ( IsInside( from ) )
				{
					from.LocalOverheadMessage( MessageType.Regular, 0x3B2, 501280 ); // That is locked, but is usable from the inside.
				}
				else
				{
					from.LocalOverheadMessage( MessageType.Regular, 0x3B2, 502503 ); // That is locked.

					return;
				}
			}

			if ( m_Open && !IsFreeToClose() )
				return;

			if ( m_Open )
				OnClosed( from );
			else
				OnOpened( from );

			if ( UseChainedFunctionality )
			{
				bool open = !m_Open;

				List<BaseDoor> list = GetChain();

				for ( int i = 0; i < list.Count; ++i )
					list[i].Open = open;
			}
			else
			{
				Open = !m_Open;

				BaseDoor link = this.Link;

				if ( m_Open && link != null && !link.Open )
					link.Open = true;
			}
		}