Пример #1
0
        private void updateEquipment()
        {
            EquipmentTemplate result = equipment.FirstOrDefault(a => a.Entry == activeCreature.EquipmentTemplateId);

            if (result != null)
            {
                activeEquipment    = result;
                txtEquipLeft.Text  = activeEquipment.EquipEntry1;
                txtEquipRight.Text = activeEquipment.EquipEntry2;
                txtEquipRange.Text = activeEquipment.EquipEntry3;
            }
            else
            {
                txtEquipLeft.Text  = "";
                txtEquipRight.Text = "";
                txtEquipRange.Text = "";
            }
        }
Пример #2
0
        public List <EquipmentTemplate> GetEquipment()
        {
            string query = @"SELECT 
                                A.Entry, 
                                CONCAT(item1.name, ' (', A.EquipEntry1, ')') AS EquipEntry1,
                                CONCAT(item2.name, ' (', A.EquipEntry2, ')') AS EquipEntry2,
                                CONCAT(item3.name, ' (', A.EquipEntry3, ')') AS EquipEntry3
                            FROM creature_equip_template A
                            LEFT OUTER JOIN item_template item1 ON A.EquipEntry1 = item1.entry
                            LEFT OUTER JOIN item_template item2 ON A.EquipEntry2 = item2.entry
                            LEFT OUTER JOIN item_template item3 ON A.EquipEntry3 = item3.entry";
            List <EquipmentTemplate> equipment = new List <EquipmentTemplate>();

            if (OpenConnection())
            {
                MySqlCommand    cmd        = new MySqlCommand(query, connection);
                MySqlDataReader dataReader = cmd.ExecuteReader();

                while (dataReader.Read())
                {
                    EquipmentTemplate e = new EquipmentTemplate()
                    {
                        Entry       = dataReader["Entry"].ToString(),
                        EquipEntry1 = dataReader["EquipEntry1"].ToString(),
                        EquipEntry2 = dataReader["EquipEntry2"].ToString(),
                        EquipEntry3 = dataReader["EquipEntry3"].ToString(),
                    };
                    equipment.Add(e);
                }

                dataReader.Close();
                CloseConnection();
            }

            return(equipment);
        }