示例#1
0
 private static void DisplaySingleBook(MudObject Actor, RuleSet From, String BookName)
 {
     if (From == null || From.FindRuleBook(BookName) == null)
     {
         Core.SendMessage(Actor, "[no rules]");
     }
     else
     {
         var book = From.FindRuleBook(BookName);
         DisplayBookHeader(Actor, book);
         foreach (var rule in book.Rules)
         {
             Core.SendMessage(Actor, rule.DescriptiveName == null ? "[Unnamed rule]" : rule.DescriptiveName);
         }
     }
 }
示例#2
0
        /// <summary>
        /// Do the types supplied match the types defined on an already declared global rulebook?
        /// Derived types 'match' their ancestor for the purposes of this function.
        /// </summary>
        /// <param name="Name"></param>
        /// <param name="ResultType"></param>
        /// <param name="ArgumentCount"></param>
        /// <returns></returns>
        internal bool TypesAgreeWithDeclaredGlobalRuleBook(String Name, Type ResultType, int ArgumentCount)
        {
            if (Rules == null)
            {
                return(true);               // This means that rules were declared before global rulebooks were discovered. Queueing prevents this from happening.
            }
            var book = Rules.FindRuleBook(Name);

            if (book == null)
            {
                return(true);
            }

            if (book.ResultType != ResultType)
            {
                return(false);
            }
            if (book.ArgumentCount != ArgumentCount)
            {
                return(false);
            }

            return(true);
        }