示例#1
0
        public override void OnDoubleClick(Mobile from)
        {
            if (from.Mounted && !CropHelper.CanWorkMounted)
            {
                from.SendMessage("You cannot plant a seed while mounted."); return;
            }
            Point3D m_pnt = from.Location;
            Map     m_map = from.Map;

            if (!IsChildOf(from.Backpack))
            {
                from.SendLocalizedMessage(1042010); return;
            }
            else if (!CropHelper.CheckCanGrow(this, m_map, m_pnt.X, m_pnt.Y))
            {
                from.SendMessage("This seed will not grow here."); return;
            }
            ArrayList cropshere = CropHelper.CheckCrop(m_pnt, m_map, 0);

            if (cropshere.Count > 0)
            {
                from.SendMessage("There is already a crop growing here."); return;
            }
            ArrayList cropsnear = CropHelper.CheckCrop(m_pnt, m_map, 1);

            if ((cropsnear.Count > 8))
            {
                from.SendMessage("There are too many crops nearby."); return;
            }
            if (this.BumpZ)
            {
                ++m_pnt.Z;
            }
            if (!from.Mounted)
            {
                from.Animate(32, 5, 1, true, false, 0);
            }
            from.SendMessage("You plant the seed.");
            this.Consume();
            if (Utility.RandomDouble() <= 0.01)
            {
                Item item2 = new BlackRoseSeedling(from);
                item2.Location = m_pnt;
                item2.Map      = m_map;
                from.SendMessage("The seed was a Muntant Seed !!!!");
            }
            else
            {
                Item item = new WhiteRoseSeedling(from);
                item.Location = m_pnt;
                item.Map      = m_map;
            }
        }
 public static void init(BlackRoseSeedling plant)
 {
     plant.thisTimer = new CropHelper.GrowTimer(plant, typeof(BlackRoseCrop), plant.Sower);
     plant.thisTimer.Start();
 }