コード例 #1
0
        //remove all mods or all crafted mods, obeying prefix/suffix lock, leaving locked mods, and downgrading rarity if necessary
        public void ClearMods()
        {
            bool prefixlock = false;
            bool suffixlock = false;

            foreach (ModCraft m in LiveMods)
            {
                PoEModData modtemplate = CraftingDatabase.AllMods[m.SourceData];
                if (modtemplate.key == ModLogic.PrefixLock)
                {
                    prefixlock = true;
                }
                if (modtemplate.key == ModLogic.SuffixLock)
                {
                    suffixlock = true;
                }
            }
            for (int i = LiveMods.Count - 1; i >= 0; i--)
            {
                ModCraft   m           = LiveMods[i];
                PoEModData modtemplate = CraftingDatabase.AllMods[m.SourceData];
                if (!m.IsLocked && !(prefixlock && modtemplate.generation_type == ModLogic.Prefix) && !(suffixlock && modtemplate.generation_type == ModLogic.Suffix))
                {
                    RemoveModAt(LiveMods, i);
                }
            }
        }
コード例 #2
0
 private ModCraft(ModCraft m)
 {
     SourceData = m.SourceData;
     Stats      = new List <ModRoll>();
     foreach (ModRoll r in m.Stats)
     {
         Stats.Add(r.Copy());
     }
     IsLocked = m.IsLocked;
     Quality  = m.Quality;
 }
コード例 #3
0
        //remove crafted mods, ignoring metamod locks
        public bool ClearCraftedMods()
        {
            int removedcount = 0;

            for (int i = LiveMods.Count - 1; i >= 0; i--)
            {
                ModCraft   m           = LiveMods[i];
                PoEModData modtemplate = CraftingDatabase.AllMods[m.SourceData];
                if (!m.IsLocked && modtemplate.domain == "crafted")
                {
                    RemoveModAt(LiveMods, i);
                    removedcount++;
                }
            }
            return(removedcount > 0);
        }
コード例 #4
0
        private void InsertMod(IList <ModCraft> modlist, PoEModData template)
        {
            ModCraft m = new ModCraft(template);
            int      i = 0;

            while (i < modlist.Count)
            {
                if ((template.generation_type == ModLogic.Prefix && CraftingDatabase.AllMods[modlist[i].SourceData].generation_type != ModLogic.Prefix) ||
                    (template.generation_type == ModLogic.Suffix && CraftingDatabase.AllMods[modlist[i].SourceData].generation_type != ModLogic.Prefix && CraftingDatabase.AllMods[modlist[i].SourceData].generation_type != ModLogic.Suffix))
                {
                    break;
                }
                i++;
            }
            modlist.Insert(i, new ModCraft(template));
            LiveTags.UnionWith(template.adds_tags);
            UpdateModQuality(m, QualityType);
        }
コード例 #5
0
        private void UpdateModQuality(ModCraft mod, string name)
        {
            PoEModData     modtemplate = CraftingDatabase.AllMods[mod.SourceData];
            IList <string> tags;

            if (name != null && ModLogic.CatalystTags.Keys.Contains(name))
            {
                tags = ModLogic.CatalystTags[name];
            }
            else
            {
                tags = new List <string>();
            }
            bool match = false;

            foreach (string s in tags)
            {
                if (modtemplate.type_tags.Contains(s))
                {
                    match = true;
                    break;
                }
            }
            if (modtemplate.type_tags.Contains(ModLogic.CatalystIgnore))
            {
                match = false;
            }
            if (match)
            {
                mod.Quality = BaseQuality;
            }
            else
            {
                mod.Quality = 0;
            }
        }