using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Logging;
using GameNetcodeStuff;
using HarmonyLib;
using InventoryFixPlugin.Patches;
using LethalCompanyInputUtils.Api;
using UnityEngine;
using UnityEngine.InputSystem;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("InventoryFixPlugin")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("InventoryFixPlugin")]
[assembly: AssemblyCopyright("Copyright © 2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("EFA7C3FB-B6D0-4458-A9BC-C69583EFEF34")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8.1", FrameworkDisplayName = ".NET Framework 4.8.1")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace InventoryFixPlugin
{
public class Keybinds : LcInputActions
{
[InputAction("<Keyboard>/p", Name = "[InventoryFixPlugin]\nThrowingObject reverse")]
public InputAction ThrowingObjectReverseHotkey { get; set; }
}
[BepInPlugin("Dokge.InventoryFixPlugin", "Invemtory fix plugin", "0.0.1")]
public class Plugin : BaseUnityPlugin
{
private const string modGUID = "Dokge.InventoryFixPlugin";
private const string modName = "Invemtory fix plugin";
private const string modVersion = "0.0.1";
private readonly Harmony harmony = new Harmony("Dokge.InventoryFixPlugin");
internal static Keybinds InputActionsInstance = new Keybinds();
private static Plugin Instance;
internal static ManualLogSource mls;
private void Awake()
{
if ((Object)(object)Instance == (Object)null)
{
Instance = this;
}
mls = Logger.CreateLogSource("Dokge.InventoryFixPlugin");
mls.LogInfo((object)"Plugin has awaken");
harmony.PatchAll(typeof(PlayerControllerBPatch));
harmony.PatchAll(typeof(Plugin));
}
public static bool IsModLoaded(string guid)
{
return Chainloader.PluginInfos.ContainsKey(guid);
}
}
}
namespace InventoryFixPlugin.Patches
{
[HarmonyPatch(typeof(PlayerControllerB))]
public class PlayerControllerBPatch
{
private static PlayerControllerB play;
internal static ManualLogSource mls;
[HarmonyPatch("Update")]
[HarmonyPrefix]
private static void ThrowingObjectReverse(PlayerControllerB __instance)
{
play = __instance;
if (Plugin.InputActionsInstance.ThrowingObjectReverseHotkey.triggered && !__instance.isPlayerDead && !__instance.isTypingChat && !__instance.inTerminalMenu && (Object)(object)__instance == (Object)(object)GameNetworkManager.Instance.localPlayerController)
{
Traverse.Create((object)play).Field("throwingObject").SetValue((object)(!(bool)Traverse.Create((object)play).Field("throwingObject").GetValue()));
Plugin.mls.LogInfo((object)"\"ThrowingObject\" been reversed");
}
}
}
}