Пример #1
0
        private void AddPotion(Mobile from, params PotionEffect[] effects)
        {
            Item item = GetPotion(from, effects);

            if (item != null)
            {
                m_Plant.Pour(from, item);
            }
            else
            {
                int message;
                if (m_Plant.ApplyPotion(effects[0], true, out message))
                {
                    from.SendLocalizedMessage(1061884);                       // You don't have any strong potions of that type in your pack.

                    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~.

                    return;
                }
                else
                {
                    m_Plant.LabelTo(from, message);
                }
            }

            from.SendGump(new MainPlantGump(m_Plant));
        }
Пример #2
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);
     }
 }
Пример #3
0
        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;
            }
            }
        }
Пример #4
0
        public override void OnResponse(NetState sender, RelayInfo info)
        {
            var 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.NetState.SendDisplayHelpTopic(HelpTopic.InfestationLevel);

                from.SendGump(new MainPlantGump(m_Plant));

                break;
            }

            case 3:     // Fungus
            {
                from.NetState.SendDisplayHelpTopic(HelpTopic.FungusLevel);

                from.SendGump(new MainPlantGump(m_Plant));

                break;
            }

            case 4:     // Poison
            {
                from.NetState.SendDisplayHelpTopic(HelpTopic.PoisonLevel);

                from.SendGump(new MainPlantGump(m_Plant));

                break;
            }

            case 5:     // Disease
            {
                from.NetState.SendDisplayHelpTopic(HelpTopic.DiseaseLevel);

                from.SendGump(new MainPlantGump(m_Plant));

                break;
            }

            case 6:     // Water
            {
                var bev = from.Backpack.FindItemsByType <BaseBeverage>()
                          .Find(
                    beverage =>
                    beverage.IsEmpty && beverage.Pourable && beverage.Content == BeverageType.Water
                    );

                if (bev == null)
                {
                    from.Target = new PlantPourTarget(m_Plant);
                    from.SendLocalizedMessage(
                        1060808,
                        $"#{m_Plant.GetLocalizedPlantStatus()}"
                        );     // Target the container you wish to use to water the ~1_val~.
                }
                else
                {
                    m_Plant.Pour(from, bev);
                }

                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.NetState.SendDisplayHelpTopic(HelpTopic.PlantGrowing);

                from.SendGump(new MainPlantGump(m_Plant));

                break;
            }

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

                break;
            }
            }
        }