コード例 #1
0
        protected override object GetFormattedValue(object value, int rowIndex, ref DataGridViewCellStyle cellStyle, System.ComponentModel.TypeConverter valueTypeConverter, System.ComponentModel.TypeConverter formattedValueTypeConverter, DataGridViewDataErrorContexts context)
        {
            if (value == DBNull.Value || value == null)
            {
                return("");
            }

            return(RealmSynergy.FromSeries((uint)value).Text);
        }
コード例 #2
0
 protected override object GetFormattedValue(
     object value,
     int rowIndex,
     ref DataGridViewCellStyle cellStyle,
     TypeConverter valueTypeConverter,
     TypeConverter formattedValueTypeConverter,
     DataGridViewDataErrorContexts context)
 {
     return(value == DBNull.Value || value == null ? (object)"" : (object)RealmSynergy.FromSeries((uint)value).Text);
 }
コード例 #3
0
        public override object ParseFormattedValue(
            object formattedValue,
            DataGridViewCellStyle cellStyle,
            TypeConverter formattedValueTypeConverter,
            TypeConverter valueTypeConverter)
        {
            if (formattedValue == null || formattedValue == DBNull.Value)
            {
                return((object)DBNull.Value);
            }
            string Name = (string)formattedValue;

            return(Name == string.Empty ? (object)DBNull.Value : (object)RealmSynergy.FromName(Name).GameSeries);
        }
コード例 #4
0
        public override object ParseFormattedValue(object formattedValue, DataGridViewCellStyle cellStyle, System.ComponentModel.TypeConverter formattedValueTypeConverter, System.ComponentModel.TypeConverter valueTypeConverter)
        {
            if (formattedValue == null || formattedValue == DBNull.Value)
            {
                return(DBNull.Value);
            }
            string s = (string)formattedValue;

            if (s == string.Empty)
            {
                return(DBNull.Value);
            }
            return(RealmSynergy.FromName(s).GameSeries);
        }
コード例 #5
0
ファイル: FFRKViewInventory.cs プロジェクト: moorecp/ffrkx
        void UpdateEquipmentGrid(DataEquipmentInformation[] EquipList)
        {
            int filterTypeLowerBound;
            int filterTypeUpperBound;

            if (comboBoxFilterType.SelectedIndex.Equals((int)ViewFilterTypeComboIndex.All))
            {
                filterTypeLowerBound = 0; //If "All" filter selected, select all item types (specifically those within index range 0-99).
                filterTypeUpperBound = 99;
            }
            else   //If any other filter selected, set upper and lower bound of item types to that specific type.
            {
                filterTypeLowerBound = comboBoxFilterType.SelectedIndex;
                filterTypeUpperBound = comboBoxFilterType.SelectedIndex;
            }
            mEquipments = EquipList;
            dataGridViewEquipment.Rows.Clear();
            foreach (DataEquipmentInformation equip in EquipList)
            {
                //If "All" selected, chooses all item types from 0-99, if "Weapon" is selected, chooses item types in range 1-1 (i.e. =1).
                if (((int)equip.Type >= filterTypeLowerBound) && ((int)equip.Type <= filterTypeUpperBound) &&
                    (equip.Category != SchemaConstants.EquipmentCategory.ArmorUpgrade) &&     //Exclude Armour upgrade mats from "Armour" filter.
                    (equip.Category != SchemaConstants.EquipmentCategory.WeaponUpgrade))        //Exclude Weapon upgrade mats from "Weapon" filter.
                {
                    int             row_index = dataGridViewEquipment.Rows.Add();
                    DataGridViewRow row       = dataGridViewEquipment.Rows[row_index];
                    row.Tag = equip;
                    row.Cells[dgcItemID.Name].Value   = equip.EquipmentId;
                    row.Cells[dgcItem.Name].Value     = equip.Name;
                    row.Cells[dgcCategory.Name].Value = equip.Category;
                    row.Cells[dgcType.Name].Value     = equip.Type;
                    row.Cells[dgcRarity.Name].Value   = new RarityColumnValue((int)equip.BaseRarity, (int)equip.EvolutionNumber);
                    row.Cells[dgcSynergy.Name].Value  = new SynergyColumnValue(RealmSynergy.FromSeries(equip.SeriesId));
                    row.Cells[dgcLevel.Name].Value    = new LevelColumnValue(equip.Level, equip.LevelMax);
                    row.Cells[dgcAugments.Name].Value = new AugmentColumnValue(equip.Augment, equip.AugmentMax);
                    if (mAnalyzer != null)
                    {
                        row.Cells[dgcScore.Name].Value = new ScoreColumnValue(mAnalyzer.GetScore(equip.InstanceId));
                    }

                    GridEquipStats stats = ComputeDisplayStats(equip);
                    SetStatsForRow(row, equip, stats);
                }
            }
        }
