Пример #1
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.
                    }
                }
            }
Пример #2
0
            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.
                    }
                }
            }