Exemple #1
0
        public static string ReplaceOriginalWeaponNames(string text, bool uppercase)
        {
            string returnText = text;

            foreach (Weapon weapon in Weapons.Values)
            {
                if (weapon.OriginalName != null)
                {
                    string name = weapon.Name;

                    if (uppercase)
                    {
                        name = StringCapitalizer.Capitalize(name);
                    }
                    else
                    {
                        name = name.ToLower();
                    }

                    returnText = new Regex(Regex.Escape(weapon.OriginalName), RegexOptions.IgnoreCase).Replace(returnText, name);
                }
            }

            return(returnText);
        }
Exemple #2
0
        private static SpellInfo ParseSpell(Match spell, SpellInfo prevInfo)
        {
            string spellname = spell.Groups["spellname"].Value.TrimEnd(new char[] { 'D', ' ' });

            spellname = StringCapitalizer.Capitalize(spellname).Trim();

            SpellInfo spellInfo = null;

            if ((String.Compare(spellname, "lesser", true) == 0 ||
                 String.Compare(spellname, "greater", true) == 0) && prevInfo != null)
            {
                spellInfo = prevInfo;
                spellname = spellInfo.Name + ", " + spellname;
            }
            else
            {
                spellInfo = new SpellInfo();
            }

            spellInfo.Count = spell.IntValue("spellcount");

            spellInfo.Name = spellname;

            spellInfo.Spell = Spell.ByName(spellname);

            spellInfo.DC = spell.IntValue("DC");

            if (spell.Groups["spellcast"].Success)
            {
                if (String.Compare(spell.Groups["spellcast"].Value, "already", true) == 0)
                {
                    spellInfo.AlreadyCast = true;
                }
                else
                {
                    spellInfo.Cast = spell.IntValue("spellcast");
                }
            }

            if (spell.Groups["othertext"].Success)
            {
                spellInfo.Other = spell.Groups["othertext"].Value;
            }

            if (spell.Groups["onlytext"].Success)
            {
                spellInfo.Only = spell.Groups["onlytext"].Value;
            }


            if (spell.Groups["superscript"].Success)
            {
                string superscript = spell.Groups["superscript"].Value;
                if (superscript.Contains("M"))
                {
                    spellInfo.Mythic = true;
                }
            }

            return(spellInfo);
        }
 public static String Capitalize(this String text)
 {
     return(StringCapitalizer.Capitalize(text));
 }