Ejemplo n.º 1
0
 public FairyLanternTarget(Item i)
     : base(3, false, TargetFlags.None)
 {
     m_Potion = (FairyLantern)i;
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Called when a mobile double cliks on the item.
        /// </summary>
        /// <param name="from">The mobile who double clicked.</param>
        public override void OnDoubleClick(Mobile from)
        {
            if (!Movable)
            {
                return;
            }

            if (from.InRange(this.GetWorldLocation(), 2) == false)
            {
                from.SendLocalizedMessage(500486);      //That is too far away.
                return;
            }
            else if (m_link == null || m_link.Deleted)
            {
                from.SendMessage("Unfortunelately, your pet is lost forever in faerie realms.");
                return;
                //Basically just an "In case something happened"  Thing so Server don't crash.
            }
            else if (!from.CheckAlive())
            {
                from.SendLocalizedMessage(1060190);     //You cannot do that while dead!
            }
            else if (from.Followers + m_link.ControlSlots > from.FollowersMax)
            {
                from.SendMessage("You have too many followers to unshrink that creature.");
                return;
            }
            else
            {
                bool alreadyOwned = m_link.Owners.Contains(from);
                if (!alreadyOwned)
                {
                    m_link.Owners.Add(from);
                }

                m_link.SetControlMaster(from);
                m_toDeletePet = false;

                m_link.Location = from.Location;

                m_link.Map = from.Map;

                m_link.ControlTarget = from;

                m_link.ControlOrder = OrderType.Follow;

                if (m_link.Summoned)
                {
                    m_link.SummonMaster = from;
                }

                if (m_WonderfullyHappyOnUnshrink)
                {
                    m_link.Loyalty = 100;
                }

                m_link.IsBonded = (m_link.IsBonded && from == BondOwner);

                this.Delete();
                Item NewLantern = new FairyLantern();

                if (from != null)
                {
                    from.SendMessage("You release the creature");
                    if (!from.AddToBackpack(NewLantern))
                    {
                        NewLantern.MoveToWorld(new Point3D(from.X, from.Y, from.Z), from.Map);
                        from.SendMessage("Your backpack is full so the fairy lantern falls to the ground");
                    }
                }
                else
                {
                    NewLantern.MoveToWorld(new Point3D(from.X, from.Y, from.Z), from.Map);  // place lantern at current location
                }
            }
        }