예제 #1
0
파일: Seed.cs 프로젝트: zerodowned/Ulmeta
            protected override void OnTarget(Mobile from, object targeted)
            {
                if (m_Seed.Deleted)
                {
                    return;
                }

                if (!m_Seed.IsChildOf(from.Backpack))
                {
                    from.SendLocalizedMessage(1042664);                       // You must have the object in your backpack to use it.
                    return;
                }

                if (targeted is PlantItem)
                {
                    PlantItem plant = (PlantItem)targeted;

                    plant.PlantSeed(from, m_Seed);
                }
                else if (targeted is Item)
                {
                    ((Item)targeted).LabelTo(from, 1061919);                       // You must use a seed on a bowl of dirt!
                }
                else
                {
                    from.SendLocalizedMessage(1061919);                       // You must use a seed on a bowl of dirt!
                }
            }
예제 #2
0
파일: Seed.cs 프로젝트: zmazza/ServUO
            protected override void OnTarget(Mobile from, object targeted)
            {
                if (m_Seed.Deleted)
                {
                    return;
                }

                if (!m_Seed.IsChildOf(from.Backpack))
                {
                    from.SendLocalizedMessage(1042664); // You must have the object in your backpack to use it.
                    return;
                }

                if (targeted is PlantItem)
                {
                    PlantItem plant = (PlantItem)targeted;

                    plant.PlantSeed(from, m_Seed);
                }
                else if (targeted is GardenAddonComponent)
                {
                    GardenAddonComponent addon = (GardenAddonComponent)targeted;

                    if (addon.Plant != null)
                    {
                        from.SendLocalizedMessage(1150367); // This plot already has a plant!
                    }
                    else
                    {
                        Multis.BaseHouse house = Multis.BaseHouse.FindHouseAt(addon);

                        if (house != null)
                        {
                            int fertileDirt = from.Backpack == null ? 0 : from.Backpack.GetAmount(typeof(FertileDirt), false);

                            if (fertileDirt > 0)
                            {
                                from.SendGump(new FertileDirtGump(m_Seed, fertileDirt, addon));
                            }
                            else
                            {
                                RaisedGardenPlantItem dirt = new RaisedGardenPlantItem();
                                dirt.MoveToWorld(new Point3D(addon.X, addon.Y, addon.Z + 5), addon.Map);

                                dirt.PlantSeed(from, m_Seed);
                                addon.Plant    = dirt;
                                dirt.Component = addon;
                            }
                        }
                    }
                }
                else if (targeted is Item)
                {
                    ((Item)targeted).LabelTo(from, 1061919); // You must use a seed on a bowl of dirt!
                }
                else
                {
                    from.SendLocalizedMessage(1061919); // You must use a seed on a bowl of dirt!
                }
            }
예제 #3
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                if (m_Seed.Deleted)
                {
                    return;
                }

                if (!m_Seed.IsChildOf(from.Backpack))
                {
                    from.SendAsciiMessage("You must have the object in your backpack to use it.");
                    return;
                }

                if (targeted is PlantItem)
                {
                    PlantItem plant = (PlantItem)targeted;

                    plant.PlantSeed(from, m_Seed);
                }
                else if (targeted is Item)
                {
                    ((Item)targeted).LabelTo(from, "You must use a seed on a bowl of dirt!");
                }
                else
                {
                    from.SendAsciiMessage("You must use a seed on a bowl of dirt!");
                }
            }