示例#1
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!
                }
            }
示例#2
0
        public override void OnResponse(NetState state, RelayInfo info)
        {
            if (info.ButtonID == 0)
            {
                return;
            }

            Mobile from    = state.Mobile;
            bool   fertile = info.ButtonID == 1;

            if (fertile && (from.Backpack == null || !from.Backpack.ConsumeTotal(typeof(FertileDirt), 20, false)))
            {
                from.SendLocalizedMessage(1150366); // You don't have enough fertile dirt in the top level of your backpack.
                return;
            }

            GardenAddonComponent comp = m_AttachTo as GardenAddonComponent;
            LandTarget           lt   = m_AttachTo as LandTarget;

            if (comp != null && m_Seed != null)
            {
                RaisedGardenPlantItem dirt = new RaisedGardenPlantItem(fertile);
                dirt.MoveToWorld(new Point3D(comp.X, comp.Y, comp.Z + 5), comp.Map);
                dirt.Component = comp;
                comp.Plant     = dirt;
                dirt.PlantSeed(from, m_Seed);
            }
            else if (lt != null)
            {
                MaginciaPlantItem dirt = new MaginciaPlantItem(fertile);
                dirt.MoveToWorld(((LandTarget)m_AttachTo).Location, from.Map);
                dirt.Owner = from;
                dirt.StartTimer();
            }
        }
示例#3
0
        public override void OnResponse(NetState state, RelayInfo info)
        {
            if (info.ButtonID == 0)
                return;

            Mobile from = state.Mobile;
            bool fertile = info.ButtonID == 1;

            if (fertile && (from.Backpack == null || !from.Backpack.ConsumeTotal(typeof(FertileDirt), 20, false)))
            {
                from.SendLocalizedMessage(1150366); // You don't have enough fertile dirt in the top level of your backpack.
                return;
            }

            GardenAddonComponent comp = m_AttachTo as GardenAddonComponent;
            LandTarget lt = m_AttachTo as LandTarget;

            if (comp != null && m_Seed != null)
            {
                RaisedGardenPlantItem dirt = new RaisedGardenPlantItem(fertile);
                dirt.MoveToWorld(new Point3D(comp.X, comp.Y, comp.Z + 5), comp.Map);
                dirt.Component = comp;
                comp.Plant = dirt;
                dirt.PlantSeed(from, m_Seed);
            }
            else if (lt != null)
            {
                MaginciaPlantItem dirt = new MaginciaPlantItem(fertile);
                dirt.MoveToWorld(((LandTarget)m_AttachTo).Location, from.Map);
                dirt.Owner = from;
                dirt.StartTimer();
            }
        }
示例#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.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;
            }
            }
        }
示例#5
0
文件: Seed.cs 项目: Crome696/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 Server.Items.GardenAddonComponent)
                {
                    Server.Items.GardenAddonComponent addon = (Server.Items.GardenAddonComponent)targeted;

                    if (addon.Plant != null)
                        from.SendLocalizedMessage(1150367); // This plot already has a plant!
                    else
                    {
                        Server.Multis.BaseHouse house = Server.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!
                }
			}