示例#1
0
        private void ParseEquipmentProperties(Item item, ParsingItem parsingItem)
        {
            var propertySection = parsingItem.WholeSections[1];

            item.ItemLevel                       = patterns.GetInt(patterns.ItemLevel, item.Text);
            item.Identified                      = !ParseFromEnd(patterns.Unidentified, parsingItem);
            item.Properties.Armor                = patterns.GetInt(patterns.Armor, propertySection);
            item.Properties.EnergyShield         = patterns.GetInt(patterns.EnergyShield, propertySection);
            item.Properties.Evasion              = patterns.GetInt(patterns.Evasion, propertySection);
            item.Properties.ChanceToBlock        = patterns.GetInt(patterns.ChanceToBlock, propertySection);
            item.Properties.Quality              = patterns.GetInt(patterns.Quality, propertySection);
            item.Properties.AttacksPerSecond     = patterns.GetDouble(patterns.AttacksPerSecond, propertySection);
            item.Properties.CriticalStrikeChance = patterns.GetDouble(patterns.CriticalStrikeChance, propertySection);
            item.Properties.ElementalDps         = patterns.GetDps(patterns.ElementalDamage, propertySection, item.Properties.AttacksPerSecond);
            item.Properties.PhysicalDps          = patterns.GetDps(patterns.PhysicalDamage, propertySection, item.Properties.AttacksPerSecond);
            item.Properties.DamagePerSecond      = item.Properties.ElementalDps + item.Properties.PhysicalDps;
            item.Corrupted                       = ParseFromEnd(patterns.Corrupted, parsingItem);
        }
示例#2
0
        private void ParseHeader(ref Item item, ref string input)
        {
            var dataItem = itemDataService.ParseItem(input);

            if (dataItem == null)
            {
                throw new NotSupportedException("Item not found.");
            }

            item.Name   = dataItem.Name;
            item.Type   = dataItem.Type;
            item.Rarity = dataItem.Rarity;

            var lines = NewlinePattern.Split(input);

            item.NameLine = SeparatorPattern.IsMatch(lines[1]) ? string.Empty : lines[1];
            item.TypeLine = SeparatorPattern.IsMatch(lines[2]) ? string.Empty : lines[2];

            if (item.Rarity == Rarity.Unknown)
            {
                item.Rarity = GetRarity(lines[0]);
            }

            if (item.Rarity != Rarity.DivinationCard)
            {
                item.ItemLevel  = patterns.GetInt(patterns.ItemLevel, input);
                item.Identified = !patterns.Unidentified.IsMatch(input);
                item.Corrupted  = patterns.Corrupted.IsMatch(input);
            }
        }