Ejemplo n.º 1
0
        public XElement Serialize(string tagName)
        {
            if (tagName == null)
            {
                throw new ArgumentNullException("tagName");
            }

            XElement root = new XElement(tagName);

            if (!NoRankRestriction)
            {
                root.Add(new XElement("minRank", MinRank.GetFullName()));
            }
            //root.Add( new XElement( "maxRank", maxRank ) );

            lock ( playerPermissionListLock ) {
                foreach (string playerName in includedPlayers.Keys)
                {
                    root.Add(new XElement("included", playerName));
                }
                foreach (string playerName in excludedPlayers.Keys)
                {
                    root.Add(new XElement("excluded", playerName));
                }
            }
            return(root);
        }
Ejemplo n.º 2
0
        public void PrintDescription(Player player, IClassy target, string noun, string verb)
        {
            if (player == null)
            {
                throw new ArgumentNullException("player");
            }
            if (target == null)
            {
                throw new ArgumentNullException("target");
            }
            if (noun == null)
            {
                throw new ArgumentNullException("noun");
            }
            if (verb == null)
            {
                throw new ArgumentNullException("verb");
            }
            PlayerListCollection list = ExceptionList;

            noun = Char.ToUpper(noun[0]) + noun.Substring(1);     // capitalize first letter

            StringBuilder message = new StringBuilder();

            if (NoRankRestriction)
            {
                message.AppendFormat("{0} {1}&S can be {2} by anyone",
                                     noun, target.GetClassyName(), verb);
            }
            else
            {
                message.AppendFormat("{0} {1}&S can only be {2} by {3}+&S",
                                     noun, target.GetClassyName(),
                                     verb, MinRank.GetClassyName());
            }

            if (list.Included.Length > 0)
            {
                message.AppendFormat(" and {0}&S", list.Included.JoinToClassyString());
            }

            if (list.Excluded.Length > 0)
            {
                message.AppendFormat(", except {0}", list.Excluded.JoinToClassyString());
            }

            message.Append('.');
            player.Message(message.ToString());
        }