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 string CreatePath(ItemSpawnerV2.PageMode Page, ItemSpawnerID ID) { string path = Page.ToString(); //If the category is meatfortress, include it if (ID.Category == ItemSpawnerID.EItemCategory.MeatFortress) { path += "/" + ID.Category.ToString(); } //If the category is modded, include it else if (!Enum.IsDefined(typeof(ItemSpawnerID.EItemCategory), ID.Category) && IM.CDefInfo.ContainsKey(ID.Category)) { path += "/" + IM.CDefInfo[ID.Category].DisplayName; } //Include all subcategories that aren't none if (ID.SubCategory != ItemSpawnerID.ESubCategory.None) { if (Enum.IsDefined(typeof(ItemSpawnerID.ESubCategory), ID.SubCategory)) { path += "/" + ID.SubCategory.ToString(); } else if (IM.CDefSubInfo.ContainsKey(ID.SubCategory)) { path += "/" + IM.CDefSubInfo[ID.SubCategory].DisplayName; } } path += "/" + MainObjectID; return(path); }
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); } }
public void LegacyPopulateFromID(ItemSpawnerV2.PageMode Page, ItemSpawnerID ID, bool IsModded) { if (ID.MainObject != null) { MainObjectID = ID.MainObject.ItemID; } else { OtherLogger.LogWarning("ItemSpawnerID has a null MainObject! ItemID: " + ID.ItemID); MainObjectID = ID.ItemID; } if (IM.OD.ContainsKey(MainObjectID)) { OtherLoader.SpawnerEntriesByID[MainObjectID] = this; } SpawnWithIDs = new List <string>(); if (ID.SecondObject != null) { SpawnWithIDs.Add(ID.SecondObject.ItemID); } //Add secondary items to entry, being careful of null values! SecondaryObjectIDs = new List <string>(); foreach (ItemSpawnerID secondary in ID.Secondaries) { if (secondary != null && secondary.MainObject != null) { SecondaryObjectIDs.Add(secondary.MainObject.ItemID); } else if (secondary == null) { OtherLogger.LogWarning("Failed to add secondary to item (" + MainObjectID + ") due to secondary item being null!"); } else { OtherLogger.LogWarning("Failed to add secondary to item (" + MainObjectID + ") due to null MainObject!, Secondary display name: " + secondary.DisplayName); } } if (ID.Secondaries_ByStringID != null) { SecondaryObjectIDs.AddRange(ID.Secondaries_ByStringID); } EntryPath = CreatePath(Page, ID); EntryIcon = ID.Sprite; DisplayName = ID.DisplayName; IsDisplayedInMainEntry = ID.IsDisplayedInMainEntry; UsesLargeSpawnPad = ID.UsesLargeSpawnPad; this.IsModded = IsModded; TutorialBlockIDs = new List <string>(); TutorialBlockIDs.AddRange(ID.TutorialBlocks); ModTags = new List <string>(); ModTags.AddRange(ID.ModTags); }