Example #1
0
 protected override void OnTarget(Mobile from, object targeted)
 {
     if (!m_Plant.Deleted && from.InRange(m_Plant.GetWorldLocation(), 3) && targeted is Item)
     {
         m_Plant.Pour(from, (Item)targeted);
     }
 }
        public override void OnResponse(NetState sender, RelayInfo info)
        {
            Mobile from = sender.Mobile;

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

            if (((info.ButtonID >= 6 && info.ButtonID <= 10) || info.ButtonID == 12) && !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:     // Reproduction menu
            {
                if (m_Plant.PlantStatus > PlantStatus.BowlOfDirt)
                {
                    from.SendGump(new ReproductionGump(m_Plant));
                }
                else
                {
                    from.SendLocalizedMessage(1061885);         // You need to plant a seed in the bowl first.

                    from.SendGump(new MainPlantGump(m_Plant));
                }

                break;
            }

            case 2:                                        // Infestation
            {
                from.Send(new DisplayHelpTopic(54, true)); // INFESTATION LEVEL

                from.SendGump(new MainPlantGump(m_Plant));

                break;
            }

            case 3:                                        // Fungus
            {
                from.Send(new DisplayHelpTopic(56, true)); // FUNGUS LEVEL

                from.SendGump(new MainPlantGump(m_Plant));

                break;
            }

            case 4:                                        // Poison
            {
                from.Send(new DisplayHelpTopic(58, true)); // POISON LEVEL

                from.SendGump(new MainPlantGump(m_Plant));

                break;
            }

            case 5:                                        // Disease
            {
                from.Send(new DisplayHelpTopic(60, true)); // DISEASE LEVEL

                from.SendGump(new MainPlantGump(m_Plant));

                break;
            }

            case 6:     // Water
            {
                Item[] item = from.Backpack.FindItemsByType(typeof(BaseBeverage));

                bool foundUsableWater = false;

                if (item != null && item.Length > 0)
                {
                    for (int i = 0; i < item.Length; ++i)
                    {
                        BaseBeverage beverage = (BaseBeverage)item[i];

                        if (!beverage.IsEmpty && beverage.Pourable && beverage.Content == BeverageType.Water)
                        {
                            foundUsableWater = true;
                            m_Plant.Pour(from, beverage);
                            break;
                        }
                    }
                }

                if (!foundUsableWater)
                {
                    from.Target = new PlantPourTarget(m_Plant);
                    from.SendLocalizedMessage(1060808, "#" + m_Plant.GetLocalizedPlantStatus().ToString());         // Target the container you wish to use to water the ~1_val~.
                }

                from.SendGump(new MainPlantGump(m_Plant));

                break;
            }

            case 7:     // Poison potion
            {
                AddPotion(from, PotionEffect.PoisonGreater, PotionEffect.PoisonDeadly);

                break;
            }

            case 8:     // Cure potion
            {
                AddPotion(from, PotionEffect.CureGreater);

                break;
            }

            case 9:     // Heal potion
            {
                AddPotion(from, PotionEffect.HealGreater);

                break;
            }

            case 10:     // Strength potion
            {
                AddPotion(from, PotionEffect.StrengthGreater);

                break;
            }

            case 11:                                       // Help
            {
                from.Send(new DisplayHelpTopic(48, true)); // PLANT GROWING

                from.SendGump(new MainPlantGump(m_Plant));

                break;
            }

            case 12:     // Empty the bowl
            {
                from.SendGump(new EmptyTheBowlGump(m_Plant));

                break;
            }
            }
        }