Ejemplo n.º 1
0
        public static FilterEconomyRuleSet Generate(ConcreteEconomyRules ruleHost)
        {
            var builder = new RuleSetBuilder(ruleHost)
                          .SetSection("currency->prophecy")
                          .UseDefaultQuery()
                          .AddDefaultPostProcessing()
                          .AddDefaultIntegrationTarget();

            builder.AddRule("ANCHOR", "ANCHOR",
                            new Func <string, bool>((string s) =>
            {
                return(builder.RuleSet.DefaultSet.HasAspect("AnchorAspect"));
            }));

            builder.AddRule("t1", "t1",
                            new Func <string, bool>((string s) =>
            {
                var price = builder.RuleSet.DefaultSet.LowestPrice;
                return(price > FilterPolishConstants.T1DiviBreakPoint);
            }));

            builder.AddRule("MultiBase", "t2",
                            new Func <string, bool>((string s) =>
            {
                var price = builder.RuleSet.DefaultSet.HighestPrice;
                return(price > FilterPolishConstants.T1DiviBreakPoint);
            }));

            builder.AddRule("t2", "t2",
                            new Func <string, bool>((string s) =>
            {
                var price = builder.RuleSet.DefaultSet.LowestPrice;
                return(price > FilterPolishConstants.T2DiviBreakPoint);
            }));

            builder.AddRule("rest", "rest",
                            new Func <string, bool>((string s) =>
            {
                return(true);
            }));

            return(builder.Build());
        }
Ejemplo n.º 2
0
        public static FilterEconomyRuleSet Generate(ConcreteEconomyRules ruleHost, string segment)
        {
            var builder = new RuleSetBuilder(ruleHost)
                          .SetSection(segment)
                          .UseDefaultQuery()
                          .AddDefaultPostProcessing()
                          .AddDefaultIntegrationTarget();

            builder.AddRule("ANCHOR", "ANCHOR",
                            new Func <string, bool>((string s) =>
            {
                return(builder.RuleSet.DefaultSet.HasAspect("AnchorAspect"));
            }));

            builder.AddRule("unknown", "unknown",
                            new Func <string, bool>((string s) =>
            {
                return(!ruleHost.EconomyInformation.EconomyTierlistOverview[segment].ContainsKey(s));
            }));

            builder.AddRule("t1-82", "t1-1",
                            new Func <string, bool>((string s) =>
            {
                var price = GetPrice(82) * builder.RuleSet.DefaultSet.ValueMultiplier;
                return(price > FilterPolishConstants.T1BaseTypeBreakPoint);
            }), nextgroup: "t2");


            builder.AddRule("t1-84", "t1-2",
                            new Func <string, bool>((string s) =>
            {
                var price = GetPrice(84) * builder.RuleSet.DefaultSet.ValueMultiplier;
                return(price > FilterPolishConstants.T1BaseTypeBreakPoint);
            }), nextgroup: "t2");

            builder.AddRule("t1-86", "t1-3",
                            new Func <string, bool>((string s) =>
            {
                var price = GetPrice(86) * builder.RuleSet.DefaultSet.ValueMultiplier;
                return(price > FilterPolishConstants.T1BaseTypeBreakPoint);
            }), nextgroup: "t2");

            builder.AddRule("t2-80", "t2-1",
                            new Func <string, bool>((string s) =>
            {
                var price = GetPrice(82) * builder.RuleSet.DefaultSet.ValueMultiplier;
                return(price > FilterPolishConstants.T2BaseTypeBreakPoint);
            }), group: "t2");


            builder.AddRule("t2-85", "t2-2",
                            new Func <string, bool>((string s) =>
            {
                var price = Math.Max(GetPrice(86), GetPrice(85)) * builder.RuleSet.DefaultSet.ValueMultiplier;
                return(price > FilterPolishConstants.T2BaseTypeBreakPoint);
            }), group: "t2");

            builder.AddRule("rest", "rest",
                            new Func <string, bool>((string s) =>
            {
                return(true);
            }));

            return(builder.Build());

            float GetPrice(int level)
            {
                if (level > 86)
                {
                    return(0);
                }

                if (builder.RuleSet.DefaultSet.ftPrice.ContainsKey(level))
                {
                    return(builder.RuleSet.DefaultSet.ftPrice[level]);
                }
                else
                {
                    return(GetPrice(level + 1));
                }
            }
        }
