Ejemplo n.º 1
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                if (targeted is MaginciaPlantItem)
                {
                    MaginciaPlantItem plant = (MaginciaPlantItem)targeted;

                    if (!plant.IsContract)
                    {
                        if (plant.ContractTime.Month == DateTime.UtcNow.Month)
                        {
                            from.SendLocalizedMessage(1155760); // You may do this once every other month.
                            return;
                        }

                        plant.ContractTime = DateTime.UtcNow;
                        from.SendLocalizedMessage(1155762); // You have hired a gardener to tend to your plant.  The gardener will no longer tend to your plant when server maintenance occurs after the expiration date of your gardening contract.  While a gardener is tending to your plant you will not have to care for it.
                        m_Item.Delete();
                    }
                    else
                    {
                        from.SendLocalizedMessage(1155761); // A Gardener is already tending to this plant.
                    }
                }
                else
                {
                    from.SendLocalizedMessage(1155759); // This item can only be used on New Magincia Gardening Plants.
                }
            }
Ejemplo n.º 2
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                if (!MaginciaPlantSystem.Enabled)
                {
                    from.SendMessage("Magincia plant placement is currently disabled.");
                    return;
                }

                Map map = from.Map;

                if (targeted is LandTarget && map != null)
                {
                    LandTarget lt = (LandTarget)targeted;
                    Region     r  = Region.Find(lt.Location, map);

                    if (r != null && r.IsPartOf("Magincia") && (lt.Name == "dirt" || lt.Name == "grass"))
                    {
                        if (MaginciaPlantSystem.CanAddPlant(from, lt.Location))
                        {
                            if (!MaginciaPlantSystem.CheckDelay(from))
                            {
                                return;
                            }
                            else if (from.Mounted || from.Flying)
                            {
                                from.SendLocalizedMessage(501864); // You can't mine while riding.
                            }
                            else if (from.IsBodyMod && !from.Body.IsHuman)
                            {
                                from.SendLocalizedMessage(501865); // You can't mine while polymorphed.
                            }
                            else
                            {
                                m_Hoe.UsesRemaining--;

                                from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1150492); // You till a small area to plant.
                                from.Animate(AnimationType.Attack, 3);

                                MaginciaPlantItem dirt = new MaginciaPlantItem
                                {
                                    Owner = from
                                };
                                dirt.StartTimer();

                                MaginciaPlantSystem.OnPlantPlanted(from, from.Map);

                                Timer.DelayCall(TimeSpan.FromSeconds(.7), new TimerStateCallback(MoveItem_Callback), new object[] { dirt, lt.Location, map });
                            }
                        }
                    }
                    else
                    {
                        from.SendLocalizedMessage(1150457); // The ground here is not good for gardening.
                    }
                }
            }
Ejemplo n.º 3
0
Archivo: Hoe.cs Proyecto: pallop/Servuo
            protected override void OnTarget(Mobile from, object targeted)
            {
                Map map = from.Map;

                if (targeted is LandTarget && map != null)
                {
                    LandTarget lt = (LandTarget)targeted;
                    Region     r  = Region.Find(lt.Location, map);

                    if (r != null && r.IsPartOf("Magincia") && (lt.Name == "dirt" || lt.Name == "grass"))
                    {
                        if (!MaginciaPlantSystem.Enabled)
                        {
                            from.SendMessage("Magincia plant placement is currently disabled.");
                        }
                        else if (MaginciaPlantSystem.CanAddPlant(from, lt.Location))
                        {
                            int fertileDirt = from.Backpack == null ? 0 : from.Backpack.GetAmount(typeof(FertileDirt), false);

                            if (fertileDirt > 0)
                            {
                                from.SendGump(new FertileDirtGump(null, fertileDirt, lt));
                            }
                            else
                            {
                                if (from.Body.IsHuman && !from.Mounted)
                                {
                                    from.Animate(11, 5, 1, true, false, 0);
                                }

                                from.PlaySound(0x125);

                                MaginciaPlantItem dirt = new MaginciaPlantItem();
                                dirt.StartTimer();

                                Timer.DelayCall(TimeSpan.FromSeconds(.7), new TimerStateCallback(MoveItem_Callback), new object[] { dirt, lt.Location, map });
                            }
                        }
                    }
                    else
                    {
                        from.SendLocalizedMessage(1150457); // The ground here is not good for gardening.
                    }
                }
            }