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 MoonforgedGatesAndFences v1.0.9
MoonforgedGatesAndFences.dll
Decompiled 2 weeks agousing System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using HarmonyLib; 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: AssemblyTitle("MoonforgedGatesAndFences")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Caenos")] [assembly: AssemblyProduct("MoonforgedGatesAndFences")] [assembly: AssemblyCopyright("Copyright © 2025")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("8ad799d2-7e36-4098-b363-92c0f7924b6a")] [assembly: AssemblyFileVersion("1.0.9.0")] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyVersion("1.0.9.0")] namespace Moonforged.GatesAndFences; public class RelicRegistration { public string PrefabName; public string DisplayName; public RequirementConfig[] Requirements; public string Description; public string Category; public int Comfort; public string CraftingStation; public RelicRegistration(string prefab, string display, RequirementConfig[] reqs, string desc, string cat, int comfort = 0, string craftingStation = "Workbench") { PrefabName = prefab; DisplayName = display; Requirements = reqs; Description = desc; Category = cat; Comfort = comfort; CraftingStation = craftingStation; } } public static class RelicRegistrar { private static bool wasAlreadyRegistered = false; public static readonly List<RelicRegistration> AllRegistrations = new List<RelicRegistration> { new RelicRegistration("v1_SilverGate", "Silver Gate", (RequirementConfig[])(object)new RequirementConfig[2] { new RequirementConfig("Silver", 5, 0, true), new RequirementConfig("Tin", 2, 0, true) }, "", "building", 0, "Forge"), new RelicRegistration("v1_DvergrForgedGate", "Dvergr Forged Gate", (RequirementConfig[])(object)new RequirementConfig[2] { new RequirementConfig("BlackMetal", 5, 0, true), new RequirementConfig("Bronze", 5, 0, true) }, "", "building", 0, "Forge"), new RelicRegistration("v1_DvergrForgedGate3m", "Dvergr Forged Gate 3m Tall", (RequirementConfig[])(object)new RequirementConfig[2] { new RequirementConfig("BlackMetal", 2, 0, true), new RequirementConfig("Bronze", 1, 0, true) }, "", "building", 0, "Forge"), new RelicRegistration("v1_DvergrForgedGate4m", "Dvergr Forged Gate 4m Tall", (RequirementConfig[])(object)new RequirementConfig[2] { new RequirementConfig("BlackMetal", 2, 0, true), new RequirementConfig("Bronze", 1, 0, true) }, "", "building", 0, "Forge"), new RelicRegistration("v1_EmberlightGate", "Moonforged Emberlight Gate", (RequirementConfig[])(object)new RequirementConfig[4] { new RequirementConfig("BlackMetal", 5, 0, true), new RequirementConfig("Bronze", 1, 0, true), new RequirementConfig("Stone", 5, 0, true), new RequirementConfig("Resin", 2, 0, true) }, "", "building", 0, "Forge"), new RelicRegistration("v1_ValkyriesGate", "Valkyrie's Gate", (RequirementConfig[])(object)new RequirementConfig[3] { new RequirementConfig("Iron", 3, 0, true), new RequirementConfig("Bronze", 1, 0, true), new RequirementConfig("Silver", 2, 0, true) }, "A side gate to Valhalla.", "building", 0, "Forge"), new RelicRegistration("v1_NeoWall", "Valkyrie's New Wall", (RequirementConfig[])(object)new RequirementConfig[3] { new RequirementConfig("BlackMetal", 1, 0, true), new RequirementConfig("Tar", 1, 0, true), new RequirementConfig("Bronze", 1, 0, true) }, "", "building", 0, "Forge"), new RelicRegistration("v1_SilverFence", "Silver Fence", (RequirementConfig[])(object)new RequirementConfig[1] { new RequirementConfig("Silver", 2, 0, true) }, "Silver Fence of the Howling Cavern.", "building", 0, "Forge"), new RelicRegistration("v1_IroncrestWardenFenceBK", "Ironcrest Warden Fence Black", (RequirementConfig[])(object)new RequirementConfig[1] { new RequirementConfig("Iron", 1, 0, true) }, "", "building", 0, "Forge"), new RelicRegistration("v1_IroncrestWardenFenceSilver", "Ironcrest Warden Fence Silver", (RequirementConfig[])(object)new RequirementConfig[1] { new RequirementConfig("Silver", 1, 0, true) }, "", "building", 0, "Forge"), new RelicRegistration("v1_Stonewatch_Palisade", "Stonewatch Palisade", (RequirementConfig[])(object)new RequirementConfig[2] { new RequirementConfig("BlackMetal", 2, 0, true), new RequirementConfig("Stone", 4, 0, true) }, "", "building", 0, "Forge"), new RelicRegistration("v1_GildedRingwatchFence", "Gilded Ringwatch Fence", (RequirementConfig[])(object)new RequirementConfig[2] { new RequirementConfig("Iron", 2, 0, true), new RequirementConfig("Bronze", 1, 0, true) }, "", "building", 0, "Forge"), new RelicRegistration("v1_chain_fence", "Golden Chain Fence", (RequirementConfig[])(object)new RequirementConfig[1] { new RequirementConfig("Bronze", 1, 0, true) }, "", "building", 0, "Forge"), new RelicRegistration("v1_VikingArchGate", "Viking Castle Arch Gate", (RequirementConfig[])(object)new RequirementConfig[3] { new RequirementConfig("Stone", 5, 0, true), new RequirementConfig("Wood", 5, 0, true), new RequirementConfig("Coal", 5, 0, true) }, "", "building"), new RelicRegistration("v1_CurvedWoodFence", "Curved Wood Fence", (RequirementConfig[])(object)new RequirementConfig[2] { new RequirementConfig("Wood", 2, 0, true), new RequirementConfig("FineWood", 2, 0, true) }, "", "building"), new RelicRegistration("v1_BlackFence", "Black Fence", (RequirementConfig[])(object)new RequirementConfig[2] { new RequirementConfig("Iron", 2, 0, true), new RequirementConfig("Bronze", 1, 0, true) }, "", "building", 0, "Forge"), new RelicRegistration("v1_Wrought_iron_fence_1", "Wrought Iron Fence I", (RequirementConfig[])(object)new RequirementConfig[2] { new RequirementConfig("Iron", 2, 0, true), new RequirementConfig("Bronze", 1, 0, true) }, "", "building", 0, "Forge"), new RelicRegistration("v1_StoneBlackFence", "Stone Black Fence", (RequirementConfig[])(object)new RequirementConfig[2] { new RequirementConfig("Bronze", 1, 0, true), new RequirementConfig("Stone", 1, 0, true) }, "", "building", 0, "Forge"), new RelicRegistration("v1_VikingGate", "Moonforged Viking Gate", (RequirementConfig[])(object)new RequirementConfig[4] { new RequirementConfig("Coal", 4, 0, true), new RequirementConfig("Wood", 10, 0, true), new RequirementConfig("RoundLog", 15, 0, true), new RequirementConfig("LeatherScraps", 10, 0, true) }, "Old Viking Gate.", "building"), new RelicRegistration("v1_GardenGate", "Moonforged Garden Gate", (RequirementConfig[])(object)new RequirementConfig[2] { new RequirementConfig("Coal", 2, 0, true), new RequirementConfig("Wood", 2, 0, true) }, "", "building"), new RelicRegistration("v1_GardenFence", "Moonforged Garden Fence", (RequirementConfig[])(object)new RequirementConfig[2] { new RequirementConfig("Coal", 2, 0, true), new RequirementConfig("Wood", 2, 0, true) }, "", "building"), new RelicRegistration("M_Garden_Fence1x1", "Small Garden Fence 1x1", (RequirementConfig[])(object)new RequirementConfig[1] { new RequirementConfig("Wood", 2, 0, true) }, "", "building"), new RelicRegistration("M_Garden_Fence_Medium", "Medium Garden Fence", (RequirementConfig[])(object)new RequirementConfig[1] { new RequirementConfig("Wood", 3, 0, true) }, "", "building"), new RelicRegistration("M_Garden_Pole1x1", "Small Garden Pole 1x1", (RequirementConfig[])(object)new RequirementConfig[1] { new RequirementConfig("Wood", 1, 0, true) }, "", "building"), new RelicRegistration("M_Garden_Gate_Small", "Small Garden Gate", (RequirementConfig[])(object)new RequirementConfig[1] { new RequirementConfig("Wood", 12, 0, true) }, "", "building"), new RelicRegistration("M_Garden_Fence2x2", "Garden Fence 2x2", (RequirementConfig[])(object)new RequirementConfig[1] { new RequirementConfig("Wood", 4, 0, true) }, "", "building"), new RelicRegistration("M_Garden_Fence3x2", "Garden Fence 3x2", (RequirementConfig[])(object)new RequirementConfig[1] { new RequirementConfig("Wood", 6, 0, true) }, "", "building"), new RelicRegistration("M_Garden_Pole2x2", "Garden Pole 2x2", (RequirementConfig[])(object)new RequirementConfig[1] { new RequirementConfig("Wood", 2, 0, true) }, "", "building"), new RelicRegistration("M_Garden_Gate", "Garden Gate", (RequirementConfig[])(object)new RequirementConfig[1] { new RequirementConfig("Wood", 24, 0, true) }, "", "building"), new RelicRegistration("v1_Element03", "Moonforged Ivy Gate", (RequirementConfig[])(object)new RequirementConfig[2] { new RequirementConfig("FineWood", 5, 0, true), new RequirementConfig("Wood", 10, 0, true) }, "", "building"), new RelicRegistration("v1_Element04", "Moonforged Twinleaf Gate", (RequirementConfig[])(object)new RequirementConfig[2] { new RequirementConfig("FineWood", 5, 0, true), new RequirementConfig("Wood", 10, 0, true) }, "", "building"), new RelicRegistration("v1_Element0", "Moonforged Castle Gate", (RequirementConfig[])(object)new RequirementConfig[3] { new RequirementConfig("Iron", 5, 0, true), new RequirementConfig("Wood", 20, 0, true), new RequirementConfig("Tar", 10, 0, true) }, "", "building", 0, "Forge"), new RelicRegistration("v1_Element01", "Moonforged Archgate", (RequirementConfig[])(object)new RequirementConfig[3] { new RequirementConfig("Stone", 10, 0, true), new RequirementConfig("Wood", 10, 0, true), new RequirementConfig("Iron", 2, 0, true) }, "", "building", 0, "piece_stonecutter"), new RelicRegistration("v1_MoonforgedIronboundGate", "Moonforged Ironbound Gate", (RequirementConfig[])(object)new RequirementConfig[3] { new RequirementConfig("Iron", 10, 0, true), new RequirementConfig("Wood", 10, 0, true), new RequirementConfig("Coal", 2, 0, true) }, "", "building", 0, "Forge"), new RelicRegistration("v1_BlackFenceStonePillar", "Stone Black Fence Pillar", (RequirementConfig[])(object)new RequirementConfig[4] { new RequirementConfig("Iron", 1, 0, true), new RequirementConfig("Bronze", 1, 0, true), new RequirementConfig("Stone", 2, 0, true), new RequirementConfig("Resin", 1, 0, true) }, "", "building", 0, "piece_stonecutter"), new RelicRegistration("v1_BlackFenceStonePillar3m", "Stone Black Fence Pillar 3m", (RequirementConfig[])(object)new RequirementConfig[4] { new RequirementConfig("Iron", 1, 0, true), new RequirementConfig("Bronze", 1, 0, true), new RequirementConfig("Stone", 2, 0, true), new RequirementConfig("Resin", 1, 0, true) }, "", "building", 0, "piece_stonecutter"), new RelicRegistration("M_WolfGate", "Moonforged Fenrir Gate", (RequirementConfig[])(object)new RequirementConfig[3] { new RequirementConfig("Iron", 10, 0, true), new RequirementConfig("Stone", 40, 0, true), new RequirementConfig("GreydwarfEye", 10, 0, true) }, "Twin wolves guard the threshold, forged beneath the moon’s cold fire. Their silent howls echo through the ages", "building", 0, "Forge"), new RelicRegistration("M_Hobbit_Door", "Hobbit House Door", (RequirementConfig[])(object)new RequirementConfig[3] { new RequirementConfig("Iron", 5, 0, true), new RequirementConfig("Stone", 20, 0, true), new RequirementConfig("GreydwarfEye", 10, 0, true) }, "", "building", 0, "Forge"), new RelicRegistration("M_Garden_Gate_Arch", "Moonforged Arched Garden Gate", (RequirementConfig[])(object)new RequirementConfig[3] { new RequirementConfig("Dandelion", 5, 0, true), new RequirementConfig("Thistle", 5, 0, true), new RequirementConfig("Mushroom", 10, 0, true) }, "", "building"), new RelicRegistration("M_Gargoyle_Gate", "Moonforged Gargoyle Gate", (RequirementConfig[])(object)new RequirementConfig[3] { new RequirementConfig("Iron", 5, 0, true), new RequirementConfig("Stone", 20, 0, true), new RequirementConfig("GreydwarfEye", 10, 0, true) }, "", "building", 0, "Forge"), new RelicRegistration("M_GargoyleFence_5m", "Moonforged Gargoyle Fence 5m", (RequirementConfig[])(object)new RequirementConfig[3] { new RequirementConfig("Iron", 5, 0, true), new RequirementConfig("Stone", 20, 0, true), new RequirementConfig("GreydwarfEye", 10, 0, true) }, "", "building", 0, "Forge"), new RelicRegistration("M_MedievalMetalDoor", "Medieval Metal Door", (RequirementConfig[])(object)new RequirementConfig[3] { new RequirementConfig("Iron", 5, 0, true), new RequirementConfig("Stone", 20, 0, true), new RequirementConfig("GreydwarfEye", 10, 0, true) }, "", "building", 0, "piece_stonecutter"), new RelicRegistration("Moonforged_Silent_Hill_Gate", "Moonforged Swamp Gate", (RequirementConfig[])(object)new RequirementConfig[2] { new RequirementConfig("Wood", 15, 0, true), new RequirementConfig("ElderBark", 15, 0, true) }, "", "building"), new RelicRegistration("Wolf_Door", "Moonforged Stone Wolf Door", (RequirementConfig[])(object)new RequirementConfig[3] { new RequirementConfig("Stone", 30, 0, true), new RequirementConfig("Crystal", 10, 0, true), new RequirementConfig("Iron", 10, 0, true) }, "", "building", 0, "Forge") }; public static IEnumerable<string> GetAllCategories() { return AllRegistrations.Select((RelicRegistration r) => CategoryToTab(r.Category)).Distinct(); } private static string CategoryToTab(string category) { if (string.IsNullOrWhiteSpace(category)) { return MoonforgedGates.PlayerPreferredCategory.Value; } string text = category.ToLowerInvariant(); string text2 = text; string text3 = text2; if (text3 == "building") { return MoonforgedGates.PlayerPreferredCategory.Value; } return category; } public static void RegisterAllRelics(AssetBundle bundle) { if (wasAlreadyRegistered) { return; } foreach (RelicRegistration allRegistration in AllRegistrations) { RegisterRelic(bundle, allRegistration); } wasAlreadyRegistered = true; } private static void RegisterRelic(AssetBundle bundle, RelicRegistration reg) { //IL_04aa: Unknown result type (might be due to invalid IL or missing references) //IL_04af: Unknown result type (might be due to invalid IL or missing references) //IL_04b6: Unknown result type (might be due to invalid IL or missing references) //IL_04c2: Expected O, but got Unknown //IL_04ed: Unknown result type (might be due to invalid IL or missing references) //IL_04f4: Expected O, but got Unknown //IL_04d3: Unknown result type (might be due to invalid IL or missing references) //IL_04d8: Unknown result type (might be due to invalid IL or missing references) //IL_04e0: Unknown result type (might be due to invalid IL or missing references) //IL_04ec: Expected O, but got Unknown //IL_0553: Unknown result type (might be due to invalid IL or missing references) //IL_0558: Unknown result type (might be due to invalid IL or missing references) //IL_0560: Unknown result type (might be due to invalid IL or missing references) //IL_056c: Expected O, but got Unknown //IL_0597: Unknown result type (might be due to invalid IL or missing references) //IL_059e: Expected O, but got Unknown //IL_057d: Unknown result type (might be due to invalid IL or missing references) //IL_0582: Unknown result type (might be due to invalid IL or missing references) //IL_058a: Unknown result type (might be due to invalid IL or missing references) //IL_0596: Expected O, but got Unknown //IL_05fa: Unknown result type (might be due to invalid IL or missing references) //IL_0601: Expected O, but got Unknown //IL_0646: Unknown result type (might be due to invalid IL or missing references) //IL_0650: Expected O, but got Unknown if ((Object)(object)bundle == (Object)null) { return; } GameObject val = bundle.LoadAsset<GameObject>(reg.PrefabName); if ((Object)(object)val == (Object)null) { return; } ((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.op_Implicit((Object)(object)val.GetComponent<ZSyncTransform>())) { val.AddComponent<ZSyncTransform>(); } Piece val3 = val.GetComponent<Piece>(); if ((Object)(object)val3 == (Object)null) { val3 = val.AddComponent<Piece>(); } val3.m_name = reg.DisplayName; val3.m_description = reg.Description; val3.m_groundOnly = false; GameObject val4 = null; GameObject val5 = null; GameObject val6 = null; GameObject val7 = null; if (reg.PrefabName == "v1_CurvedWoodFence" || reg.PrefabName == "v1_GardenGate" || reg.PrefabName == "M_Hobbit_Door" || reg.PrefabName == "v1_Element04" || reg.PrefabName == "v1_Element01" || reg.PrefabName == "v1_Element0" || reg.PrefabName == "v1_Element03" || reg.PrefabName == "v1_GardenFence" || reg.PrefabName == "v1_Element02a" || reg.PrefabName == "v1_MoonforgedIronboundGate" || reg.PrefabName == "Moonforged_Silent_Hill_Gate" || reg.PrefabName == "v1_VikingGate" || reg.PrefabName == "M_Garden_Fence2x2" || reg.PrefabName == "M_Garden_Fence3x2" || reg.PrefabName == "M_Garden_Pole2x2" || reg.PrefabName == "M_Garden_Gate" || reg.PrefabName == "M_Garden_Fence1x1" || reg.PrefabName == "M_Garden_Fence_Medium" || reg.PrefabName == "M_Garden_Pole1x1" || reg.PrefabName == "M_Garden_Gate_Small") { if ((Object)(object)ZNetScene.instance != (Object)null) { val4 = ZNetScene.instance.GetPrefab("vfx_Place_wood"); val5 = ZNetScene.instance.GetPrefab("sfx_build_hammer_wood"); val6 = ZNetScene.instance.GetPrefab("vfx_destroyed_wood"); val7 = ZNetScene.instance.GetPrefab("sfx_wood_break"); } } else if (reg.PrefabName == "v1_SilverGate" || reg.PrefabName == "v1_DvergrForgedGate" || reg.PrefabName == "v1_DvergrForgedGate3m" || reg.PrefabName == "v1_DvergrForgedGate4m" || reg.PrefabName == "v1_EmberlightGate" || reg.PrefabName == "v1_ValkyriesGate" || reg.PrefabName == "v1_GildedRingwatchFence" || reg.PrefabName == "v1_SilverFence" || reg.PrefabName == "v1_IroncrestWardenFenceBK" || reg.PrefabName == "v1_IroncrestWardenFenceSilver" || reg.PrefabName == "v1_VikingArchGate" || reg.PrefabName == "v1_BlackFence" || reg.PrefabName == "v1_Wrought_iron_fence_1" || reg.PrefabName == "M_WolfGate" || reg.PrefabName == "v1_chain_fence") { if ((Object)(object)ZNetScene.instance != (Object)null) { val4 = ZNetScene.instance.GetPrefab("vfx_Place_stone"); val5 = ZNetScene.instance.GetPrefab("sfx_build_hammer_metal"); val6 = ZNetScene.instance.GetPrefab("vfx_destroyed"); val7 = ZNetScene.instance.GetPrefab("sfx_metal_blocked"); } } else if ((Object)(object)ZNetScene.instance != (Object)null) { val4 = ZNetScene.instance.GetPrefab("vfx_Place_stone"); val5 = ZNetScene.instance.GetPrefab("sfx_build_hammer_stone"); val6 = ZNetScene.instance.GetPrefab("vfx_destroyed"); val7 = ZNetScene.instance.GetPrefab("sfx_rock_destroyed"); } List<EffectData> list = new List<EffectData>(); if ((Object)(object)val4 != (Object)null) { list.Add(new EffectData { m_prefab = val4, m_enabled = true }); } if ((Object)(object)val5 != (Object)null) { list.Add(new EffectData { m_prefab = val5, m_enabled = true }); } EffectList val8 = new EffectList(); val8.m_effectPrefabs = list.ToArray(); val3.m_placeEffect = val8; WearNTear val9 = val.GetComponent<WearNTear>(); if ((Object)(object)val9 == (Object)null) { val9 = val.AddComponent<WearNTear>(); } val9.m_health = 1000f; val9.m_noRoofWear = true; List<EffectData> list2 = new List<EffectData>(); if ((Object)(object)val6 != (Object)null) { list2.Add(new EffectData { m_prefab = val6, m_enabled = true }); } if ((Object)(object)val7 != (Object)null) { list2.Add(new EffectData { m_prefab = val7, m_enabled = true }); } EffectList val10 = new EffectList(); val10.m_effectPrefabs = list2.ToArray(); val9.m_destroyedEffect = val10; Sprite val11 = bundle.LoadAsset<Sprite>(reg.PrefabName); if ((Object)(object)val11 == (Object)null) { val11 = bundle.LoadAsset<Sprite>(reg.PrefabName.ToLowerInvariant()); } if ((Object)(object)val11 != (Object)null) { val3.m_icon = val11; } PieceConfig val12 = new PieceConfig(); val12.PieceTable = "Hammer"; val12.Category = CategoryToTab(reg.Category); val12.CraftingStation = reg.CraftingStation; val12.Requirements = reg.Requirements; PieceManager.Instance.AddPiece(new CustomPiece(val, true, val12)); } } [BepInPlugin("Moonforged.GatesAndFences", "Moonforged Gates & Fences", "1.0.9")] [BepInDependency(/*Could not decode attribute arguments.*/)] public class MoonforgedGates : BaseUnityPlugin { [CompilerGenerated] private sealed class <DelayedRegister>d__10 : IEnumerator<object>, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public AssetBundle bundle; public MoonforgedGates <>4__this; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <DelayedRegister>d__10(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { switch (<>1__state) { default: return false; case 0: <>1__state = -1; break; case 1: <>1__state = -1; break; } if ((Object)(object)ZNetScene.instance == (Object)null) { <>2__current = null; <>1__state = 1; return true; } RelicRegistrar.RegisterAllRelics(bundle); return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } public const string PluginGUID = "Moonforged.GatesAndFences"; public const string PluginName = "Moonforged Gates & Fences"; public const string PluginVersion = "1.0.9"; private AssetBundle gatesBundle; private Harmony harmony; public static ConfigEntry<string> PlayerPreferredCategory; private void Awake() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown //IL_00b3: Unknown result type (might be due to invalid IL or missing references) harmony = new Harmony("moonforged.gates.scalingdebug"); harmony.PatchAll(); string platformBundleResourcePath = GetPlatformBundleResourcePath(); gatesBundle = EmbeddedAssetBundleLoader.LoadBundle(platformBundleResourcePath); if ((Object)(object)gatesBundle == (Object)null) { ((BaseUnityPlugin)this).Logger.LogError((object)("Failed to load embedded AssetBundle: " + platformBundleResourcePath)); return; } ((BaseUnityPlugin)this).Logger.LogInfo((object)("Loaded embedded AssetBundle: " + platformBundleResourcePath)); PlayerPreferredCategory = ((BaseUnityPlugin)this).Config.Bind<string>("General", "CustomHammerTab", "MoonforgedGatesAndFences", "Set the hammer tab where this mod's pieces should appear (e.g., Building, Furniture, MoonforgedGatesAndFences)"); foreach (string allCategory in RelicRegistrar.GetAllCategories()) { PieceManager.Instance.AddPieceCategory(allCategory); } PrefabManager.OnPrefabsRegistered += OnPrefabsRegistered; } private static string GetPlatformBundleResourcePath() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Invalid comparison between Unknown and I4 RuntimePlatform platform = Application.platform; RuntimePlatform val = platform; if ((int)val <= 1) { return "MoonforgedGatesAndFences.gatesandfences_mac"; } return "MoonforgedGatesAndFences.gatesandfences_windows"; } private void OnDestroy() { PrefabManager.OnPrefabsRegistered -= OnPrefabsRegistered; } private void OnPrefabsRegistered() { ((MonoBehaviour)this).StartCoroutine(DelayedRegister(gatesBundle)); } [IteratorStateMachine(typeof(<DelayedRegister>d__10))] private IEnumerator DelayedRegister(AssetBundle bundle) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <DelayedRegister>d__10(0) { <>4__this = this, bundle = bundle }; } } public static class EmbeddedAssetBundleLoader { public static AssetBundle LoadBundle(string resourcePath) { Assembly executingAssembly = Assembly.GetExecutingAssembly(); using Stream stream = executingAssembly.GetManifestResourceStream(resourcePath); if (stream == null) { Debug.LogError((object)("AssetBundle resource not found: " + resourcePath)); return null; } using MemoryStream memoryStream = new MemoryStream(); stream.CopyTo(memoryStream); return AssetBundle.LoadFromMemory(memoryStream.ToArray()); } }