public void Execute(MySqlConnection connection, MySqlTransaction transaction)
        {
            string stmt = "SELECT i.id, i.name, i.rarity, i.series, i.type, i.subtype, " +
                          "       s.base_atk, s.base_mag, s.base_acc, s.base_def, s.base_res, s.base_eva, s.base_mnd, " +
                          "       s.max_atk, s.max_mag, s.max_acc, s.max_def, s.max_res, s.max_eva, s.max_mnd " +
                          "FROM   items i LEFT OUTER JOIN equipment_stats s ON s.equipment_id = i.id";

            using (MySqlCommand command = new MySqlCommand(stmt, connection, transaction))
            {
                using (MySqlDataReader reader = command.ExecuteReader())
                {
                    while (reader.Read())
                    {
                        DataCache.Items.Key  key  = new DataCache.Items.Key();
                        DataCache.Items.Data data = new DataCache.Items.Data();
                        key.ItemId   = (uint)reader["id"];
                        data.Name    = (string)reader["name"];
                        data.Rarity  = (byte)reader["rarity"];
                        data.Series  = reader.GetValueOrNull <uint>("series");
                        data.Type    = (byte)reader["type"];
                        data.Subtype = (byte)reader["subtype"];

                        data.BaseStats     = new GameData.EquipStats();
                        data.BaseStats.Atk = reader.GetValueOrNull <short>("base_atk");
                        data.BaseStats.Mag = reader.GetValueOrNull <short>("base_mag");
                        data.BaseStats.Acc = reader.GetValueOrNull <short>("base_acc");
                        data.BaseStats.Def = reader.GetValueOrNull <short>("base_def");
                        data.BaseStats.Res = reader.GetValueOrNull <short>("base_res");
                        data.BaseStats.Eva = reader.GetValueOrNull <short>("base_eva");
                        data.BaseStats.Mnd = reader.GetValueOrNull <short>("base_mnd");

                        data.MaxStats     = new GameData.EquipStats();
                        data.MaxStats.Atk = reader.GetValueOrNull <short>("max_atk");
                        data.MaxStats.Mag = reader.GetValueOrNull <short>("max_mag");
                        data.MaxStats.Acc = reader.GetValueOrNull <short>("max_acc");
                        data.MaxStats.Def = reader.GetValueOrNull <short>("max_def");
                        data.MaxStats.Res = reader.GetValueOrNull <short>("max_res");
                        data.MaxStats.Eva = reader.GetValueOrNull <short>("max_eva");
                        data.MaxStats.Mnd = reader.GetValueOrNull <short>("max_mnd");
                        mItems.Update(key, data);
                    }
                }
            }
        }
Exemple #2
0
        public void Execute(MySqlConnection connection, MySqlTransaction transaction)
        {
            string stmt = "SELECT i.id, i.name, i.rarity, i.series, i.type, i.subtype, " +
                          "       s.base_atk, s.base_mag, s.base_acc, s.base_def, s.base_res, s.base_eva, s.base_mnd, " +
                          "       s.max_atk, s.max_mag, s.max_acc, s.max_def, s.max_res, s.max_eva, s.max_mnd " +
                          "FROM   items i LEFT OUTER JOIN equipment_stats s ON s.equipment_id = i.id";

            using (MySqlCommand command = new MySqlCommand(stmt, connection, transaction))
            {
                using (MySqlDataReader reader = command.ExecuteReader())
                {
                    while (reader.Read())
                    {
                        DataCache.Items.Key key = new DataCache.Items.Key();
                        DataCache.Items.Data data = new DataCache.Items.Data();
                        key.ItemId = (uint)reader["id"];
                        data.Name = (string)reader["name"];
                        data.Rarity = (byte)reader["rarity"];
                        data.Series = reader.GetValueOrNull<uint>("series");
                        data.Type = (byte)reader["type"];
                        data.Subtype = (byte)reader["subtype"];

                        data.BaseStats = new GameData.EquipStats();
                        data.BaseStats.Atk = reader.GetValueOrNull<short>("base_atk");
                        data.BaseStats.Mag = reader.GetValueOrNull<short>("base_mag");
                        data.BaseStats.Acc = reader.GetValueOrNull<short>("base_acc");
                        data.BaseStats.Def = reader.GetValueOrNull<short>("base_def");
                        data.BaseStats.Res = reader.GetValueOrNull<short>("base_res");
                        data.BaseStats.Eva = reader.GetValueOrNull<short>("base_eva");
                        data.BaseStats.Mnd = reader.GetValueOrNull<short>("base_mnd");

                        data.MaxStats = new GameData.EquipStats();
                        data.MaxStats.Atk = reader.GetValueOrNull<short>("max_atk");
                        data.MaxStats.Mag = reader.GetValueOrNull<short>("max_mag");
                        data.MaxStats.Acc = reader.GetValueOrNull<short>("max_acc");
                        data.MaxStats.Def = reader.GetValueOrNull<short>("max_def");
                        data.MaxStats.Res = reader.GetValueOrNull<short>("max_res");
                        data.MaxStats.Eva = reader.GetValueOrNull<short>("max_eva");
                        data.MaxStats.Mnd = reader.GetValueOrNull<short>("max_mnd");
                        mItems.Update(key, data);
                    }
                }
            }
        }
Exemple #3
0
        private void PopulateActiveBattleListView(EventBattleInitiated battle)
        {
            listViewActiveBattle.Items.Clear();
            if (battle == null)
            {
                labelActiveBattleNotice.Visible = true;
                labelNoDrops.Visible            = false;
                return;
            }

            listViewActiveBattle.View = View.Details;
            List <DropEvent> drops = battle.Battle.Drops.ToList();

            labelActiveBattleNotice.Visible = false;
            if (drops.Count == 0)
            {
                labelNoDrops.Visible = true;
                return;
            }

            lock (FFRKProxy.Instance.Cache.SyncRoot)
            {
                foreach (DropEvent drop in battle.Battle.Drops)
                {
                    string Item;
                    DataCache.Items.Key ItemKey = new DataCache.Items.Key {
                        ItemId = drop.ItemId
                    };
                    DataCache.Items.Data ItemData = null;
                    if (drop.ItemType == DataEnemyDropItem.DropItemType.Gold)
                    {
                        Item = String.Format("{0} gold", drop.GoldAmount);
                    }
                    else if (drop.ItemType == DataEnemyDropItem.DropItemType.Materia)
                    {
                        Item = drop.MateriaName;
                    }
                    else if (drop.ItemType == DataEnemyDropItem.DropItemType.Potion)
                    {
                        Item = drop.PotionName;
                    }
                    else if (FFRKProxy.Instance.Cache.Items.TryGetValue(ItemKey, out ItemData))
                    {
                        Item = ItemData.Name;
                    }
                    else
                    {
                        Item = drop.ItemId.ToString();
                    }

                    if (drop.NumberOfItems > 1)
                    {
                        Item += String.Format(" x{0}", drop.NumberOfItems);
                    }
                    string[] row =
                    {
                        Item,
                        drop.Rarity.ToString(),
                        drop.Round.ToString(),
                        drop.EnemyName,
                        "",
                        ""
                    };
                    listViewActiveBattle.Items.Add(new ListViewItem(row));
                }
            }
        }