Ejemplo n.º 3
0
        public static FilterEconomyRuleSet Generate(ConcreteEconomyRules ruleHost)
        {
            var builder = new RuleSetBuilder(ruleHost)
                          .SetSection("divination")
                          .UseDefaultQuery()
                          .AddDefaultPostProcessing()
                          .AddDefaultIntegrationTarget();


            builder.AddRule("ANCHOR", "ANCHOR",
                            new Func <string, bool>((string s) =>
            {
                return(builder.RuleSet.DefaultSet.HasAspect("AnchorAspect"));
            }));


            builder.AddRule("unknown", "unknown",
                            new Func <string, bool>((string s) =>
            {
                return(!ruleHost.EconomyInformation.EconomyTierlistOverview["divination"].ContainsKey(s));
            }));


            builder.AddRule("t1", "t1",
                            new Func <string, bool>((string s) =>
            {
                var price = builder.RuleSet.DefaultSet.LowestPrice * builder.RuleSet.DefaultSet.ValueMultiplier;
                return(price > FilterPolishConstants.T1DiviBreakPoint);
            }));


            builder.AddRule("t2", "t2",
                            new Func <string, bool>((string s) =>
            {
                var price = builder.RuleSet.DefaultSet.LowestPrice * builder.RuleSet.DefaultSet.ValueMultiplier;
                return(price > FilterPolishConstants.T2DiviBreakPoint);
            }));

            builder.AddRule("SingleCardSave", "t2",
                            new Func <string, bool>((string s) =>
            {
                return(builder.RuleSet.DefaultSet.HasAspect("SingleCardAspect"));
            }));

            builder.AddRule("t3", "t3",
                            new Func <string, bool>((string s) =>
            {
                var price = builder.RuleSet.DefaultSet.LowestPrice * builder.RuleSet.DefaultSet.ValueMultiplier;
                return(price > FilterPolishConstants.T3DiviBreakPoint);
            }));

            builder.AddRule("TimelessSave", "t3",
                            new Func <string, bool>((string s) =>
            {
                return(builder.RuleSet.DefaultSet.HasAspect("TimelessResultAspect"));
            }));

            builder.AddRule("CurrencySaveT4", "t4c",
                            new Func <string, bool>((string s) =>
            {
                var price = builder.RuleSet.DefaultSet.LowestPrice * builder.RuleSet.DefaultSet.ValueMultiplier;

                if (builder.RuleSet.DefaultSet.HasAspect("CurrencyTypeAspect"))
                {
                    if (builder.RuleSet.DefaultSet.HasAspect("PoorDiviAspect"))
                    {
                        return(price > FilterPolishConstants.T5DiviBreakPoint * 2);
                    }
                    else
                    {
                        return(price > FilterPolishConstants.T5DiviBreakPoint);
                    }
                }

                return(false);
            }));

            builder.AddRule("CurrencySaveT4X", "t4c",
                            new Func <string, bool>((string s) =>
            {
                var price = builder.RuleSet.DefaultSet.LowestPrice * builder.RuleSet.DefaultSet.ValueMultiplier;
                return(builder.RuleSet.DefaultSet.HasAspect("FarmableOrbAspect"));
            }));

            builder.AddRule("RandomSave", "rest",
                            new Func <string, bool>((string s) =>
            {
                return(builder.RuleSet.DefaultSet.HasAspect("LargeRandomPoolAspect"));
            }));

            builder.AddRule("CurrencySaveT5", "t5c",
                            new Func <string, bool>((string s) =>
            {
                var price = builder.RuleSet.DefaultSet.LowestPrice * builder.RuleSet.DefaultSet.ValueMultiplier;
                return((price < FilterPolishConstants.T5DiviBreakPoint || builder.RuleSet.DefaultSet.HasAspect("PoorDiviAspect")) && builder.RuleSet.DefaultSet.HasAspect("CurrencyTypeAspect"));
            }));

            builder.AddRule("t5", "t5",
                            new Func <string, bool>((string s) =>
            {
                if (builder.RuleSet.DefaultSet.HasAspect("PreventHidingAspect"))
                {
                    return(false);
                }

                var price = builder.RuleSet.DefaultSet.LowestPrice * builder.RuleSet.DefaultSet.ValueMultiplier;
                return(price < FilterPolishConstants.T5DiviBreakPoint);
            }));

            builder.AddRule("rest", "rest",
                            new Func <string, bool>((string s) =>
            {
                return(true);
            }));

            return(builder.Build());
        }
