private void RegisterItemIntoMetaTagSystem(ItemSpawnerEntry entry) { if (!IM.OD.ContainsKey(entry.MainObjectID)) { return; } FVRObject mainObject = IM.OD[entry.MainObjectID]; string pageString = entry.EntryPath.Split('/')[0]; string subCategoryString = entry.EntryPath.Split('/')[1]; ItemSpawnerV2.PageMode page = ItemSpawnerV2.PageMode.Firearms; if (Enum.IsDefined(typeof(ItemSpawnerV2.PageMode), pageString)) { page = (ItemSpawnerV2.PageMode)Enum.Parse(typeof(ItemSpawnerV2.PageMode), pageString); } ItemSpawnerID.ESubCategory subCategory = ItemSpawnerID.ESubCategory.None; if (Enum.IsDefined(typeof(ItemSpawnerID.ESubCategory), subCategoryString)) { subCategory = (ItemSpawnerID.ESubCategory)Enum.Parse(typeof(ItemSpawnerID.ESubCategory), subCategoryString); } IM.AddMetaTag(subCategoryString, TagType.SubCategory, entry.MainObjectID, page); entry.ModTags.ForEach(tag => IM.AddMetaTag(tag, TagType.ModTag, entry.MainObjectID, page)); RegisterItemIntoMetaTagSystem(mainObject, page); }
private static void MetaTagPatch(ItemSpawnerID ID) { //If this IDs items didn't get added, add it to the firearm page if (IM.Instance.PageItemLists.ContainsKey(ItemSpawnerV2.PageMode.Firearms)) { if (!IM.Instance.PageItemLists.Any(o => o.Value.Contains(ID.ItemID)) && IM.OD.ContainsKey(ID.MainObject.ItemID) && IM.OD[ID.MainObject.ItemID].IsModContent) { OtherLogger.Log("Adding misc mod item to meta tag system: " + ID.ItemID, OtherLogger.LogType.Loading); IM.AddMetaTag(ID.Category.ToString(), TagType.Category, ID.ItemID, ItemSpawnerV2.PageMode.Firearms); IM.AddMetaTag(ID.SubCategory.ToString(), TagType.SubCategory, ID.ItemID, ItemSpawnerV2.PageMode.Firearms); } } }
private void RegisterItemIntoMetaTagSystem(FVRObject mainObject, ItemSpawnerV2.PageMode page) { if (mainObject.Category == FVRObject.ObjectCategory.Firearm) { IM.AddMetaTag(mainObject.TagSet.ToString(), TagType.Set, mainObject.ItemID, page); IM.AddMetaTag(mainObject.TagEra.ToString(), TagType.Era, mainObject.ItemID, page); IM.AddMetaTag(mainObject.TagFirearmSize.ToString(), TagType.Size, mainObject.ItemID, page); IM.AddMetaTag(mainObject.TagFirearmAction.ToString(), TagType.Action, mainObject.ItemID, page); IM.AddMetaTag(mainObject.TagFirearmRoundPower.ToString(), TagType.RoundClass, mainObject.ItemID, page); IM.AddMetaTag(mainObject.TagFirearmCountryOfOrigin.ToString(), TagType.CountryOfOrigin, mainObject.ItemID, page); IM.AddMetaTag(mainObject.TagFirearmFirstYear.ToString(), TagType.IntroductionYear, mainObject.ItemID, page); IM.AddMetaTag(mainObject.MagazineType.ToString(), TagType.MagazineType, mainObject.ItemID, page); if (mainObject.UsesRoundTypeFlag) { IM.AddMetaTag(mainObject.RoundType.ToString(), TagType.Caliber, mainObject.ItemID, page); } mainObject.TagFirearmFiringModes.ForEach(tag => IM.AddMetaTag(tag.ToString(), TagType.FiringMode, mainObject.ItemID, page)); mainObject.TagFirearmFeedOption.ForEach(tag => IM.AddMetaTag(tag.ToString(), TagType.FeedOption, mainObject.ItemID, page)); mainObject.TagFirearmMounts.ForEach(mode => IM.AddMetaTag(mode.ToString(), TagType.AttachmentMount, mainObject.ItemID, page)); } else if (mainObject.Category == FVRObject.ObjectCategory.Attachment) { IM.AddMetaTag(mainObject.TagSet.ToString(), TagType.Set, mainObject.ItemID, page); IM.AddMetaTag(mainObject.TagEra.ToString(), TagType.Era, mainObject.ItemID, page); IM.AddMetaTag(mainObject.TagAttachmentFeature.ToString(), TagType.AttachmentFeature, mainObject.ItemID, page); IM.AddMetaTag(mainObject.TagAttachmentMount.ToString(), TagType.AttachmentMount, mainObject.ItemID, page); } }