public StatData GetById(string id) { var result = PseudoPatterns.FirstOrDefault(x => x.Id == id); if (result != null) { return(result); } result = ImplicitPatterns.FirstOrDefault(x => x.Id == id); if (result != null) { return(result); } result = ExplicitPatterns.FirstOrDefault(x => x.Id == id); if (result != null) { return(result); } result = CraftedPatterns.FirstOrDefault(x => x.Id == id); if (result != null) { return(result); } result = EnchantPatterns.FirstOrDefault(x => x.Id == id); if (result != null) { return(result); } return(null); }
public bool IsMatch(string id, string text) { ModifierPattern pattern = null; pattern = PseudoPatterns.FirstOrDefault(x => x.Metadata.Id == id); if (pattern == null) { pattern = ImplicitPatterns.FirstOrDefault(x => x.Metadata.Id == id); } if (pattern == null) { pattern = ExplicitPatterns.FirstOrDefault(x => x.Metadata.Id == id); } if (pattern == null) { pattern = CraftedPatterns.FirstOrDefault(x => x.Metadata.Id == id); } if (pattern == null) { pattern = EnchantPatterns.FirstOrDefault(x => x.Metadata.Id == id); } if (pattern == null) { pattern = FracturedPatterns.FirstOrDefault(x => x.Metadata.Id == id); } if (pattern == null) { return(false); } if (pattern.Pattern != null && pattern.Pattern.IsMatch(text)) { return(true); } if (pattern.NegativePattern != null && pattern.NegativePattern.IsMatch(text)) { return(true); } return(false); }
public bool IsMatch(string id, string text) { ModifierPatternMetadata metadata = null; metadata = PseudoPatterns.FirstOrDefault(x => x.Id == id); if (metadata == null) { metadata = ImplicitPatterns.FirstOrDefault(x => x.Id == id); } if (metadata == null) { metadata = ExplicitPatterns.FirstOrDefault(x => x.Id == id); } if (metadata == null) { metadata = CraftedPatterns.FirstOrDefault(x => x.Id == id); } if (metadata == null) { metadata = EnchantPatterns.FirstOrDefault(x => x.Id == id); } if (metadata == null) { metadata = FracturedPatterns.FirstOrDefault(x => x.Id == id); } if (metadata == null) { return(false); } foreach (var pattern in metadata.Patterns) { if (pattern.Pattern != null && pattern.Pattern.IsMatch(text)) { return(true); } } return(false); }
public ModifierMetadata GetById(string id) { var result = PseudoPatterns.FirstOrDefault(x => x.Metadata.Id == id); if (result != null) { return(result.Metadata); } result = ImplicitPatterns.FirstOrDefault(x => x.Metadata.Id == id); if (result != null) { return(result.Metadata); } result = ExplicitPatterns.FirstOrDefault(x => x.Metadata.Id == id); if (result != null) { return(result.Metadata); } result = CraftedPatterns.FirstOrDefault(x => x.Metadata.Id == id); if (result != null) { return(result.Metadata); } result = EnchantPatterns.FirstOrDefault(x => x.Metadata.Id == id); if (result != null) { return(result.Metadata); } result = FracturedPatterns.FirstOrDefault(x => x.Metadata.Id == id); if (result != null) { return(result.Metadata); } return(null); }