Ejemplo n.º 1
0
        private void updateDetails()
        {
            string cardTextNoBackslash = pulls[lbxCards.SelectedIndex].getCardText().Replace("\\", String.Empty);

            lblName.Text   = pulls[lbxCards.SelectedIndex].displayName;
            rtbDesc.Text   = $"{pulls[lbxCards.SelectedIndex].getCardID()}\n{Consts.GetStringValue(pulls[lbxCards.SelectedIndex].getAttrib())} {Consts.GetStringValue(pulls[lbxCards.SelectedIndex].getClass())} {Consts.GetStringValue(pulls[lbxCards.SelectedIndex].getType())}\n{cardTextNoBackslash}";
            lblAtk.Text    = $"ATK {pulls[lbxCards.SelectedIndex].getAttack()}";
            lblDef.Text    = $"DEF {pulls[lbxCards.SelectedIndex].getDefense()}";
            lblRarity.Text = $"Rarity: {Consts.GetStringValue(pulls[lbxCards.SelectedIndex].getRarity())}";
        }
Ejemplo n.º 2
0
        private void Form2_Load(object sender, EventArgs e)
        {
            string dbpath = Environment.CurrentDirectory + "\\sets.db";

            if (File.Exists(dbpath))
            {
                using (SQLiteConnection conn = new SQLiteConnection("Data Source=" + dbpath + ";"))
                {
                    using (SQLiteCommand cmd = new SQLiteCommand($"SELECT * FROM {selectedSet.getAbbreviation}", conn))
                    {
                        conn.Open();
                        using (SQLiteDataReader reader = cmd.ExecuteReader())
                        {
                            while (reader.Read())
                            {
                                Card card = new Card(reader.GetString(0), reader.GetString(1),
                                                     Consts.getCardTypeByStringValue(reader.GetString(2)),
                                                     Consts.getRarityByStringValue(reader.GetString(3)),
                                                     Consts.getAttribByStringValue(reader.GetString(4)),
                                                     Consts.getClassByStringValue(reader.GetString(5)),
                                                     reader.GetString(6), reader.GetString(7), reader.GetString(8), reader.GetString(9));
                                setCards.Add(card);
                            }
                        }
                        conn.Close();
                    }
                }
            }
            else
            {
                MessageBox.Show("Could not find database file.", "Error 1", MessageBoxButtons.OK);
                Application.Exit();
            }


            foreach (Card c in setCards)
            {
                if (c.getRarity() == Consts.Rarity.Common)
                {
                    commons.Add(c);
                }
                else if (c.getRarity() == Consts.Rarity.ShortPrint)
                {
                    shortprints.Add(c);
                }
                else if (c.getRarity() == Consts.Rarity.SuperShortPrint)
                {
                    supershortprints.Add(c);
                }
                else if ((c.getRarity() == Consts.Rarity.Rare) || (c.getRarity() == Consts.Rarity.RareUltimate))
                {
                    rares.Add(c);
                }
                else if ((c.getRarity() == Consts.Rarity.SuperRare) || (c.getRarity() == Consts.Rarity.SuperUltimate))
                {
                    supers.Add(c);
                }
                else if ((c.getRarity() == Consts.Rarity.UltraRare) || (c.getRarity() == Consts.Rarity.UltraUltimate))
                {
                    ultras.Add(c);
                }
                else if (c.getRarity() == Consts.Rarity.SecretRare)
                {
                    secrets.Add(c);
                }
                else
                {
                    commons.Add(c);
                }
            }

            for (int i = 0; i < packsToOpen; i++)
            {
                foreach (Card c in openPack(setCards))
                {
                    pulls.Add(c);
                }
            }

            lbxCards.DataSource    = pulls;
            lbxCards.DisplayMember = "displayName";
        }