/// <summary>
        /// gets a list of spells for the choice of a given eldritch invocation
        /// </summary>
        /// <param name="invocation">selected eldritch invocation</param>
        public List <Spell> getInvocationSpellOptions(EldritchInvocation invocation)
        {
            List <Spell> spellList = new List <Spell>();

            if (invocation.Name == "Book of Ancient Secrets")
            {
                using (SQLiteConnection connection = new SQLiteConnection(ConnectionString))
                    using (SQLiteCommand command = new SQLiteCommand(connection))
                    {
                        connection.Open();
                        command.CommandText = "SELECT name, ritual, level, school, castTime, range, duration, components, materials, description FROM spells " +
                                              "INNER JOIN books ON books.bookid=spells.book " +
                                              "WHERE level = 1 AND ritual = 1 " +
                                              "AND books.title IN (@UsedBooks)";
                        SQLiteCommandExtensions.AddParametersWithValues(command, "@UsedBooks", UsedBooks);

                        using (SQLiteDataReader dbReader = command.ExecuteReader())
                        {
                            while (dbReader.Read())
                            {
                                if (!dbReader.IsDBNull(0))
                                {
                                    spellList.Add(new Spell(dbReader.GetString(0), dbReader.GetBoolean(1), dbReader.GetInt32(2), dbReader.GetString(3), dbReader.GetString(4), dbReader.GetString(5), dbReader.GetString(6), dbReader.GetString(6), dbReader.GetString(8), dbReader.GetString(9), false));
                                }
                            }
                        }
                    }
            }

            return(spellList);
        }
        /// <summary>
        /// gets a list of the additional cantrips the given subclass may choose from
        /// </summary>
        /// <param name="subclass">chosen subclass</param>
        public List <Spell> getExtraSubclassCantripOptions(string subclass)
        {
            List <Spell> cantripList = new List <Spell>();

            using (SQLiteConnection connection = new SQLiteConnection(ConnectionString))
                using (SQLiteCommand command = new SQLiteCommand(connection))
                {
                    connection.Open();
                    command.CommandText = "SELECT spells.name, spells.ritual, spells.level, spells.school, spells.castTime, spells.range, " +
                                          "spells.duration, spells.components, spells.materials, spells.description FROM spells " +
                                          "INNER JOIN books ON spells.book = books.bookid " +
                                          "WHERE spells.level = 0 " +
                                          "AND spells.classes LIKE \"%\" || " +
                                          "(SELECT classes.name FROM extraSubclassCantrips " +
                                          "INNER JOIN subclasses ON subclasses.subclassId = extraSubclassCantrips.subclassId " +
                                          "INNER JOIN classes ON classes.classid = extraSubclassCantrips.classId " +
                                          "WHERE subclasses.name = @Subclass) || \"%\" " +
                                          "AND books.title IN(@UsedBooks)";
                    command.Parameters.AddWithValue("@Subclass", subclass);
                    SQLiteCommandExtensions.AddParametersWithValues(command, "@UsedBooks", UsedBooks);

                    using (SQLiteDataReader dbReader = command.ExecuteReader())
                    {
                        while (dbReader.Read())
                        {
                            if (!dbReader.IsDBNull(0))
                            {
                                cantripList.Add(new Spell(dbReader.GetString(0), dbReader.GetBoolean(1), dbReader.GetInt32(2), dbReader.GetString(3), dbReader.GetString(4), dbReader.GetString(5), dbReader.GetString(6), dbReader.GetString(7), dbReader.GetString(8), dbReader.GetString(9), false));
                            }
                        }
                    }
                }

            return(cantripList);
        }
        ///// <summary>
        ///// gets a list of eldritch invocations the warlock may choose with the current level and pact choice
        ///// </summary>
        ///// <param name="warlockPact">chosen warlock pact</param>
        ///// <param name="level">current level</param>
        //public List<EldritchInvocation> getEldritchInvocations(WarlockPact warlockPact, int level)
        //{
        //    List<EldritchInvocation> invocations = new List<EldritchInvocation>();

        //    using (SQLiteConnection connection = new SQLiteConnection(ConnectionString))
        //    using (SQLiteCommand command = new SQLiteCommand(connection))
        //    {
        //        connection.Open();
        //        command.CommandText = "SELECT eldritchInvocations.name, eldritchInvocations.description, eldritchInvocations.level, " +
        //                              "eldritchInvocations.pactRestriction, eldritchInvocations.hasSpellChoice, RequiredSpells.name, RequiredSpells.ritual, RequiredSpells.level, " +
        //                              "RequiredSpells.school, RequiredSpells.castTime, RequiredSpells.range, RequiredSpells.duration, " +
        //                              "RequiredSpells.components, RequiredSpells.materials, RequiredSpells.description, GainedSpells.name, " +
        //                              "GainedSpells.ritual, GainedSpells.level, GainedSpells.school, GainedSpells.castTime, GainedSpells.range, " +
        //                              "GainedSpells.duration, GainedSpells.components, GainedSpells.materials, GainedSpells.description " +
        //                              "FROM eldritchInvocations " +
        //                              "LEFT JOIN eldritchInvocationRequiredSpells ON eldritchInvocationRequiredSpells.invocationId = eldritchInvocations.invocationId " +
        //                              "LEFT JOIN eldritchInvocationGainedSpells ON eldritchInvocationGainedSpells.invocationId = eldritchInvocations.invocationId " +
        //                              "LEFT JOIN spells as RequiredSpells ON RequiredSpells.spellId = eldritchInvocationRequiredSpells.spellId " +
        //                              "LEFT JOIN spells as GainedSpells ON GainedSpells.spellId = eldritchInvocationGainedSpells.spellId " +
        //                              "WHERE (eldritchInvocations.pactRestriction = @NonPact OR eldritchInvocations.pactRestriction LIKE @Pact) " +
        //                              "AND eldritchInvocations.level BETWEEN 1 AND @Level";
        //        command.Parameters.AddWithValue("@NonPact", string.Empty);
        //        command.Parameters.AddWithValue("@Pact", warlockPact.Name);
        //        command.Parameters.AddWithValue("@Level", level.ToString());

        //        using (SQLiteDataReader dbReader = command.ExecuteReader())
        //        {
        //            while (dbReader.Read())
        //            {
        //                if (!dbReader.IsDBNull(0))
        //                {
        //                    Spell gainedSpell = new Spell();
        //                    if (!dbReader.IsDBNull(5))
        //                    {
        //                        gainedSpell = new Spell(dbReader.GetString(5), dbReader.GetBoolean(6), dbReader.GetInt32(7), dbReader.GetString(8), dbReader.GetString(9), dbReader.GetString(10), dbReader.GetString(11), dbReader.GetString(12), dbReader.GetString(13), dbReader.GetString(14), false);
        //                    }

        //                    Spell requiredSpell = new Spell();
        //                    if (!dbReader.IsDBNull(15))
        //                    {
        //                        requiredSpell = new Spell(dbReader.GetString(15), dbReader.GetBoolean(16), dbReader.GetInt32(17), dbReader.GetString(18), dbReader.GetString(19), dbReader.GetString(20), dbReader.GetString(21), dbReader.GetString(22), dbReader.GetString(23), dbReader.GetString(24), false);
        //                    }

        //                    invocations.Add(new EldritchInvocation(dbReader.GetString(0), dbReader.GetString(1), dbReader.GetInt32(2), requiredSpell, dbReader.GetString(3), gainedSpell, dbReader.GetBoolean(4)));
        //                }
        //            }
        //        }
        //    }

        //    return invocations;
        //}



        /// <summary>
        /// gets a list of eldritch invocations the warlock may choose with the current level and pact choice
        /// </summary>
        /// <param name="knownSpells">list of known spells</param>
        /// <param name="warlockPact">chosen warlock pact</param>
        /// <param name="level">current level</param>
        public List <EldritchInvocation> getEldritchInvocations(List <Spell> knownSpells, WarlockPact warlockPact, int level)
        {
            List <EldritchInvocation> invocations = new List <EldritchInvocation>();

            using (SQLiteConnection connection = new SQLiteConnection(ConnectionString))
                using (SQLiteCommand command = new SQLiteCommand(connection))
                {
                    connection.Open();
                    command.CommandText = "SELECT eldritchInvocations.name, eldritchInvocations.description, eldritchInvocations.level, " +
                                          "eldritchInvocations.pactRestriction, eldritchInvocations.hasSpellChoice, RequiredSpells.name, RequiredSpells.ritual, RequiredSpells.level, " +
                                          "RequiredSpells.school, RequiredSpells.castTime, RequiredSpells.range, RequiredSpells.duration, " +
                                          "RequiredSpells.components, RequiredSpells.materials, RequiredSpells.description, GainedSpells.name, " +
                                          "GainedSpells.ritual, GainedSpells.level, GainedSpells.school, GainedSpells.castTime, GainedSpells.range, " +
                                          "GainedSpells.duration, GainedSpells.components, GainedSpells.materials, GainedSpells.description " +
                                          "FROM eldritchInvocations " +
                                          "LEFT JOIN eldritchInvocationRequiredSpells ON eldritchInvocationRequiredSpells.invocationId = eldritchInvocations.invocationId " +
                                          "LEFT JOIN eldritchInvocationGainedSpells ON eldritchInvocationGainedSpells.invocationId = eldritchInvocations.invocationId " +
                                          "LEFT JOIN spells as RequiredSpells ON RequiredSpells.spellId = eldritchInvocationRequiredSpells.spellId " +
                                          "LEFT JOIN spells as GainedSpells ON GainedSpells.spellId = eldritchInvocationGainedSpells.spellId " +
                                          "WHERE (eldritchInvocations.pactRestriction = @NonPact OR eldritchInvocations.pactRestriction LIKE @Pact) " +
                                          "AND eldritchInvocations.level BETWEEN 1 AND @Level " +
                                          "AND (RequiredSpells.name IS NULL OR RequiredSpells.name IN (@KnownSpells))";
                    command.Parameters.AddWithValue("@NonPact", string.Empty);
                    command.Parameters.AddWithValue("@Pact", warlockPact.Name);
                    command.Parameters.AddWithValue("@Level", level.ToString());
                    SQLiteCommandExtensions.AddParametersWithValues(command, "@KnownSpells", knownSpells.Select(spell => spell.Name).ToList());

                    using (SQLiteDataReader dbReader = command.ExecuteReader())
                    {
                        while (dbReader.Read())
                        {
                            if (!dbReader.IsDBNull(0))
                            {
                                Spell gainedSpell = new Spell();
                                if (!dbReader.IsDBNull(5))
                                {
                                    gainedSpell = new Spell(dbReader.GetString(5),
                                                            dbReader.GetBoolean(6),
                                                            dbReader.GetInt32(7),
                                                            dbReader.GetString(8),
                                                            dbReader.GetString(9),
                                                            dbReader.GetString(10),
                                                            dbReader.GetString(11),
                                                            dbReader.GetString(12),
                                                            dbReader.GetString(13),
                                                            dbReader.GetString(14),
                                                            false);
                                }

                                Spell requiredSpell = new Spell();
                                if (!dbReader.IsDBNull(15))
                                {
                                    requiredSpell = new Spell(dbReader.GetString(15),
                                                              dbReader.GetBoolean(16),
                                                              dbReader.GetInt32(17),
                                                              dbReader.GetString(18),
                                                              dbReader.GetString(19),
                                                              dbReader.GetString(20),
                                                              dbReader.GetString(21),
                                                              dbReader.GetString(22),
                                                              dbReader.GetString(23),
                                                              dbReader.GetString(24),
                                                              false);
                                }

                                invocations.Add(new EldritchInvocation(dbReader.GetString(0),
                                                                       dbReader.GetString(1),
                                                                       dbReader.GetInt32(2),
                                                                       requiredSpell,
                                                                       dbReader.GetString(3),
                                                                       gainedSpell,
                                                                       dbReader.GetBoolean(4),
                                                                       hasInvocationSkillGain(dbReader.GetString(0))));
                            }
                        }
                    }
                }

            return(invocations);
        }