private void DivinationJsonHandler(ItemData jdata, LeagueData data) { string name = jdata.Name; if (!data.DivinationCards.ContainsKey(name)) { DivinationCard div = new DivinationCard(); data.DivinationCards.Add(name, div); } data.DivinationCards[name].Load(jdata); }
private void DivinationJsonHandler(JsonData jdata, LeagueData data) { string name = jdata.Name; if (!data.DivinationCards.TryGetValue(name, out DivinationCard div)) { div = new DivinationCard(); data.DivinationCards.Add(name, div); } data.DivinationCards[name].Load(jdata); }
private void FillFilterDivinationData(LeagueData data, List <string> baseTypes, DivinationValue value) { foreach (string baseTy in baseTypes) { if (!data.DivinationCards.TryGetValue(baseTy, out DivinationCard divCard)) { divCard = new DivinationCard(baseTy); data.DivinationCards.Add(baseTy, divCard); } divCard.FilterValue = value; } }
private string GenerateDivinationString(FilterType type) { List <string> list2to10cConflict = new List <string>(); List <string> listLess2cConflict = new List <string>(); List <string> listNearlyWorthlessConflict = new List <string>(); List <string> listWorthlessConflict = new List <string>(); List <string> list10c = new List <string>(); List <string> list2to10c = new List <string>(); List <string> listLess2c = new List <string>(); List <string> listNearlyWorthless = new List <string>(); List <string> listWorthless = new List <string>(); StringBuilder sb = new StringBuilder(); foreach (string divCard in DivinationCards) { DivinationCard data = DivinationA[divCard]; DivinationValue expectedVal = data.ExpectedFilterValue; if (!data.HasHardCodedValue) { DivinationValue filterVal = data.FilterValue; DivinationCard dataB = DivinationB[divCard]; //if (data.SeverityLevel == 0) // expectedVal = filterVal; //if SC < HC - 5 then +1 tier if (data.Tier < dataB.Tier && data.ChaosValue < dataB.ChaosValue - 5.0f) { expectedVal = DivinationValue.FromTier(expectedVal.Tier + 1); } } else if (data.ChaosValue - 0.5f > expectedVal.HighValue) { //MessageBox.Show(divCard + " is more valuable than expected"); //throw new InvalidOperationException(divCard + " is more valuable than expected"); // card is somehow valuable? } switch (expectedVal.Value) { case DivinationValueEnum.Error: case DivinationValueEnum.Chaos10: list10c.Add(divCard); break; case DivinationValueEnum.Chaos2to10: if (list10c.Exists(str => divCard.Contains(str))) { list2to10cConflict.Add(divCard); } else { list2to10c.Add(divCard); } break; case DivinationValueEnum.ChaosLess2: if (list10c.Exists(str => divCard.Contains(str)) || list2to10c.Exists(str => divCard.Contains(str))) { listLess2cConflict.Add(divCard); } else { listLess2c.Add(divCard); } break; case DivinationValueEnum.NearlyWorthless: if (list10c.Exists(str => divCard.Contains(str)) || list2to10c.Exists(str => divCard.Contains(str)) || listLess2c.Exists(str => divCard.Contains(str))) { listNearlyWorthlessConflict.Add(divCard); } else { listNearlyWorthless.Add(data.Name); } break; case DivinationValueEnum.Worthless: if (list10c.Exists(str => divCard.Contains(str)) || list2to10c.Exists(str => divCard.Contains(str)) || listLess2c.Exists(str => divCard.Contains(str)) || listNearlyWorthless.Exists(str => divCard.Contains(str))) { listWorthlessConflict.Add(divCard); } else { listWorthless.Add(divCard); } break; default: throw new InvalidOperationException("Unknown Divination Value: " + expectedVal.Value); } } // Name Conflicts sb.AppendLine("# Potential Conflicts!!! (They have been separated but may need to be reorganized)").AppendLine(); foreach (List <string> list in Conflicts) { sb.Append("# "); foreach (string str in list) { string baseTy = str; if (baseTy.Contains(' ')) { baseTy = "\"" + baseTy + "\""; } sb.Append(baseTy).Append(' '); } sb.Remove(sb.Length - 1, 1).AppendLine(); } sb.AppendLine(); // Conflicts if (list2to10cConflict.Count > 0) { sb.AppendLine("Show # Divination Cards - 2-10c (Conflicts)").AppendLine("\tClass Divination").Append("\tBaseType ").AppendLine(ItemList(list2to10cConflict)).AppendLine(styleDiv2c).AppendLine(); } if (listLess2cConflict.Count > 0) { bool shown = DivinationCard.IsShown(type, DivinationValueEnum.ChaosLess2); string showHide = shown ? "Show" : "Hide"; string style = shown ? styleDivLess2cHide : styleDivLess2cShow; sb.AppendLine(showHide + " # Divination Cards - <2c (Conflicts)").AppendLine("\tClass Divination").Append("\tBaseType ").AppendLine(ItemList(listLess2cConflict)).AppendLine(style).AppendLine(); } if (listNearlyWorthlessConflict.Count > 0) { string showHide = DivinationCard.IsShown(type, DivinationValueEnum.NearlyWorthless) ? "Show" : "Hide"; sb.AppendLine(showHide + " # Divination Cards - Nearly Worthless (Conflicts)").AppendLine("\tClass Divination").Append("\tBaseType ").AppendLine(ItemList(listNearlyWorthlessConflict)).AppendLine(styleDivNearlyWorthless).AppendLine(); } if (listWorthlessConflict.Count > 0) { string showHide = DivinationCard.IsShown(type, DivinationValueEnum.Worthless) ? "Show" : "Hide"; sb.AppendLine(showHide + " # Divination Cards - Worthless (Conflicts)").AppendLine("\tClass Divination").Append("\tBaseType ").AppendLine(ItemList(listWorthlessConflict)).AppendLine(styleDivWorthless).AppendLine(); } if (list10c.Count > 0) { sb.AppendLine("Show # Divination Cards - 10c+").AppendLine("\tClass Divination").Append("\tBaseType ").AppendLine(ItemList(list10c)).AppendLine(styleDiv10c).AppendLine(); } if (list2to10c.Count > 0) { sb.AppendLine("Show # Divination Cards - 2-10c").AppendLine("\tClass Divination").Append("\tBaseType ").AppendLine(ItemList(list2to10c)).AppendLine(styleDiv2c).AppendLine(); } if (listLess2c.Count > 0) { bool shown = DivinationCard.IsShown(type, DivinationValueEnum.ChaosLess2); string showHide = shown ? "Show" : "Hide"; string style = shown ? styleDivLess2cHide : styleDivLess2cShow; sb.AppendLine(showHide + " # Divination Cards - <2c").AppendLine("\tClass Divination").Append("\tBaseType ").AppendLine(ItemList(listLess2c)).AppendLine(style).AppendLine(); } if (listNearlyWorthless.Count > 0) { string showHide = DivinationCard.IsShown(type, DivinationValueEnum.NearlyWorthless) ? "Show" : "Hide"; sb.AppendLine(showHide + " # Divination Cards - Nearly Worthless").AppendLine("\tClass Divination").Append("\tBaseType ").AppendLine(ItemList(listNearlyWorthless)).AppendLine(styleDivNearlyWorthless).AppendLine(); } if (listWorthless.Count > 0) { string showHide = DivinationCard.IsShown(type, DivinationValueEnum.Worthless) ? "Show" : "Hide"; sb.AppendLine(showHide + " # Divination Cards - Worthless").AppendLine("\tClass Divination").Append("\tBaseType ").AppendLine(ItemList(listWorthless)).AppendLine(styleDivWorthless).AppendLine(); } sb.AppendLine(divNewOrWorthless); return(sb.ToString()); }
//IEnumerable<string> lines private string GenerateDivinationString() { List <string> list1to10cConflict = new List <string>(); List <string> listLess1cConflict = new List <string>(); List <string> listNearlyWorthlessConflict = new List <string>(); List <string> listWorthlessConflict = new List <string>(); List <string> list10c = new List <string>(); List <string> list1to10c = new List <string>(); List <string> listLess1c = new List <string>(); List <string> listNearlyWorthless = new List <string>(); List <string> listWorthless = new List <string>(); StringBuilder sb = new StringBuilder(); foreach (string divCard in DivinationCards) { DivinationCard data = DivinationSC[divCard]; DivinationValue expectedVal = data.ExpectedFilterValue; DivinationValue filterVal = data.FilterValue; DivinationCard dataHC = DivinationHC[divCard]; DivinationValue expectedValHC = dataHC.ExpectedFilterValue; if (data.SeverityLevel == 0) { expectedVal = filterVal; } else if (Safe && filterVal.LowValue < data.ChaosValue) { expectedVal = DivinationValue.FromTier(expectedVal.Tier + 1); } //if SC <1c and HC 4c+ then +1 tier if (HCFriendly && expectedVal.Tier < 2 && dataHC.ChaosValue > 4.0f) { expectedVal = DivinationValue.FromTier(expectedVal.Tier + 1); } switch (expectedVal.Value) { case DivinationValueEnum.Chaos10: list10c.Add(divCard); break; case DivinationValueEnum.Chaos1to10: if (list10c.Exists(str => divCard.Contains(str))) { list1to10cConflict.Add(divCard); } else { list1to10c.Add(divCard); } break; case DivinationValueEnum.ChaosLess1: if (list10c.Exists(str => divCard.Contains(str)) || list1to10c.Exists(str => divCard.Contains(str))) { listLess1cConflict.Add(divCard); } else { listLess1c.Add(divCard); } break; case DivinationValueEnum.NearlyWorthless: if (list10c.Exists(str => divCard.Contains(str)) || list1to10c.Exists(str => divCard.Contains(str)) || listLess1c.Exists(str => divCard.Contains(str))) { listNearlyWorthlessConflict.Add(divCard); } else { listNearlyWorthless.Add(data.Name); } break; case DivinationValueEnum.Worthless: if (list10c.Exists(str => divCard.Contains(str)) || list1to10c.Exists(str => divCard.Contains(str)) || listLess1c.Exists(str => divCard.Contains(str)) || listNearlyWorthless.Exists(str => divCard.Contains(str))) { listWorthlessConflict.Add(divCard); } else { listWorthless.Add(divCard); } break; default: break; } } sb.AppendLine(headerDiv).AppendLine(); sb.AppendLine(GenerateDivinationConflictsString()).AppendLine(); if (list1to10cConflict.Count > 0) { sb.AppendLine("Show # Divination Cards - 1c+ (Conflicts)").AppendLine("\tClass Divination").Append('\t').AppendLine(BaseTypeList(list1to10cConflict)).AppendLine(styleDiv1c).AppendLine(); } if (listLess1cConflict.Count > 0) { sb.AppendLine("Show # Divination Cards - <1c (Conflicts)").AppendLine("\tClass Divination").Append('\t').AppendLine(BaseTypeList(listLess1cConflict)).AppendLine(styleDivLess1c).AppendLine(); } if (listNearlyWorthlessConflict.Count > 0) { sb.AppendLine("Show # Divination Cards - Nearly Worthless (Conflicts)").AppendLine("\tClass Divination").Append('\t').AppendLine(BaseTypeList(listNearlyWorthlessConflict)).AppendLine(styleDivNearlyWorthless).AppendLine(); } if (listWorthlessConflict.Count > 0) { sb.AppendLine("Hide # Divination Cards - Worthless (Conflicts)").AppendLine("\tClass Divination").Append('\t').AppendLine(BaseTypeList(listWorthlessConflict)).AppendLine(styleDivWorthless).AppendLine(); } if (list10c.Count > 0) { sb.AppendLine("Show # Divination Cards - 10c+").AppendLine("\tClass Divination").Append('\t').AppendLine(BaseTypeList(list10c)).AppendLine(styleDiv10c).AppendLine(); } if (list1to10c.Count > 0) { sb.AppendLine("Show # Divination Cards - 1c+").AppendLine("\tClass Divination").Append('\t').AppendLine(BaseTypeList(list1to10c)).AppendLine(styleDiv1c).AppendLine(); } if (listLess1c.Count > 0) { sb.AppendLine("Show # Divination Cards - <1c").AppendLine("\tClass Divination").Append('\t').AppendLine(BaseTypeList(listLess1c)).AppendLine(styleDivLess1c).AppendLine(); } if (listNearlyWorthless.Count > 0) { sb.AppendLine("Show # Divination Cards - Nearly Worthless").AppendLine("\tClass Divination").Append('\t').AppendLine(BaseTypeList(listNearlyWorthless)).AppendLine(styleDivNearlyWorthless).AppendLine(); } if (listWorthless.Count > 0) { sb.AppendLine("Show # Divination Cards - Worthless").AppendLine("\tClass Divination").Append('\t').AppendLine(BaseTypeList(listWorthless)).AppendLine(styleDivWorthless).AppendLine(); } sb.AppendLine(divNewOrWorthless); return(sb.ToString()); }