public List <AttributeModifier> GetAttributeModifiers(int level, float multiplier = 1) { var modifiers = new List <AttributeModifier>(); foreach (var attributeModifierCurveData in this.data.Attributes) { var amount = Curve.Evaluate( level, attributeModifierCurveData.Min, attributeModifierCurveData.Max, attributeModifierCurveData.CurveType) * multiplier; amount *= Quality; var attributeData = new AttributeModifierData { Type = ModifierType.Flat, Amount = amount }; var attributeModifier = new AttributeModifier( this.attributeRepository.Find(attributeModifierCurveData.AttributeId), attributeData); modifiers.Add(attributeModifier); } modifiers.AddRange(ItemModifiers.SelectMany(m => m.GetAttributeModifiers(level, multiplier))); return(modifiers); }
public ItemModifiers Parse(ParsingItem parsingItem) { var mods = new ItemModifiers(); ParseModifiers(mods.Explicit, ExplicitPatterns, parsingItem); ParseModifiers(mods.Enchant, EnchantPatterns, parsingItem); ParseModifiers(mods.Implicit, ImplicitPatterns, parsingItem); ParseModifiers(mods.Crafted, CraftedPatterns, parsingItem); ParseModifiers(mods.Fractured, FracturedPatterns, parsingItem); // ParseModifiers(mods.Veiled, VeiledPatterns, parsingItem); mods.Pseudo = pseudoModifierProvider.Parse(mods); return(mods); }
public List <Modifier> Parse(ItemModifiers modifiers) { var pseudo = new List <Modifier>(); FillPseudo(ref pseudo, modifiers.Explicit); FillPseudo(ref pseudo, modifiers.Implicit); FillPseudo(ref pseudo, modifiers.Enchant); FillPseudo(ref pseudo, modifiers.Crafted); pseudo.ForEach(x => { x.Text = ParseHashPattern.Replace(x.Text, ((int)x.Values[0]).ToString(), 1); }); return(pseudo); }
public List <PropertyModifier> GetPropertyModifiers(int level, int forgeLevel, float multiplier = 1) { var modifiers = new List <PropertyModifier>(); foreach (var propertyModifierCurveData in this.data.Properties) { var property = this.propertyRepository.Find(propertyModifierCurveData.PropertyId); var amount = Curve.Evaluate( level, propertyModifierCurveData.Min, propertyModifierCurveData.Max, propertyModifierCurveData.CurveType) * (property.IsUnscalable ? 1 : multiplier); amount *= Quality; var forge = Curve.Evaluate( forgeLevel, propertyModifierCurveData.Min, propertyModifierCurveData.Max, propertyModifierCurveData.CurveType) * (property.IsUnscalable ? 1 : multiplier); if (property.IsFractional()) { forge *= 0.25f; } amount += forge; var propertyData = new PropertyModifierData { PropertyId = property.Id, Type = ModifierType.Flat, Amount = amount }; modifiers.Add(new PropertyModifier(property, propertyData)); } modifiers.AddRange(ItemModifiers.SelectMany(m => m.GetPropertyModifiers(level, forgeLevel, multiplier))); return(modifiers); }
public ItemModifiers Parse(ParsingItem parsingItem) { var text = NewLinePattern.Replace(parsingItem.Text, "\n"); var mods = new ItemModifiers(); // Make sure the text ends with an empty line for our regexes to work correctly if (!text.EndsWith("\n")) { text += "\n"; } ParseMods(mods.Explicit, ExplicitPatterns, text); ParseMods(mods.Implicit, ImplicitPatterns, text); ParseMods(mods.Enchant, EnchantPatterns, text); ParseMods(mods.Crafted, CraftedPatterns, text); //FillMods(mods.Veiled, VeiledPatterns, text); ParseMods(mods.Fractured, FracturedPatterns, text); mods.Pseudo = pseudoModifierProvider.Parse(mods); return(mods); }