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 UIMMod v1.0.2
UIMMod.dll
Decompiled a year agousing System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Logging; using HarmonyLib; 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("UIMMod")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("UIMMod")] [assembly: AssemblyCopyright("Copyright © 2024")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("249fda81-2cdb-4fab-a352-cee32408d892")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyVersion("1.0.0.0")] namespace UIMMod; [BepInPlugin("uimmod.ValheimMod", "UIMMod", "1.0.2")] [BepInProcess("valheim.exe")] public class InventoryDropEdits : BaseUnityPlugin { [HarmonyPatch(typeof(Humanoid), "DropItem")] public static class DropitemPatch { private static void Prefix(ref Inventory inventory, ItemData item, int amount) { inventory.RemoveItem(item, amount); amount = 0; } } [HarmonyPatch(typeof(InventoryGui), "OnStackAll")] public static class StackAllPatch { private static bool Prefix() { Debug.Log((object)"Prevented Stack."); return false; } } [HarmonyPatch(typeof(InventoryGui), "OnDropOutside")] public static class DropOutsidePatch { private static bool Prefix() { Debug.Log((object)"Prevented Drop."); return false; } } [HarmonyPatch(typeof(Inventory), "MoveItemToThis", new Type[] { typeof(Inventory), typeof(ItemData) })] public static class PreventMovePatch1 { private static bool Prefix(Inventory fromInventory, ItemData item) { if (fromInventory == ((Humanoid)Player.m_localPlayer).GetInventory()) { Debug.Log((object)"Cannot move from player inventory"); return false; } Debug.Log((object)"Can move into player inventory"); return true; } } [HarmonyPatch(typeof(Inventory), "MoveItemToThis", new Type[] { typeof(Inventory), typeof(ItemData), typeof(int), typeof(int), typeof(int) })] public static class PreventMovePatch2 { private static bool Prefix(Inventory __instance, Inventory fromInventory, ItemData item) { if (fromInventory == ((Humanoid)Player.m_localPlayer).GetInventory() && __instance != ((Humanoid)Player.m_localPlayer).GetInventory()) { Debug.Log((object)"Moving from player to non-player inventory not allowed."); return false; } return true; } } [HarmonyPatch(typeof(Piece), "DropResources")] public static class PiecePatch { private static bool Prefix() { Debug.Log((object)"Prevented building resources from dropping"); return false; } } [HarmonyPatch(typeof(Player), "CreateTombStone")] public static class DeathPatch { private static bool Prefix(Player __instance) { Inventory inventory = ((Humanoid)__instance).GetInventory(); foreach (ItemData allItem in inventory.GetAllItems()) { if (!allItem.m_shared.m_teleportable) { inventory.RemoveItem(allItem); Debug.Log((object)("Destroyed item: " + allItem.m_shared.m_name)); } } return false; } } [HarmonyPatch(typeof(ItemStand), "CanAttach")] public static class ItemStandPatch { private static bool Prefix(ItemData item) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Invalid comparison between Unknown and I4 //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Invalid comparison between Unknown and I4 //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Invalid comparison between Unknown and I4 //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Invalid comparison between Unknown and I4 //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Invalid comparison between Unknown and I4 //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Invalid comparison between Unknown and I4 //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Invalid comparison between Unknown and I4 ItemType itemType = item.m_shared.m_itemType; string name = item.m_shared.m_name; if ((int)itemType == 19 || (int)itemType == 3 || (int)itemType == 4 || (int)itemType == 22 || (int)itemType == 14 || (int)itemType == 20 || (int)itemType == 13 || (int)itemType == 18) { Debug.Log((object)(name + " allowed on Item Stand.")); return true; } if (name == "$item_dragonegg" || name == "$item_goblintotem" || name == "$item_bell") { Debug.Log((object)(name + " allowed on Item Stand.")); return true; } Debug.Log((object)(name + " not allowed on Item Stand.")); return false; } } [HarmonyPatch(typeof(Player), "TryPlacePiece")] public static class PlaceFoodPatch { private static bool Prefix(Player __instance, Piece piece) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Invalid comparison between Unknown and I4 //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Invalid comparison between Unknown and I4 if ((int)piece.m_category == 6 || (int)piece.m_category == 7) { ((Character)__instance).Message((MessageType)2, "$msg_invalidplacement", 0, (Sprite)null); return false; } return true; } } private const string pluginGUID = "uimmod.ValheimMod"; private const string pluginName = "UIMMod"; private const string pluginVersion = "1.0.2"; private readonly Harmony harmony = new Harmony("uimmod.ValheimMod"); public static ManualLogSource logger = Logger.CreateLogSource("UIMMod"); private void Awake() { logger.LogInfo((object)"Thank you for using the UIM Mod."); harmony.PatchAll(); } }