private void GetFilterEnchantsData(IEnumerable <string> lines) { EnchantmentValue value = null; while (lines.Any()) { lines = lines.SkipWhile(aline => !aline.StartsWith("Show ") && !aline.StartsWith("Hide ")); if (!lines.Any()) { return; } string line = lines.First(); if (!line.Contains("# Enchantments -") || line.Contains("Unique")) { lines = lines.Skip(1); continue; } if (line.Contains("20c+")) { value = EnchantmentValue.Chaos20; } else if (line.Contains("10c+")) { value = EnchantmentValue.Chaos10; } else { //if (!line.Contains("Other")) // MessageBox.Show("Unexpected Enchant input: " + line, "Error", MessageBoxButtons.OK); lines = lines.Skip(1); continue; } lines = lines.Skip(1).SkipWhile(aline => !aline.TrimStart().StartsWith("HasEnchantment ") && !aline.StartsWith("Show ") && !aline.StartsWith("Hide ")); line = lines.First().TrimStart(); if (line.StartsWith("HasEnchantment ")) { IEnumerable <string> enchantTypes = SplitQuotedList(line).Skip(1); FillFilterEnchantData(SC, enchantTypes, value); FillFilterEnchantData(HC, enchantTypes, value); } } }
private string GenerateEnchantsString() { StringBuilder sb = new StringBuilder(); List <string> list20c = new List <string>(); List <string> list10c = new List <string>(); foreach (string name in Enchantments) { Enchantment data = EnchantsA[name]; if (data.Source == EnchantmentSource.BlightOils) { continue; } Enchantment dataB = EnchantsB[name]; EnchantmentValue expectedVal = data.ExpectedFilterValue; EnchantmentValue filterVal = data.ExpectedFilterValue; if (data.SeverityLevel == 0) { expectedVal = filterVal; } if (expectedVal.Tier < 1 && !dataB.IsLowConfidence && dataB.ChaosValue >= 50.0f) { //if SC <10c and HC 50c+ then 10+c expectedVal = EnchantmentValue.Chaos10; } switch (expectedVal.Value) { case EnchantmentValueEnum.Chaos10: list10c.Add(data.Name); break; case EnchantmentValueEnum.Chaos20: list20c.Add(data.Name); break; case EnchantmentValueEnum.Worthless: case EnchantmentValueEnum.Error: break; } } string enchStyleUniq = @" Rarity = Unique SetFontSize 45 SetTextColor 255 128 64 # Unique (15c+) SetBackgroundColor 255 255 255 255 # Unique (15c+) SetBorderColor 255 128 64 255 # Unique (15c+) PlayAlertSound 1 200 # High Value MinimapIcon 0 Red UpsideDownHouse PlayEffect Red" ; string enchStyleRare20 = @" SetFontSize 45 SetTextColor 0 100 220 # Crafting Base (High) SetBackgroundColor 255 255 255 255 # Crafting Base (High) SetBorderColor 40 80 150 255 # Crafting Base (High) PlayAlertSound 1 200 # High Value MinimapIcon 0 Red UpsideDownHouse PlayEffect Red" ; string enchStyle10 = @" SetFontSize 40 SetTextColor 255 255 255 # Crafting Base (Mid) SetBackgroundColor 60 60 60 255 # Crafting Base (Mid) SetBorderColor 45 90 160 255 # Crafting Base (Mid) PlayAlertSound 4 200 # Mid Value MinimapIcon 0 Blue UpsideDownHouse PlayEffect Blue" ; if (list20c.Count > 0) { sb.AppendLine(@"Show # Enchantments - 20c+ Unique").Append("\tHasEnchantment ").AppendLine(ItemList(list20c)).AppendLine(enchStyleUniq).AppendLine(); sb.AppendLine(@"Show # Enchantments - 20c+ Other").Append("\tHasEnchantment ").AppendLine(ItemList(list20c)).AppendLine(enchStyleRare20).AppendLine(); } if (list10c.Count > 0) { sb.AppendLine(@"Show # Enchantments - 10c+ Unique").Append("\tHasEnchantment ").AppendLine(ItemList(list10c)).AppendLine(enchStyleUniq).AppendLine(); sb.AppendLine(@"Show # Enchantments - 10c+ Other").Append("\tHasEnchantment ").AppendLine(ItemList(list10c)).AppendLine(enchStyle10).AppendLine(); } sb.AppendLine( @"Show # Enchantments - Jewelry AnyEnchantment True Class Rings Amulets Rarity <= Rare SetFontSize 40 SetTextColor 255 255 255 # Crafting Base (Mid) SetBackgroundColor 60 60 60 255 # Crafting Base (Mid) SetBorderColor 45 90 160 255 # Crafting Base (Mid) PlayAlertSound 4 200 # Mid Value MinimapIcon 0 Blue UpsideDownHouse PlayEffect Blue Show # Enchantments - Helmets Boots AnyEnchantment True Class Helmets Boots Rarity <= Rare Sockets < 6 SetFontSize 36 SetBackgroundColor 50 50 50 230 # Crafting Base (Low) SetBorderColor 0 0 0 255 # Crafting Base (Low)" ); return(sb.ToString()); }
private void FillFilterEnchantData(LeagueData data, IEnumerable <string> enchantTypes, EnchantmentValue value) { foreach (string enchType in enchantTypes) { if (!data.Enchantments.TryGetValue(enchType, out Enchantment ench)) { ench = new Enchantment(enchType); data.Enchantments.Add(enchType, ench); } ench.FilterValue = value; } }