using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
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("uimmode.ValheimMod", "UIMMode", "1.0.0")]
[BepInProcess("valheim.exe")]
public class JumpHigher : 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")
{
Debug.Log((object)(name + " allowed on Item Stand."));
return true;
}
Debug.Log((object)(name + " not allowed on Item Stand."));
return false;
}
}
private readonly Harmony harmony = new Harmony("uimmode.ValheimMod");
private void Awake()
{
harmony.PatchAll();
}
}