Esempio n. 1
0
        public override void OnResponse(NetState sender, RelayInfo info)
        {
            if (m_From == null || m_PlantBowl == null)
            {
                return;
            }
            if (m_From.Deleted || !m_From.Alive || m_PlantBowl.Deleted)
            {
                return;
            }

            if (!m_From.InRange(m_PlantBowl.GetWorldLocation(), 2))
            {
                m_From.SendMessage("You are too far away to access that.");
                return;
            }

            bool closeGump = true;

            switch (info.ButtonID)
            {
            //Harvest or Add Ingredient
            case 1:
                if (m_PlantBowl.ReadyForHarvest)
                {
                    m_PlantBowl.Harvest(m_From);
                }

                else
                {
                    m_PlantBowl.AddIngredient(m_From);
                }

                closeGump = false;
                break;

            //Launch Guide
            case 2:
                closeGump = false;
                break;
            }

            if (!closeGump)
            {
                m_From.CloseGump(typeof(PlantGump));
                m_From.SendGump(new PlantGump(m_From, m_PlantBowl));
            }
        }
Esempio n. 2
0
            protected override void OnTarget(Mobile from, object target)
            {
                if (!SpecialAbilities.Exists(from))
                {
                    return;
                }
                if (m_PlantBowl == null)
                {
                    return;
                }
                if (m_PlantBowl.Deleted)
                {
                    return;
                }

                IPoint3D location = target as IPoint3D;

                if (location == null)
                {
                    return;
                }

                Point3D targetLocation = new Point3D(location.X, location.Y, location.Z);

                if (target is Item)
                {
                    Item item = target as Item;

                    targetLocation = item.GetWorldLocation();
                }

                if (Utility.GetDistance(from.Location, targetLocation) > 2)
                {
                    from.SendMessage("That target is too far away.");
                    return;
                }

                if (!from.Map.InLOS(from.Location, targetLocation))
                {
                    from.SendMessage("That target is out of sight.");
                    return;
                }

                if (!from.InRange(m_PlantBowl.GetWorldLocation(), 2))
                {
                    from.SendMessage("You are too far away from your plant bowl to target that.");

                    from.CloseGump(typeof(PlantGump));
                    from.SendGump(new PlantGump(from, m_PlantBowl));

                    return;
                }

                //Need Seed
                if (m_PlantBowl.PlantSeed == null)
                {
                    if (target is PlantSeed)
                    {
                        PlantSeed plantSeed = target as PlantSeed;

                        m_PlantBowl.PlantSeed = plantSeed;
                        m_PlantBowl.PlantSeed.Internalize();

                        from.PlaySound(0x059);
                        from.SendMessage("You plant the seed into the plant bowl.");
                    }

                    else
                    {
                        from.SendMessage("That is not a plant seed.");
                    }

                    from.CloseGump(typeof(PlantGump));
                    from.SendGump(new PlantGump(from, m_PlantBowl));

                    return;
                }

                //Add Ingredients
                else
                {
                    //Water Container
                    if (IsWaterContainer(target))
                    {
                        if (m_PlantBowl.WaterValue == PlantPersistance.MaxWater)
                        {
                            from.SendMessage("That plant bowl is already at full water capacity.");
                        }

                        else if (m_PlantBowl.GetWaterFromContainer(from, target))
                        {
                            m_PlantBowl.WaterValue += PlantPersistance.WaterAddedPerUse;

                            if (m_PlantBowl.WaterValue > PlantPersistance.MaxWater)
                            {
                                m_PlantBowl.WaterValue = PlantPersistance.MaxWater;
                            }

                            from.PlaySound(0x4E);
                            from.SendMessage("You fill the plant bowl with some water.");
                        }

                        else
                        {
                            from.SendMessage("There is not enough water available to fill this plant bowl.");
                        }

                        from.CloseGump(typeof(PlantGump));
                        from.SendGump(new PlantGump(from, m_PlantBowl));

                        return;
                    }

                    //Soil Item
                    else if (target is SoilEnhancer)
                    {
                        SoilEnhancer soilEnhancer = target as SoilEnhancer;

                        if (m_PlantBowl.SoilQualityValue == PlantPersistance.MaxSoilQuality)
                        {
                            from.SendMessage("That plant bowl is at maximum soil richness.");
                        }

                        else if (m_PlantBowl.SoilQualityValue >= soilEnhancer.MaxSoilQuality)
                        {
                            from.SendMessage("That plant requires a higher quality soil enhancer to increase its soil richness further.");
                        }

                        else
                        {
                            m_PlantBowl.SoilQualityValue += soilEnhancer.SoilQualityIncrease;

                            if (m_PlantBowl.SoilQualityValue > soilEnhancer.MaxSoilQuality)
                            {
                                m_PlantBowl.SoilQualityValue = soilEnhancer.MaxSoilQuality;
                            }

                            from.PlaySound(Utility.RandomList(0x134, 0x133, 0x132, 0x131));
                            from.SendMessage("You increase the plant's soil richness.");

                            soilEnhancer.Charges--;

                            if (soilEnhancer.Charges == 0)
                            {
                                soilEnhancer.Delete();
                            }
                        }

                        from.CloseGump(typeof(PlantGump));
                        from.SendGump(new PlantGump(from, m_PlantBowl));

                        return;
                    }

                    else
                    {
                        from.SendMessage("You cannot add that as an ingredient to this plant bowl.");

                        from.CloseGump(typeof(PlantGump));
                        from.SendGump(new PlantGump(from, m_PlantBowl));

                        return;
                    }
                }
            }
Esempio n. 3
0
        public override void OnResponse(NetState sender, RelayInfo info)
        {
            if (m_Player == null)
            {
                return;
            }
            if (m_Player.Deleted)
            {
                return;
            }
            if (!m_Player.Alive)
            {
                return;
            }
            if (m_PlantBowl == null)
            {
                return;
            }
            if (m_PlantBowl.Deleted)
            {
                return;
            }

            if (!m_Player.InRange(m_PlantBowl.GetWorldLocation(), 2))
            {
                m_Player.SendMessage("You are too far away to access that.");
                return;
            }

            bool closeGump = true;

            switch (info.ButtonID)
            {
            //Guide
            case 1:
                closeGump = false;
                break;

            //Action
            case 2:
                if (m_PlantBowl.ReadyForHarvest)
                {
                    m_PlantBowl.Harvest(m_Player);
                }

                else
                {
                    m_PlantBowl.AddIngredient(m_Player);
                }

                closeGump = false;
                break;
            }

            if (!closeGump)
            {
                m_Player.CloseGump(typeof(PlantGump));
                m_Player.SendGump(new PlantGump(m_Player, m_PlantBowl));
            }

            else
            {
                m_Player.PlaySound(closeGumpSound);
            }
        }