Server.Items.SpecialFishingNet.OnTarget C# (CSharp) Méthode

OnTarget() public méthode

public OnTarget ( Server.Mobile from, object obj ) : void
from Server.Mobile
obj object
Résultat void
		public void OnTarget( Mobile from, object obj )
		{
			if ( Deleted || m_InUse )
				return;

			IPoint3D p3D = obj as IPoint3D;

			if ( p3D == null )
				return;

			Map map = from.Map;

			if ( map == null || map == Map.Internal )
				return;

			int x = p3D.X, y = p3D.Y, z = map.GetAverageZ( x, y ); // OSI just takes the targeted Z

			if ( !from.InRange( p3D, 6 ) )
			{
				from.SendLocalizedMessage( 500976 ); // You need to be closer to the water to fish!
			}
			else if ( !from.InLOS( obj ) )
			{
				from.SendLocalizedMessage( 500979 ); // You cannot see that location.
			}
			else if ( RequireDeepWater ? FullValidation( map, x, y ) : ( ValidateDeepWater( map, x, y ) || ValidateUndeepWater( map, obj, ref z ) ) )
			{
				Point3D p = new Point3D( x, y, z );

				if ( GetType() == typeof( SpecialFishingNet ) )
				{
					for ( int i = 1; i < Amount; ++i ) // these were stackable before, doh
						from.AddToBackpack( new SpecialFishingNet() );
				}

				m_InUse = true;
				Movable = false;
				MoveToWorld( p, map );

				SpellHelper.Turn( from, p );
				from.Animate( 12, 5, 1, true, false, 0 );

				Effects.SendLocationEffect( p, map, 0x352D, 16, 4 );
				Effects.PlaySound( p, map, 0x364 );

				Timer.DelayCall( TimeSpan.FromSeconds( 1.0 ), TimeSpan.FromSeconds( 1.25 ), 14, new TimerStateCallback( DoEffect ), new object[]{ p, 0, from } );

				from.SendLocalizedMessage( RequireDeepWater ? 1010487 : 1074492 ); // You plunge the net into the sea... / You plunge the net into the water...
			}
			else
			{
				from.SendLocalizedMessage( RequireDeepWater ? 1010485 : 1074491 ); // You can only use this net in deep water! / You can only use this net in water!
			}
		}