Ejemplo n.º 1
0
        public FormKey GetLeveledListUsingArmorSets(ISkyrimMod PatchMod, bool createLL = false)
        {
            LeveledItem ll = null;

            if (LLKey == FormKey.Null || createLL)
            {
                var list = Armors.Select(a => a.CreateLeveledList().AsLink <IItemGetter>());
                ll    = OutfitUtils.CreateLeveledList(PatchMod, list, Configuration.Patcher.LeveledListPrefix + Name, 1, Configuration.LeveledListFlag);
                LLKey = ll.FormKey;
            }
            return(LLKey);
        }
Ejemplo n.º 2
0
        public FormKey CreateLeveledList(ISkyrimMod patchMod, bool forceCreate = false)
        {
            LeveledItem ll = null;

            if (forceCreate || LLFormKey == FormKey.Null)
            {
                var items = Armors.Select(a => a.FormKey.AsLink <IItemGetter>())
                            .Union(Weapons.Select(a => a.AsLink <IItemGetter>()).EmptyIfNull());
                ll        = OutfitUtils.CreateLeveledList(patchMod, items, Prefix, 1, LeveledItem.Flag.UseAll);
                LLFormKey = ll.FormKey;
            }
            return(LLFormKey);
        }
Ejemplo n.º 3
0
        public void CreateMatchingSetFrom(IEnumerable <IArmorGetter> others, bool addAll = false)
        {
            ConcurrentDictionary <string, ConcurrentDictionary <string, TArmor> > matchedArmors1 = new();
            IEnumerable <TArmor> armorParts = others
                                              .Where(x => (ArmorUtils.GetMaterial(x).Equals(Material) ||
                                                           x.HasKeyword(Skyrim.Keyword.ArmorJewelry)) &&
                                                     Type.Equals(ArmorUtils.GetArmorType(x)))
                                              .Select(x => new TArmor(x));

            if (!addAll)
            {
                var block = new ActionBlock <TArmor>(
                    armor =>
                {
                    var armorName = armor.Name;
                    if (HelperUtils.GetMatchingWordCount(Body.Name, armorName) > 0)
                    {
                        armor.BodySlots.Select(x => x.ToString()).ForEach(flag =>
                        {
                            if (!matchedArmors1.ContainsKey(flag))
                            {
                                matchedArmors1.TryAdd(flag,
                                                      new ConcurrentDictionary <string, TArmor>());
                            }
                            matchedArmors1.GetValueOrDefault(flag)
                            .TryAdd(HelperUtils.GetMatchingWordCount(Body.Name, armorName).ToString(), armor);
                        });
                    }
                }, new ExecutionDataflowBlockOptions {
                    MaxDegreeOfParallelism = 30
                });

                foreach (var armor in armorParts)
                {
                    block.Post(armor);
                }
                block.Complete();
                block.Completion.Wait();

                var armors = matchedArmors1.Values.Select(x => x.OrderBy(k => k.Key).Last().Value);
                this.AddArmors(armors);
                Logger.DebugFormat("Created Armors Set: {0}=> [{1}]", Body.FormKey.ModKey.FileName,
                                   string.Join(", ", Armors.Select(x => x.Name)));
            }
            else
            {
                this.AddArmors(armorParts);
            }
        }
Ejemplo n.º 4
0
 public IEnumerable <FormLink <IItemGetter> > GetLeveledListsUsingArmorSets()
 {
     return(Armors.Select(a => a.CreateLeveledList().AsLink <IItemGetter>()));;
 }