public Dictionary <string, SpellList> ParseClassSpells()
        {
            List <string> classNames = _sbCheckerBaseInput.CharacterClasses.GetClassNames();
            SpellList     spellList;

            _classSpells = new Dictionary <string, SpellList>();
            Dictionary <string, int>    classPos    = new Dictionary <string, int>(); //class name, class string position
            Dictionary <string, string> spellBlocks = new Dictionary <string, string>();
            bool hasRacialSpells = _sbCheckerBaseInput.Race_Base.RaceSB.SpellsKnown.Length > 0;

            try
            {
                string className = string.Empty;
                FindSpellsKnown(classNames, classPos, spellBlocks, hasRacialSpells);

                //spells prepared
                FindSpellsPrepared(classNames, ref classPos, spellBlocks, hasRacialSpells);

                //extracts prepared
                FindExtractsPrepared(classNames, ref classPos, spellBlocks, hasRacialSpells);

                if (!classNames.Any() && _sbCheckerBaseInput.MonsterSB.SpellsPrepared.Length > 0)
                {
                    spellList = new SpellList();
                    spellList.ParseSpellList(_sbCheckerBaseInput.MonsterSB.SpellsPrepared, _sbCheckerBaseInput.SourceSuperScripts);
                    if (spellList.Errors.Length > 0)
                    {
                        _sbCheckerBaseInput.MessageXML.AddFail("Spells Prepared-" + className, spellList.Errors);
                    }
                    string temp2 = spellList.Source.Substring(0, spellList.Source.IndexOf(PathfinderConstants.SPACE)).Trim();
                    _classSpells.Add(temp2, spellList);
                }

                if (!classNames.Any() && _sbCheckerBaseInput.MonsterSB.SpellsKnown.Length > 0)
                {
                    spellList = new SpellList();
                    spellList.ParseSpellList(_sbCheckerBaseInput.MonsterSB.SpellsKnown, _sbCheckerBaseInput.SourceSuperScripts);
                    if (spellList.Errors.Length > 0)
                    {
                        _sbCheckerBaseInput.MessageXML.AddFail("Spells Known-" + className, spellList.Errors);
                    }
                    string temp2 = spellList.Source.Substring(0, spellList.Source.IndexOf(PathfinderConstants.SPACE)).Trim();
                    _classSpells.Add(temp2, spellList);
                }
            }
            catch (Exception ex)
            {
                _sbCheckerBaseInput.MessageXML.AddFail("ParseClassSpells", ex.Message);
            }

            return(_classSpells);
        }
        private void FindExtractsPrepared(List <string> classNames, ref Dictionary <string, int> classPos,
                                          Dictionary <string, string> spellBlocks, bool hasRacialSpells)
        {
            if (_sbCheckerBaseInput.MonsterSB.ExtractsPrepared.Length == 0)
            {
                return;
            }

            int beforeCount = classPos.Count;

            FindClassSpellStringPositions(classNames, classPos, _sbCheckerBaseInput.MonsterSB.ExtractsPrepared, hasRacialSpells);

            if (classPos.Count == beforeCount)
            {
                _sbCheckerBaseInput.MessageXML.AddFail("ExtractsPrepared", "Can't find ExtractsPrepared spellBlock");
            }

            string hold = GetSpellBlockText(classPos, ref spellBlocks, "Extracts");

            string    className, spellsHold, spellBlock;
            SpellList spellList;

            foreach (KeyValuePair <string, string> kvp in spellBlocks)
            {
                className  = kvp.Key;
                spellsHold = kvp.Value;
                spellBlock = GetOneSpellBlock(ref spellsHold, className, classNames);

                spellList = new SpellList();
                spellList.ParseSpellList(spellBlock, _sbCheckerBaseInput.SourceSuperScripts);
                if (spellList.Errors.Length > 0)
                {
                    _sbCheckerBaseInput.MessageXML.AddFail("Extracts Prepared-" + className, spellList.Errors);
                }
                if (!_classSpells.ContainsKey(className))
                {
                    _classSpells.Add(className, spellList);
                }
            }
        }
        private void FindSpellsKnown(List <string> classNames,
                                     Dictionary <string, int> classPos, Dictionary <string, string> spellBlocks, bool hasRacialSpells)
        {
            string spellBlock;

            if (_sbCheckerBaseInput.MonsterSB.SpellsKnown.Length == 0)
            {
                return;
            }

            //spells known
            FindClassSpellStringPositions(classNames, classPos, _sbCheckerBaseInput.MonsterSB.SpellsKnown, hasRacialSpells);
            if (!classPos.Any())
            {
                _sbCheckerBaseInput.MessageXML.AddFail("SpellsKnown", "Can't find SpellsKnown spellBlock");
            }

            string    hold = GetSpellBlockText(classPos, ref spellBlocks, "Known");
            string    className, spellsHold;
            SpellList spellList;

            foreach (KeyValuePair <string, string> kvp in spellBlocks)
            {
                className  = kvp.Key;
                spellsHold = kvp.Value;
                spellBlock = GetOneSpellBlock(ref spellsHold, className, classNames);

                spellList = new SpellList();
                spellList.ParseSpellList(spellBlock, _sbCheckerBaseInput.SourceSuperScripts);
                if (spellList.Errors.Length > 0)
                {
                    _sbCheckerBaseInput.MessageXML.AddFail("Class Spells-" + className, spellList.Errors);
                }
                _classSpells.Add(className, spellList);
            }
        }