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 NoHammerBuildMenu v0.1.4
NoHammerBuildMenu.dll
Decompiled 8 hours agousing System; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using HarmonyLib; using Jotunn.Configs; using Jotunn.Managers; using Microsoft.CodeAnalysis; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: IgnoresAccessChecksTo("")] [assembly: AssemblyCompany("NoHammerBuildMenu")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyDescription("Configurable keybind that opens Valheim's build menu without needing a hammer in your inventory.")] [assembly: AssemblyFileVersion("0.1.4.0")] [assembly: AssemblyInformationalVersion("0.1.4+5a40423d2ed922ee0df7c2236ee30902c0d41151")] [assembly: AssemblyProduct("NoHammerBuildMenu")] [assembly: AssemblyTitle("NoHammerBuildMenu")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.1.4.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace NoHammerBuildMenu { [BepInPlugin("javidahmed64592.nohammerbuildmenu", "No Hammer Build Menu", "0.1.4")] [BepInDependency(/*Could not decode attribute arguments.*/)] public class NoHammerBuildMenuPlugin : BaseUnityPlugin { [HarmonyPatch(typeof(Inventory), "GetAllPieceTables")] private static class Inventory_GetAllPieceTables_Patch { [HarmonyPostfix] private static void Postfix(List<PieceTable> tables) { if ((Object)(object)_phantomHammer?.m_shared?.m_buildPieces != (Object)null && !tables.Contains(_phantomHammer.m_shared.m_buildPieces)) { tables.Add(_phantomHammer.m_shared.m_buildPieces); } } } [HarmonyPatch(typeof(Inventory), "ContainsItem")] private static class Inventory_ContainsItem_Patch { [HarmonyPrefix] private static bool Prefix(ItemData item, ref bool __result) { if (_phantomHammer != null && item == _phantomHammer) { __result = true; return false; } return true; } } [HarmonyPatch(typeof(Humanoid), "SetupVisEquipment")] private static class Humanoid_SetupVisEquipment_Patch { [HarmonyPrefix] private static void Prefix(Humanoid __instance, out ItemData __state) { __state = null; if (_phantomHammer != null && __instance.GetRightItem() == _phantomHammer) { __state = _phantomHammer; __instance.m_rightItem = null; } } [HarmonyPostfix] private static void Postfix(Humanoid __instance, ItemData __state) { if (__state == null) { return; } __instance.m_rightItem = __state; Player val = (Player)(object)((__instance is Player) ? __instance : null); if (val != null) { VisEquipment visEquipment = ((Humanoid)val).m_visEquipment; if (visEquipment != null) { visEquipment.SetRightItem(StringExtensionMethods.GetStableHashCode(((Object)__state.m_dropPrefab).name), __state.m_quality); } } } } public const string PluginGUID = "javidahmed64592.nohammerbuildmenu"; public const string PluginName = "No Hammer Build Menu"; public const string PluginVersion = "0.1.4"; private const string HammerPrefabName = "Hammer"; private const string ButtonName = "NoHammerBuildMenu_Toggle"; private const string ButtonQueryName = "NoHammerBuildMenu_Toggle!javidahmed64592.nohammerbuildmenu"; private ConfigEntry<KeyCode> _keybind; private static ItemData _phantomHammer; private Harmony _harmony; private bool _knownRecipesRefreshed; private void Awake() { //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Expected O, but got Unknown //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Expected O, but got Unknown _keybind = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("Keybinds", "Open Build Menu", (KeyCode)98, "Equips a virtual hammer and opens the build menu, without needing a real hammer in your inventory. Rebindable from the in-game controls menu."); InputManager.Instance.AddButton("javidahmed64592.nohammerbuildmenu", new ButtonConfig { Name = "NoHammerBuildMenu_Toggle", Config = _keybind }); _harmony = new Harmony("javidahmed64592.nohammerbuildmenu"); _harmony.PatchAll(); } private void OnDestroy() { Harmony harmony = _harmony; if (harmony != null) { harmony.UnpatchSelf(); } } private void Update() { if (_phantomHammer != null) { _phantomHammer.m_durability = _phantomHammer.m_shared.m_maxDurability; } Player localPlayer = Player.m_localPlayer; if ((Object)(object)localPlayer == (Object)null) { _phantomHammer = null; _knownRecipesRefreshed = false; return; } EnsurePhantomHammer(); if (!_knownRecipesRefreshed && _phantomHammer != null) { _knownRecipesRefreshed = true; localPlayer.UpdateKnownRecipesList(); } if (!Menu.IsVisible() && !InventoryGui.IsVisible() && (!((Object)(object)Chat.instance != (Object)null) || !Chat.instance.HasFocus()) && ZInput.GetButtonDown("NoHammerBuildMenu_Toggle!javidahmed64592.nohammerbuildmenu")) { ToggleBuildMenu(localPlayer); } } private void ToggleBuildMenu(Player player) { EnsurePhantomHammer(); if (_phantomHammer != null) { if (((Humanoid)player).GetRightItem() != _phantomHammer) { ((Humanoid)player).EquipItem(_phantomHammer, true); } else { ((Humanoid)player).UnequipItem(_phantomHammer, true); } } } private void EnsurePhantomHammer() { //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Expected O, but got Unknown if (_phantomHammer == null && !((Object)(object)ObjectDB.instance == (Object)null)) { GameObject itemPrefab = ObjectDB.instance.GetItemPrefab("Hammer"); if (!((Object)(object)itemPrefab == (Object)null)) { ItemDrop component = itemPrefab.GetComponent<ItemDrop>(); _phantomHammer = new ItemData { m_shared = component.m_itemData.m_shared, m_dropPrefab = itemPrefab, m_stack = 1, m_quality = 1, m_variant = 0, m_durability = component.m_itemData.m_shared.m_maxDurability, m_customData = new Dictionary<string, string>() }; } } } } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] internal sealed class IgnoresAccessChecksToAttribute : Attribute { internal IgnoresAccessChecksToAttribute(string assemblyName) { } } }