private ChaosRecipeResult CalculateChaosRecipe(StashTab tab) { ChaosRecipeResult result = new ChaosRecipeResult(); string startStr = "https://web.poecdn.com/image/Art/2DItems/"; foreach (var item in tab.Items) { if (item.FrameType == 2 && item.ItemLevel >= 60 && item.ItemLevel < 75) { int startIndex = item.IconUrl.IndexOf(startStr); if (startIndex == -1) { continue; } startIndex += startStr.Length; int endIndex = item.IconUrl.IndexOf("/", startIndex); if (endIndex == -1) { continue; } string type = item.IconUrl.Substring(startIndex, endIndex - startIndex); if (type == "Weapons") { int nextIndex = item.IconUrl.IndexOf("/", endIndex + 1); if (nextIndex != -1) { type = item.IconUrl.Substring(startIndex, nextIndex - startIndex); } } if (type == "Armours") { int nextIndex = item.IconUrl.IndexOf("/", endIndex + 1); if (nextIndex != -1) { type = item.IconUrl.Substring(startIndex, nextIndex - startIndex); } } SetResult(type, ref result); } } return(result); }
private void SetResult(string type, ref ChaosRecipeResult result) { switch (type) { case "Rings": ++result.NbRings; break; case "Belts": ++result.NbBelts; break; case "Amulets": ++result.NbAmulets; break; case "Armours/Helmets": ++result.NbHelmets; break; case "Armours/Boots": ++result.NbBoots; break; case "Armours/Gloves": ++result.NbGloves; break; case "Armours/BodyArmours": ++result.NbBodyArmours; break; case "Armours/Shields": ++result.NbOffHands; break; case "Weapons/OneHandWeapons": ++result.Nb1HWeapons; break; case "Weapons/TwoHandWeapons": ++result.Nb2HWeapons; break; } }
public void NewChaosRecipeResult(ChaosRecipeResult result) { OnNewChaosRecipeResult(result); }