using 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 GameNetcodeStuff;
using HarmonyLib;
using UnityEngine;
using UnityEngine.InputSystem;
using UnityEngine.InputSystem.Utilities;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("ItemTertiaryUse_Conflict_Solver")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("ItemTertiaryUse_Conflict_Solver")]
[assembly: AssemblyCopyright("Copyright © 2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("c5cd0220-7601-4924-8dc1-3d5d6d9175c3")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace ItemTertiaryUse_Conflict_Solver
{
[BepInPlugin("Hackattack242.ItemTertiaryUse_Conflict_Solver", "ItemTertiaryUse Conflict Solver", "1.0.0")]
public class ItemTertiaryUse_conflict_solver_base : BaseUnityPlugin
{
private const string mod_GUID = "Hackattack242.ItemTertiaryUse_Conflict_Solver";
private const string mod_name = "ItemTertiaryUse Conflict Solver";
private const string mod_version = "1.0.0";
private readonly Harmony harmony = new Harmony("Hackattack242.ItemTertiaryUse_Conflict_Solver");
private static ItemTertiaryUse_conflict_solver_base Instance;
private ManualLogSource logger;
private void Awake()
{
if ((Object)(object)Instance == (Object)null)
{
Instance = this;
}
logger = Logger.CreateLogSource("ItemTertiaryUse Conflict Solver");
logger.LogInfo((object)"ItemTertiaryUse Conflict Solver has awoken");
harmony.PatchAll();
}
internal static void LogDebug(string message)
{
Instance.Log(message, (LogLevel)32);
}
internal static void LogInfo(string message)
{
Instance.Log(message, (LogLevel)16);
}
internal static void LogWarning(string message)
{
Instance.Log(message, (LogLevel)4);
}
internal static void LogError(string message)
{
Instance.Log(message, (LogLevel)2);
}
internal static void LogError(Exception ex)
{
Instance.Log(ex.Message + "\n" + ex.StackTrace, (LogLevel)2);
}
private void Log(string message, LogLevel logLevel)
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
logger.Log(logLevel, (object)message);
}
}
}
namespace ItemTertiaryUse_Conflict_Solver.Patches
{
[HarmonyPatch(typeof(PlayerControllerB))]
internal class Player_controller_patcher
{
[HarmonyPatch("ItemTertiaryUse_performed")]
[HarmonyPrefix]
private static bool patch_bad_interactions(ref InteractTrigger ___hoveringOverTrigger)
{
//IL_0038: Unknown result type (might be due to invalid IL or missing references)
//IL_003d: Unknown result type (might be due to invalid IL or missing references)
//IL_0041: Unknown result type (might be due to invalid IL or missing references)
//IL_0046: Unknown result type (might be due to invalid IL or missing references)
//IL_004b: Unknown result type (might be due to invalid IL or missing references)
//IL_0050: Unknown result type (might be due to invalid IL or missing references)
//IL_00aa: 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_00b3: Unknown result type (might be due to invalid IL or missing references)
//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
//IL_00be: Unknown result type (might be due to invalid IL or missing references)
//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)___hoveringOverTrigger != (Object)null)
{
string text = "interact_default";
string text2 = "use_default";
Enumerator<InputBinding> enumerator = IngamePlayerSettings.Instance.playerInput.actions.FindAction("Interact", false).bindings.GetEnumerator();
try
{
while (enumerator.MoveNext())
{
InputBinding current = enumerator.Current;
if (((InputBinding)(ref current)).path.Contains("Keyboard"))
{
text = ((InputBinding)(ref current)).overridePath;
}
}
}
finally
{
((IDisposable)enumerator).Dispose();
}
Enumerator<InputBinding> enumerator2 = IngamePlayerSettings.Instance.playerInput.actions.FindAction("ItemTertiaryUse", false).bindings.GetEnumerator();
try
{
while (enumerator2.MoveNext())
{
InputBinding current2 = enumerator2.Current;
if (((InputBinding)(ref current2)).path.Contains("Keyboard"))
{
text2 = ((InputBinding)(ref current2)).overridePath;
}
}
}
finally
{
((IDisposable)enumerator2).Dispose();
}
ItemTertiaryUse_conflict_solver_base.LogInfo("keybind comparison: " + text + ", " + text2);
if (text == text2)
{
return false;
}
}
return true;
}
}
}