Esempio n. 1
0
 private void FillFilterUniqueData(LeagueData data, List <string> baseTypes, UniqueValue value)
 {
     foreach (string baseTy in baseTypes)
     {
         if (!data.Uniques.TryGetValue(baseTy, out UniqueBaseType unique))
         {
             if (baseTy == "Maelstr")
             {
                 if (!data.Uniques.TryGetValue("Maelström Staff", out unique))
                 {
                     unique = new UniqueBaseType("Maelström Staff");
                     data.Uniques.Add("Maelström Staff", unique);
                 }
             }
             else
             {
                 unique = new UniqueBaseType(baseTy);
                 data.Uniques.Add(baseTy, unique);
                 MessageBox.Show("Filter: unknown basetype: " + unique.BaseType, "Error", MessageBoxButtons.OK);
                 Environment.Exit(1);
             }
         }
         unique.FilterValue = value;
     }
 }
Esempio n. 2
0
 private void FillUniqueListView(ListView lv, LeagueData data)
 {
     lv.BeginUpdate();
     lv.Items.Clear();
     foreach (string baseType in model.Uniques)
     {
         if (!data.Uniques.TryGetValue(baseType, out UniqueBaseType uniqData))
         {
             continue;
         }
         string values = "";
         foreach (UniqueItem udata in uniqData.Items)
         {
             if (udata.Links > 4)
             {
                 values += "(" + udata.Links + "L)";
             }
             string value = udata.Count > 0 ? udata.ChaosValue.ToString() : "?";
             values += udata.Name + ": " + value + ", ";
         }
         UniqueValue expect     = uniqData.ExpectedFilterValue;
         string      severity   = uniqData.SeverityLevel.ToString();
         string      filterVal  = uniqData.FilterValue.ToString();
         string      expectVal  = expect.Value == uniqData.FilterValue.Value ? "" : expect.ToString();
         string      listedVals = values.Substring(0, values.Length - 2);
         lv.Items.Add(new ListViewItem(new string[] { baseType, severity, filterVal, expectVal, listedVals }));
     }
     lv.AutoResizeColumns(ColumnHeaderAutoResizeStyle.ColumnContent);
     lv.Columns[0].AutoResize(ColumnHeaderAutoResizeStyle.ColumnContent);
     lv.Columns[1].AutoResize(ColumnHeaderAutoResizeStyle.HeaderSize);
     lv.Columns[2].AutoResize(ColumnHeaderAutoResizeStyle.HeaderSize);
     lv.Columns[3].AutoResize(ColumnHeaderAutoResizeStyle.HeaderSize);
     lv.Columns[4].AutoResize(ColumnHeaderAutoResizeStyle.ColumnContent);
     lv.EndUpdate();
 }
        private string GenerateUniquesString(FilterType type)
        {
            List <string> list15c     = new List <string>();
            List <string> list5to15c  = new List <string>();
            List <string> list3to5c   = new List <string>();
            List <string> listLimited = new List <string>();
            StringBuilder sb          = new StringBuilder();

            foreach (var uniq in UniquesA)
            {
                UniqueBaseType entry        = uniq.Value;
                string         baseTy       = uniq.Key;
                UniqueValue    expectedVal  = entry.ExpectedFilterValue;
                UniqueValue    filterVal    = entry.FilterValue;
                string         outputBaseTy = baseTy;
                int            index        = baseTy.IndexOf('ö');
                if (index > 0)
                {
                    outputBaseTy = outputBaseTy.Substring(0, index);
                }
                UniqueBaseType entryHC       = UniquesB[baseTy];
                UniqueValue    expectedValHC = entryHC.ExpectedFilterValue;

                if (entry.SeverityLevel == 0)
                {
                    expectedVal = filterVal;
                }
                //if is only core drop and SC <3c and HC 15c+ then Limited
                if (expectedVal.Tier == 0 && expectedValHC.Tier > 0)
                {
                    if (expectedValHC.Tier > 2 || !entry.Items.All(x => x.IsCoreDrop))
                    {
                        expectedVal = UniqueValue.Limited;
                    }
                }

                switch (expectedVal.Value)
                {
                case UniqueValueEnum.Chaos15:
                    list15c.Add(outputBaseTy);
                    break;

                case UniqueValueEnum.Chaos5to15:
                    list5to15c.Add(outputBaseTy);
                    break;

                case UniqueValueEnum.Chaos3to5:
                    list3to5c.Add(outputBaseTy);
                    break;

                case UniqueValueEnum.Limited:
                    listLimited.Add(outputBaseTy);
                    break;

                default:
                    break;
                }
            }

            sb.AppendLine(uniqueWarning).AppendLine();
            sb.AppendLine(uniqueJewels).AppendLine();
            if (list15c.Count > 0)
            {
                sb.AppendLine(header15c).AppendLine();
                sb.AppendLine("Show  # Uniques - 15c+").AppendLine("\tRarity = Unique").Append("\tBaseType ").AppendLine(ItemList(list15c)).AppendLine(style15c).AppendLine();
            }
            sb.AppendLine(header5to15c).AppendLine();
            if (list5to15c.Count > 0)
            {
                sb.AppendLine("Show  # Uniques - 5-15c").AppendLine("\tRarity = Unique").Append("\tBaseType ").AppendLine(ItemList(list5to15c)).AppendLine(style5to15c).AppendLine();
            }
            sb.AppendLine("Show  # Uniques - Enchanted").AppendLine("\tRarity = Unique").AppendLine("\tAnyEnchantment True").AppendLine(style5to15c).AppendLine();
            sb.AppendLine(header3c).AppendLine();
            if (list3to5c.Count > 0)
            {
                sb.AppendLine("Show  # Uniques - 3-5c").AppendLine("\tRarity = Unique").Append("\tBaseType ").AppendLine(ItemList(list3to5c)).AppendLine(style3c).AppendLine();
            }
            sb.AppendLine(loreweaveStr).AppendLine(style3c).AppendLine();
            sb.AppendLine(replicaUniq).AppendLine();
            sb.AppendLine(headerLess3c).AppendLine();

            string showHide = type == FilterType.VERY_STRICT ? "Hide" : "Show";
            string vsSound  = type == FilterType.VERY_STRICT ? styleUniqueIcon : styleUniqueIconSound;
            string sSound   = (type != FilterType.VERY_STRICT && type != FilterType.STRICT) ? styleUniqueIconSound : "	DisableDropSound";

            if (type != FilterType.VERY_STRICT)
            {
                sb.AppendLine(lessLvl67).AppendLine();
            }
            if (listLimited.Count > 0)
            {
                sb.AppendLine(headerLimited);
                sb.AppendLine("Show  # Uniques - Limited").AppendLine("\tRarity = Unique").Append("\tBaseType ").AppendLine(ItemList(listLimited)).AppendLine(styleLimited).AppendLine(vsSound).AppendLine();
            }
            sb.AppendLine(showHide + uniqueNewOrWorthless).Append(sSound).AppendLine();

            return(sb.ToString());
        }
        private string GenerateUniquesString()
        {
            List <string> list10c             = new List <string>();
            List <string> list2to10c          = new List <string>();
            List <string> list1to2c           = new List <string>();
            List <string> listLess1c          = new List <string>();
            List <string> listLess1cShared    = new List <string>();
            List <string> listLess1cLeague    = new List <string>();
            List <string> listLess1cBoss      = new List <string>();
            List <string> listLess1cCrafted   = new List <string>();
            List <string> listLess1cLabyrinth = new List <string>();
            StringBuilder sb = new StringBuilder();

            foreach (KeyValuePair <string, UniqueBaseType> uniq in UniquesSC)
            {
                UniqueBaseType entry        = uniq.Value;
                string         baseTy       = uniq.Key;
                UniqueValue    expectedVal  = entry.ExpectedFilterValue;
                UniqueValue    filterVal    = entry.FilterValue;
                string         outputBaseTy = baseTy;
                int            index        = baseTy.IndexOf('ö');
                if (index > 0)
                {
                    outputBaseTy = outputBaseTy.Substring(0, index);
                }
                UniqueBaseType entryHC       = UniquesHC[baseTy];
                UniqueValue    expectedValHC = entryHC.ExpectedFilterValue;

                if (entry.SeverityLevel == 0)
                {
                    expectedVal = filterVal;
                }
                else if (Safe && filterVal.Tier > expectedVal.Tier)
                {
                    if (entry.Items.Count > 1 || filterVal.LowValue < entry.Items[0].ChaosValue)
                    {
                        expectedVal = UniqueValue.FromTier(expectedVal.Tier + 1);
                    }
                }
                //if SC <1c and HC 4c+ then 1-2c
                if (HCFriendly && expectedVal.Tier < 2 && expectedValHC.Tier > 2 && entryHC.Items.Any(i => i.IsCoreDrop && i.ChaosValue > 4.0f))
                {
                    expectedVal = UniqueValue.Chaos1to2;
                }

                switch (expectedVal.Value)
                {
                case UniqueValueEnum.Chaos10:
                    list10c.Add(outputBaseTy);
                    break;

                case UniqueValueEnum.Chaos2to10:
                    list2to10c.Add(outputBaseTy);
                    break;

                case UniqueValueEnum.Chaos1to2:
                    list1to2c.Add(outputBaseTy);
                    break;

                case UniqueValueEnum.ChaosLess1:
                    listLess1c.Add(outputBaseTy);
                    break;

                case UniqueValueEnum.ChaosLess1League:
                    listLess1cLeague.Add(outputBaseTy);
                    break;

                case UniqueValueEnum.ChaosLess1Boss:
                    listLess1cBoss.Add(outputBaseTy);
                    break;

                case UniqueValueEnum.ChaosLess1Shared:
                    listLess1cShared.Add(outputBaseTy);
                    break;

                case UniqueValueEnum.ChaosLess1Crafted:
                    listLess1cCrafted.Add(outputBaseTy);
                    break;

                case UniqueValueEnum.ChaosLess1Labyrinth:
                    listLess1cLabyrinth.Add(outputBaseTy);
                    break;

                default:
                    break;
                }
            }

            if (list10c.Count > 0)
            {
                sb.AppendLine(header10c).AppendLine();
                sb.AppendLine("Show  # Uniques - 10c+").AppendLine("\tRarity = Unique").Append('\t').AppendLine(BaseTypeList(list10c)).AppendLine(style10c).AppendLine();
            }
            if (list2to10c.Count > 0)
            {
                sb.AppendLine(header2to10c).AppendLine();
                sb.AppendLine("Show  # Uniques - 2-10c").AppendLine("\tRarity = Unique").Append('\t').AppendLine(BaseTypeList(list2to10c)).AppendLine(style2to10c).AppendLine();
            }
            sb.AppendLine(header1c).AppendLine();
            if (list1to2c.Count > 0)
            {
                sb.AppendLine("Show  # Uniques - 1-2c").AppendLine("\tRarity = Unique").Append('\t').AppendLine(BaseTypeList(list1to2c)).AppendLine(style1c).AppendLine();
            }
            sb.AppendLine(loreweaveStr).AppendLine();
            sb.AppendLine(headerLess1c).AppendLine();
            if (listLess1cLeague.Count > 0)
            {
                sb.AppendLine("Show  # Uniques - <1c - League").AppendLine("\tRarity = Unique").Append('\t').AppendLine(BaseTypeList(listLess1cLeague)).AppendLine(styleLess1c).AppendLine();
            }
            if (listLess1cBoss.Count > 0)
            {
                sb.AppendLine("Show  # Uniques - <1c - Boss Prophecy").AppendLine("\tRarity = Unique").Append('\t').AppendLine(BaseTypeList(listLess1cBoss)).AppendLine(styleLess1c).AppendLine();
            }
            if (listLess1cShared.Count > 0)
            {
                sb.AppendLine("Show  # Uniques - <1c - Shared").AppendLine("\tRarity = Unique").Append('\t').AppendLine(BaseTypeList(listLess1cShared)).AppendLine(styleLess1c).AppendLine();
            }
            if (listLess1cCrafted.Count > 0)
            {
                sb.AppendLine("Show  # Uniques - <1c - Crafted Fated Purchased").AppendLine("\tRarity = Unique").Append('\t').AppendLine(BaseTypeList(listLess1cCrafted)).AppendLine(styleLess1c).AppendLine();
            }
            if (listLess1cLabyrinth.Count > 0)
            {
                sb.AppendLine("Show  # Uniques - <1c - Labyrinth").AppendLine("\tRarity = Unique").Append('\t').AppendLine(BaseTypeList(listLess1cLabyrinth)).AppendLine(styleLess1c).AppendLine();
            }
            if (listLess1c.Count > 0)
            {
                sb.AppendLine("Show  # Uniques - <1c - Nearly Worthless").AppendLine("\tRarity = Unique").Append('\t').AppendLine(BaseTypeList(listLess1c)).AppendLine(styleLess1c).AppendLine();
            }
            sb.AppendLine(uniqueNewOrWorthless);

            return(sb.ToString());
        }
        public void CalculateExpectedValue()
        {
            if (!Items.Any())
            {
                ExpectedFilterValue = FilterValue;
                return;
            }

            float       minValueBoss         = float.MaxValue;
            float       maxValueBoss         = float.MinValue;
            float       minValueLeague       = float.MaxValue;
            float       maxValueLeague       = float.MinValue;
            float       minValueCraftedFated = float.MaxValue;
            float       maxValueCraftedFated = float.MinValue;
            float       minValue             = float.MaxValue;
            float       maxValue             = float.MinValue;
            bool        isLeagueOnly         = true;
            bool        hasLeague            = false;
            bool        hasCoreLeague        = false;
            bool        hasLabyrinth         = false;
            bool        isBossOnly           = true;
            bool        hasBoss         = false;
            bool        isCraftedOnly   = true;
            bool        isUnobtainable  = true;
            int         minExpectedTier = 1;
            UniqueValue minExpected     = UniqueValue.Unknown;

            // Determine Expected Value
            foreach (UniqueItem uniqData in Items)
            {
                if (uniqData.Unobtainable)
                {
                    continue;
                }
                isUnobtainable = false;
                if (uniqData.IsCrafted || uniqData.IsFated || uniqData.IsPurchased)
                {
                    if (!uniqData.IsLowConfidence)
                    {
                        if (minValueCraftedFated > uniqData.ChaosValue)
                        {
                            minValueCraftedFated = uniqData.ChaosValue;
                        }
                        if (maxValueCraftedFated < uniqData.ChaosValue)
                        {
                            maxValueCraftedFated = uniqData.ChaosValue;
                        }
                    }
                    continue;
                }
                isCraftedOnly = false;

                if (uniqData.IsCoreDrop)
                {
                    isLeagueOnly  = false;
                    hasCoreLeague = hasCoreLeague || uniqData.League.Length != 0;
                    if (uniqData.IsLimitedDrop)
                    {
                        if (uniqData.IsLabyrinthDrop)
                        {
                            hasLabyrinth = true;
                        }
                        else
                        {
                            hasBoss = true;
                        }
                        if (!uniqData.IsLowConfidence)
                        {
                            if (minValueBoss > uniqData.ChaosValue)
                            {
                                minValueBoss = uniqData.ChaosValue;
                            }
                            if (maxValueBoss < uniqData.ChaosValue)
                            {
                                maxValueBoss = uniqData.ChaosValue;
                            }
                        }
                    }
                    else
                    {
                        isBossOnly = false;
                        if (!uniqData.IsLowConfidence && uniqData.Links != 6)
                        {
                            if (minValue > uniqData.ChaosValue)
                            {
                                minValue = uniqData.ChaosValue;
                            }
                            if (maxValue < uniqData.ChaosValue)
                            {
                                maxValue = uniqData.ChaosValue;
                            }
                        }
                    }
                }
                else
                {
                    hasLeague = true;
                    if (!uniqData.IsLowConfidence)
                    {
                        if (minValueLeague > uniqData.ChaosValue)
                        {
                            minValueLeague = uniqData.ChaosValue;
                        }
                        if (maxValueLeague < uniqData.ChaosValue)
                        {
                            maxValueLeague = uniqData.ChaosValue;
                        }
                    }
                }
            }

            if (isUnobtainable)
            {
                ExpectedFilterValue = UniqueValue.Chaos10; // unique exists in permanent leagues only
                return;
            }
            else if (isCraftedOnly)
            {
                minValue    = minValueCraftedFated;
                maxValue    = maxValueCraftedFated;
                minExpected = UniqueValue.ChaosLess1Crafted;
            }
            else if (isLeagueOnly)
            {
                minValue    = minValueLeague;
                maxValue    = maxValueLeague;
                minExpected = UniqueValue.ChaosLess1League;
            }
            else if (isBossOnly)
            {
                minValue = minValueBoss;
                maxValue = maxValueBoss;
                if (hasBoss)
                {
                    minExpected = UniqueValue.ChaosLess1Boss;
                }
                else
                {
                    minExpected = UniqueValue.ChaosLess1Labyrinth;
                }
            }
            else if (hasLeague)
            {
                if (minValueLeague > 6.0f)
                {
                    minExpected = UniqueValue.ChaosLess1Shared;
                }
                else
                {
                    minExpected = UniqueValue.ChaosLess1;
                }
            }
            else if (hasBoss)
            {
                minExpected = UniqueValue.ChaosLess1Boss;
            }
            else if (hasCoreLeague)
            {
                minExpected = UniqueValue.ChaosLess1League;
            }
            else if (hasLabyrinth)
            {
                minExpected = UniqueValue.ChaosLess1;
            }
            else
            {
                minExpectedTier = 0;
            }

            // Set Expected Value
            if (minValue > maxValue) //no confident value
            {
                ExpectedFilterValue = FilterValue;
            }
            else //confident value
            {
                ExpectedFilterValue = UniqueValue.ValueOf(minValue);
                if (ExpectedFilterValue.Tier <= 1)
                {
                    if (maxValue > 50.0f)
                    {
                        ExpectedFilterValue = UniqueValue.Chaos2to10;
                    }
                    else if (maxValue > 9.0f || (minValue > 0.95f && maxValue > 1.8f))
                    {
                        ExpectedFilterValue = UniqueValue.Chaos1to2;
                    }
                    else if (maxValue > 2.0f || minValue > 0.95f)
                    {
                        ExpectedFilterValue = UniqueValue.ChaosLess1;
                    }
                }
                else if (ExpectedFilterValue.Value == UniqueValueEnum.Chaos1to2 && minValue > 1.9f && maxValue > 4.9f)
                {
                    ExpectedFilterValue = UniqueValue.Chaos2to10;
                }
            }
            if (ExpectedFilterValue.Tier <= minExpectedTier)
            {
                ExpectedFilterValue = minExpected;
            }
        }
