Esempio n. 1
0
        public override void OnResponse(NetState sender, RelayInfo info)
        {
            var from = sender.Mobile;

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

            if (info.ButtonID == 3 && !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:     // Cancel
            {
                from.SendGump(new ReproductionGump(m_Plant));

                break;
            }

            case 2:                                        // Help
            {
                from.Send(new DisplayHelpTopic(70, true)); // DECORATIVE MODE

                from.SendGump(new SetToDecorativeGump(m_Plant));

                break;
            }

            case 3:     // Ok
            {
                m_Plant.PlantStatus = PlantStatus.DecorativePlant;
                m_Plant.LabelTo(
                    from,
                    1053077
                    );     // You prune the plant. This plant will no longer produce resources or seeds, but will require no upkeep.

                break;
            }
            }
        }
Esempio n. 2
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;
            }
            }
        }
Esempio n. 3
0
        protected override void OnTarget(Mobile from, object targeted)
        {
            if (!m_Plant.Deleted && m_Plant.PlantStatus < PlantStatus.DecorativePlant && from.InRange(m_Plant.GetWorldLocation(), 3))
            {
                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.
                }
                else 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
                {
                    PlantItem targ = targeted as PlantItem;

                    if (targ == null || targ.PlantStatus >= PlantStatus.DecorativePlant || targ.PlantStatus <= PlantStatus.BowlOfDirt)
                    {
                        m_Plant.LabelTo(from, 1053070);                           // You can only pollinate other specially grown plants!
                    }
                    else if (!targ.IsUsableBy(from))
                    {
                        targ.LabelTo(from, 1061856);                           // You must have the item in your backpack or locked down in order to use it.
                    }
                    else if (!targ.IsCrossable)
                    {
                        targ.LabelTo(from, 1053073);                           // You cannot cross-pollinate with a mutated plant!
                    }
                    else if (!targ.PlantSystem.PollenProducing)
                    {
                        targ.LabelTo(from, 1053074);                           // This plant is not in the flowering stage. You cannot pollinate it!
                    }
                    else if (targ.PlantSystem.Health < PlantHealth.Healthy)
                    {
                        targ.LabelTo(from, 1053075);                           // You cannot pollinate an unhealthy plant!
                    }
                    else if (targ.PlantSystem.Pollinated)
                    {
                        targ.LabelTo(from, 1053072);                           // This plant has already been pollinated!
                    }
                    else if (targ == m_Plant)
                    {
                        targ.PlantSystem.Pollinated = true;
                        targ.PlantSystem.SeedType   = m_Plant.PlantType;
                        targ.PlantSystem.SeedHue    = m_Plant.PlantHue;

                        targ.LabelTo(from, 1053071);                           // You pollinate the plant with its own pollen.
                    }
                    else
                    {
                        targ.PlantSystem.Pollinated = true;
                        targ.PlantSystem.SeedType   = PlantTypeInfo.Cross(m_Plant.PlantType, targ.PlantType);
                        targ.PlantSystem.SeedHue    = PlantHueInfo.Cross(m_Plant.PlantHue, targ.PlantHue);

                        targ.LabelTo(from, 1053076);                           // You successfully cross-pollinate the plant.
                    }
                }
            }
        }
Esempio n. 4
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 == 3 && !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:                     // Cancel
            {
                from.SendGump(new MainPlantGump(m_Plant));

                break;
            }

            case 2:                                        // Help
            {
                from.Send(new DisplayHelpTopic(71, true)); // EMPTYING THE BOWL

                from.SendGump(new EmptyTheBowlGump(m_Plant));

                break;
            }

            case 3:                     // Ok
            {
                PlantBowl bowl = new PlantBowl();

                if (!from.PlaceInBackpack(bowl))
                {
                    bowl.Delete();

                    m_Plant.LabelTo(from, 1053047);                                       // You cannot empty a bowl with a full pack!
                    from.SendGump(new MainPlantGump(m_Plant));

                    break;
                }

                if (m_Plant.PlantStatus != PlantStatus.BowlOfDirt && m_Plant.PlantStatus < PlantStatus.Plant)
                {
                    Seed seed = new Seed(m_Plant.PlantType, m_Plant.PlantHue, m_Plant.ShowType);

                    if (!from.PlaceInBackpack(seed))
                    {
                        bowl.Delete();
                        seed.Delete();

                        m_Plant.LabelTo(from, 1053047);                                           // You cannot empty a bowl with a full pack!
                        from.SendGump(new MainPlantGump(m_Plant));

                        break;
                    }
                }

                m_Plant.Delete();

                break;
            }
            }
        }
        protected override void OnTargetFinish(Mobile from)
        {
            if (!m_Plant.Deleted && m_Plant.PlantStatus < PlantStatus.DecorativePlant && from.InRange(m_Plant.GetWorldLocation(), 3) && m_Plant.IsUsableBy(from))
            {
                if (from.HasGump(typeof(MainPlantGump)))
                {
                    from.CloseGump(typeof(MainPlantGump));
                }

                from.SendGump(new MainPlantGump(m_Plant));
            }
        }