Ejemplo n.º 4
0
        public static FilterEconomyRuleSet Generate(ConcreteEconomyRules ruleHost)
        {
            var builder = new RuleSetBuilder(ruleHost)
                          .SetSection("uniques")
                          .UseDefaultQuery()
                          .AddDefaultPostProcessing()
                          .AddDefaultIntegrationTarget();

            //var set = builder.Rulebuilder.RuleSet.DefaultSet.DefaultSet;

            builder.AddRule("ANCHOR", "ANCHOR",
                            new Func <string, bool>((string s) =>
            {
                return(builder.RuleSet.DefaultSet.HasAspect("AnchorAspect"));
            }));

            builder.AddRule("unknown", "unknown",
                            new Func <string, bool>((string s) =>
            {
                return(!ruleHost.EconomyInformation.EconomyTierlistOverview["uniques"].ContainsKey(s));
            }));

            builder.AddRule("t1", "t1",
                            new Func <string, bool>((string s) =>
            {
                return(builder.RuleSet.DefaultSet.LowestPrice > FilterPolishConstants.T1BreakPoint);
            }));

            builder.AddRule("t2", "t2",
                            new Func <string, bool>((string s) =>
            {
                return(builder.RuleSet.DefaultSet.LowestPrice > FilterPolishConstants.T2BreakPoint);
            }));

            builder.AddRule("uncommon", "multispecial",
                            new Func <string, bool>((string s) =>
            {
                var fit = false;
                if (builder.RuleSet.DefaultSet.HighestPrice > FilterPolishConstants.T2BreakPoint)
                {
                    if (builder.RuleSet.DefaultSet.HasAspect("UncommonAspect"))
                    {
                        var relevantList = builder.RuleSet.DefaultSet.AspectCheck(new HashSet <string>()
                        {
                            "UncommonAspect"
                        }, new HashSet <string>()
                        {
                            "BossDropAspect", "NonDropAspect", "LeagueDropAspect", "NonEventDropAspect"
                        });

                        if (relevantList.Count > 0)
                        {
                            return(relevantList.OrderByDescending(x => x.CVal).First().CVal > FilterPolishConstants.T2BreakPoint * FilterPolishConstants.UncommonAspectMultiplier);
                        }
                    }
                }

                return(fit);
            }));

            builder.AddRule("ExpensiveTwin", "multispecial",
                            new Func <string, bool>((string s) =>
            {
                var relevantList = builder.RuleSet.DefaultSet.AspectCheck(new HashSet <string>()
                {
                    "HandledAspect"
                }, new HashSet <string>()
                {
                    "BossDropAspect", "NonDropAspect", "LeagueDropAspect", "ProphecyResultAspect", "NonEventDropAspect"
                });

                if (relevantList.Count > 1)
                {
                    if (relevantList.Max(x => x.CVal) > FilterPolishConstants.T2BreakPoint * FilterPolishConstants.CommonTwinAspectMultiplier)
                    {
                        return(true);
                    }
                }

                return(false);
            }));

            builder.AddRule("highVariety", "multispecial",
                            new Func <string, bool>((string s) =>
            {
                var fit = false;
                if (builder.RuleSet.DefaultSet.HighestPrice > FilterPolishConstants.T2BreakPoint * FilterPolishConstants.HighVarietyMultiplier)
                {
                    if (builder.RuleSet.DefaultSet.HasAspect("HighVarietyAspect"))
                    {
                        var relevantList = builder.RuleSet.DefaultSet.AspectCheck(new HashSet <string>(), new HashSet <string>()
                        {
                            "BossDropAspect", "NonDropAspect", "LeagueDropAspect", "NonEventDropAspect"
                        });

                        if (relevantList.Count > 0)
                        {
                            return(relevantList.OrderByDescending(x => x.CVal).First().CVal > FilterPolishConstants.T2BreakPoint * FilterPolishConstants.HighVarietyMultiplier);
                        }
                    }
                }

                return(fit);
            }));

            builder.AddRule("leagueDropAspect", "multileague",
                            new Func <string, bool>((string s) =>
            {
                var fit = false;
                if (builder.RuleSet.DefaultSet.HighestPrice > FilterPolishConstants.T2BreakPoint)
                {
                    if (builder.RuleSet.DefaultSet.HasAspect("LeagueDropAspect"))
                    {
                        var relevantList = builder.RuleSet.DefaultSet.AspectCheck(new HashSet <string>()
                        {
                            "LeagueDropAspect"
                        }, new HashSet <string>()
                        {
                            "BossDropAspect", "NonDropAspect", "NonEventDropAspect"
                        });

                        if (relevantList.Count > 0)
                        {
                            return(relevantList.OrderByDescending(x => x.CVal).First().CVal > FilterPolishConstants.T2BreakPoint * FilterPolishConstants.LeagueDropAspectMultiplier);
                        }
                    }
                }

                return(fit);
            }));

            builder.AddRule("BossOnly", "multispecial",
                            new Func <string, bool>((string s) =>
            {
                var fit = false;
                if (builder.RuleSet.DefaultSet.HighestPrice > FilterPolishConstants.T2BreakPoint)
                {
                    var relevantList = builder.RuleSet.DefaultSet.AspectCheck(new HashSet <string> {
                    }, new HashSet <string>()
                    {
                        "NonDropAspect"
                    });

                    if (relevantList.Count > 0 && relevantList.AllItemsFullFill(new HashSet <string>()
                    {
                        "BossDropAspect"
                    }, new HashSet <string>()))
                    {
                        return(relevantList.OrderByDescending(x => x.CVal).First().CVal > FilterPolishConstants.T2BreakPoint * FilterPolishConstants.LeagueDropAspectMultiplier);
                    }
                }

                return(fit);
            }));

            builder.AddRule("Changed?", "metainfluenced",
                            new Func <string, bool>((string s) =>
            {
                return(builder.RuleSet.DefaultSet.HasAspect("ChangedAspect"));
            }));

            builder.AddRule("MetaSave", "t2",
                            new Func <string, bool>((string s) =>
            {
                return(builder.RuleSet.DefaultSet.HasAspect("MetaBiasAspect"));
            }));

            builder.AddRule("SuperLeagueUnique", "multileague",
                            new Func <string, bool>((string s) =>
            {
                if (builder.RuleSet.DefaultSet.HighestPrice > FilterPolishConstants.T1BreakPoint)
                {
                    var relevantList = builder.RuleSet.DefaultSet.AspectCheck(new HashSet <string>()
                    {
                        "BossDropAspect", "LeagueDropAspect"
                    }, new HashSet <string>()
                    {
                        "NonDropAspect", "NonEventDropAspect"
                    });

                    if (relevantList.Count > 0)
                    {
                        return(relevantList.OrderByDescending(x => x.CVal).First().CVal > FilterPolishConstants.SuperTierBreakPoint);
                    }
                }
                return(false);
            }));

            builder.AddRule("???", "???",
                            new Func <string, bool>((string s) =>
            {
                var fit = false;
                if (builder.RuleSet.DefaultSet.HighestPrice > FilterPolishConstants.T2BreakPoint)
                {
                    if (builder.RuleSet.DefaultSet.HasAspect("LeagueDropAspect"))
                    {
                        return(builder.RuleSet.DefaultSet.OfAspect("LeagueDropAspect").OrderByDescending(x => x.CVal).First().CVal > FilterPolishConstants.T2BreakPoint);
                    }
                }

                return(fit);
            }));

            builder.AddRule("prophecy", "prophecy",
                            new Func <string, bool>((string s) =>
            {
                var aspects = builder.RuleHost.ItemInformation["uniques", s];
                if (aspects == null)
                {
                    return(false);
                }

                return(builder.RuleSet.DefaultSet.HasAspect("ProphecyMaterialAspect"));
            }));

            builder.AddRule("hideable", "hideable",
                            new Func <string, bool>((string s) =>
            {
                var maxprice = builder.RuleSet.DefaultSet.Max(x => x.CVal);
                if (maxprice > FilterPolishConstants.T2BreakPoint * 0.8f)
                {
                    return(false);
                }

                if (builder.RuleSet.DefaultSet.AllItemsFullFill(new HashSet <string>()
                {
                }, new HashSet <string>()
                {
                    "HighVarietyAspect", "LeagueDropAspect", "NonEventDropAspect", "BossDropAspect", "EarlyLeagueInterestAspect", "IgnoreAspect", "UncommonAspect", "MetaBiasAspect", "AnchorAspect"
                }))
                {
                    return(true);
                }

                return(false);
            }));

            builder.AddRule("rest", "rest",
                            new Func <string, bool>((string s) =>
            {
                return(true);
            }));

            return(builder.Build());
        }
        public static FilterEconomyRuleSet Generate(ConcreteEconomyRules ruleHost)
        {
            var builder = new RuleSetBuilder(ruleHost)
                          .SetSection("divination")
                          .UseDefaultQuery()
                          .AddDefaultPostProcessing()
                          .AddDefaultIntegrationTarget();

            builder.AddRule("unknown", "unknown",
                            new Func <string, bool>((string s) =>
            {
                return(!ruleHost.EconomyInformation.EconomyTierlistOverview["divination"].ContainsKey(s));
            }));


            builder.AddRule("t1", "t1",
                            new Func <string, bool>((string s) =>
            {
                var price = builder.Item.LowestPrice * builder.Item.ValueMultiplier;
                return(price > FilterPolishConfig.DiviT1BreakPoint);
            }));

            builder.AddRule("t2", "t2",
                            new Func <string, bool>((string s) =>
            {
                var price = builder.Item.LowestPrice * builder.Item.ValueMultiplier;
                return(price > FilterPolishConfig.DiviT2BreakPoint);
            }));

            builder.AddRule("SingleCardSave", "t2",
                            new Func <string, bool>((string s) =>
            {
                return(builder.Item.HasAspect("SingleCardAspect"));
            }));

            builder.AddSimpleAspectContainerRule("EARLYBuffAspect", "t2", "BuffAspect");

            builder.AddRule("t3", "t3",
                            new Func <string, bool>((string s) =>
            {
                // We reduce the tiering of CurrencyType items here. They should be more weighted towards t4c, since poe.ninja seems to price them higher than they are.
                var price = builder.Item.LowestPrice * builder.Item.ValueMultiplier * (builder.Item.HasAspect("CurrencyTypeAspect") ? 0.8f : 1f);

                return(price > FilterPolishConfig.DiviT3BreakPoint);
            }));

            builder.AddRule("TimelessSave", "t3",
                            new Func <string, bool>((string s) =>
            {
                return(builder.Item.HasAspect("TimelessResultAspect"));
            }));

            builder.AddEarlyLeagueHandling("t3");
            builder.AddEarlyLeagueProtectionBlock("t2", new HashSet <string>()
            {
                "t1", "t2"
            }, "earlyProtHIGH");

            builder.AddRule("CurrencySaveT4", "t4c",
                            new Func <string, bool>((string s) =>
            {
                var price = builder.Item.LowestPrice * builder.Item.ValueMultiplier;

                if (builder.Item.HasAspect("CurrencyTypeAspect"))
                {
                    if (builder.Item.HasAspect("PoorDropAspect"))
                    {
                        return(price > FilterPolishConfig.DiviT5BreakPoint * 3);
                    }
                    else
                    {
                        return(price > FilterPolishConfig.DiviT5BreakPoint * 1.5);
                    }
                }

                return(false);
            }));

            builder.AddRule("CurrencySaveT4X", "t4c",
                            new Func <string, bool>((string s) =>
            {
                var price = builder.Item.LowestPrice * builder.Item.ValueMultiplier;

                if (builder.Item.HasAspect("CurrencyTypeAspect"))
                {
                    return(builder.Item.HasAspect("FarmableOrbAspect") || builder.Item.HasAspect("PreventHidingAspect"));
                }

                return(false);
            }));

            builder.AddEarlyLeagueProtectionBlock("t4", new HashSet <string>()
            {
                "t3"
            }, "earlyProtLOW");

            builder.AddRule("CurrencySaveT5", "t5c",
                            new Func <string, bool>((string s) =>
            {
                return(builder.Item.HasAspect("CurrencyTypeAspect"));
            }));

            builder.AddSimpleAspectContainerRule("EARLYNerfAspect", "t2", "NerfAspect");

            builder.AddRule("RandomSave", "t4",
                            new Func <string, bool>((string s) =>
            {
                return(builder.Item.HasAspect("LargeRandomPoolAspect"));
            }));


            builder.AddRule("PoorCard", "t5",
                            new Func <string, bool>((string s) =>
            {
                var price = builder.Item.LowestPrice * builder.Item.ValueMultiplier;
                return(price < (FilterPolishConfig.DiviT5BreakPoint * 2.5f) && builder.Item.HasAspect("PoorDropAspect"));
            }));

            builder.AddRule("T5RedemptionPrevented", "t5",
                            new Func <string, bool>((string s) =>
            {
                if (builder.GetTierOfItem(s).Contains("t5"))
                {
                    var price = builder.Item.LowestPrice * builder.Item.ValueMultiplier;
                    return(price < FilterPolishConfig.DiviT5BreakPoint * 2);
                }

                return(false);
            }));

            builder.AddRule("t5", "t5",
                            new Func <string, bool>((string s) =>
            {
                if (builder.Item.HasAspect("PreventHidingAspect"))
                {
                    return(false);
                }

                var price = builder.Item.LowestPrice * builder.Item.ValueMultiplier;
                return(price < FilterPolishConfig.DiviT5BreakPoint);
            }));

            builder.AddExplicitRest("t4", "t4");

            //builder.AddRule("rest", "rest",
            //    new Func<string, bool>((string s) =>
            //    {
            //        return true;
            //    }));

            return(builder.Build());
        }