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 LokasDrawersPatch v1.0.3
LokasDrawersPatch.dll
Decompiled a week agousing System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using HarmonyLib; using ItemDrawers; using Microsoft.CodeAnalysis; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("LokasDrawersPatch")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyDescription("Custom keybinds and extended range for ItemDrawers")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("LokasDrawersPatch")] [assembly: AssemblyTitle("LokasDrawersPatch")] [assembly: AssemblyVersion("1.0.0.0")] [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 LokasDrawersPatch { [BepInPlugin("com.loka.valheim.lokasdrawerspatch", "LokasDrawersPatch", "1.0.3")] [BepInDependency(/*Could not decode attribute arguments.*/)] public class Plugin : BaseUnityPlugin { public const string PluginGUID = "com.loka.valheim.lokasdrawerspatch"; public const string PluginName = "LokasDrawersPatch"; public const string PluginVersion = "1.0.3"; public static ConfigEntry<KeyCode> TakeOneKey; public static ConfigEntry<KeyCode> TakeStackKey; private Harmony _harmony; private void Awake() { //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Expected O, but got Unknown TakeOneKey = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("Controls", "TakeOneKey", (KeyCode)306, "Hold while pressing Use (E) to withdraw 1 item."); TakeStackKey = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("Controls", "TakeStackKey", (KeyCode)308, "Hold while pressing Use (E) to withdraw a full stack."); _harmony = new Harmony("com.loka.valheim.lokasdrawerspatch"); _harmony.PatchAll(); ((BaseUnityPlugin)this).Logger.LogInfo((object)"LokasDrawersPatch v1.0.3 loaded."); } private void OnDestroy() { Harmony harmony = _harmony; if (harmony != null) { harmony.UnpatchSelf(); } } } [HarmonyPatch(typeof(Drawer))] public static class DrawerPatches { [HarmonyPrefix] [HarmonyPatch("Interact")] public static bool Prefix_Interact(Drawer __instance, ref bool __result, int slot, Humanoid user, bool hold, bool alt) { //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) if (hold) { __result = false; return false; } Traverse val = Traverse.Create((object)__instance); if (!val.Property<bool>("IsValid", (object[])null).Value) { __result = false; return false; } Player val2 = (Player)(object)((user is Player) ? user : null); if ((Object)(object)val2 == (Object)null || !PrivateArea.CheckAccess(((Component)__instance).transform.position, 0f, true, false)) { __result = false; return false; } if (val.Method("IsFree", new object[1] { slot }).GetValue<bool>()) { ((Character)val2).Message((MessageType)2, "Empty: use an item from hotbar to assign", 0, (Sprite)null, false); __result = false; return false; } bool flag = (int)Plugin.TakeOneKey.Value != 0 && Input.GetKey(Plugin.TakeOneKey.Value); bool flag2 = (int)Plugin.TakeStackKey.Value != 0 && Input.GetKey(Plugin.TakeStackKey.Value); int value = val.Method("GetCount", new object[1] { slot }).GetValue<int>(); if (flag) { if (value <= 0) { val.Method("RequestClear", new object[1] { slot }).GetValue(); ((Character)val2).Message((MessageType)2, "The drawer is free for another item", 0, (Sprite)null, false); __result = true; return false; } __result = val.Method("Take", new object[3] { slot, val2, 1 }).GetValue<bool>(); return false; } if (flag2) { __result = val.Method("Take", new object[3] { slot, val2, -1 }).GetValue<bool>(); return false; } object value2 = val.Method("GetItem", new object[1] { slot }).GetValue(); object value3 = val.Method("GetData", new object[1] { slot }).GetValue(); if (value2 != null) { __result = val.Method("StoreFromInventory", new object[4] { slot, val2, value2, value3 }).GetValue<bool>(); } else { __result = false; } return false; } [HarmonyPostfix] [HarmonyPatch("GetHoverText", new Type[] { typeof(int) })] public static void Postfix_GetHoverText(ref string __result) { //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) if (string.IsNullOrEmpty(__result)) { return; } int num = __result.IndexOf('\n'); string text = ((num > 0) ? __result.Substring(0, num) : __result); string text2 = "E"; try { Type type = Type.GetType("Localization, assembly_valheim"); if (type != null) { object value = Traverse.Create(type).Property("instance", (object[])null).GetValue(); if (value != null) { text2 = Traverse.Create(value).Method("Localize", new object[1] { "$KEY_Use" }).GetValue<string>(); } } } catch { text2 = "E"; } __result = text + "\n[<color=yellow><b>" + text2 + "</b></color>] Deposit all\n" + $"[<color=yellow><b>{Plugin.TakeOneKey.Value} + {text2}</b></color>] Take 1\n" + $"[<color=yellow><b>{Plugin.TakeStackKey.Value} + {text2}</b></color>] Take stack"; } } }