Пример #1
0
 public override void OnAfterDelete()
 {
     if (m_Galleon != null)
     {
         m_Galleon.Delete();
     }
 }
Пример #2
0
        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;
                }

                if (from.AccessLevel < AccessLevel.GameMaster && (map == Map.Ilshenar || map == Map.Malas))
                {
                    from.SendLocalizedMessage(1043284);                       // A ship can not be created here.
                    return;
                }

                if (from.Region.IsPartOf(typeof(HouseRegion)) /*|| BaseGalleon.FindBoatAt( from, from.Map ) != null */)
                {
                    from.SendLocalizedMessage(1010568, null, 0x25);                       // You may not place a ship while on another ship or inside a house.
                    return;
                }

                BaseGalleon boat = Boat;

                if (boat == null)
                {
                    return;
                }

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

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

                    boat.Owner = from;

                    uint keyValue = boat.CreateKeys(from);

                    for (int i = 0; i < boat.Ropes.Count; ++i)
                    {
                        boat.Ropes[i].KeyValue = keyValue;
                    }

                    boat.MoveToWorld(p, map);

                    boat.SetFacing(_chosenDirection);
                }
                else
                {
                    boat.Delete();
                    from.SendLocalizedMessage(1043284);                       // A ship can not be created here.
                }
            }
        }