コード例 #1
0
        private void OnItemSelected(object sender, SelectionChangedEventArgs e)
        {
            if (SelectedItem == null)
            {
                return;
            }

            var list = ItemDictionary[SelectedItem];

            StringBuilder builder = new StringBuilder();

            if (list.Any())
            {
                builder.Append(Environment.NewLine);
                builder.Append("Base Item Name: " + list[0].ItemBase.Name);
                builder.Append(Environment.NewLine);
                builder.Append("Base Item Type: " + list[0].ItemBase.Type);
                builder.Append(Environment.NewLine);
                builder.Append("Base Item Subtype: " + list[0].ItemBase.Subtype);
                builder.Append(Environment.NewLine);
                builder.Append(Environment.NewLine);
            }

            builder.Append("Condition: " + SelectedItem.ItemName);
            builder.Append(Environment.NewLine);
            builder.Append("Value Per Item (C): " + SelectedItem.Value);
            builder.Append(Environment.NewLine);
            builder.Append("Value (C): " + SelectedItem.Value * list.Count);
            builder.Append(Environment.NewLine);
            builder.Append("Count: " + list.Count);

            if (list.Count > 50)
            {
                builder.Append(Environment.NewLine);
                builder.Append("Showing the first 50 items");
            }
            AffixValueCalculator calculator = new AffixValueCalculator();

            foreach (var item in list.Take(50))
            {
                builder.Append(Environment.NewLine);
                builder.Append("---------------------");
                builder.Append(Environment.NewLine);

                builder.Append("Rarity: " + item.Rarity);
                builder.Append(Environment.NewLine);


                if (item.ItemBase.Properties.ContainsKey(ItemProperties.EnergyShield) && item.ItemBase.Properties[ItemProperties.EnergyShield] > 0)
                {
                    var totalEs = calculator.GetAffixValues(AffixNames.TotalEnergyShield, item, AffixType.Meta, StatValueType.Flat);
                    builder.Append("Total ES: " + totalEs[0]);
                    builder.Append(Environment.NewLine);
                }

                if (item.ItemBase.Properties.ContainsKey(ItemProperties.Armour) && item.ItemBase.Properties[ItemProperties.Armour] > 0)
                {
                    var totalArmour = calculator.GetAffixValues(AffixNames.TotalArmor, item, AffixType.Meta, StatValueType.Flat);
                    builder.Append("Total Armour: " + totalArmour[0]);
                    builder.Append(Environment.NewLine);
                }

                if (item.ItemBase.Properties.ContainsKey(ItemProperties.Evasion) && item.ItemBase.Properties[ItemProperties.Evasion] > 0)
                {
                    var totalEvasion = calculator.GetAffixValues(AffixNames.TotalEvasion, item, AffixType.Meta, StatValueType.Flat);
                    builder.Append("Total Evasion: " + totalEvasion[0]);
                    builder.Append(Environment.NewLine);
                }

                if (item.ItemBase.Properties.ContainsKey(ItemProperties.DPS))
                {
                    var totalEvasion = calculator.GetAffixValues(AffixNames.TotalDps, item, AffixType.Meta, StatValueType.Flat);
                    builder.Append("Total Damage: " + totalEvasion[0]);
                    builder.Append(Environment.NewLine);
                }

                builder.Append("Prefixes");
                builder.Append(Environment.NewLine);
                foreach (var prefix in item.Prefixes)
                {
                    WriteAffix(prefix, builder);
                }
                builder.Append(Environment.NewLine);

                builder.Append("Suffixes");
                builder.Append(Environment.NewLine);
                foreach (var suffix in item.Suffixes)
                {
                    WriteAffix(suffix, builder);
                }

                builder.Append(Environment.NewLine);
                if (item.Corrupted)
                {
                    builder.Append("\t");
                    builder.Append("Corrupted");
                    builder.Append(Environment.NewLine);
                }
            }

            ItemResults = builder.ToString();

            OnPropertyChanged(nameof(ItemResults));
        }
コード例 #2
0
        private void UpdateModMinMax()
        {
            var modAffixes = _affixes.Where(x => x.ModType == AffixName).OrderBy(x => x.Tier);

            var lastTier  = modAffixes.Last();
            var firstTier = modAffixes.First();

            if (StatValueType == StatValueType.Tier)
            {
                _statOneMin   = firstTier.Tier;
                _statTwoMin   = null;
                _statThreeMin = null;

                _statOneMax   = lastTier.Tier;
                _statTwoMax   = null;
                _statThreeMax = null;
            }
            else if (_affixType == AffixType.Meta)
            {
                AffixValueCalculator calculator = new AffixValueCalculator();
                var max = calculator.GetModMax(AffixName, _itemBase, _affixes, AffixType.Meta);

                _statOneMin   = 0;
                _statTwoMin   = null;
                _statThreeMin = null;

                _statOneMax   = max.FirstOrDefault();
                _statTwoMax   = null;
                _statThreeMax = null;
            }
            else
            {
                if (!string.IsNullOrEmpty(lastTier.StatName1))
                {
                    _statOneMin = lastTier.StatMin1;
                }
                if (!string.IsNullOrEmpty(lastTier.StatName2))
                {
                    _statTwoMin = lastTier.StatMin2;
                }
                if (!string.IsNullOrEmpty(lastTier.StatName3))
                {
                    _statThreeMin = lastTier.StatMin3;
                }

                if (!string.IsNullOrEmpty(firstTier.StatName1))
                {
                    _statOneMax = firstTier.StatMax1;
                }
                if (!string.IsNullOrEmpty(firstTier.StatName2))
                {
                    _statTwoMax = firstTier.StatMax2;
                }
                if (!string.IsNullOrEmpty(firstTier.StatName3))
                {
                    _statThreeMax = firstTier.StatMax3;
                }
            }

            FirstStatMin  = _statOneMin;
            SecondStatMin = _statTwoMin;
            ThirdStatMin  = _statThreeMin;

            FirstStatMax  = _statOneMax;
            SecondStatMax = _statTwoMax;
            ThirdStatMax  = _statThreeMax;

            OnPropertyChanged(nameof(FirstStatMin));
            OnPropertyChanged(nameof(SecondStatMin));
            OnPropertyChanged(nameof(ThirdStatMin));

            OnPropertyChanged(nameof(FirstStatMax));
            OnPropertyChanged(nameof(SecondStatMax));
            OnPropertyChanged(nameof(ThirdStatMax));

            OnPropertyChanged(nameof(FirstStatSelectionVisibility));
            OnPropertyChanged(nameof(SecondStatSelectionVisibility));
            OnPropertyChanged(nameof(DoubleStatSelectionVisibility));

            OnPropertyChanged(nameof(IsFirstStatEnabled));
            OnPropertyChanged(nameof(IsSecondStatEnabled));
        }