Ejemplo n.º 1
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)
            {
                GardenBedPlantItem dirt = new GardenBedPlantItem(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();
            }
        }
Ejemplo n.º 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;
            }

            if (m_AttachTo is GardenAddonComponent comp && m_Seed != null)
            {
                GardenBedPlantItem dirt = new GardenBedPlantItem(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);
            }
Ejemplo n.º 3
0
            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 plant)
                {
                    plant.PlantSeed(from, m_Seed);
                }
                else if (targeted is GardenAddonComponent addon)
                {
                    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
                            {
                                GardenBedPlantItem dirt = new GardenBedPlantItem();
                                dirt.MoveToWorld(new Point3D(addon.X, addon.Y, addon.Z + addon.ZLocation()), 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!
                }
            }