Exemplo n.º 1
0
 private static void GoToRoom(Squire squire)
 {
     squire.SetControlMaster(null);
     squire.SummonMaster = null;
     squire.Internalize();
     squire.Controlled = true;
 }
        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 (squire == null || squire.Deleted)
            {
                from.SendMessage("Your squire has been sold into slavery.");
                return;
            }
            else if (!from.CheckAlive())
            {
                from.SendLocalizedMessage(1060190);                     //You cannot do that while dead!
            }
            else if (from.Followers + squire.ControlSlots > from.FollowersMax)
            {
                from.SendMessage("You have too many followers to call your squire.");
                return;
            }
            else
            {
                bool alreadyOwned = squire.Owners.Contains(from);
                if (!alreadyOwned)
                {
                    squire.Owners.Add(from);
                }

                //Make the Squire belong to their master again.
                squire.SetControlMaster(from);
                m_KillTheSquire = false;

                //Bring the Squire to their master.
                squire.Location = from.Location;
                squire.Map      = from.Map;

                //Set the Squire to follow their master.
                squire.ControlTarget = from;
                squire.ControlOrder  = OrderType.Follow;

                //Just in case someone messed with the system.
                if (squire.Summoned)
                {
                    squire.SummonMaster = from;
                }

                this.Delete();
            }
        }