示例#1
0
        public override void OnDoubleClick(Mobile from)
        {
            Point3D m_pnt = from.Location;
            Map     m_map = from.Map;

            if (CropHelper.ValidateGardenGround(m_map, m_pnt.X, m_pnt.Y))
            {
                if (CropHelper.ValidateNoCrop(m_map, m_pnt.X, m_pnt.Y))
                {
                    if (!this.IsChildOf(from.Backpack))
                    {
                        from.SendLocalizedMessage(1042664); // You must have the object in your backpack to use it.
                        return;
                    }

                    GrowableCrop crop = CropHelper.GetInfo(m_CropType).CropItem;
                    from.Animate(from.Mounted ? 29 : 32, 5, 1, true, false, 0);
                    crop.Location = m_pnt;
                    crop.Z        = crop.Z + 1;
                    crop.Map      = m_map;
                    from.SendMessage("You manage to plant a " + this.Name);
                    if (this.Amount > 1)
                    {
                        this.Amount--;
                    }
                    else
                    {
                        this.Delete();
                    }
                }
                else
                {
                    from.SendMessage("There already is a seed here!");
                }
            }
            else
            {
                from.SendMessage("You must be in a garden to plant the seed!");
            }
        }
示例#2
0
 public GrowTimer(GrowableCrop c, int timespan)
     : base(TimeSpan.FromSeconds(timespan), TimeSpan.FromSeconds(timespan))
 {
     crop     = c;
     Priority = TimerPriority.OneSecond;
 }