Ejemplo n.º 1
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                if (m_Parrot == null || m_Parrot.Deleted)
                {
                    return;
                }

                ParrotPerchAddon perch = null;

                if (targeted is ParrotPerchAddon)
                {
                    perch = targeted as ParrotPerchAddon;
                }
                else if (targeted is ParrotPerchAddonComponent)
                {
                    perch = ((ParrotPerchAddonComponent)targeted).Addon as ParrotPerchAddon;
                }

                if (perch != null)
                {
                    BaseHouse h = perch.MyHouse;

                    if (h == null || (h.Owner != from && !h.CoOwners.Contains(from)))
                    {
                        from.SendLocalizedMessage(1072618);                           // Parrots can only be placed on Parrot Perches in houses where you are an owner or co-owner.
                    }
                    else if (perch.Parrot != null)
                    {
                        from.SendLocalizedMessage(1072616);                           // That Parrot Perch already has a Parrot.
                    }
                    else
                    {
                        Parrot parrot = new Parrot(m_Parrot.Hue);

                        parrot.MoveToWorld(new Point3D(perch.Location.X, perch.Location.Y, perch.Location.Z + 11), perch.Map);

                        perch.Parrot = parrot;
                        parrot.Perch = perch;

                        m_Parrot.Delete();
                    }
                }
                else
                {
                    from.SendLocalizedMessage(1072614);                       // You must place the Parrot on a Parrot Perch.
                }
            }