示例#1
0
 public bool IsInherited(int m)
 {
     if (Base.Contains(m))
     {
         return(false);
     }
     return(Special.Contains(m) || Egg.Contains(m) || LevelUp.Contains(m) || TMHM.Contains(m) || Tutor.Contains(m));
 }
示例#2
0
        public void TestQuoteString()
        {
            // String that goes through unscathed.
            string s = Session.QuoteString("xxx");

            Assert.AreEqual("xxx", s);

            // Strings that just need double quotes.
            s = Session.QuoteString("hello there"); // space
            Assert.AreEqual("\"hello there\"", s);
            s = Session.QuoteString("a,b");         // comma
            Assert.AreEqual("\"a,b\"", s);
            s = Session.QuoteString("a(b");         // left paren
            Assert.AreEqual("\"a(b\"", s);
            s = Session.QuoteString("a)b");         // right paren
            Assert.AreEqual("\"a)b\"", s);

            // Strings that need backslashes.
            s = Session.QuoteString("a\"b");  // double quote
            Assert.AreEqual("\"a\\\"b\"", s);
            s = Session.QuoteString(@"a\nb"); // backslash
            Assert.AreEqual("\"a\\\\nb\"", s);

            // Backslashes that are left alone.
            s = Session.QuoteString(@"a\nb", quoteBackslashes: false);
            Assert.AreEqual("\"a\\nb\"", s);

            // More than one of something, to make sure the whole string is scanned.
            s = Session.QuoteString("My, my (oh!) \"foo\"\\n");
            Assert.AreEqual("\"My, my (oh!) \\\"foo\\\"\\\\n\"", s);

            // Now the whole ASCII-7 character set, except the special characters, to make sure nothing else is molested.
            const string Special = "\" ,()\\";
            string       ascii7  = string.Empty;

            for (int i = 33; i < 127; i++)
            {
                if (!Special.Contains((char)i))
                {
                    ascii7 += (char)i;
                }
            }

            s = Session.QuoteString(ascii7);
            Assert.AreEqual(ascii7, s);

            // Verify that known control characters are expanded and quotes are added.
            s = Session.QuoteString("hello\r\n\f\t\b");
            Assert.AreEqual("\"hello\\r\\n\\f\\t\\b\"", s);

            // Verify that other control characters are rejected.
            Assert.Throws <ArgumentException>(() => Session.QuoteString("hello\x7fthere"));
        }
        public Item GetAttachedItem()
        {
            Item item = Item.CopyItemFromDictionary(ItemID);

            // Quick fix to restore scribed scroll information.
            if (item.baseType == Globals.eItemBaseType.Scroll && Special.Contains("longDesc:"))
            {
                item = Autonomy.ItemBuilding.ScrollManager.CreateSpellScroll(Special);
            }
            else
            {
                item.special = Special;
            }

            item.attunedID   = AttunedID;
            item.coinValue   = CoinValue;
            item.charges     = Charges;
            item.attuneType  = AttuneType;
            item.figExp      = FigExp;
            item.timeCreated = TimeCreated;
            item.whoCreated  = WhoCreated;
            return(item);
        }
示例#4
0
 public bool IsInherited(int m) => !Base.Contains(m) || Special.Contains(m) ||
 Egg.Contains(m) || LevelUp.Contains(m) ||
 TMHM.Contains(m) || Tutor.Contains(m);