예제 #1
0
        public void GetFlatPrefixValueTest()
        {
            String    modName    = "testMod";
            int       testValue1 = 5;
            int       testValue2 = 10;
            int       testValue3 = 15;
            AffixType affixType  = AffixType.Prefix;

            Affix     affix         = CreateTestAffix(modName, affixType);
            Stat      stat          = CreateTestStat(testValue1, testValue2, testValue3, affix);
            Equipment testEquipment = CreateTestEquipment(stat);

            List <int> values = _affixValueCalculator.GetAffixValues(modName, testEquipment, affixType, StatValueType.Flat);

            Assert.AreEqual(stat.Value1, values[0]);
            Assert.AreEqual(stat.Value2, values[1]);
            Assert.AreEqual(stat.Value3, values[2]);
        }
        public void MetamodOpenPrefixesTest()
        {
            String metaModName = AffixTypes.OpenPrefix;

            Affix     affix         = CreateTestAffix("testMod", AffixType.Prefix);
            Stat      stat          = CreateTestStat(affix, 5, 10);
            Equipment testEquipment = new Equipment();

            for (int i = 0; i < 4; i++)
            {
                List <int> values = _affixValueCalculator.GetAffixValues(metaModName, testEquipment, AffixType.Meta, StatValueType.Flat);
                testEquipment.Stats.Add(stat);

                Assert.AreEqual(3 - i, values[0]);
                Assert.AreEqual(1, values.Count);
            }
        }
예제 #3
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));
        }