DND_Monster.Ability.TextSpellBlockFormat_NotInnate C# (CSharp) Method

TextSpellBlockFormat_NotInnate() public method

public TextSpellBlockFormat_NotInnate ( ) : string
return string
        public string TextSpellBlockFormat_NotInnate()
        {
            if (!isSpell) return "";

            string returnstring = "";
            string spellSlots = Description.Split('|')[4];
            string[] spells = Description.Split('|')[5].Split(',');

            for (int i = 0; i < 10; i++)
            {
                if (i > 0 && Convert.ToInt16(spellSlots.Split(',')[i - 1]) == 0)
                {
                    i = 10; break;
                }

                if (i == 0)
                {
                    returnstring += "- Cantrips (at will): ";
                }
                else
                {
                    string suffix = "";
                    switch (i)
                    {
                        case 1:
                            suffix = "st";
                            break;
                        case 2:
                            suffix = "nd";
                            break;
                        case 3:
                            suffix = "rd";
                            break;
                        default:
                            suffix = "th";
                            break;
                    }

                    returnstring += "- " + i + suffix + " level (" + spellSlots.Split(',')[i - 1] + " slots): ";
                }

                returnstring += "";

                bool addedData = false;
                foreach (string item in spells)
                {
                    if (item.Contains(i + ":"))
                    {
                        if (!String.IsNullOrEmpty(item) || !String.IsNullOrWhiteSpace(item))
                        {
                            returnstring += "*" + item.Replace(i + ":", "").Replace("(", "*(").Replace(")", ")") + "*, ";
                            addedData = true;
                        }
                    }
                }

                if (addedData) { returnstring = returnstring.Substring(0, returnstring.Length - 3); }
                returnstring += "*" + Environment.NewLine + Environment.NewLine;
            }

            return returnstring;
        }