Ejemplo n.º 1
0
        public override string OnIdentify(Mobile from)
        {
            string msg      = null;
            int    nSockets = 0;

            // first see if the target has any existing sockets

            XmlSockets s = XmlAttach.FindAttachment(this.AttachedTo, typeof(XmlSockets)) as XmlSockets;

            if (s != null)
            {
                // find out how many sockets it has
                nSockets = s.NSockets;
            }

            if (nSockets > this.MaxSockets)
            {
                this.m_MaxSockets = nSockets;
            }

            if (this.MaxSockets == nSockets)
            {
                // already full so no chance of socketing
                return("Cannot be socketed any further.");
            }

            if (this.MaxSockets > 0)
            {
                msg = String.Format("Maximum sockets allowed is {0}.", this.MaxSockets);
            }
            else if (this.MaxSockets == 0)
            {
                return("You cannot add sockets to this.");
            }
            else if (this.MaxSockets == -1)
            {
                msg = String.Format("Can be socketed.");
            }

            // compute difficulty based upon existing sockets

            if (from != null)
            {
                if (this.MinSkillLevel > 0)
                {
                    msg += String.Format("\nRequires {0} skill in {1} to socket.", this.MinSkillLevel, this.RequiredSkill);
                }

                if (this.MinSkillLevel2 > 0)
                {
                    msg += String.Format("\nas well as {0} skill in {1} to socket.", this.MinSkillLevel2, this.RequiredSkill2);
                }

                if (this.RequiredResource != null && this.ResourceQuantity > 0)
                {
                    msg += String.Format("\nSocketing consumes {0} {1}.", this.ResourceQuantity, this.RequiredResource.Name);
                }

                int success = XmlSockets.ComputeSuccessChance(from, nSockets, this.MinSkillLevel, this.RequiredSkill, this.MinSkillLevel2, this.RequiredSkill2);

                msg += String.Format("\n{0}% chance of socketing\n", success);
            }

            return(msg);
        }