Пример #1
0
 public void ParseRareAstralPlateReturnsCorrectResult()
 {
     var mods = new[]
     {
         "+1% to Fire Resistance", "+50 to maximum Life", "+32 to Strength", "10% increased Armour"
     };
     var item = new Item("Metadata/Items/Armours/BodyArmours/BodyStr15",
                         "Hypnotic Keep Astral Plate", 20, 62, FrameType.Rare, false, mods, true);
     var definition              = _baseItemDefinitions.GetBaseItemById(item.BaseMetadataId);
     var local                   = new ModifierSource.Local.Item(ItemSlot.BodyArmour, item.Name);
     var global                  = new ModifierSource.Global(local);
     var armourPropertyStat      = new Stat("BodyArmour.Armour");
     var valueCalculationContext = Mock.Of <IValueCalculationContext>(c =>
                                                                      c.GetValue(armourPropertyStat, NodeType.Total, PathDefinition.MainPath) == (NodeValue?)5);
     var expectedModifiers =
         new (string stat, Form form, double?value, ModifierSource source)[]
Пример #2
0
        public ParseResult Parse(ItemParserParameter parameter)
        {
            var(item, slot) = parameter;

            if (!item.IsEnabled)
            {
                return(ParseResult.Empty);
            }

            var localSource            = new ModifierSource.Local.Item(slot, item.Name);
            var globalSource           = new ModifierSource.Global(localSource);
            var baseItemDefinition     = _baseItemDefinitions.GetBaseItemById(item.BaseMetadataId);
            var partialParserParameter =
                new PartialItemParserParameter(item, slot, baseItemDefinition, localSource, globalSource);

            var parseResults = new List <ParseResult>(_partialParsers.Length);

            foreach (var partialParser in _partialParsers)
            {
                parseResults.Add(partialParser.Parse(partialParserParameter));
            }
            return(ParseResult.Aggregate(parseResults));
        }