Server.Multis.BaseDockedBoat.OnPlacement C# (CSharp) Méthode

OnPlacement() public méthode

public OnPlacement ( Mobile from, Point3D p ) : void
from Mobile
p Point3D
Résultat void
		public void OnPlacement( Mobile from, Point3D p )
		{
			if ( Deleted )
			{
				return;
			}
			else if ( !IsChildOf( from.Backpack ) )
			{
				from.SendLocalizedMessage( 1042001 ); // That must be in your pack for you to use it.
			}
			else
			{
				Map map = from.Map;

				if ( map == null )
					return;

				BaseBoat boat = Boat;

				if ( boat == null )
					return;

				p = new Point3D( p.X - m_Offset.X, p.Y - m_Offset.Y, p.Z - m_Offset.Z );

				if ( BaseBoat.IsValidLocation( p ) && boat.CanFit( p, map, boat.ItemID ) )
				{
					Delete();

					boat.Owner = from;
					boat.Anchored = true;
					boat.ShipName = m_ShipName;

					uint keyValue = boat.CreateKeys( from );

					if ( boat.PPlank != null )
						boat.PPlank.KeyValue = keyValue;

					if ( boat.SPlank != null )
						boat.SPlank.KeyValue = keyValue;

					boat.MoveToWorld( p, map );
				}
				else
				{
					boat.Delete();
					from.SendLocalizedMessage( 1043284 ); // A ship can not be created here.
				}
			}
		}

Usage Example

Exemple #1
0
            protected override void OnTarget(Mobile from, object o)
            {
                IPoint3D ip = o as IPoint3D;

                if (ip != null)
                {
                    if (ip is Item)
                    {
                        ip = ((Item)ip).GetWorldTop();
                    }

                    Point3D p = new Point3D(ip);

                    Region region = Region.Find(p, from.Map);

                    if (from.Region != null && from.Region.IsDungeonRules)
                    {
                        from.SendLocalizedMessage(502488);                         // You can not place a ship inside a dungeon.
                    }
                    else if (region is HouseRegion)
                    {
                        from.SendLocalizedMessage(1042549);                         // A boat may not be placed in this area.
                    }
                    else
                    {
                        m_Model.OnPlacement(from, p);
                    }
                }
            }
All Usage Examples Of Server.Multis.BaseDockedBoat::OnPlacement