using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using HarmonyLib;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("NicholaScott.LethalCompany.NoHornNoise")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("NicholaScott.LethalCompany.NoHornNoise")]
[assembly: AssemblyCopyright("Copyright © 2023")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("C46A93C3-7D37-4BD5-BEFF-A85F6A9A4D87")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace NicholaScott.LethalCompany.NoHornNoise;
[BepInPlugin("NicholaScott.LethalCompany.NoHornNoise", "No Horn Noise", "0.0.1")]
public class NoHorns : BaseUnityPlugin
{
public void Awake()
{
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
//IL_0017: Expected O, but got Unknown
Harmony val = new Harmony(((BaseUnityPlugin)this).Info.Metadata.GUID);
val.PatchAll(typeof(NoHornPatch));
((BaseUnityPlugin)this).Logger.LogInfo((object)$"Patched {val.GetPatchedMethods().Count()}");
}
}
public static class NoHornPatch
{
public static bool DenyHorns(GrabbableObject __instance)
{
if (__instance.itemProperties.itemName.Contains("horn"))
{
return false;
}
return true;
}
[HarmonyPatch(typeof(GrabbableObject), "ActivateItemClientRpc")]
[HarmonyPrefix]
public static bool DenyOnClient(GrabbableObject __instance)
{
return DenyHorns(__instance);
}
[HarmonyPatch(typeof(GrabbableObject), "ActivateItemServerRpc")]
[HarmonyPrefix]
public static bool DenyOnHost(GrabbableObject __instance)
{
return DenyHorns(__instance);
}
}