Server.Items.InteriorDecorator.InternalTarget.OnTarget C# (CSharp) Method

OnTarget() protected method

protected OnTarget ( Server.Mobile from, object targeted ) : void
from Server.Mobile
targeted object
return void
			protected override void OnTarget( Mobile from, object targeted )
			{
				if ( targeted is Item && InteriorDecorator.CheckUse( from ) )
				{
					BaseHouse house = BaseHouse.FindHouseAt( from );
					Item item = (Item)targeted;
					
					bool isDecorableComponent = false;

					if ( item is AddonComponent || item is AddonContainerComponent || item is BaseAddonContainer )
					{
						object addon = null;
						int count = 0;

						if ( item is AddonComponent )
						{
							AddonComponent component = (AddonComponent) item;
							count = component.Addon.Components.Count;
							addon = component.Addon;
						}
						else if ( item is AddonContainerComponent )
						{
							AddonContainerComponent component = (AddonContainerComponent) item;
							count = component.Addon.Components.Count;
							addon = component.Addon;
						}
						else if ( item is BaseAddonContainer )
						{
							BaseAddonContainer container = (BaseAddonContainer) item;
							count = container.Components.Count;
							addon = container;
						}

						if ( m_Decorator.Command == DecorateCommand.Turn )
						{
							FlipableAddonAttribute[] attributes = (FlipableAddonAttribute[]) addon.GetType().GetCustomAttributes( typeof( FlipableAddonAttribute ), false );

							if ( attributes.Length > 0 )
								isDecorableComponent = true;
						}
					}

					if ( house == null || !house.IsCoOwner( from ) )
					{
						from.SendLocalizedMessage( 502092 ); // You must be in your house to do this.
					}
					else if ( item.Parent != null || !house.IsInside( item ) )
					{
						from.SendLocalizedMessage( 1042270 ); // That is not in your house.
					}
					else if ( !house.IsLockedDown( item ) && !house.IsSecure( item ) && !isDecorableComponent )
					{
						if ( item is AddonComponent && m_Decorator.Command == DecorateCommand.Up )
							from.SendLocalizedMessage( 1042274 ); // You cannot raise it up any higher.
						else if ( item is AddonComponent && m_Decorator.Command == DecorateCommand.Down )
							from.SendLocalizedMessage( 1042275 ); // You cannot lower it down any further.
						else
							from.SendLocalizedMessage( 1042271 ); // That is not locked down.
					}
					else if ( item.TotalWeight + item.PileWeight > 100 )
					{
						from.SendLocalizedMessage( 1042272 ); // That is too heavy.
					}
					else
					{
						switch ( m_Decorator.Command )
						{
							case DecorateCommand.Up:	Up( item, from );	break;
							case DecorateCommand.Down:	Down( item, from );	break;
							case DecorateCommand.Turn:	Turn( item, from );	break;
						}
					}
				}
				
				from.Target = new InternalTarget( m_Decorator );
			}