Example #1
0
        private string ApplyInfExalt(ItemInfluence inf, int tries)
        {
            if (BenchItem.Rarity != ItemRarity.Rare)
            {
                return("Invalid item rarity for selected currency");
            }
            if (BenchItem.ItemLevel < 68)
            {
                return("Item must be ilvl 68+");
            }
            if (BenchItem.LiveMods.Count >= 2 * BenchItem.GetAffixLimit())
            {
                return("Item cannot have another mod");
            }
            if (BenchItem.GetInfluences().Count > 0)
            {
                return("Item already has influence");
            }
            bool res = DoAddMod(ItemRarity.Rare, false, tries, 20, inf);

            if (res)
            {
                return(null);
            }
            else
            {
                return("Item has no valid rollable mods");
            }
        }
Example #2
0
        public static IList <string> InfToNames(ItemInfluence inf)
        {
            switch (inf)
            {
            case ItemInfluence.Shaper:
                return(new List <string>()
                {
                    "The Shaper's", "of Shaping"
                });

            case ItemInfluence.Elder:
                return(new List <string>()
                {
                    "Eldritch", "of the Elder"
                });

            case ItemInfluence.Redeemer:
                return(new List <string>()
                {
                    "Redeemer's", "of Redemption"
                });

            case ItemInfluence.Hunter:
                return(new List <string>()
                {
                    "Hunter's", "of the Hunt"
                });

            case ItemInfluence.Warlord:
                return(new List <string>()
                {
                    "Warlord's", "of the Conquest"
                });

            default:
                return(new List <string>()
                {
                    "Crusader's", "of the Crusade"
                });
            }
        }
Example #3
0
        public static string InfToTag(ItemInfluence inf)
        {
            switch (inf)
            {
            case ItemInfluence.Shaper:
                return("shaper_tag");

            case ItemInfluence.Elder:
                return("elder_tag");

            case ItemInfluence.Redeemer:
                return("redeemer_tag");

            case ItemInfluence.Hunter:
                return("hunter_tag");

            case ItemInfluence.Warlord:
                return("warlord_tag");

            default:
                return("crusader_tag");
            }
        }