Esempio n. 6
0
        private UniqueValue CalculateExpectedValue()
        {
            if (!Items.Any())
            {
                return(FilterValue);
            }
            if (Items.Count == 1)
            {
                float val = Items[0].ChaosValue;
                if (val < 0.01 || Items[0].IsLowConfidence || (val >= FilterValue.LowValue && val <= FilterValue.HighValue))
                {
                    return(FilterValue);
                }
                return(UniqueValue.ValueOf(val));
            }
            bool  isUnobtainable = true;
            float minVal         = float.MaxValue;
            float maxVal         = float.MinValue;
            float minValLimited  = float.MaxValue;
            float maxValLimited  = float.MinValue;
            float minValLeague   = float.MaxValue;
            float maxValLeague   = float.MinValue;
            float minValCrafted  = float.MaxValue;
            float maxValCrafted  = float.MinValue;
            int   minTier        = 0;
            float filterVal      = FilterValue.LowValue + (FilterValue.HighValue - FilterValue.LowValue) / 2.0f;

            foreach (UniqueItem uniq in Items)
            {
                if (uniq.IsUnobtainable)
                {
                    continue;
                }
                isUnobtainable = false;
                if (uniq.IsPurchased || uniq.IsCrafted || uniq.IsFated)
                {
                    if (uniq.Count > 0)
                    {
                        minValCrafted = Math.Min(minValCrafted, uniq.ChaosValue);
                        maxValCrafted = Math.Max(maxValCrafted, uniq.ChaosValue);
                    }
                    continue;
                }
                if (uniq.Count == 0)
                {
                    minTier = Math.Min(minTier, 1);
                    continue;
                }
                if (!uniq.IsCoreDrop)
                {
                    minValLeague = Math.Min(minValLeague, uniq.ChaosValue);
                    maxValLeague = Math.Max(maxValLeague, uniq.ChaosValue);
                    if (uniq.ChaosValue >= 8.0f)
                    {
                        minTier = Math.Max(minTier, 1);
                    }
                    continue;
                }
                if (uniq.Source.Length > 0 && !uniq.IsProphecyDrop)                   // IsProphecyDrop || uniq.IsLabyrinthDrop || uniq.IsBossDrop
                {
                    minValLimited = Math.Min(minValLimited, uniq.ChaosValue);
                    maxValLimited = Math.Max(maxValLimited, uniq.ChaosValue);
                    if (uniq.ChaosValue >= 5.0f)
                    {
                        minTier = Math.Max(minTier, 1);
                    }
                    continue;
                }
                if (uniq.Leagues.Any(x => x.Length == 0))
                {
                    if (uniq.IsLowConfidence)
                    {
                        if (minVal > maxVal)
                        {
                            minVal = filterVal;
                            maxVal = filterVal;
                        }
                        if (uniq.ChaosValue >= 40.0f)
                        {
                            minTier = Math.Max(minTier, 3);
                        }
                        if (uniq.ChaosValue >= 15.0f)
                        {
                            minTier = Math.Max(minTier, 2);
                        }
                        else if (uniq.ChaosValue >= 5.0f)
                        {
                            minTier = Math.Max(minTier, 1);
                        }
                        continue;
                    }
                    else
                    {
                        minVal = Math.Min(minVal, uniq.ChaosValue);
                        maxVal = Math.Max(maxVal, uniq.ChaosValue);
                    }
                }
                else
                {
                    minValLimited = Math.Min(minValLimited, uniq.ChaosValue);
                    maxValLimited = Math.Max(maxValLimited, uniq.ChaosValue);
                    if (uniq.ChaosValue >= 15.0f)
                    {
                        minTier = Math.Max(minTier, 2);
                    }
                    if (uniq.ChaosValue >= 5.0f)
                    {
                        minTier = Math.Max(minTier, 1);
                    }
                }
            }

            if (isUnobtainable)
            {
                return(UniqueValue.Chaos15);
            }
            if (minVal > maxVal)
            {
                if (minValLimited <= maxValLimited)
                {
                    minVal = minValLimited;
                    maxVal = maxValLimited;
                }
                else if (minValLeague <= maxValLeague)
                {
                    minVal  = minValLeague;
                    maxVal  = maxValLeague;
                    minTier = Math.Max(minTier, 2);
                }
                else if (minValCrafted <= maxValCrafted)
                {
                    minVal  = minValCrafted;
                    maxVal  = maxValCrafted;
                    minTier = Math.Max(minTier, 2);
                }
                else
                {
                    return(FilterValue);
                }
            }

            if (minVal >= 14.0f)
            {
                return(UniqueValue.Chaos15);
            }
            if (minVal >= 4.7f || maxVal >= 100.0f || minTier == 3)
            {
                return(UniqueValue.Chaos5to15);
            }
            if (minVal >= 2.95f || maxVal >= 15.0f || minTier == 2)
            {
                return(UniqueValue.Chaos3to5);
            }
            if (maxVal >= 7.0f || minTier == 1)
            {
                return(UniqueValue.Limited);
            }
            return(UniqueValue.Worthless);
        }