コード例 #6
0
        void UpdateEquipmentGrid(DataEquipmentInformation[] EquipList)
        {
            mEquipments = EquipList;
            dataGridViewEquipment.Rows.Clear();
            foreach (DataEquipmentInformation equip in EquipList)
            {
                int             row_index = dataGridViewEquipment.Rows.Add();
                DataGridViewRow row       = dataGridViewEquipment.Rows[row_index];
                row.Tag = equip;
                row.Cells[dgcItemID.Name].Value   = equip.EquipmentId;
                row.Cells[dgcItem.Name].Value     = equip.Name;
                row.Cells[dgcCategory.Name].Value = equip.Category;
                row.Cells[dgcType.Name].Value     = equip.Type;
                row.Cells[dgcRarity.Name].Value   = new RarityColumnValue((int)equip.BaseRarity, (int)equip.EvolutionNumber);
                row.Cells[dgcSynergy.Name].Value  = new SynergyColumnValue(RealmSynergy.FromSeries(equip.SeriesId));
                row.Cells[dgcLevel.Name].Value    = new LevelColumnValue(equip.Level, equip.LevelMax);
                row.Cells[dgcScore.Name].Value    = new ScoreColumnValue(mAnalyzer.GetScore(equip.InstanceId));

                GridEquipStats stats = ComputeDisplayStats(equip);
                SetStatsForRow(row, equip, stats);
            }
        }
コード例 #7
0
ファイル: DbOpFilterDrops.cs プロジェクト: moorecp/ffrkx
        public void Execute(MySqlConnection connection, MySqlTransaction transaction)
        {
            SelectBuilder builder = new SelectBuilder();

            builder.Table = "dungeon_drops";
            builder.Columns.Add("*");
            builder.Parameters.Add(mItemTypes);
            builder.Parameters.Add(mRarities);
            builder.Parameters.Add(mSynergies);
            builder.Parameters.Add(mWorlds);
            builder.Parameters.Add(mDungeons);
            builder.Parameters.Add(mBattles);
            builder.Parameters.Add(mName);

            // Since histogram bars will come in on different rows we need a way to look up the item
            // so we can modify its histogram on the fly.
            var keyed_lookup = new Dictionary <KeyValuePair <uint, uint>, BasicItemDropStats>();

            string stmt = builder.ToString();

            using (MySqlCommand command = new MySqlCommand(stmt, connection))
            {
                builder.Bind(command);
                using (MySqlDataReader reader = command.ExecuteReader())
                {
                    while (reader.Read())
                    {
                        uint battle_id = (uint)reader["battleid"];
                        uint item_id   = (uint)reader["itemid"];
                        var  key       = new KeyValuePair <uint, uint>(battle_id, item_id);

                        BasicItemDropStats stats = null;
                        if (!keyed_lookup.TryGetValue(key, out stats))
                        {
                            // This is a new entry.
                            RealmSynergy.SynergyValue synergy = null;
                            int series_ordinal = reader.GetOrdinal("item_series");
                            if (!reader.IsDBNull(series_ordinal))
                            {
                                uint series = (uint)reader["item_series"];
                                synergy = RealmSynergy.FromSeries(series);
                            }

                            stats = new BasicItemDropStats
                            {
                                BattleId              = battle_id,
                                ItemId                = item_id,
                                DungeonId             = (uint)reader["dungeon_id"],
                                WorldId               = (uint)reader["world_id"],
                                WorldName             = (string)reader["world_name"],
                                DungeonName           = (string)reader["dungeon_name"],
                                DungeonType           = (SchemaConstants.DungeonType)reader["dungeon_type"],
                                Rarity                = (SchemaConstants.Rarity)reader["item_rarity"],
                                Type                  = (SchemaConstants.ItemType)reader["item_type"],
                                TimesRun              = (uint)reader["times_run"],
                                TimesRunWithHistogram = (uint)reader["times_run_with_histogram"],
                                Synergy               = synergy,
                                BattleName            = (string)reader["battle_name"],
                                BattleStamina         = (ushort)reader["battle_stamina"],
                                ItemName              = (string)reader["item_name"],
                            };

                            keyed_lookup.Add(key, stats);
                        }

                        // Modify its histogram entry.
                        int  bucket       = (int)reader["histo_bucket"];
                        uint bucket_value = (uint)reader["histo_value"];

                        if (bucket < 0)
                        {
                            // The total drops is stored in bucket -1.  This should always be present.
                            stats.TotalDrops = bucket_value;
                        }
                        else if (bucket > 0)
                        {
                            // We should never have a bucket 0, because that would mean 0 of the item dropped,
                            // in which case why would it even be in the drop list?
                            System.Diagnostics.Debug.Assert(bucket != 0);

                            stats.Histogram[bucket] = bucket_value;
                        }
                    }
                }
            }

            if (mOnlyRepeatable)
            {
                mDropList = keyed_lookup.Values.Where(x => x.IsBattleRepeatable).ToList();
            }
            else
            {
                mDropList = keyed_lookup.Values.ToList();
            }

            foreach (BasicItemDropStats stats in mDropList)
            {
                // Post process the list.  None of the items will have a value set for Histogram[0] because that
                // means we didn't see anything.  So we have to compute this by subtracting all the events where
                // we did see something from all the events total.

                stats.Histogram[0] = stats.TimesRunWithHistogram;
                for (int i = 1; i < stats.Histogram.BucketCount; ++i)
                {
                    stats.Histogram[0] -= stats.Histogram[i];
                }
            }
        }