Decompiled source of UndetectableKitty v0.0.1

BepinEx/plugins/UndetectableKitty.dll

Decompiled 5 months ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using NeedyCats;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = "")]
[assembly: AssemblyCompany("LethalCompanyMod")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("LethalCompanyMod")]
[assembly: AssemblyTitle("LethalCompanyMod")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
}
namespace LethalCompanyUndetectableKitty
{
	[BepInPlugin("Taboo.UndetectableKitty", "UndetectableKitty", "0.0.0.1")]
	public class UndetectablKittyMod : BaseUnityPlugin
	{
		public const string modGUID = "Taboo.UndetectableKitty";

		public const string modName = "UndetectableKitty";

		public const string modVersion = "0.0.0.1";

		private readonly Harmony harmony = new Harmony("Taboo.UndetectableKitty");

		public static ManualLogSource mLogger = Logger.CreateLogSource("Taboo.UndetectableKitty");

		private static ConfigEntry<float> minMeowOveride;

		private static ConfigEntry<float> maxMeowOveride;

		private void Awake()
		{
			ManualLogSource val = Logger.CreateLogSource("Taboo.UndetectableKitty");
			val.LogMessage((object)"Taboo.UndetectableKitty has loaded succesfully.");
			ManualLogSource val2 = Logger.CreateLogSource("Taboo.UndetectableKitty");
			minMeowOveride = ((BaseUnityPlugin)this).Config.Bind<float>("UndetectableKitty", "Minimum time between meows.", 0f, "Sets the minimum amount of time between meows.  Set to 0 to use default.");
			maxMeowOveride = ((BaseUnityPlugin)this).Config.Bind<float>("UndetectableKitty", "Maximum time between meows.", 0f, "Sets the maximum amount of time between meows.  Set to 0 to use default.");
			harmony.PatchAll(typeof(UndetectablKittyMod));
			val2.LogMessage((object)"Patched");
		}

		[HarmonyPatch(typeof(MouthDogAI))]
		[HarmonyPatch("DetectNoise")]
		[HarmonyPrefix]
		private static bool DetectNoisePatch(ref int noiseID, ref NeedyCatProp __instance)
		{
			mLogger.LogMessage((object)"Dog Patch Called");
			if (noiseID == 8881)
			{
				return false;
			}
			return true;
		}

		[HarmonyPatch(typeof(NeedyCatProp))]
		[HarmonyPatch("MakeCatMeowServerRpc")]
		[HarmonyPrefix]
		private static void MakeCatMeowServerRpcPatch(ref NeedyCatProp __instance)
		{
			mLogger.LogMessage((object)"Cat Patch Called");
			if (minMeowOveride.Value != 0f)
			{
				__instance.IntervalMeow.x = minMeowOveride.Value;
			}
			if (maxMeowOveride.Value != 0f)
			{
				__instance.IntervalMeow.y = maxMeowOveride.Value;
			}
		}
	}
}