Exemplo n.º 1
0
 private void Naytaweapon(weapon ase, ComboBox sender)
 {
     //näytetään valittu esine
     if (ase.Dmg > 0)
     {
         TBitem.Text += "Dmg: " + (ase.Dmg * (1 + ase.Increaseddmg)) * (1 + ase.Elderextra);
     }
     if (ase.Accuracy > 0)
     {
         TBitem.Text += Environment.NewLine + "Accuracy: " + ase.Accuracy;
     }
     //näytetään pelaajan esine
     if (player.Weapon.Dmg > 0)
     {
         TBequiped.Text += "Dmg: " + (player.Weapon.Dmg * (1 + player.Weapon.Increaseddmg)) * (1 + player.Weapon.Elderextra);
     }
     if (player.Weapon.Accuracy > 0)
     {
         TBequiped.Text += Environment.NewLine + "Accuracy: " + ase.Accuracy;
     }
     if (player.Weapon.Critchance > 0)
     {
         TBequiped.Text += Environment.NewLine + "Critchance: " + ase.Critchance;
     }
     if (player.Weapon.Critdmg > 0)
     {
         TBequiped.Text += Environment.NewLine + "Crit damage: " + ase.Critdmg;
     }
 }
Exemplo n.º 2
0
 private void CBweapons_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (CBweapons.SelectedItem != null)
     {
         TBitem.Clear();
         TBequiped.Clear();
         weapon ase = (weapon)CBweapons.SelectedItem;
         viimeksivalittu = ase;
         Naytaweapon(ase, CBweapons);
     }
 }
Exemplo n.º 3
0
        public void VieWeapons(weapon weapon, int id)
        {
            string     command = "INSERT INTO PlayerItems (characterId, dmg, extradmg, accuracy, incdmg, itemtype, equiped, critdmg, critchance) VALUES(@id, @dmg, @extradmg, @accuracy, @incdmg, @itemtype, @equiped, @critdmg, @critchance)";
            SqlCommand komento = new SqlCommand(command, connection);

            komento.Parameters.AddWithValue("@id", id);
            komento.Parameters.AddWithValue("@accuracy", weapon.Accuracy);
            komento.Parameters.AddWithValue("@dmg", weapon.Dmg);
            komento.Parameters.AddWithValue("@extradmg", weapon.Elderextra);
            komento.Parameters.AddWithValue("@incdmg", weapon.Increaseddmg);
            komento.Parameters.AddWithValue("@itemtype", "weapon");
            komento.Parameters.AddWithValue("@equiped", weapon.Equiped);
            komento.Parameters.AddWithValue("@critdmg", weapon.Critdmg);
            komento.Parameters.AddWithValue("@critchance", weapon.Critchance);
        }
Exemplo n.º 4
0
        public List <Esineet> HaeEsineet(int id)
        {
            List <Esineet> inventory = new List <Esineet>();

            try
            {
                using (connection)
                {
                    yhdista();
                    string command;
                    command = "Select * From PlayerItems Where characterid = @id";
                    SqlCommand komento = new SqlCommand(command, connection);
                    komento.Parameters.AddWithValue("@id", id);
                    using (SqlDataReader reader = komento.ExecuteReader())
                    {
                        for (int i = 0; i < reader.FieldCount; i++)
                        {
                            reader.Read();
                            string vertaa = reader.GetString(13);
                            switch (vertaa)
                            {
                            case "amulet":
                                Amulet amulet = new Amulet();
                                amulet.Accuracy      = reader.GetDecimal(8);
                                amulet.Def           = reader.GetDecimal(9);
                                amulet.Hp            = reader.GetDecimal(7);
                                amulet.Increaseddef  = reader.GetDecimal(12);
                                amulet.ElderExtradmg = reader.GetDecimal(6);
                                amulet.Lifeleech     = reader.GetDecimal(2);
                                amulet.Manaleech     = reader.GetDecimal(3);
                                amulet.Equiped       = reader.GetBoolean(14);
                                inventory.Add(amulet);
                                break;

                            case "belt":
                                Belt belt = new Belt();
                                belt.Accuracy     = reader.GetDecimal(8);
                                belt.Def          = reader.GetDecimal(9);
                                belt.Hp           = reader.GetDecimal(7);
                                belt.Increaseddef = reader.GetDecimal(12);
                                belt.Equiped      = reader.GetBoolean(14);
                                inventory.Add(belt);
                                break;

                            case "body":
                                Body body = new Body();
                                body.Accuracy     = reader.GetDecimal(8);
                                body.Def          = reader.GetDecimal(9);
                                body.Hp           = reader.GetDecimal(7);
                                body.Increaseddef = reader.GetDecimal(12);
                                body.Equiped      = reader.GetBoolean(14);
                                inventory.Add(body);
                                break;

                            case "bootsit":
                                Boots boots = new Boots();
                                boots.Accuracy     = reader.GetDecimal(8);
                                boots.Def          = reader.GetDecimal(9);
                                boots.Hp           = reader.GetDecimal(7);
                                boots.Increaseddef = reader.GetDecimal(12);
                                boots.Speed        = reader.GetDecimal(5);
                                boots.Equiped      = reader.GetBoolean(14);
                                inventory.Add(boots);
                                break;

                            case "gloves":
                                Gloves gloves = new Gloves();
                                gloves.Accuracy     = reader.GetDecimal(8);
                                gloves.Def          = reader.GetDecimal(9);
                                gloves.Hp           = reader.GetDecimal(7);
                                gloves.Increaseddef = reader.GetDecimal(12);
                                gloves.Addeddmg     = reader.GetDecimal(10);
                                gloves.Lifeleech    = reader.GetDecimal(2);
                                gloves.Equiped      = reader.GetBoolean(14);
                                inventory.Add(gloves);
                                break;

                            case "helmet":
                                Helmet helmet = new Helmet();
                                helmet.Accuracy     = reader.GetDecimal(8);
                                helmet.Def          = reader.GetDecimal(9);
                                helmet.Hp           = reader.GetDecimal(7);
                                helmet.Increaseddef = reader.GetDecimal(12);
                                helmet.Equiped      = reader.GetBoolean(14);
                                inventory.Add(helmet);
                                break;

                            case "ring":
                                Ring ring = new Ring();
                                ring.Accuracy     = reader.GetDecimal(8);
                                ring.Def          = reader.GetDecimal(9);
                                ring.Hp           = reader.GetDecimal(7);
                                ring.Increaseddef = reader.GetDecimal(12);
                                ring.Lifeleech    = reader.GetDecimal(2);
                                ring.Manaleech    = reader.GetDecimal(3);
                                ring.Addeddmg     = reader.GetDecimal(10);
                                ring.Equiped      = reader.GetBoolean(14);
                                inventory.Add(ring);
                                break;

                            case "weapon":
                                weapon weapon = new weapon();
                                weapon.Elderextra   = reader.GetDecimal(6);
                                weapon.Dmg          = reader.GetDecimal(4);
                                weapon.Increaseddmg = reader.GetDecimal(11);
                                weapon.Equiped      = reader.GetBoolean(14);
                                weapon.Critchance   = reader.GetDecimal(16);
                                weapon.Critdmg      = reader.GetDecimal(15);
                                inventory.Add(weapon);
                                break;
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex);
            }
            return(inventory);
        }