DND_Monster.Ability.WebSpellBlockFormat_NotInnate C# (CSharp) Method

WebSpellBlockFormat_NotInnate() public method

public WebSpellBlockFormat_NotInnate ( ) : string
return string
        public string WebSpellBlockFormat_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 += "<p>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 += "<p>" + i + suffix + " level (" + spellSlots.Split(',')[i - 1] + " slots): ";
                }

                returnstring += "<i>";

                bool addedData = false;
                foreach (string item in spells)
                {
                    if (item.Contains(i + ":"))
                    {
                        if (!String.IsNullOrEmpty(item) || !String.IsNullOrWhiteSpace(item))
                        {
                            returnstring += item.Replace(i + ":", "").Replace("(", "</i>(").Replace(")", ")<i>") + ", ";
                            addedData = true;
                        }
                    }
                }
                if (addedData) { returnstring = returnstring.Substring(0, returnstring.Length - 2); }
                returnstring += "</i></br>" + "</p>";
            }

            return returnstring;
        }