Esempio n. 6
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 || !from.InRange(m_Plant.GetWorldLocation(), 3))
            {
                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
            {
                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~.

                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;
            }
            }
        }
Esempio n. 7
0
        public override void OnResponse(NetState sender, RelayInfo info)
        {
            var from = sender.Mobile;

            if (info.ButtonID == 0 || m_Plant.Deleted || m_Plant.PlantStatus is >= PlantStatus.DecorativePlant or 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.NetState.SendDisplayHelpTopic(HelpTopic.PollinationState);

                from.SendGump(new ReproductionGump(m_Plant));

                break;
            }

            case 4:     // Resources
            {
                from.NetState.SendDisplayHelpTopic(HelpTopic.ResourceProduction);

                from.SendGump(new ReproductionGump(m_Plant));

                break;
            }

            case 5:     // Seeds
            {
                from.NetState.SendDisplayHelpTopic(HelpTopic.SeedProduction);

                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)
                {
                    // You cannot gather pollen from a plant in this stage of development!
                    m_Plant.LabelTo(from, 1053051);
                }
                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
            {
                var resInfo = PlantResourceInfo.GetInfo(m_Plant.PlantType, m_Plant.PlantHue);
                var 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
                {
                    var resource = resInfo.CreateResource();

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

                from.SendGump(new ReproductionGump(m_Plant));

                break;
            }

            case 8:     // Gather seeds
            {
                var 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
                {
                    var 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();
                        // You attempt to gather as many seeds as you can hold, but your backpack is full.
                        m_Plant.LabelTo(from, 1053062);
                    }
                }

                from.SendGump(new ReproductionGump(m_Plant));

                break;
            }
            }
        }
Esempio n. 8
0
        public override void OnResponse(NetState sender, RelayInfo info)
        {
            Mobile from = sender.Mobile;

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

            if (info.ButtonID == 3 && !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:                     // Cancel
            {
                from.SendGump(new ReproductionGump(m_Plant));

                break;
            }

            case 2:                                        // Help
            {
                from.Send(new DisplayHelpTopic(70, true)); // DECORATIVE MODE

                from.SendGump(new SetToDecorativeGump(m_Plant));

                break;
            }

            case 3:                     // Ok
            {
                m_Plant.PlantStatus = PlantStatus.DecorativePlant;
                m_Plant.LabelTo(from, 1053077);                           // You prune the plant. This plant will no longer produce resources or seeds, but will require no upkeep.

                if (!m_Plant.RequiresUpkeep || m_Plant.MaginciaPlant)
                {
                    m_Plant.Movable = true;

                    if (m_Plant is MaginciaPlantItem)
                    {
                        ((MaginciaPlantItem)m_Plant).SetToDecorative = DateTime.Now;
                    }

                    if (from.Backpack != null)
                    {
                        from.Backpack.TryDropItem(from, m_Plant, false);
                    }

                    if (m_Plant is RaisedGardenPlantItem)
                    {
                        RaisedGardenPlantItem rp = m_Plant as RaisedGardenPlantItem;

                        if (rp.Component != null)
                        {
                            rp.Component.Plant = null;
                            rp.Component       = null;
                        }
                    }
                }

                break;
            }
            }
        }
        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;
            }
            }
        }