private void AddSeedsState(int x, int y)
        {
            PlantSystem system     = m_Plant.PlantSystem;
            int         totalSeeds = system.AvailableSeeds + system.LeftSeeds;

            if (!m_Plant.Reproduces || totalSeeds == 0)
            {
                AddLabel(x + 5, y, 0x21, "X");
            }
            else
            {
                AddLabel(x, y, PlantHueInfo.GetInfo(system.SeedHue).GumpHue,
                         string.Format("{0}/{1}", system.AvailableSeeds, totalSeeds));
            }
        }
        private void AddResourcesState(int x, int y)
        {
            PlantResourceInfo resInfo = PlantResourceInfo.GetInfo(m_Plant.PlantType, m_Plant.PlantHue);

            PlantSystem system         = m_Plant.PlantSystem;
            int         totalResources = system.AvailableResources + system.LeftResources;

            if (resInfo == null || totalResources == 0)
            {
                AddLabel(x + 5, y, 0x21, "X");
            }
            else
            {
                AddLabel(x, y, PlantHueInfo.GetInfo(m_Plant.PlantHue).GumpHue,
                         string.Format("{0}/{1}", system.AvailableResources, totalResources));
            }
        }
        private void AddPollinationState(int x, int y)
        {
            PlantSystem system = m_Plant.PlantSystem;

            if (!system.PollenProducing)
            {
                AddLabel(x, y, 0x35, "-");
            }
            else if (!system.Pollinated)
            {
                AddLabel(x, y, 0x21, "!");
            }
            else
            {
                AddLabel(x, y, 0x3F, "+");
            }
        }
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);

            int version = reader.ReadInt();

            switch (version)
            {
            case 2:
            case 1:
            {
                m_Level = (SecureLevel)reader.ReadInt();
                goto case 0;
            }

            case 0:
            {
                if (version < 1)
                {
                    m_Level = SecureLevel.CoOwners;
                }

                m_PlantStatus = (PlantStatus)reader.ReadInt();
                m_PlantType   = (PlantType)reader.ReadInt();
                m_PlantHue    = (PlantHue)reader.ReadInt();
                m_ShowType    = reader.ReadBool();

                if (m_PlantStatus < PlantStatus.DecorativePlant)
                {
                    m_PlantSystem = new PlantSystem(this, reader);
                }

                if (version < 2 && PlantHueInfo.IsCrossable(m_PlantHue))
                {
                    m_PlantHue |= PlantHue.Reproduces;
                }

                break;
            }
            }

            m_Instances.Add(this);
        }
        public override void OnResponse(NetState sender, RelayInfo info)
        {
            Mobile from = sender.Mobile;

            if (info.ButtonID == 0 || m_Plant.Deleted || m_Plant.PlantStatus >= PlantStatus.DecorativePlant || m_Plant.PlantStatus == PlantStatus.BowlOfDirt)
            {
                return;
            }

            if ((info.ButtonID >= 6 && info.ButtonID <= 8) && !from.InRange(m_Plant.GetWorldLocation(), 3))
            {
                from.LocalOverheadMessage(MessageType.Regular, 0x3E9, 500446); // That is too far away.
                return;
            }

            if (!m_Plant.IsUsableBy(from))
            {
                m_Plant.LabelTo(from, 1061856); // You must have the item in your backpack or locked down in order to use it.
                return;
            }

            switch (info.ButtonID)
            {
            case 1:     // Main menu
            {
                from.SendGump(new MainPlantGump(m_Plant));

                break;
            }

            case 2:     // Set to decorative
            {
                if (m_Plant.PlantStatus == PlantStatus.Stage9)
                {
                    from.SendGump(new SetToDecorativeGump(m_Plant));
                }

                break;
            }

            case 3:                                        // Pollination
            {
                from.Send(new DisplayHelpTopic(67, true)); // POLLINATION STATE

                from.SendGump(new ReproductionGump(m_Plant));

                break;
            }

            case 4:                                        // Resources
            {
                from.Send(new DisplayHelpTopic(69, true)); // RESOURCE PRODUCTION

                from.SendGump(new ReproductionGump(m_Plant));

                break;
            }

            case 5:                                        // Seeds
            {
                from.Send(new DisplayHelpTopic(68, true)); // SEED PRODUCTION

                from.SendGump(new ReproductionGump(m_Plant));

                break;
            }

            case 6:     // Gather pollen
            {
                if (!m_Plant.IsCrossable)
                {
                    m_Plant.LabelTo(from, 1053050);         // You cannot gather pollen from a mutated plant!
                }
                else if (!m_Plant.PlantSystem.PollenProducing)
                {
                    m_Plant.LabelTo(from, 1053051);         // You cannot gather pollen from a plant in this stage of development!
                }
                else if (m_Plant.PlantSystem.Health < PlantHealth.Healthy)
                {
                    m_Plant.LabelTo(from, 1053052);         // You cannot gather pollen from an unhealthy plant!
                }
                else
                {
                    from.Target = new PollinateTarget(m_Plant);
                    from.SendLocalizedMessage(1053054);         // Target the plant you wish to cross-pollinate to.

                    break;
                }

                from.SendGump(new ReproductionGump(m_Plant));

                break;
            }

            case 7:     // Gather resources
            {
                PlantResourceInfo resInfo = PlantResourceInfo.GetInfo(m_Plant.PlantType, m_Plant.PlantHue);
                PlantSystem       system  = m_Plant.PlantSystem;

                if (resInfo == null)
                {
                    if (m_Plant.IsCrossable)
                    {
                        m_Plant.LabelTo(from, 1053056);         // This plant has no resources to gather!
                    }
                    else
                    {
                        m_Plant.LabelTo(from, 1053055);         // Mutated plants do not produce resources!
                    }
                }
                else if (system.AvailableResources == 0)
                {
                    m_Plant.LabelTo(from, 1053056);         // This plant has no resources to gather!
                }
                else
                {
                    Item resource = resInfo.CreateResource();

                    if (from.PlaceInBackpack(resource))
                    {
                        system.AvailableResources--;
                        m_Plant.LabelTo(from, 1053059);         // You gather resources from the plant.
                    }
                    else
                    {
                        resource.Delete();
                        m_Plant.LabelTo(from, 1053058);         // You attempt to gather as many resources as you can hold, but your backpack is full.
                    }
                }

                from.SendGump(new ReproductionGump(m_Plant));

                break;
            }

            case 8:     // Gather seeds
            {
                PlantSystem system = m_Plant.PlantSystem;

                if (!m_Plant.Reproduces)
                {
                    m_Plant.LabelTo(from, 1053060);         // Mutated plants do not produce seeds!
                }
                else if (system.AvailableSeeds == 0)
                {
                    m_Plant.LabelTo(from, 1053061);         // This plant has no seeds to gather!
                }
                else
                {
                    Seed seed = new Seed(system.SeedType, system.SeedHue, true);

                    if (from.PlaceInBackpack(seed))
                    {
                        system.AvailableSeeds--;
                        m_Plant.LabelTo(from, 1053063);         // You gather seeds from the plant.
                    }
                    else
                    {
                        seed.Delete();
                        m_Plant.LabelTo(from, 1053062);         // You attempt to gather as many seeds as you can hold, but your backpack is full.
                    }
                }

                from.SendGump(new ReproductionGump(m_Plant));

                break;
            }
            }
        }
        public MainPlantGump(PlantItem plant) : base(20, 20)
        {
            m_Plant = plant;

            DrawBackground();

            DrawPlant();

            AddButton(71, 67, 0xD4, 0xD4, 1, GumpButtonType.Reply, 0); // Reproduction menu
            AddItem(59, 68, 0xD08);

            PlantSystem system = plant.PlantSystem;

            AddButton(71, 91, 0xD4, 0xD4, 2, GumpButtonType.Reply, 0); // Infestation
            AddItem(8, 96, 0x372);
            AddPlus(95, 92, system.Infestation);

            AddButton(71, 115, 0xD4, 0xD4, 3, GumpButtonType.Reply, 0); // Fungus
            AddItem(58, 115, 0xD16);
            AddPlus(95, 116, system.Fungus);

            AddButton(71, 139, 0xD4, 0xD4, 4, GumpButtonType.Reply, 0); // Poison
            AddItem(59, 143, 0x1AE4);
            AddPlus(95, 140, system.Poison);

            AddButton(71, 163, 0xD4, 0xD4, 5, GumpButtonType.Reply, 0); // Disease
            AddItem(55, 167, 0x1727);
            AddPlus(95, 164, system.Disease);

            AddButton(209, 67, 0xD2, 0xD2, 6, GumpButtonType.Reply, 0); // Water
            AddItem(193, 67, 0x1F9D);
            AddPlusMinus(196, 67, system.Water);

            AddButton(209, 91, 0xD4, 0xD4, 7, GumpButtonType.Reply, 0); // Poison potion
            AddItem(201, 91, 0xF0A);
            AddLevel(196, 91, system.PoisonPotion);

            AddButton(209, 115, 0xD4, 0xD4, 8, GumpButtonType.Reply, 0); // Cure potion
            AddItem(201, 115, 0xF07);
            AddLevel(196, 115, system.CurePotion);

            AddButton(209, 139, 0xD4, 0xD4, 9, GumpButtonType.Reply, 0); // Heal potion
            AddItem(201, 139, 0xF0C);
            AddLevel(196, 139, system.HealPotion);

            AddButton(209, 163, 0xD4, 0xD4, 10, GumpButtonType.Reply, 0); // Strength potion
            AddItem(201, 163, 0xF09);
            AddLevel(196, 163, system.StrengthPotion);

            AddImage(48, 47, 0xD2);
            AddLevel(54, 47, (int)m_Plant.PlantStatus);

            AddImage(232, 47, 0xD2);
            AddGrowthIndicator(239, 47);

            AddButton(48, 183, 0xD2, 0xD2, 11, GumpButtonType.Reply, 0); // Help
            AddLabel(54, 183, 0x835, "?");

            AddButton(232, 183, 0xD4, 0xD4, 12, GumpButtonType.Reply, 0); // Empty the bowl
            AddItem(219, 180, 0x15FD);
        }