Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of Gallery v1.0.0
plugins/RavenwoodRelicsGalery/RavenwoodRelicsGallery.dll
Decompiled a day agousing System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using Jotunn.Configs; using Jotunn.Entities; using Jotunn.Managers; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: AssemblyVersion("0.0.0.0")] namespace RavenwoodRelicsGallery; [BepInPlugin("Ravenwood.RelicsGallery", "Ravenwood Relics Gallery", "1.0.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] public class RavenwoodRelicsGallery : BaseUnityPlugin { public const string PluginGUID = "Ravenwood.RelicsGallery"; public const string PluginName = "Ravenwood Relics Gallery"; public const string PluginVersion = "1.0.0"; private AssetBundle galleryBundle; private bool registrationEventAttached; private void Awake() { //IL_0029: Unknown result type (might be due to invalid IL or missing references) RelicRegistrar.InitConfig(((BaseUnityPlugin)this).Config); foreach (string allCategory in RelicRegistrar.GetAllCategories()) { PieceManager.Instance.AddPieceCategory(allCategory); } Assembly executingAssembly = Assembly.GetExecutingAssembly(); string text = executingAssembly.GetManifestResourceNames().FirstOrDefault((string resource) => resource.ToLowerInvariant().Contains("ravenwoodgallery")); if (string.IsNullOrEmpty(text)) { ((BaseUnityPlugin)this).Logger.LogError((object)"Could not find embedded asset bundle resource containing 'ravenwoodgallery'."); return; } using (Stream stream = executingAssembly.GetManifestResourceStream(text)) { if (stream == null) { ((BaseUnityPlugin)this).Logger.LogError((object)("Embedded asset bundle stream was null for '" + text + "'.")); return; } using MemoryStream memoryStream = new MemoryStream(); stream.CopyTo(memoryStream); galleryBundle = AssetBundle.LoadFromMemory(memoryStream.ToArray()); } if ((Object)(object)galleryBundle == (Object)null) { ((BaseUnityPlugin)this).Logger.LogError((object)"Failed to load Ravenwood Gallery AssetBundle from embedded resource."); return; } PrefabManager.OnPrefabsRegistered += RegisterNow; registrationEventAttached = true; } private void OnDestroy() { if (registrationEventAttached) { PrefabManager.OnPrefabsRegistered -= RegisterNow; registrationEventAttached = false; } } private void RegisterNow() { if (!((Object)(object)galleryBundle == (Object)null)) { RelicRegistrar.RegisterAllRelics(galleryBundle); PrefabManager.OnPrefabsRegistered -= RegisterNow; registrationEventAttached = false; ((BaseUnityPlugin)this).Logger.LogInfo((object)"Ravenwood Relics Gallery 1.0.0 loaded. Gallery prefabs registered."); } } } public class RelicRegistration { public string PrefabName; public string DisplayName; public RequirementConfig[] Requirements; public string Description; public RelicRegistration(string prefab, string display, RequirementConfig[] reqs, string desc) { PrefabName = prefab; DisplayName = display; Requirements = reqs; Description = desc; } } public static class RelicRegistrar { private static bool wasAlreadyRegistered = false; private static ConfigEntry<string> customHammerTabConfig; private static readonly Dictionary<string, ConfigEntry<string>> recipeConfigs = new Dictionary<string, ConfigEntry<string>>(StringComparer.OrdinalIgnoreCase); private static readonly HashSet<string> IronSoundPrefabs = new HashSet<string>(StringComparer.OrdinalIgnoreCase) { "RWG_Dragon_Banner", "RWG_Dutch_Banner", "RWG_Lion_King" }; private const int GalleryPictureComfortGroup = 71001; private const int GalleryTrophyComfortGroup = 71002; public static readonly List<RelicRegistration> AllRegistrations = new List<RelicRegistration> { new RelicRegistration("RWG_Picture1", "Picture 1", (RequirementConfig[])(object)new RequirementConfig[1] { new RequirementConfig("RWc_Deer", 20, 0, true) }, "A Ravenwood gallery picture frame."), new RelicRegistration("RWG_Picture2", "Picture 2", (RequirementConfig[])(object)new RequirementConfig[1] { new RequirementConfig("RWc_Deer", 20, 0, true) }, "A Ravenwood gallery picture frame."), new RelicRegistration("RWG_Picture3", "Picture 3", (RequirementConfig[])(object)new RequirementConfig[1] { new RequirementConfig("RWc_Deer", 15, 0, true) }, "A Ravenwood gallery picture frame."), new RelicRegistration("RWG_Picture4", "Picture 4", (RequirementConfig[])(object)new RequirementConfig[1] { new RequirementConfig("RWc_Deer", 15, 0, true) }, "A Ravenwood gallery picture frame."), new RelicRegistration("RWG_Picture5", "Picture 5", (RequirementConfig[])(object)new RequirementConfig[1] { new RequirementConfig("RWc_Deer", 5, 0, true) }, "A Ravenwood gallery picture frame."), new RelicRegistration("RWG_Vikings", "Picture 6", (RequirementConfig[])(object)new RequirementConfig[1] { new RequirementConfig("RWc_Deer", 15, 0, true) }, "A Ravenwood gallery picture frame."), new RelicRegistration("RWG_Picture_01_A", "Picture 01 A", (RequirementConfig[])(object)new RequirementConfig[1] { new RequirementConfig("RWc_Bear", 2, 0, true) }, "A Ravenwood gallery picture frame."), new RelicRegistration("RWG_Picture_02_A", "Picture 02 A", (RequirementConfig[])(object)new RequirementConfig[1] { new RequirementConfig("RWc_Bear", 1, 0, true) }, "A Ravenwood gallery picture frame."), new RelicRegistration("RWG_Picture_03_A", "Picture 03 A", (RequirementConfig[])(object)new RequirementConfig[2] { new RequirementConfig("RWc_Deer", 2, 0, true), new RequirementConfig("RWc_Bear", 2, 0, true) }, "A Ravenwood gallery picture frame."), new RelicRegistration("RWG_Picture_04_A", "Picture 04 A", (RequirementConfig[])(object)new RequirementConfig[1] { new RequirementConfig("RWc_Bear", 2, 0, true) }, "A Ravenwood gallery picture frame."), new RelicRegistration("RWG_Picture_05_A", "Picture 05 A", (RequirementConfig[])(object)new RequirementConfig[1] { new RequirementConfig("RWc_Bear", 3, 0, true) }, "A Ravenwood gallery picture frame."), new RelicRegistration("RWG_Picture_06_A", "Picture 06 A", (RequirementConfig[])(object)new RequirementConfig[1] { new RequirementConfig("RWc_Bear", 3, 0, true) }, "A Ravenwood gallery picture frame."), new RelicRegistration("RWG_Picture_07_A", "Picture 07 A", (RequirementConfig[])(object)new RequirementConfig[1] { new RequirementConfig("RWc_Bear", 4, 0, true) }, "A Ravenwood gallery picture frame."), new RelicRegistration("RWG_Picture_08_A", "Picture 08 A", (RequirementConfig[])(object)new RequirementConfig[1] { new RequirementConfig("RWc_Bear", 5, 0, true) }, "A Ravenwood gallery picture frame."), new RelicRegistration("RWG_Picture_09_A", "Picture 09 A", (RequirementConfig[])(object)new RequirementConfig[1] { new RequirementConfig("RWc_Bear", 3, 0, true) }, "A Ravenwood gallery picture frame."), new RelicRegistration("RWG_Picture_10_A", "Picture 10 A", (RequirementConfig[])(object)new RequirementConfig[1] { new RequirementConfig("RWc_Bear", 3, 0, true) }, "A Ravenwood gallery picture frame."), new RelicRegistration("RWG_Picture_01_B", "Picture 01 B", (RequirementConfig[])(object)new RequirementConfig[1] { new RequirementConfig("RWc_Deer", 10, 0, true) }, "A Ravenwood gallery picture frame."), new RelicRegistration("RWG_Picture_02_B", "Picture 02 B", (RequirementConfig[])(object)new RequirementConfig[1] { new RequirementConfig("RWc_Deer", 5, 0, true) }, "A Ravenwood gallery picture frame."), new RelicRegistration("RWG_Picture_03_B", "Picture 03 B", (RequirementConfig[])(object)new RequirementConfig[1] { new RequirementConfig("RWc_Deer", 12, 0, true) }, "A Ravenwood gallery picture frame."), new RelicRegistration("RWG_Picture_04_B", "Picture 04 B", (RequirementConfig[])(object)new RequirementConfig[1] { new RequirementConfig("RWc_Deer", 10, 0, true) }, "A Ravenwood gallery picture frame."), new RelicRegistration("RWG_Picture_05_B", "Picture 05 B", (RequirementConfig[])(object)new RequirementConfig[1] { new RequirementConfig("RWc_Deer", 15, 0, true) }, "A Ravenwood gallery picture frame."), new RelicRegistration("RWG_Picture_06_B", "Picture 06 B", (RequirementConfig[])(object)new RequirementConfig[1] { new RequirementConfig("RWc_Deer", 15, 0, true) }, "A Ravenwood gallery picture frame."), new RelicRegistration("RWG_Picture_07_B", "Picture 07 B", (RequirementConfig[])(object)new RequirementConfig[1] { new RequirementConfig("RWc_Deer", 20, 0, true) }, "A Ravenwood gallery picture frame."), new RelicRegistration("RWG_Picture_08_B", "Picture 08 B", (RequirementConfig[])(object)new RequirementConfig[1] { new RequirementConfig("RWc_Deer", 25, 0, true) }, "A Ravenwood gallery picture frame."), new RelicRegistration("RWG_Picture_09_B", "Picture 09 B", (RequirementConfig[])(object)new RequirementConfig[1] { new RequirementConfig("RWc_Deer", 15, 0, true) }, "A Ravenwood gallery picture frame."), new RelicRegistration("RWG_Picture_10_B", "Picture 10 B", (RequirementConfig[])(object)new RequirementConfig[1] { new RequirementConfig("RWc_Deer", 15, 0, true) }, "A Ravenwood gallery picture frame."), new RelicRegistration("RWG_Apatosaurus", "Apatosaurus Trophy", (RequirementConfig[])(object)new RequirementConfig[1] { new RequirementConfig("RWc_Wolf", 2, 0, true) }, "A Ravenwood gallery trophy display."), new RelicRegistration("RWG_BearHead", "Bear Trophy", (RequirementConfig[])(object)new RequirementConfig[1] { new RequirementConfig("RWc_Deer", 40, 0, true) }, "A Ravenwood gallery trophy display."), new RelicRegistration("RWG_BoarHead", "Boar Trophy", (RequirementConfig[])(object)new RequirementConfig[1] { new RequirementConfig("RWc_Deer", 40, 0, true) }, "A Ravenwood gallery trophy display."), new RelicRegistration("RWG_DeerHead", "Deer Trophy", (RequirementConfig[])(object)new RequirementConfig[1] { new RequirementConfig("RWc_Deer", 40, 0, true) }, "A Ravenwood gallery trophy display."), new RelicRegistration("RWG_ElephantHead", "Elephant Trophy", (RequirementConfig[])(object)new RequirementConfig[1] { new RequirementConfig("RWc_Deer", 40, 0, true) }, "A Ravenwood gallery trophy display."), new RelicRegistration("RWG_HippoHead", "Hippo Trophy", (RequirementConfig[])(object)new RequirementConfig[1] { new RequirementConfig("RWc_Deer", 40, 0, true) }, "A Ravenwood gallery trophy display."), new RelicRegistration("RWG_LionHead", "Lion Trophy", (RequirementConfig[])(object)new RequirementConfig[1] { new RequirementConfig("RWc_Deer", 40, 0, true) }, "A Ravenwood gallery trophy display."), new RelicRegistration("RWG_Mamoth", "Mammoth Trophy", (RequirementConfig[])(object)new RequirementConfig[1] { new RequirementConfig("RWc_Wolf", 3, 0, true) }, "A Ravenwood gallery trophy display."), new RelicRegistration("RWG_RhinoHead", "Rhino Trophy", (RequirementConfig[])(object)new RequirementConfig[1] { new RequirementConfig("RWc_Deer", 40, 0, true) }, "A Ravenwood gallery trophy display."), new RelicRegistration("RWG_Trophy_Deer", "Deer Trophy", (RequirementConfig[])(object)new RequirementConfig[1] { new RequirementConfig("RWc_Deer", 40, 0, true) }, "A Ravenwood gallery trophy display."), new RelicRegistration("RWG_Dragon_Banner", "Banner of a Dragon", (RequirementConfig[])(object)new RequirementConfig[2] { new RequirementConfig("RWc_Deer", 15, 0, true), new RequirementConfig("RWc_Bear", 5, 0, true) }, "A Ravenwood gallery trophy display."), new RelicRegistration("RWG_Dutch_Banner", "Banner of Kings", (RequirementConfig[])(object)new RequirementConfig[2] { new RequirementConfig("RWc_Deer", 15, 0, true), new RequirementConfig("RWc_Bear", 5, 0, true) }, "A Ravenwood gallery trophy display."), new RelicRegistration("RWG_Lion_King", "Banner of Lions", (RequirementConfig[])(object)new RequirementConfig[2] { new RequirementConfig("RWc_Deer", 15, 0, true), new RequirementConfig("RWc_Bear", 5, 0, true) }, "A Ravenwood gallery trophy display.") }; public static void InitConfig(ConfigFile config) { if (config == null) { return; } if (customHammerTabConfig == null) { customHammerTabConfig = config.Bind<string>("General", "CustomHammerTab", "Ravenwood", "Hammer tab/category used by Ravenwood Relics Gallery pieces. Restart Valheim after changing this setting."); } if (recipeConfigs.Count > 0) { return; } foreach (RelicRegistration allRegistration in AllRegistrations) { recipeConfigs[allRegistration.PrefabName] = config.Bind<string>("Recipes", allRegistration.PrefabName, string.Join(",", Array.ConvertAll(allRegistration.Requirements, (RequirementConfig requirement) => $"{requirement.Item}:{requirement.Amount}")), "Build recipe for this prefab. Format: ItemPrefab:Amount. Separate multiple requirements with commas, for example: RWc_Deer:1,Wood:5. Restart Valheim after changing this setting."); } config.Save(); } public static void RegisterAllRelics(AssetBundle bundle) { if (wasAlreadyRegistered) { return; } if ((Object)(object)bundle == (Object)null) { Debug.LogError((object)"[RavenwoodRelicsGallery] AssetBundle is null. Registration stopped."); return; } int num = 0; int num2 = 0; foreach (RelicRegistration allRegistration in AllRegistrations) { if (RegisterRelic(bundle, allRegistration)) { num++; } else { num2++; } } wasAlreadyRegistered = true; Debug.Log((object)$"[RavenwoodRelicsGallery] Registered {num}/{AllRegistrations.Count} relics. Failed: {num2}."); } private static bool RegisterRelic(AssetBundle bundle, RelicRegistration reg) { //IL_011e: Unknown result type (might be due to invalid IL or missing references) //IL_014b: Unknown result type (might be due to invalid IL or missing references) //IL_0178: Unknown result type (might be due to invalid IL or missing references) //IL_01eb: Unknown result type (might be due to invalid IL or missing references) //IL_01f0: Unknown result type (might be due to invalid IL or missing references) //IL_01fc: Unknown result type (might be due to invalid IL or missing references) //IL_0208: Unknown result type (might be due to invalid IL or missing references) //IL_0214: Unknown result type (might be due to invalid IL or missing references) //IL_0223: Expected O, but got Unknown //IL_022c: Unknown result type (might be due to invalid IL or missing references) //IL_0236: Expected O, but got Unknown if ((Object)(object)bundle == (Object)null) { return false; } if (reg == null || string.IsNullOrWhiteSpace(reg.PrefabName)) { Debug.LogWarning((object)"[RavenwoodRelicsGallery] Skipped a null or empty relic registration."); return false; } GameObject val = bundle.LoadAsset<GameObject>(reg.PrefabName); if ((Object)(object)val == (Object)null) { Debug.LogWarning((object)("[RavenwoodRelicsGallery] Missing prefab in AssetBundle: " + reg.PrefabName)); return false; } ((Object)val).name = reg.PrefabName; ZNetView val2 = val.GetComponent<ZNetView>(); if ((Object)(object)val2 == (Object)null) { val2 = val.AddComponent<ZNetView>(); } val2.m_persistent = true; val2.m_syncInitialScale = true; if ((Object)(object)val.GetComponent<ZSyncTransform>() == (Object)null) { val.AddComponent<ZSyncTransform>(); } Piece val3 = val.GetComponent<Piece>() ?? val.AddComponent<Piece>(); val3.m_name = reg.DisplayName; val3.m_description = reg.Description; val3.m_groundOnly = false; if (IronSoundPrefabs.Contains(reg.PrefabName)) { val3.m_comfort = 1; val3.m_comfortGroup = (ComfortGroup)3; } else if (string.Equals(reg.Description, "A Ravenwood gallery trophy display.", StringComparison.Ordinal)) { val3.m_comfort = 1; val3.m_comfortGroup = (ComfortGroup)71002; } else if (string.Equals(reg.Description, "A Ravenwood gallery picture frame.", StringComparison.Ordinal)) { val3.m_comfort = 1; val3.m_comfortGroup = (ComfortGroup)71001; } WearNTear val4 = val.GetComponent<WearNTear>() ?? val.AddComponent<WearNTear>(); val4.m_health = 1000000f; val4.m_noRoofWear = true; val4.m_noSupportWear = false; val4.m_supports = true; ConfigurePlacementAndDestructionEffects(reg.PrefabName, val3, val4); ConfigureVanillaFragmentDestruction(val, val4); Sprite val5 = bundle.LoadAsset<Sprite>(reg.PrefabName); if ((Object)(object)val5 != (Object)null) { val3.m_icon = val5; } PieceConfig val6 = new PieceConfig { PieceTable = "Hammer", Category = GetConfiguredCategory(), CraftingStation = "piece_workbench", Requirements = GetConfiguredRequirements(reg) }; PieceManager.Instance.AddPiece(new CustomPiece(val, true, val6)); return true; } private static void ConfigurePlacementAndDestructionEffects(string prefabName, Piece piece, WearNTear wear) { //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Expected O, but got Unknown //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Expected O, but got Unknown if (!((Object)(object)piece == (Object)null) && !((Object)(object)wear == (Object)null)) { bool flag = !string.IsNullOrWhiteSpace(prefabName) && IronSoundPrefabs.Contains(prefabName); GameObject prefab = PrefabManager.Instance.GetPrefab("vfx_Place_wood"); GameObject prefab2 = PrefabManager.Instance.GetPrefab(flag ? "sfx_build_hammer_metal" : "sfx_build_hammer_wood"); GameObject prefab3 = PrefabManager.Instance.GetPrefab("vfx_destroyed"); GameObject prefab4 = PrefabManager.Instance.GetPrefab(flag ? "sfx_build_hammer_metal" : "sfx_wood_break"); if (piece.m_placeEffect == null) { piece.m_placeEffect = new EffectList(); } if (wear.m_destroyedEffect == null) { wear.m_destroyedEffect = new EffectList(); } RemoveEffectsByName(piece.m_placeEffect, "sfx_build_hammer_wood", "sfx_build_hammer_metal"); RemoveEffectsByName(wear.m_destroyedEffect, "sfx_wood_break", "sfx_build_hammer_metal"); AddEffectIfMissing(piece.m_placeEffect, prefab); AddEffectIfMissing(piece.m_placeEffect, prefab2); AddEffectIfMissing(wear.m_destroyedEffect, prefab3); AddEffectIfMissing(wear.m_destroyedEffect, prefab4); } } private static void ConfigureVanillaFragmentDestruction(GameObject prefab, WearNTear wear) { //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Expected O, but got Unknown if ((Object)(object)prefab == (Object)null || (Object)(object)wear == (Object)null) { return; } List<GameObject> list = new List<GameObject>(); if (wear.m_fragmentRoots != null) { GameObject[] fragmentRoots = wear.m_fragmentRoots; foreach (GameObject candidate in fragmentRoots) { AddFragmentRootIfValid(prefab, list, candidate); } } foreach (Transform item in prefab.transform) { Transform val = item; if (!((Object)(object)val == (Object)null)) { GameObject gameObject = ((Component)val).gameObject; if (!((Object)(object)gameObject.GetComponentInChildren<Renderer>(true) == (Object)null)) { AddFragmentRootIfValid(prefab, list, gameObject); } } } if (list.Count == 0) { Renderer[] componentsInChildren = prefab.GetComponentsInChildren<Renderer>(true); Renderer[] array = componentsInChildren; foreach (Renderer val2 in array) { if (!((Object)(object)val2 == (Object)null)) { Transform val3 = ((Component)val2).transform; while ((Object)(object)val3.parent != (Object)null && (Object)(object)val3.parent != (Object)(object)prefab.transform) { val3 = val3.parent; } if ((Object)(object)val3.parent == (Object)(object)prefab.transform) { AddFragmentRootIfValid(prefab, list, ((Component)val3).gameObject); } } } } wear.m_autoCreateFragments = true; if (list.Count > 0) { wear.m_fragmentRoots = list.ToArray(); } } private static void AddFragmentRootIfValid(GameObject prefab, List<GameObject> roots, GameObject candidate) { if (!((Object)(object)prefab == (Object)null) && roots != null && !((Object)(object)candidate == (Object)null) && !((Object)(object)candidate == (Object)(object)prefab) && candidate.transform.IsChildOf(prefab.transform) && !((Object)(object)candidate.GetComponentInChildren<Renderer>(true) == (Object)null) && !roots.Any((GameObject existing) => (Object)(object)existing == (Object)(object)candidate)) { roots.Add(candidate); } } private static void RemoveEffectsByName(EffectList effectList, params string[] prefabNames) { if (effectList == null || effectList.m_effectPrefabs == null || prefabNames == null || prefabNames.Length == 0) { return; } effectList.m_effectPrefabs = effectList.m_effectPrefabs.Where((EffectData effect) => effect == null || (Object)(object)effect.m_prefab == (Object)null || !prefabNames.Any((string name) => string.Equals(((Object)effect.m_prefab).name, name, StringComparison.OrdinalIgnoreCase))).ToArray(); } private static void AddEffectIfMissing(EffectList effectList, GameObject effectPrefab) { //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Expected O, but got Unknown if (effectList != null && !((Object)(object)effectPrefab == (Object)null)) { List<EffectData> list = (effectList.m_effectPrefabs ?? Array.Empty<EffectData>()).ToList(); if (!list.Any((EffectData effect) => effect != null && (Object)(object)effect.m_prefab != (Object)null && string.Equals(((Object)effect.m_prefab).name, ((Object)effectPrefab).name, StringComparison.OrdinalIgnoreCase))) { list.Add(new EffectData { m_prefab = effectPrefab, m_enabled = true, m_variant = -1 }); effectList.m_effectPrefabs = list.ToArray(); } } } private static RequirementConfig[] GetConfiguredRequirements(RelicRegistration reg) { //IL_01c1: Unknown result type (might be due to invalid IL or missing references) //IL_01cb: Expected O, but got Unknown if (reg == null || string.IsNullOrWhiteSpace(reg.PrefabName)) { return reg?.Requirements; } if (!recipeConfigs.TryGetValue(reg.PrefabName, out var value) || value == null) { return reg.Requirements; } string value2 = value.Value; if (string.IsNullOrWhiteSpace(value2)) { Debug.LogWarning((object)("[RavenwoodRelicsGallery] Empty recipe config for " + reg.PrefabName + ". Using the default recipe.")); return reg.Requirements; } List<RequirementConfig> list = new List<RequirementConfig>(); string[] array = value2.Split(new char[2] { ',', ';' }, StringSplitOptions.RemoveEmptyEntries); string[] array2 = array; foreach (string text in array2) { string text2 = text.Trim(); int num = text2.IndexOf(':'); if (num <= 0 || num >= text2.Length - 1) { Debug.LogWarning((object)("[RavenwoodRelicsGallery] Invalid recipe entry '" + text2 + "' for " + reg.PrefabName + ". Expected ItemPrefab:Amount.")); continue; } string text3 = text2.Substring(0, num).Trim(); string s = text2.Substring(num + 1).Trim(); if (string.IsNullOrWhiteSpace(text3) || !int.TryParse(s, out var result) || result <= 0) { Debug.LogWarning((object)("[RavenwoodRelicsGallery] Invalid recipe entry '" + text2 + "' for " + reg.PrefabName + ". Expected ItemPrefab:Amount with an amount greater than zero.")); } else { list.Add(new RequirementConfig(text3, result, 0, true)); } } if (list.Count == 0) { Debug.LogWarning((object)("[RavenwoodRelicsGallery] No valid configured requirements for " + reg.PrefabName + ". Using the default recipe.")); return reg.Requirements; } return list.ToArray(); } private static string GetConfiguredCategory() { string text = customHammerTabConfig?.Value; return string.IsNullOrWhiteSpace(text) ? "Ravenwood" : text.Trim(); } public static IEnumerable<string> GetAllCategories() { return new string[1] { GetConfiguredCategory() }; } }