Example #4
0
        public static IDictionary <PoEModData, int> FilterForInfluence(IDictionary <PoEModData, int> dict, ItemInfluence inf)
        {
            IDictionary <PoEModData, int> filtereddict = new Dictionary <PoEModData, int>();
            IList <string> infnames = EnumConverter.InfToNames(inf);

            foreach (PoEModData mod in dict.Keys)
            {
                if (infnames.Contains(mod.name))
                {
                    filtereddict.Add(mod, dict[mod]);
                }
            }
            return(filtereddict);
        }
        public void UpdatePreviews()
        {
            if (Bench == null || Bench.BenchItem == null || Currency == null)
            {
                WeightedModsDisplay.UpdateData(new Dictionary <PoEModData, object>());
                return;
            }
            ItemCraft   itemcopy = Bench.BenchItem.Copy();
            RollOptions ops      = new RollOptions();
            IDictionary <PoEModData, int> extendedpool = new Dictionary <PoEModData, int>(Bench.BaseValidMods);
            PoEBaseItemData itemtemplate = CraftingDatabase.AllBaseItems[itemcopy.SourceData];
            //Shaper = null/invalid; inf and temp tags used for the 4 conquerors' exalts
            ItemInfluence      inf        = ItemInfluence.Shaper;
            IList <PoEModData> forcedmods = new List <PoEModData>();
            int    cesscount = 0;
            object c         = Currency.GetSelected();

            if (c is PoEEssenceData e)
            {
                string itemclass = itemtemplate.item_class;
                if (itemclass == "Rune Dagger")
                {
                    itemclass = "Dagger";
                }
                if (itemclass == "Warstaff")
                {
                    itemclass = "Staff";
                }
                if (e.mods.Keys.Contains(itemclass))
                {
                    forcedmods.Add(CraftingDatabase.CoreMods[e.mods[itemclass]]);
                }
                ops.ILvlCap = e.item_level_restriction ?? 200;
                itemcopy.ClearCraftedMods();
                itemcopy.ClearMods();
            }
            else if (c is PoECurrencyData)
            {
                string currency = ((PoECurrencyData)c).name;
                if (itemcopy.GetInfluences().Count == 0)
                {
                    if (currency == "Redeemer's Exalted Orb")
                    {
                        inf = ItemInfluence.Redeemer;
                    }
                    else if (currency == "Hunter's Exalted Orb")
                    {
                        inf = ItemInfluence.Hunter;
                    }
                    else if (currency == "Warlord's Exalted Orb")
                    {
                        inf = ItemInfluence.Warlord;
                    }
                    else if (currency == "Crusader's Exalted Orb")
                    {
                        inf = ItemInfluence.Crusader;
                    }
                    if (inf != ItemInfluence.Shaper)
                    {
                        string tag = itemtemplate.item_class_properties[Utils.EnumConverter.InfToTag(inf)];
                        if (tag != null)    //temporarily add influence tag
                        {
                            itemcopy.LiveTags.Add(tag);
                        }
                    }
                }
                if (inf == ItemInfluence.Shaper)    //if selected item isn't a conq exalt
                {
                    //if it's a reroll currency, preview as if the item has been scoured
                    if (currency == "Chaos Orb" || currency == "Orb of Alchemy" || currency == "Orb of Transmutation" || currency == "Orb of Alteration")
                    {
                        itemcopy.ClearMods();
                    }
                }
            }
            else if (c != null)
            {
                IList <PoEFossilData>        fossils         = ((System.Collections.IList)c).Cast <PoEFossilData>().ToList();
                ISet <IList <PoEModWeight> > modweightgroups = new HashSet <IList <PoEModWeight> >();
                foreach (PoEFossilData fossil in fossils)
                {
                    foreach (string t in fossil.added_mods)
                    {
                        if (!extendedpool.ContainsKey(CraftingDatabase.AllMods[t]))
                        {
                            extendedpool.Add(CraftingDatabase.AllMods[t], 0);
                        }
                    }
                    foreach (string t in fossil.forced_mods)
                    {
                        forcedmods.Add(CraftingDatabase.AllMods[t]);
                    }
                    forcedmods = new List <PoEModData>(ModLogic.FindBaseValidMods(itemtemplate, forcedmods, true).Keys);
                    if (fossil.corrupted_essence_chance > 0)
                    {
                        cesscount += fossil.corrupted_essence_chance;
                    }
                    modweightgroups.Add(fossil.negative_mod_weights);
                    modweightgroups.Add(fossil.positive_mod_weights);
                }
                ops.ModWeightGroups = modweightgroups;
                itemcopy.ClearCraftedMods();
                itemcopy.ClearMods();
            }
            foreach (PoEModData d in forcedmods)
            {
                itemcopy.AddMod(d);
            }
            IDictionary <PoEModData, int> validmods = ModLogic.FindValidMods(itemcopy, extendedpool, true, ops);

            if (inf != ItemInfluence.Shaper)    //if a conq exalt is selected, only show influenced mods
            {
                validmods = ModLogic.FilterForInfluence(validmods, inf);
            }
            IDictionary <PoEModData, object> mods = new Dictionary <PoEModData, object>();

            foreach (PoEModData d in validmods.Keys)
            {
                mods.Add(d, validmods[d]);
            }
            foreach (PoEModData d in forcedmods)
            {
                mods.Add(d, "Always");
            }
            if (cesscount > 0)
            {
                IDictionary <PoEModData, int> glyphicmods = ModLogic.FindGlyphicMods(itemcopy, ops.ModWeightGroups);
                if (glyphicmods.Count > 0)
                {
                    int weightsum = 0;
                    foreach (PoEModData d in glyphicmods.Keys)
                    {
                        weightsum += glyphicmods[d];
                    }
                    foreach (PoEModData d in glyphicmods.Keys)
                    {
                        mods.Add(d, "Special: " + ((double)cesscount / 100).ToString("0.#") + " x " + ((double)glyphicmods[d] * 100 / weightsum).ToString("N0") + "%");
                    }
                }
            }
            WeightedModsDisplay.UpdateData(mods);
        }